用双智能体框架提升大模型对代码库的深度分析与问题修复能力
SWE-Adept: An LLM-Based Agentic Framework for Deep Codebase Analysis and Structured Issue Resolution
- 双代理分工:定位代理精准导航代码依赖,修复代理系统化修改代码
- 在SWE-Bench上端到端修复率提升4.3%,显著优于现有方法
- 支持分支探索与回滚,适合需要可靠代码修改的工程场景
大语言模型在独立编程任务中表现优异,但在代码库级软件工程中仍面临两大挑战:(1)需深度导航代码库并有效管理上下文以准确定位问题;(2)需采用系统性迭代、测试驱动的方式修复问题。为此,我们提出SWE-Adept,一个基于LLM的双代理框架,其中定位代理识别问题相关代码位置,修复代理执行相应修复。针对定位,引入代理引导的深度优先搜索,有选择地遍历代码依赖关系,减少无关内容占用上下文,提升定位精度。针对修复,采用自适应规划与结构化解题策略,配备进度追踪和基于Git的版本控制工具。这些工具通过共享工作内存实现代码状态快照的分步索引存储,支持精确快照检索。该设计使代理能可靠执行版本控制操作,包括分支探索多种方案及回滚失败修改。在SWE-Bench Lite和SWE-Bench Pro上的实验表明,SWE-Adept在问题定位与修复方面持续优于先前方法,端到端修复率最高提升4.3%。
原文摘要 · Abstract (English)
Large language models (LLMs) exhibit strong performance on self-contained programming tasks. However, they still struggle with repository-level software engineering (SWE), which demands (1) deep codebase navigation with effective context management for accurate localization, and (2) systematic approaches for iterative, test-driven code modification to resolve issues. To address these challenges, we propose SWE-Adept, an LLM-based two-agent framework where a localization agent identifies issue-relevant code locations and a resolution agent implements the corresponding fixes. For issue localization, we introduce agent-directed depth-first search that selectively traverses code dependencies. This minimizes issue-irrelevant content in the agent's context window and improves localization accuracy. For issue resolution, we employ adaptive planning and structured problem solving. We equip the agent with specialized tools for progress tracking and Git-based version control. These tools interface with a shared working memory that stores code-state checkpoints indexed by execution steps, facilitating precise checkpoint retrieval. This design enables reliable agent-driven version-control operations for systematic issue resolution, including branching to explore alternative solutions and reverting failed edits. Experiments on SWE-Bench Lite and SWE-Bench Pro demonstrate that SWE-Adept consistently outperforms prior approaches in both issue localization and resolution, improving the end-to-end resolve rate by up to 4.3%.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。