paperbot · PL 论文追踪

全部论文 待读 收藏

P1 AdapTrack: Constrained Decoding without Distorting LLM's Output Intent

AdapTrack:不扭曲 LLM 输出意图的约束解码
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 5/10 · 论文研究 LLM 代码生成中的约束解码与回溯,涉及程序语言语法/API 约束,并具备理论证明与工程实现,与 PL+ML 交叉有一定关联。但其核心目标是提升 LLM 生成质量,而非用户重点关注的静态分析、形式化验证、浮点或贝叶斯程序分析,也未将 LLM 作为改进程序分析的工具,因此匹配度中等。引用 3 inbox
Yongmin Li, Jia Li, Ge Li, Zhi Jin
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出带回溯的约束解码方法 AdapTrack,在满足语法/API 约束的同时保持模型输出意图,显著提升代码生成正确率。

基于语言模型的代码生成与补全工具已被广泛使用,但生成的代码有时不满足语法正确性或 API 存在性等必要约束。约束解码通过在每一步贪婪地剔除违反约束的生成选项来保证约束满足,但其严重缺陷是会扭曲模型的输出意图,迫使模型生成虽满足约束却不符合开发意图、因而错误的代码。针对这一问题,本文提出 AdapTrack,在生成过程中引入回溯机制,避免扭曲语言模型的输出意图,从而产生既满足约束又与模型输出意图语义更一致的结果。作者还从理论上证明 AdapTrack 产生的分布与给定已生成 token 时模型的条件分布一致,因而保证输出意图不被扭曲。在合成的 API 补全数据集上,AdapTrack 相比约束解码最高提升 360.87%;在作者收集的、存在类似问题的真实 API 补全数据集上最高提升 38.93%;在通用代码生成基准上,HumanEval 最高提升 7.84%,MBPP 最高提升 6.42%。领域特定语言问题上的实验也表明,相比现有方法,该方法能给出更符合语言模型分布的生成结果。

问题
约束解码为满足语法正确性、API 存在性等约束而逐步贪婪地删除候选,会扭曲 LLM 的输出意图,导致生成语法合法但语义不符合开发意图的错误代码。
方法
AdapTrack 在约束解码的生成过程中引入回溯,使生成在满足约束的同时不改变模型在已生成前缀下的条件分布,并给出该分布一致性的理论证明。
评估
在合成的 API 补全数据集、作者收集的真实 API 补全数据集、HumanEval 与 MBPP 通用代码生成基准以及领域特定语言问题上,与约束解码及现有方法进行对比,报告最高 360.87%、38.93%、7.84% 与 6.42% 的提升。
原文摘要(Abstract)

Language model-based code generation and completion tools have been widely adopted, but they may sometimes produce code that does not meet necessary constraints, such as syntactic correctness or API existence. Constrained decoding techniques are developed to help the model generate code that adheres to the constraints by greedily eliminating generation options that violate constraints at each step of the generation process. However, there is a severe limitation of constrained decoding, that it distorts the model’s output intent, forcing it to produce code that may satisfy the constraint but does not match the development intent and is therefore incorrect. In response to this challenge, we propose AdapTrack. By incorporating backtracking into the generation process, AdapTrack avoids distorting the output intent of the language model, thereby producing results that are not only constraint-compliant but also more semantically aligned with model’s output intent. On our synthetic API completion dataset, AdapTrack can achieve up to 360.87% improvement compared to constrained decoding; on the real-world API completion dataset we collect that exhibits similar issues, AdapTrack can also achieve an improvement of up to 38.93% over constrained decoding; in general code genration benchmarks, compared to constrained decoding, AdapTrack can achieve up to 7.84% improvement on HumanEval, and up to 6.42% improvement on MBPP. This indicates that, simply by better adhering to the model’s output intent, AdapTrack can achieve significant improvements. We provide a theoretical proof that the distribution produced by AdapTrack aligns with the model’s distribution given the generated tokens, thereby ensuring that the model’s output intent is not distorted. Experiments on domain-specific language problems show that, compared to existing methods, our approach can provide generation results that are more consistent with the language model’s distribution. Our code and supplementary material are available at https://github.com/Gompyn/adaptrack.

链接与引用

DOI 原文 · arXiv · DBLP

BibTeX
@inproceedings{abs-2510-17376,
  title = {AdapTrack: Constrained Decoding without Distorting LLM's Output Intent},
  author = {Yongmin Li and Jia Li and Ge Li and Zhi Jin},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3744916.3773144}
}