cs.SEApr 28, 2026

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

Authors: Yikai ZhangJiaxin PeiKenan LiQirui JinMaoquan WangJin PanYu KangShengyu Fu+4 more

Organizations: 1Microsoft, Redmond, Washington, United States · 3Stanford Institute for Human-Centered Artificial Intelligence (HAI), Stanford University · Department of Computer Sciences, University of Wisconsin–Madison

Abstract

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.

Explore similar work

CardsList
  1. SWE Atlas: Benchmarking Coding Agents Beyond Issue Resolution

    May 8, 2026Mohit Raghavendra, Soham Dan, Miguel Romero Calvo +12Swe-Bench VerifiedCoding Agents