arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2604.26102cs.SEcs.CL
收藏

SWE-Edit:重新思考高效SWE智能体的代码编辑

SWE-Edit: Rethinking Code Editing for Efficient SWE-Agent

Microsoft(微软);Department of Computer Sciences, University of Wisconsin–Madison(威斯康星大学麦迪逊分校计算机科学系);Stanford Institute for Human-Centered Artificial Intelligence (HAI), Stanford University(斯坦福大学人机交互研究所)

Yikai Zhang, Jiaxin Pei, Kenan Li, Qirui Jin, Maoquan Wang, Jin Pan, Yu Kang, Shengyu Fu, Elsie Nallipogu, Junjie Hu, Yufan Huang, Zijian Jin

AI总结:

提出SWE-Edit框架,通过将代码编辑分解为查看器和编辑器两个子智能体,解决上下文耦合问题,在SWE-Bench Verified上提升解决率2.1个百分点并降低推理成本17.9%,且通过GRPO训练小模型实现高效编辑格式选择。

摘要:

大型语言模型智能体在软件工程方面取得了显著进展,但当前系统存在上下文耦合问题:标准代码编辑界面将代码检查、修改规划和编辑执行混杂在单个上下文窗口中,迫使智能体将探索性查看与严格格式化的编辑生成交错进行。无关上下文不断累积,编辑可靠性下降。我们提出SWE-Edit,将编辑界面分解为两个专门的子智能体:一个按需提取任务相关代码的查看器,以及一个根据高层自然语言计划执行修改的编辑器——让主智能体专注于推理,同时将上下文密集型操作委托给干净的上下文窗口。在SWE-Bench Verified上,这种分解将解决率提高了2.1个百分点,并将推理成本降低了17.9%,在多个推理模型家族(Kimi-K2、MiniMax-M2.1、GLM-4.7)上均有一致提升。我们进一步证明,有效的编辑格式选择可以训练到小模型中,而无需前沿规模的能力:在Qwen3-8B上使用自适应查找替换/全文件重写策略进行GRPO训练,将编辑成功率提高了12.5个百分点,并使8B开源编辑器在下游SWE-Bench解决率上与GPT-5-nano持平。为支持快速编辑器迭代,我们发布了PR-Edit,这是一个轻量级评估,其分数与SWE-Bench解决率强相关。我们在https://github.com/microsoft/SWE-Edit发布代码。

英文摘要:

Large language model agents have made strong progress on software engineering, yet current systems suffer from a context coupling problem: the standard code editing interface conflates code inspection, modification planning, and edit execution within a single context window, forcing agents to interleave exploratory viewing with strictly formatted edit generation. Irrelevant context accumulates and edit reliability degrades. We propose SWE-Edit, which decomposes the editing interface into two specialized subagents: a Viewer that extracts task-relevant code on demand, and an Editor that executes modifications from high-level natural language plans -- letting the main agent focus on reasoning while delegating context-intensive operations to clean context windows. On SWE-Bench Verified, this decomposition raises resolve rate by 2.1 pp and cuts inference cost by 17.9%, with consistent gains across multiple reasoning-model families (Kimi-K2, MiniMax-M2.1, GLM-4.7). We further show that effective edit-format selection can be trained into a small model rather than requiring frontier-scale capacity: GRPO training on Qwen3-8B with an adaptive find-replace/whole-file-rewrite policy improves edit success by 12.5 pp and brings an 8B open-source editor to parity with GPT-5-nano on downstream SWE-Bench resolve rate. To enable rapid editor iteration, we release PR-Edit, a lightweight evaluation whose scores correlate strongly with SWE-Bench resolve rate. We release our code at https://github.com/microsoft/SWE-Edit.

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

↑