一句话:提出 ReinFix,让 LLM 在推理与求解阶段自主检索内部与外部修复素材,显著提升程序修复效果。
基于大语言模型(LLM)的自动程序修复(APR)虽已取得领先效果,但往往忽略实际修复所必需的「修复素材」(repair ingredients),导致生成的补丁在上下文相关性与准确性上表现不佳。本文提出 ReinFix 框架,使 LLM 能在缺陷修复的推理与求解两个阶段自主检索修复素材:推理阶段集成静态分析工具检索变量定义等内部素材,在 LLM 难以理解上下文时辅助其进行根因分析;求解阶段当 LLM 缺乏修复特定缺陷的经验时,从历史修复记录中检索具有相似缺陷模式的外部素材,并以缺陷代码与根因共同引导 LLM 确定合适的修复动作,从而提高生成正确补丁的概率。在 Defects4J V1.2 与 V2.0 上的评估表明,ReinFix 优于 SOTA 基线:V1.2 上修复 146 个缺陷,比基线多 32 个;V2.0 上比 SOTA 多修复 38 个缺陷;在无数据泄漏风险的最新基准上同样保持最佳性能。
Automated Program Repair (APR) techniques aim to automatically fix buggy programs. Among these, Large Language Model-based (LLM-based) approaches have shown great promise. Recent advances demonstrate that directly leveraging LLMs can achieve leading results. However, these techniques remain suboptimal in generating contextually relevant and accurate patches, as they often overlook repair ingredients crucial for practical program repair. In this paper, we propose ReinFix, a novel framework that enables LLMs to autonomously search for repair ingredients throughout both the reasoning and solution phases of bug fixing. In the reasoning phase, ReinFix integrates static analysis tools to retrieve internal ingredients, such as variable definitions, to assist the LLM in root cause analysis when it encounters difficulty understanding the context. During the solution phase, when the LLM lacks experience in fixing specific bugs, ReinFix searches for external ingredients from historical bug fixes with similar bug patterns, leveraging both the buggy code and its root cause to guide the LLM in identifying appropriate repair actions, thereby increasing the likelihood of generating correct patches. Evaluations on two popular benchmarks (Defects4J V1.2 and V2.0) demonstrate the effectiveness of our approach over SOTA baselines. Notably, ReinFix fixes 146 bugs, which is 32 more than the baselines on Defects4J V1.2. On Defects4J V2.0, ReinFix fixes 38 more bugs than the SOTA. Importantly, when evaluating on the recent benchmarks that are free of data leakage risk, ReinFix also maintains the best performance.
@inproceedings{abs-2506-23100,
title = {Repair Ingredients Are All You Need: Improving Large Language Model-Based Program Repair via Repair Ingredients Search},
author = {Jiayi Zhang and Kai Huang and Jian Zhang and Yang Liu and Chunyang Chen},
booktitle = {ICSE},
year = {2026},
doi = {10.1145/3744916.3764534}
}