paperbot · PL 论文追踪

全部论文 待读 收藏

P1 Aligning the Objective of LLM-Based Program Repair

对齐基于 LLM 的程序修复的目标
ICSE 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE)2025匹配度 5/10 · 论文属于 LLM 辅助程序修复(AI→PL 的相邻方向),与用户关注的 LLM/Agent 改进静态分析/形式化验证不直接相关,且不涉及浮点或贝叶斯程序分析;但问题驱动、使用强模型(GPT-4)并在 Defects4J 上验证,具备一定参考价值。引用 7 inbox
Junjielong Xu, Ying Fu, Shin Hwei Tan, Pinjia He
crossref: 2026-09-12

AI 速览

一句话:提出 D4C 提示框架,通过对齐 LLM 训练目标并直接调试整个程序来修复缺陷,大幅减少采样。

当前基于大语言模型的自动程序修复(APR)面临两个错配:一是 decoder-only LLM 的下一词预测训练目标与现有 infilling 式方法的掩码片段预测目标不一致,阻碍模型充分利用预训练知识;二是现有方法仍依赖语句级故障定位提供候选缺陷代码块,限制了 LLM 探索给定位置之外的补丁。本文提出 D4C——一个直接的提示框架:让 LLM 的输出形式与其训练目标对齐,并允许其在不预先定位故障语句的情况下直接细化整个程序。在 Defects4J 上,每个补丁仅采样 10 次,D4C 即正确修复 180 个缺陷,比采用完美故障定位的 SOTA APR 方法高出 10%,同时将补丁采样数量减少 90%。结果表明,目标对齐对释放 LLM 预训练能力至关重要,且以直接调试取代“先定位缺陷块再修复”的传统流程,对基于 LLM 的 APR 更有效。

问题
现有 LLM 自动程序修复的输出目标与 decoder-only LLM 的下一词预测训练目标不一致,且依赖语句级故障定位提供的候选缺陷块,限制了 LLM 的修复能力与补丁探索空间。
方法
提出 D4C 提示框架:对齐 LLM 的输出形式与其预训练目标,并让 LLM 直接对整个程序进行调试与细化,而无需先定位故障语句。
评估
在 Defects4J 基准上评估,每个缺陷仅采样 10 个补丁:正确修复 180 个 bug,比采用完美故障定位的 SOTA APR 方法高 10%,采样次数减少 90%。
原文摘要(Abstract)

Large language models (LLMs) have achieved decent results on automated program repair (APR). However, the next token prediction training objective of decoder-only LLMs (e.g., GPT-4) is misaligned with the masked span prediction objective of current infilling-style methods, which impedes LLMs from fully leveraging pre-trained knowledge for program repair. In addition, while some LLMs can locate and repair bugs in certain functions using the related artifacts (e.g., test cases), existing methods still depend on statement-level fault localization methods to provide a list of buggy hunks for repair. This restriction hinders LLMs from exploring potential patches beyond the given locations. In this paper, we investigate a new approach to adapt LLMs to program repair. Our core insight is that LLM's APR capability can be greatly improved by simply aligning the output to their training objective and allowing them to refine the whole program without first identifying faulty statements. Based on this insight, we designed D4C, a straightforward prompting framework for APR. D4C can repair 180 bugs correctly in Defects4J, with each patch being sampled only 10 times. This surpasses the SOTA APR methods with perfect fault localization by 10 % and reduces the patch sampling number by 90 %. Our findings reveal that (1) objective alignment is crucial for fully exploiting LLM's pre-trained capability, and (2) replacing the traditional localize-buggy-hunks-then-repair workflow with direct debugging is more effective for LLM-based APR methods. Thus, we believe this paper introduces a new mindset for harnessing LLMs in APR.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8705,
  title = {Aligning the Objective of LLM-Based Program Repair},
  author = {Junjielong Xu and Ying Fu and Shin Hwei Tan and Pinjia He},
  booktitle = {ICSE},
  year = {2025},
  doi = {10.1109/icse55347.2025.00169}
}