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

SGAgent:基于建议引导的LLM多智能体框架用于仓库级软件修复

SGAgent: Suggestion-Guided LLM-Based Multi-Agent Framework for Repository-Level Software Repair

Nanjing University of Science and Technology(南京理工大学);Nanjing University(南京大学)

Quanjun Zhang, Chengyu Gao, Yu Han, Ye Shang, Chunrong Fang, Zhenyu Chen, Liang Xiao

AI总结:

提出SGAgent框架,通过引入建议阶段(localize-suggest-fix范式)和知识图谱工具,增强从定位到修复的推理,在SWE-Bench-Lite上达到51.3%修复准确率。

摘要:

大型语言模型(LLM)使得智能体能够自主与环境交互并调用外部工具。最近,基于智能体的软件修复引起了广泛关注,因为修复智能体可以定位错误、生成补丁,并在仓库级基准(如SWE-Bench)上达到最先进的性能。然而,现有方法通常采用“定位-修复”范式,直接从“错误在哪里”跳到“如何修复”,留下了根本性的推理鸿沟。为此,我们提出了SGAgent,一个基于建议引导的多智能体框架,用于仓库级软件修复,遵循“定位-建议-修复”范式。SGAgent引入了一个建议阶段,以加强从定位到修复的过渡:建议者从错误位置开始,逐步检索相关上下文,直到完全理解错误,并提供可操作的修复建议。我们进一步从目标仓库构建知识图谱(KG),并开发基于KG的工具包,以增强SGAgent的全局上下文感知和仓库级推理。三个专门的子智能体(即定位器、建议者和修复者)协作实现自动化的端到端软件修复。我们在SWE-Bench-Lite上评估了SGAgent。使用Claude-3.5的SGAgent实现了51.3%的修复准确率、81.2%的文件级和52.4%的函数级定位准确率,平均每个实例成本为1.48美元,优于使用相同基础模型的所有基线。SGAgent在不同基础LLM上也具有良好的泛化能力,使用Claude-4时达到60.7%的解决率。当扩展到漏洞修复时,它在VUL4J和VJBench上达到48.0%,展示了跨任务和编程语言的强泛化能力。

英文摘要:

Large Language Models (LLMs) have enabled intelligent agents that autonomously interact with environments and invoke external tools. Recently, agent-based software repair has drawn wide attention, as repair agents can localize bugs, generate patches, and achieve state-of-the-art performance on repository-level benchmarks (e.g., SWE-Bench). However, existing approaches usually adopt a localize-then-fix paradigm, jumping directly from "where the bug is" to "how to fix it", leaving a fundamental reasoning gap. To this end, we propose SGAgent, a Suggestion-Guided multi-Agent framework for repository-level software repair, which follows a localize-suggest-fix paradigm. SGAgent introduces a suggestion phase to strengthen the transition from localization to repair: the suggester starts from the buggy locations, incrementally retrieves relevant context until it fully understands the bug, and provides actionable repair suggestions. We further construct a Knowledge Graph (KG) from the target repository and develop a KG-based toolkit to strengthen SGAgent's global contextual awareness and repository-level reasoning. Three specialized sub-agents (i.e., localizer, suggester, and fixer) collaborate to achieve automated end-to-end software repair. We evaluate SGAgent on SWE-Bench-Lite. SGAgent with Claude-3.5 achieves 51.3% repair accuracy, 81.2% file-level, and 52.4% function-level localization accuracy at an average cost of $1.48 per instance, outperforming all baselines using the same base model. SGAgent also generalizes well across base LLMs, reaching a 60.7% resolution rate with Claude-4. When extended to vulnerability repair, it achieves 48.0% on VUL4J and VJBench, demonstrating strong generalization across tasks and programming languages.

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

↑