arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.03588cs.SEcs.MA
收藏

REFINE:通过上下文感知的补丁精炼增强程序修复智能体

REFINE: Enhancing Program Repair Agents through Context-Aware Patch Refinement

Columbia University(哥伦比亚大学)

Anvith Pabba, Simin Chen, Alex Mathai, Anindya Chakraborty, Baishakhi Ray

AI总结:

本文提出 Refine 补丁精炼框架,通过上下文消歧、测试时扩展候选多样化和 LLM 代码评审聚合,将部分正确补丁转化为正确修复,并在 SWE-Bench 上显著提升多类 APR 系统性能。

摘要:

大语言模型(LLM)最近在自动程序修复(APR)中展现出强大潜力,尤其是在仓库级场景中,其目标是根据自然语言问题描述、大型代码库和回归测试生成补丁。然而,尽管前景广阔,当前基于 LLM 的 APR 技术往往因对代码上下文理解有限且过度依赖不完整的测试套件而难以生成正确修复。因此,它们频繁生成 Draft Patches(草稿补丁)——即部分正确的补丁,要么未完整解决缺陷,要么过拟合于测试用例。在本工作中,我们提出了一个新颖的补丁精炼框架 Refine,可系统性地将 Draft Patches 转化为正确补丁。Refine 应对三项关键挑战:消解模糊的问题与代码上下文歧义,通过测试时扩展(test-time scaling)使补丁候选多样化,以及借助由 LLM 驱动的代码评审过程聚合部分修复。我们将 Refine 实现为一个通用精炼模块,可集成到基于开放智能体和基于工作流的 APR 系统中。我们在 SWE-Bench Lite 基准上的评估表明,Refine 在基于工作流的方法中取得了最先进结果,并接近所有 APR 类别中已知最佳性能。具体而言,Refine 将 AutoCodeRover 的性能提升了 14.67%,达到 51.67% 的得分,超过了所有先前基线。在 SWE-Bench Verified 上,Refine 将解决率提高了 12.2%;当跨多个 APR 系统集成时,它带来平均 14% 的提升——证明了其广泛的有效性和泛化能力。这些结果凸显了精炼作为当前 APR 流水线中缺失组件的有效性,以及智能体协作在弥合近似正确补丁与正确补丁之间差距方面的潜力。我们还开源了代码。

英文摘要:

Large Language Models (LLMs) have recently shown strong potential in automatic program repair (APR), especially in repository-level settings where the goal is to generate patches based on natural language issue descriptions, large codebases, and regression tests. However, despite their promise, current LLM-based APR techniques often struggle to produce correct fixes due to limited understanding of code context and over-reliance on incomplete test suites. As a result, they frequently generate Draft Patches-partially correct patches that either incompletely address the bug or overfit to the test cases. In this work, we propose a novel patch refinement framework, Refine, that systematically transforms Draft Patches into correct ones. Refine addresses three key challenges: disambiguating vague issue and code context, diversifying patch candidates through test-time scaling, and aggregating partial fixes via an LLM-powered code review process. We implement Refine as a general refinement module that can be integrated into both open-agent-based and workflow-based APR systems. Our evaluation on the SWE-Bench Lite benchmark shows that Refine achieves state-of-the-art results among workflow-based approaches and approaches the best-known performance across all APR categories. Specifically, Refine boosts AutoCodeRover's performance by 14.67%, achieving a score of 51.67% and surpassing all prior baselines. On SWE-Bench Verified, Refine improves the resolution rate by 12.2%, and when integrated across multiple APR systems, it yields an average improvement of 14%-demonstrating its broad effectiveness and generalizability. These results highlight the effectiveness of refinement as a missing component in current APR pipelines and the potential of agentic collaboration in closing the gap between near-correct and correct patches. We also open source our code.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑