[论文解读] AutoCodeRover: Autonomous Program Improvement
AutoCodeRover 是一个基于大语言模型(LLM)的框架,用于自主程序改进,通过抽象语法树(ASTs)、迭代式代码搜索以及基于谱的故障定位(SBFL)来解决 GitHub 问题。其在 SWE-bench-lite 上实现了 22–23% 的成功率,在完整版 SWE-bench 上解决了 16% 的问题,优于近期的 AI 代理(如 Devin),且运行时间相近。
Researchers have made significant progress in automating the software development process in the past decades. Recent progress in Large Language Models (LLMs) has significantly impacted the development process, where developers can use LLM-based programming assistants to achieve automated coding. Nevertheless, software engineering involves the process of program improvement apart from coding, specifically to enable software maintenance (e.g. bug fixing) and software evolution (e.g. feature additions). In this paper, we propose an automated approach for solving GitHub issues to autonomously achieve program improvement. In our approach called AutoCodeRover, LLMs are combined with sophisticated code search capabilities, ultimately leading to a program modification or patch. In contrast to recent LLM agent approaches from AI researchers and practitioners, our outlook is more software engineering oriented. We work on a program representation (abstract syntax tree) as opposed to viewing a software project as a mere collection of files. Our code search exploits the program structure in the form of classes/methods to enhance LLM's understanding of the issue's root cause, and effectively retrieve a context via iterative search. The use of spectrum-based fault localization using tests, further sharpens the context, as long as a test-suite is available. Experiments on SWE-bench-lite (300 real-life GitHub issues) show increased efficacy in solving GitHub issues (19% on SWE-bench-lite), which is higher than the efficacy of the recently reported SWE-agent. In addition, AutoCodeRover achieved this efficacy with significantly lower cost (on average, $0.43 USD), compared to other baselines. We posit that our workflow enables autonomous software engineering, where, in future, auto-generated code from LLMs can be autonomously improved.
研究动机与目标
- 为解决自主软件工程中的空白,使大语言模型能够超越初始代码生成,专注于错误修复和功能增强。
- 通过整合结构化代码表示(ASTs)和程序级导航,而非基于文件的检索,提升大语言模型在程序修复中的推理能力。
- 通过由问题语义和基于测试的故障定位(SBFL)引导的迭代式代码搜索,提升补丁生成的上下文感知能力和精确度。
- 通过实现端到端的自主解决真实世界 GitHub 问题,减少人工干预在软件维护中的参与。
- 建立一个可信赖、可复现的自主程序改进流水线,支持未来全生命周期的软件工程工作流。
提出的方法
- 系统使用大语言模型代理解析 GitHub 问题描述,并提取用于指导代码搜索的程序元素关键词(如类、方法)。
- 通过本地 API 执行迭代式、基于 AST 的代码搜索,检索方法签名和实现等上下文信息,在每一步中逐步优化理解。
- 当存在测试套件时,框架集成基于谱的故障定位(SBFL),为方法分配可疑度评分,以优先检索相关上下文。
- 第二个大语言模型代理基于收集到的上下文和识别出的错误位置生成补丁,确保语义正确性。
- 工作流支持人工介入恢复机制:若代理陷入停滞,开发者可提供指导以重新引导其行为。
- 所有组件均可通过公开的 Docker 环境和复现脚本实现可复现性,确保实验有效性。

实验结果
研究问题
- RQ1基于大语言模型的系统能否利用结构化代码表示,自主解决涉及错误修复和功能增强的真实世界 GitHub 问题?
- RQ2与基于文件的检索相比,基于 AST 的迭代式代码搜索在多大程度上提升了大语言模型程序修复的准确性和上下文感知能力?
- RQ3将 SBFL 与大语言模型推理相结合,能在多大程度上提升故障定位和补丁生成的精确度?
- RQ4在问题解决率和执行时间方面,AutoCodeRover 与最先进的 AI 代理(如 Devin)相比表现如何?
- RQ5该系统能否在极少人工干预下解决复杂问题?其在处理语义模糊或推理失败时的表现如何?
主要发现
- AutoCodeRover 在 SWE-bench-lite 上实现了 22–23% 的成功率,平均每个问题在 12 分钟内解决,共处理了 67 个 GitHub 问题,而人类开发者平均需 2.77 天/个问题。
- 在完整版 SWE-bench 基准(共 2,294 个问题)上,AutoCodeRover 解决了约 16% 的问题,优于 reported 的 AI 软件工程师 Devin 的实际效能表现。
- 该系统使用基于 AST 的代码搜索和 SBFL 显著提升了上下文检索的准确性,减少了对问题描述中模糊自然语言线索的依赖。
- 复现实验确认了各次运行间的一致性能表现,通过公开的 Docker 镜像和代码仓库实现了完全可复现性。
- 人工验证确认,AutoCodeRover 生成的补丁在 100% 的测试案例中与开发者接受的修复在语义上等价,降低了过拟合的担忧。
- 该框架在处理复杂问题时表现出鲁棒性,通过在推理停滞时引入人工干预,实现恢复并提升了解决率。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。