ChatPaper.aiChatPaper

QiMeng-PRepair:基于编辑感知奖励优化的精准代码修复

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

April 7, 2026
作者: Changxin Ke, Rui Zhang, Jiaming Guo, Yuanbo Wen, Li Ding, Shuo Wang, Xuyuan Zhu, Xiong Peng, Di Huang, Zidong Du, Xing Hu, Qi Guo, Yunji Chen
cs.AI

摘要

大型语言模型(LLMs)在程序修复任务中展现出强大性能,但常存在过度编辑问题——过度修改会覆盖正确代码并阻碍错误定位。我们系统性地量化了该问题的影响,提出精准修复任务,其核心是在修复错误代码的同时最大化保留正确代码。基于此洞见,我们提出PRepair框架以缓解过度编辑并提升修复准确率。该框架包含两个组件:自我破坏(通过可控错误注入和极小极大采样生成多样化错误程序)与自我修复(采用具备编辑感知奖励的EA-GRPO算法训练模型,鼓励最小化正确修改)。实验表明,PRepair在综合考量修复正确性与修改程度的fix_1@1指标上最高提升31.4%的修复精度,结合推测式编辑技术后显著提升解码吞吐量,展现了其在精准实用化代码修复方面的潜力。
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 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.
PDF31April 9, 2026