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

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

Read SWE-Edit: Rethinking Code Editing for Efficient SWE-Agent by Yikai Zhang, Jiaxin Pei, Kenan Li, Maoquan Wang, Jin Pan, Yu Kang, Shengyu Fu, Elsie Nallipogu, Junjie Hu, Yufan Huang, Zijian Jin (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2604-26102.txt.

Introduction

Zhang and eleven colleagues redesign the code-editing interface for software-engineering agents. They split it into a Viewer fetching task-relevant code on demand and an Editor making changes from high-level plans. That stops exploratory viewing and strict edit formatting from crowding one window. Resolve rate on a verified benchmark rises roughly two points, and inference cost falls nearly eighteen percent. Training a small editor to choose formats adds about thirteen points, bringing an 8B open-source editor to parity with a frontier nano-scale model.

Catalog record

CREATORYikai Zhang, Jiaxin Pei, Kenan Li, Maoquan Wang, Jin Pan, Yu Kang, Shengyu Fu, Elsie Nallipogu, Junjie Hu, Yufan Huang, Zijian Jin
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE61131
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2604.26102

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

SWE-Edit: Rethinking Code Editing for Efficient SWE-Agent Yikai Zhang, Jiaxin Pei, Kenan Li, Maoquan Wang, Jin Pan, Yu Kang, Shengyu Fu, Elsie Nallipogu, Junjie Hu, Yufan Huang, Zijian Jin Abstract Large language model agents have achieved remarkable progress on software engineering tasks, yet current approaches suffer from a fundamental 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. This causes irrelevant information to accumulate and degrades agent performance. To address this, we propose SWE-Edit , which decomposes code editing into two specialized subagents: a Viewer that extracts task-relevant code on demand, and an Editor that executes modifications from high-level plans—allowing the main agent to focus on reasoning while delegating context-intensive operations to clean context windows. We further investigate what makes an effective editing model: observing that the prevalent find-and-replace format is error-prone, we train Qwen3-8B with GRPO to adaptively select editing modes, yielding improved editing efficiency over single-format baselines. On SWE-bench Verified, SWE-Edit improves resolved rate by 2.1% while reducing inference cost by 17.9%. We additionally propose a code editing benchmark that reliably predicts downstream agentic performance, providing practical guidance for editing model selection. Our code is publicly available at https://github.com/microsoft/SWE-Edit . † † affiliationnotice: * Work done during internship at Microsoft. 1 Introduction LLM-based coding agents can now solve real-world software engineering tasks by iteratively exploring codebases and refining solutions ( 25 ; 20 ) . Central to these systems is the code editing interface ( 15 ) —the tools through which agents inspect files and apply modifications. However, current interfaces suffer from a fundamental context coupling problem : they conflate code inspection, modification planning, and edit execution within a single context window, forcing agents to interleave exploratory viewing with strictly formatted edit generation. This coupling creates a structural tension. For example, effective debugging requires broad exploration—viewing multiple files, tracing dependencies, testing hypotheses—yet each viewed file snippet persists in context regardless of its ultimate relevance. Meanwhile, generating correct code edits demands focused attention on precise locations and formats. Prior work establishes that LLM performance degrades when task-relevant information is buried within irrelevant context ( 17 ; 10 ) . For coding agents, exploration and precision are fundamentally at odds: a single agent cannot simultaneously optimize for comprehensive code understanding (which benefits from viewing many files) and reliable edit generation (which benefits from clean, focused context). Figure 1 : Overview of the proposed SWE-Edit framework architecture. The figure illustrates the dual optimization mechanism, demonstrating how optimization occurs simultaneously at both the scaffolding level (coordinating components and context) and the model level (refining the underlying models). The code editing interface comprises two core operations that manifest this tension. The view operation allows agents to inspect file contents, but since agents cannot see code before viewing, they must explore incrementally—inevitably accumulating irrelevant context. The edit operation presents orthogonal challenges. The dominant find-replace format requires exact string matching; a single whitespace mismatch causes the edit to fail. The alternative whole-file rewrite avoids matching errors but incurs prohibitive token costs for long files. More fundamentally, reasoning about what to modify and generating properly formatted edit instructions are cognitively distinct capabilities: strong reasoning models like OpenAI o1 ( 7 ) excel at describing solutions but frequently fail to produce correctly formatted edits ( 3 ) . Even GPT-5 1 1 1 Throughout this paper, GPT-5 refers to the model with reasoning effort set to high. exhibits notable formatting failure rates on the Aider Polyglot code editing benchmark ( 4 ) —a reliability gap largely overlooked when evaluating agents on code editing tasks ( 4 ; 9 ) . We propose SWE-Edit , a framework that addresses context coupling by decomposing the code editing interface into specialized subagents. A Viewer subagent receives complete files and extracts only task-relevant code on demand, eliminating exploratory context pollution from the main agent. An Editor subagent executes modifications from high-level natural language plans, decoupling reasoning from format-sensitive code generation. This decomposition allows the main agent to focus purely on problem-solving while delegating context-intensive operations to clean, specialized contexts. Beyond scaffold design, we investigate what makes an effective editing model. Observing that the optimal editing strategy varies by find-replace suffices for small changes while whole-file rewrite handles complex restructuring—we train Qwen3-8B ( 24 ) with GRPO ( 16 ) to adaptively select editing modes based on modification complexity. The resulting model outperforms single-format baselines in editing accuracy. We further introduce a code editing benchmark and demonstrate that model performance on this benchmark reliably predicts downstream effectiveness when deployed as an editor subagent, providing practical guidance for editing model selection. On SWE-bench Verified ( 9 ) , our scaffolding-level contribution—the subagent decomposition—improves over the baseline by 2.1% while reducing the inference cost by 17.9% . By decoupling planning from format-sensitive generation, the decomposition also improves edit formatting reliability by 3.5% . Our model-level contribution complements this by answering what makes an effective editor: the adaptive editing model and accompanying benchmark provide a principled path toward selecting and improving the editor subagent without costly end-to-end experimentation. 2 Related Work LLM-Based Software Engineering Large language models have advanced from code completion ( 2 ; 1 ; 8 ; 28 ) to code editing ( 4 ) and repository-level software engineering ( 9 ) . Early approaches to SWE tasks such as bug fixing employed fixed pipelines ( 13 ; 21 ) , decomposing problems into localization, repair, and validation phases. Recent agentic systems ( 25 ; 20 ) instead equip LLMs with tools for iterative codebase interaction. Our work advances this paradigm by redesigning the code editing interface—the central mechanism through which SWE-agents inspect and modify code. Multi-Agent Systems Multi-agent systems decompose complex problems across specialized agents. In software engineering, works like MetaGPT ( 6 ) and ChatDev ( 14 ) assign distinct development roles to communicating agents, while recent work ( 5 ) distributes research queries into independent, parallelizable subtasks with clear boundaries. These approaches decompose at the task or role level—each agent pursues a separable objective. In contrast, SWE-Edit decomposes at the cognitive level: reasoning about what to modify and generating properly formatted edits are not independent subtasks but intertwined capabilities that interfere when sharing context. Our subagent design disentangles these conflicting cognitive demands within the code editing interface, and can integrate into broader multi-agent SWE frameworks. The closest existing design is Aider’s Architect mode ( 3 ) , which separates a high-capacity reasoning model from a smaller editing model. Aider Architect targets a different bottleneck: it decouples reasoning from edit formatting at the single-file level, but does not address the context pollution caused by exploratory file inspection, and its high-capacity reasoning stage increases cost. In contrast, SWE-Edit introduces a three-way decomposition (Viewer + main agent + Editor) that explicitly addresses context pollution, operates at the repository level, and reduces cost (§ 4.2 ). Training and Evolving SWE-Agents Parallel efforts improve SWE-agents through training or adaptation. Live-SWE-Agent ( 22 ) evolves scaffolding dynamically, while Context-Folding ( 18 ) trains agents to manage context via subagent delegation. SWE-Dev ( 19 ) and SWE-Fixer ( 23 ) advance open-source models

Read the complete text