SWE-Router: Routing in Multi-turn Agentic Software Engineering Tasks
The paper introduces SWE-Router, a value-based routing framework that improves cost efficiency in multi-turn agentic software engineering by leveraging a cheap model's initial exploratory trajectory to make informed escalation decisions, thereby outperforming traditional description-only routers while maintaining strong performance.
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
The Big Problem: Hiring the Wrong Expert
Imagine you run a repair shop. You have two types of mechanics:
- The Apprentice: Cheap, fast, and good at simple fixes (like changing a lightbulb or tightening a loose screw).
- The Master Engineer: Extremely expensive, slow, and brilliant at solving complex, multi-layered disasters (like rebuilding a car engine from scratch).
In the world of software, these are Large Language Models (LLMs). The "Master" models are great at fixing code, but they cost a lot of money to run. The "Apprentice" models are cheap but sometimes get stuck on hard problems.
The Current Mistake:
Right now, when a customer brings in a broken piece of code, the shop manager (the router) looks only at the customer's description of the problem.
- Customer says: "My car won't start."
- Manager thinks: "That sounds serious. Let's call the Master Engineer immediately."
The Reality:
Sometimes, "My car won't start" just means a loose battery cable (a simple fix the Apprentice could handle). Other times, it means the engine block is cracked (requiring the Master). The manager can't tell the difference just by reading the note. This leads to wasting money on the Master for simple jobs.
The Solution: SWE-Router (The "Test Drive" Approach)
The authors of this paper created a new system called SWE-Router. Instead of guessing based on the description, they let the Apprentice try to fix the problem for a few minutes first.
Here is how it works:
- The Exploration Phase: The cheap Apprentice model is given the task and allowed to take a few "turns" (steps). It looks at the code, runs tests, and sees what errors pop up.
- The Observation: The system watches what the Apprentice does.
- Scenario A: The Apprentice quickly finds a typo and fixes it. The system sees this and says, "Great! The Apprentice can handle this. Let's save money and let them finish."
- Scenario B: The Apprentice gets confused, runs into a wall, and can't figure out where the bug is. The system sees this struggle and says, "Okay, this is too hard. Stop the Apprentice and call the Master Engineer immediately."
- The Decision: A special "Value Head" (a smart judge) looks at the Apprentice's progress and decides: Is this easy enough for the Apprentice to finish, or do we need to escalate?
Why This is Better (The "Information" Advantage)
The paper argues that looking at the partial history (what happened during those first few steps) gives you much more information than just reading the original problem description.
- The Old Way: Like trying to guess if a movie is a comedy or a tragedy just by reading the title. You might be wrong.
- The New Way: Like watching the first 5 minutes of the movie. If you see people laughing, you know it's a comedy. If you see a funeral, you know it's a tragedy. You have more data, so your guess is better.
The paper proves mathematically that having this extra information (the "partial trajectory") never hurts your decision-making. It is always better to know a little bit of the story before deciding who to hire.
The Results
The researchers tested this on real-world coding tasks (fixing bugs in large software projects).
- Cost Savings: They saved a lot of money because the cheap Apprentice handled many tasks that used to be sent to the expensive Master.
- Success Rate: They didn't lose any quality. When the Apprentice failed, they switched to the Master, so the tasks still got fixed.
- Surprise Bonus: In some cases, the Apprentice actually solved problems that the Master would have failed to solve if it had been called immediately. This is because the Apprentice's "exploration" helped clarify the problem in a way the Master's direct approach didn't.
Summary
SWE-Router is a smart traffic cop for software repair. Instead of sending every car to the most expensive mechanic, it lets a cheap mechanic do a quick diagnostic. If the mechanic can fix it, great! If not, they call the expert. This saves money without sacrificing quality, and it works because it learns from the process of trying to fix the problem, not just the problem description itself.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.