arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2603.01048cs.SEcs.AI
收藏

RepoRepair: 利用代码文档实现仓库级别的自动程序修复

RepoRepair: Leveraging Code Documentation for Repository-Level Automated Program Repair

State Key Laboratory for Novel Software Technology, Nanjing University(新型软件技术国家重点实验室,南京大学);Human Language Technology Research Institute, University of Texas at Dallas(人机语言技术研究院,德克萨斯大学达拉斯分校)

Zhongqiang Pan, Chuanyi Li, Wenkang Zhong, Yi Feng, Bin Luo, Vincent Ng

AI总结:

RepoRepair通过生成代码文档增强LLM能力,实现仓库级别的自动程序修复,取得高修复率和低成本的优异表现。

摘要:

自动程序修复(APR)在从孤立函数扩展到完整仓库时面临困难,因为它需要全局的、任务感知的理解来定位必要的更改。当前方法受限于上下文,依赖于浅层检索或昂贵的代理迭代,难以处理复杂的跨文件问题。为此,我们提出了RepoRepair,一种新的文档增强方法,用于仓库级别的故障定位和程序修复。我们的核心洞察是利用LLMs生成层次化的代码文档(从函数到文件)来为代码仓库提供结构化的语义抽象,使LLMs能够理解仓库级别的上下文和依赖关系。具体而言,RepoRepair首先使用基于文本的LLM(如DeepSeek-V3)为仓库生成文件/函数级别的代码文档,这些文档作为辅助知识来指导故障定位。随后,基于故障定位结果和问题描述,一个强大的LLM(如Claude-4)尝试修复识别出的可疑代码片段。在SWE-bench Lite上评估,RepoRepair在低至每修复0.44美元的成本下实现了45.7%的修复率。在SWE-bench Multimodal上,尽管每修复成本更高为0.56美元,它仍实现了37.1%的修复率,展示了在不同问题领域中稳健且成本效益高的性能。

英文摘要:

Automated program repair (APR) struggles to scale from isolated functions to full repositories, as it demands a global, task-aware understanding to locate necessary changes. Current methods, limited by context and reliant on shallow retrieval or costly agent iterations, falter on complex cross-file issues. To this end, we propose RepoRepair, a novel documentation-enhanced approach for repository-level fault localization and program repair. Our core insight is to leverage LLMs to generate hierarchical code documentation (from functions to files) for code repositories, creating structured semantic abstractions that enable LLMs to comprehend repository-level context and dependencies. Specifically, RepoRepair first employs a text-based LLM (e.g., DeepSeek-V3) to generate file/function-level code documentation for repositories, which serves as auxiliary knowledge to guide fault localization. Subsequently, based on the fault localization results and the issue description, a powerful LLM (e.g., Claude-4) attempts to repair the identified suspicious code snippets. Evaluated on SWE-bench Lite, RepoRepair achieves a 45.7% repair rate at a low cost of $0.44 per fix. On SWE-bench Multimodal, it delivers state-of-the-art performance with a 37.1% repair rate despite a higher cost of $0.56 per fix, demonstrating robust and cost-effective performance across diverse problem domains.

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

↑