SWE-Edit: Rethinking Code Editing for Efficient SWE-Agent
SWE-Edit improves the performance of software engineering agents by decoupling code inspection and modification into specialized subagents and introducing an adaptive, multi-format editing model trained with GRPO, which overall increases task completion success rates while significantly reducing inference costs.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are a master architect (the main agent) trying to repair a huge, complex building (a software codebase). Your goal is to fix a specific leak or reinforce a weak wall.
With the old method, the architect had to complete three tasks simultaneously:
- Search: Walk through every room, open every cabinet, to find the leak.
- Plan: Decide exactly how it should be repaired.
- Execute: Write the repair instructions in a very strict, pedantic language (like a robot that understands only exact measurements).
The problem? While the architect walked through the building looking for clues, he filled his mind with irrelevant details (old receipts, dusting, random furniture). By the time he tried to write the repair instructions, his mind was so overloaded with "noise" that he made mistakes. Furthermore, the strict language he had to use meant that a single wrong comma would cause the repair to fail.
SWE-Edit is a new workflow that solves this problem by hiring two specialized assistants and creating a "clean" workflow for the architect.
The two new assistants
1. The "Observer" (The specialized scout)
Instead of the architect roaming the entire building, he asks the Observer for help.
- How it works: The architect asks: "Show me the pipes near the kitchen sink." The Observer goes there, looks only at the pipes, and returns with a clean, short note containing only the relevant details.
- The advantage: The architect's mind remains clear. He does not have to wade through thousands of lines of irrelevant code. This saves time and money because the architect does not have to process a massive amount of "junk" information.
2. The "Editor" (The specialized builder)
Once the architect has the plan, he does not write the repair instructions himself. He tells the Editor: "Replace the rusty pipe with a new copper pipe."
- How it works: The Editor is a specialist who knows exactly how to write the repair instructions in the strict, pedantic language that the computer requires.
- The advantage: The architect can focus purely on what needs to be repaired (the logic), while the Editor focuses on how it is perfectly written down (the format). This prevents the architect from making silly formatting errors that would cause the repair to fail.
The "intelligent switch" (Adaptive mode)
The study also discovered that sometimes a simple repair (like replacing a single word) is best done one way, while a huge, complex overhaul (like rewriting an entire room) works best another way.
Previously, the system was locked into using only one method (like trying to repair an entire house by replacing only a single brick). The new system teaches the Editor to be intelligent:
- If the task is small, it uses a precise, low-cost method (search and replace).
- If the task is huge and chaotic, it switches to a robust, file-wide method (rewrite the whole thing).
It is like a craftsman who knows when to use a screwdriver and when to pull out a sledgehammer, instead of trying to use a screwdriver for everything.
The results
By dividing the task this way, the team found:
- Better success: The system repaired more problems correctly (about 2% more).
- Cheaper: It cost significantly less to operate (about 18% less) because the main "brain" did not have to read so much junk data.
- Fewer errors: The repair instructions were formatted correctly almost every time, so the computer did not reject them.
The "practice test" (PR-Edit benchmark)
Finally, the researchers found that testing these systems on full, expensive building repairs took too long and cost too much money. So they created a mini-practice test (called PR-Edit).
They found that if an Editor performed well on this fast, cheap practice test, it was almost guaranteed that it would also perform well on the real, expensive task. This is like a driving test: if you pass the parking test, you will likely also pass the highway test without having to drive on the highway first to find out.
In short: SWE-Edit prevents the AI from trying to do everything at once. It gives it a clean team of specialists (a scout and a builder) and an intelligent way to select the right tool for the job, making software repair faster, cheaper, and more reliable.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.