用于代码修复的锚定自博弈
Anchored Self-Play for Code Repair
AI总结:
研究代码修复能力,提出生成器-修复器自博弈,通过强化学习训练单个模型生成并修复错误,引入BugSourceBench测试泛化性,发现问题后提出锚定自博弈,提高修复率。
摘要:
代码修复是语言模型的重要能力。因代码修复数据有限,旨在用语言模型生成错误修复任务来扩展监督。提出生成器-修复器自博弈,训练单个模型生成并修复错误,随着修复器改进,生成器产生更难错误。引入BugSourceBench测试泛化性,发现自博弈存在问题,进而提出锚定自博弈,提高了修复率。
英文摘要:
Code repair is an important capability for language models (LMs): given a buggy program and unit tests, an LM must produce a fixed program that passes the tests. Because code repair data is limited, we aim to scale supervision by using an LM to generate bug--fix tasks. We propose __generator--fixer self-play__, in which a single model is trained with reinforcement learning to generate bugs and fix them. As the fixer improves, the generator adapts to produce more difficult bugs, yielding an automatic curriculum. To test whether this curriculum generalizes, we introduce BugSourceBench, a repair benchmark spanning realistic bug sources: bugs in human-written code, LM-generated code, and human-edited LM-generated code. On BugSourceBench, we find that self-play drifts toward difficult but unrealistic bugs, improving on synthetic bugs but degrading on human-authored ones. We propose Anchored Self-Play (ASP), which anchors self-play with a small reference set by adding a code-embedding similarity reward for generation and mixing reference bugs into fixer training. Across bug sources, ASP achieves the best fix rates, improving average fix rate over standard self-play by $+24\%$ relative / $+7.0$ pp absolute, with gains on bugs from both LMs and humans.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。