arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.02647cs.SE
收藏

通过多智能体辩论引导的运行时执行轨迹指导的自动程序修复

From Guessing to Seeing: Enhancing LLM-Based Program Repair via Trace-Guided Multi-strategy Debate

Northwestern Polytechnical University(西北工业大学)

Jiaqing Wu, Tong Wu, Manqing Zhang, Yunwei Dong, Bo Shen

AI总结:

本文提出TraceRepair框架,利用运行时事实作为共享约束进行补丁验证,通过多智能体协作提高修复效率和泛化能力,实验显示其在修复缺陷和处理新 bug 数据集上表现优异。

摘要:

自动程序修复(APR)在处理复杂逻辑错误和静默故障时面临挑战。当前基于LLM的APR方法多为静态,依赖源代码和基本测试输出,难以准确捕捉复杂的运行时行为和动态数据依赖。虽然纳入运行时证据如执行轨迹可暴露具体状态转换,但单一LLM解释时往往过拟合特定假设,生成的补丁仅满足测试而非正确逻辑。因此,运行时证据应作为客观约束而非单纯附加输入。我们提出TraceRepair,一种利用运行时事实作为共享约束进行补丁验证的多智能体框架。探测代理捕获关键变量的执行快照以形成客观修复基础。同时,由专门化代理组成的委员会交叉验证候选补丁以暴露不一致并迭代优化。在Defects4J基准测试中,TraceRepair正确修复392个缺陷,显著优于现有基于LLM的方法。广泛实验表明其在新构建的近期bug数据集上具有改进的效率和强泛化能力,证实性能提升源于动态推理而非记忆。

英文摘要:

Automated Program Repair (APR) aims to resolve software bugs without human intervention, but complex logic errors and silent failures remain challenging. Existing LLM-based APR methods mainly rely on source code and coarse test feedback, making it difficult to capture runtime behaviors and dynamic data dependencies. Execution traces expose concrete state transitions, yet a single LLM interpreting them in isolation may commit to an incorrect repair hypothesis and produce test-overfitting patches. We therefore treat runtime evidence as shared constraints for validating repair hypotheses rather than merely as additional prompt context. We propose TraceRepair, a multi-agent framework in which a Probe Agent captures execution snapshots of critical variables, while specialized repair agents generate, compare, and iteratively refine candidate patches against the observed runtime evidence. A Judge Agent then arbitrates the remaining hypotheses and synthesizes the final patch. Evaluated on Defects4J, TraceRepair correctly fixes 392 defects and outperforms existing LLM-based approaches. Further experiments demonstrate improved efficiency and strong generalization on a newly constructed dataset of recent bugs, suggesting that the gains arise from dynamic reasoning rather than memorization.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑