arXiv:2604.05963cs.SEcs.LG2026-04ACL被引 1

用智能奖励优化减少代码修复中的过度修改,提升修复精度。

QiMeng-PRepair: Precise Code Repair via Edit-Aware Reward Optimization

论文配图:QiMeng-PRepair: Precise Code Repair via Edit-Aware Reward Optimization
图 1 · 摘自论文原文
  • 通过编辑感知奖励优化,鼓励最小但正确的代码修改
  • 在fix_1@1指标上修复精度提升31.4%
  • 适合需要精准、高效修复的开发与自动化测试场景

大语言模型在程序修复中表现强劲,但常出现过度修改问题,即过多改动覆盖了原本正确的代码,阻碍缺陷定位。我们系统性量化了该问题的影响,并提出精确修复任务——在修复错误部分的同时最大化保留正确代码。基于此,我们提出PRepair框架,包含两个组件:Self-Breaking通过受控注入缺陷和极小化采样生成多样化的错误程序;Self-Repair采用编辑感知组相对策略优化(EA-GRPO)训练模型,并使用编辑感知奖励来鼓励最少且正确的修改。实验表明,PRepair在fix_1@1指标下修复精度最高提升31.4%,结合推测性编辑后显著提高解码吞吐量,展现出精确且实用的代码修复潜力。

原文摘要 · Abstract (English)

Large Language Models (LLMs) achieve strong program repair performance but often suffer from over-editing, where excessive modifications overwrite correct code and hinder bug localization. We systematically quantify its impact and introduce precise repair task, which maximizes reuse of correct code while fixing only buggy parts. Building on this insight, we propose PRepair, a framework that mitigates over-editing and improves repair accuracy. PRepair has two components: Self-Breaking, which generates diverse buggy programs via controlled bug injection and min-max sampling, and Self-Repairing, which trains models with Edit-Aware Group Relative Policy Optimization (EA-GRPO) using an edit-aware reward to encourage minimal yet correct edits. Experiments show that PRepair improves repair precision by up to 31.4% under $\mathrm{fix}_1@1$, a metric that jointly considers repair correctness and extent, and significantly increases decoding throughput when combined with speculative editing, demonstrating its potential for precise and practical code repair.

代码修复LLM精准修复奖励优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。