arXiv:2603.01048cs.SEcs.AI2026-03被引 8

用代码文档辅助修复整个代码库的错误,效率高且成本低。

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

  • 通过大模型生成层级化代码文档,构建全局语义理解
  • 在SWE-bench Lite上实现45.7%修复率,单次修复仅需0.44美元
  • 适合需要跨文件修复的大型项目维护者使用

自动化程序修复(APR)难以从单个函数扩展到整个代码库,因需全局任务感知以定位必要修改。现有方法受限于上下文,依赖浅层检索或高成本代理迭代,在复杂跨文件问题上表现不佳。为此,我们提出RepoRepair,一种基于文档增强的仓库级故障定位与修复方法。核心思想是利用大模型生成从函数到文件的层级化代码文档,构建结构化语义抽象,使大模型能理解仓库级上下文与依赖关系。具体而言,先用文本型大模型(如DeepSeek-V3)为仓库生成文件/函数级代码文档,作为辅助知识指导故障定位;随后,基于定位结果和问题描述,由强大大模型(如Claude-4)尝试修复可疑代码片段。在SWE-bench Lite上,RepoRepair实现45.7%修复率,每次修复成本仅0.44美元;在SWE-bench Multimodal上,以0.56美元/修复成本达到37.1%修复率,展现跨领域鲁棒且高效的性能。

原文摘要 · Abstract (English)

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.

程序修复大模型代码理解自动化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。