通过迭代强化生成的测试用例,提升程序修复成功率。
Beyond Fail-to-Pass: Iterative Hardening of Co-Generated Bug Reproduction Tests and Fixes

- 先生成测试用例,再迭代优化测试与修复代码,避免错误耦合。
- 在SWE-bench Verified上达到69.4%修复率和78.9%失败-通过率。
- 适用于需要高可信修复结果的自动化程序修复场景。
大型语言模型(LLMs)使自动化程序修复(APR)在真实漏洞中更具可行性,但直接从漏洞报告修复仍缺乏约束。漏洞重现测试(BRT)通过将漏洞报告转化为可执行的、针对特定漏洞的信号,指导修复并验证补丁。现有研究主要以失败到通过(F->P)作为评估标准,即测试在有缺陷代码上失败,在正确修复代码上通过。我们发现,仅依赖F->P不足以提升下游修复效果;部分F->P测试过于宽松,虽能复现症状,但仍允许合理但错误的修复方案通过。为此,我们提出区分严格与宽松的F->P测试,并实证表明只有严格测试能持续提升修复成功率。进一步发现,联合生成存在测试-修复错误耦合,即即使测试和修复均错误,中间的F->P检查仍可能通过。基于此,我们提出CoHarden框架,利用宽松信号作为循环收敛条件:先生成测试,再迭代强化测试与修复,直至生成的测试不再接受宽松回归。实验表明,CoHarden在SWE-bench Verified上达到69.4%修复率和78.9% F->P,优于最强的修复单向与联合生成基线,分别提升9.6和7.9个百分点,且在不同大模型和基准上均有稳定提升。
原文摘要 · Abstract (English)
Large language models (LLMs) have made automated program repair (APR) increasingly practical for real-world bugs, but repairing directly from bug reports remains underconstrained. Bug reproduction tests (BRTs) help close this gap by turning a bug report into an executable, bug-specific signal that can guide repair and validate candidate patches. Existing work has therefore studied BRT generation as a core subproblem in APR and mainly evaluates a generated BRT using the fail-to-pass (F->P) criterion, which requires the test to fail on the buggy code but pass on the golden fix. We show that F->P alone is insufficient when the goal of a BRT is to improve downstream repair. In particular, some F->P BRTs are lax, reproducing the observed symptom yet still admitting plausible-but-incorrect patches. We formalize this missing quality dimension by separating F->P BRTs into rigorous and lax ones, and show empirically that only the former consistently improve repair success. We further find that co-generation introduces test--fix error coupling, where the in-trajectory fail-to-pass (F->P) check can pass even when both the generated patch and generated test are wrong. Based on these findings, we propose CoHarden, a co-generation framework that uses the Lax signal as an in-loop convergence criterion. CoHarden first generates a test before any fix, then iteratively hardens the test and fix against surviving mutation patches until the generated test no longer admits Lax regressions. Experiments show that CoHarden reaches 69.4% Resolved and 78.9% F->P on SWE-bench Verified, outperforming the strongest fix-only and cogeneration baselines by +9.6 and +7.9 percentage points in Resolved, respectively, with consistent gains across LLM backbones and benchmarks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。