Beyond Fail-to-Pass: Iterative Hardening of Co-Generated Bug Reproduction Tests and Fixes
作者: Yuhao Tan, Zhibang Yang, Fangkai Yang, Yuan Yao, Yu Kang, Lu Wang, Pu Zhao, Xin Zhang, Xiaoxing Ma, Qingwei Lin, Saravan Rajmohan, Dongmei Zhang
分类: cs.SE, cs.AI
发布日期: 2026-07-22
备注: 29 pages, 5 figures, preprint
💡 一句话要点
提出CoHarden框架以解决BRT生成中的修复成功率问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 自动程序修复 错误重现测试 大型语言模型 迭代生成 软件维护 修复成功率 测试生成 宽松回归
📋 核心要点
- 现有的BRT生成方法主要依赖于F->P标准,导致一些测试虽然能重现错误,但仍可能接受不正确的修复。
- 论文提出CoHarden框架,通过迭代生成和强化测试与修复,确保生成的测试不再接受宽松回归。
- 实验结果表明,CoHarden在修复成功率和F->P标准上均显著优于现有的基线方法,提升幅度达到9.6和7.9个百分点。
📝 摘要(中文)
大型语言模型(LLMs)使得自动程序修复(APR)在实际应用中变得越来越可行,但直接从错误报告进行修复仍然存在约束不足的问题。错误重现测试(BRTs)通过将错误报告转化为可执行的、特定于错误的信号,帮助缩小这一差距。现有研究主要使用失败通过(F->P)标准评估生成的BRT,但我们发现仅依赖F->P不足以提升修复效果。我们将BRT分为严格和宽松两类,实验证明只有严格的BRT能持续提高修复成功率。基于这些发现,我们提出了CoHarden框架,通过迭代强化测试和修复,最终消除宽松回归。实验结果显示,CoHarden在SWE-bench Verified上达到了69.4%的解决率和78.9%的F->P,超越了最强的基线方法。
🔬 方法详解
问题定义:论文要解决的问题是现有BRT生成方法在修复成功率上的不足,尤其是依赖F->P标准导致的宽松测试问题。现有方法未能有效区分严格和宽松的BRT,影响了修复效果。
核心思路:论文的核心思路是提出CoHarden框架,通过迭代生成和强化测试与修复,确保生成的测试能够有效指导修复过程,消除宽松回归的可能性。
技术框架:CoHarden框架首先生成一个测试,然后在每次生成修复后,迭代强化测试和修复,直到生成的测试不再接受宽松回归。主要模块包括初始测试生成、迭代强化和修复生成。
关键创新:最重要的技术创新点在于将BRT分为严格和宽松两类,并提出使用宽松信号作为迭代收敛标准,这与现有方法的单一F->P标准形成了本质区别。
关键设计:在参数设置上,CoHarden框架通过迭代过程不断调整测试和修复的生成策略,确保每一步都能有效提高修复的成功率。
🖼️ 关键图片
📊 实验亮点
实验结果显示,CoHarden在SWE-bench Verified上达到了69.4%的解决率和78.9%的F->P,分别比最强的修复基线和共同生成基线提高了9.6和7.9个百分点,且在不同的LLM基础和基准上均表现出一致的提升。
🎯 应用场景
该研究的潜在应用领域包括软件开发和维护,尤其是在自动化程序修复和错误检测方面。通过提高BRT的生成质量,能够显著提升软件修复的效率和准确性,减少开发者的工作负担,具有重要的实际价值和未来影响。
📄 摘要(原文)
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.