SWE-Router Optimizes LLM Cost for Agentic Software Tasks

Seongho Son, Sangwoong Yoon, Jiahua Tang, Shuhan Wang, Lorenz Wolf, Ilija Bogunovic· July 2, 2026 View original

Summary

This paper introduces SWE-Router, a value-based temporal approach for multi-turn agentic software engineering tasks that routes issues to either cheap or expensive LLMs based on partial trajectories. It significantly improves cost efficiency while maintaining performance by conditioning routing decisions on early exploratory turns.

Multi-turn agentic Large Language Model (LLM) systems are transforming software engineering, but routing every task to the most powerful (and expensive) frontier models can be inefficient. Existing LLM routers typically make decisions based solely on the initial task description, which often lacks the nuance to distinguish between simple fixes and complex refactors. Researchers have developed SWE-Router, a novel value-based temporal routing approach. Instead of making an upfront decision, SWE-Router allows a less expensive LLM to run for a few exploratory turns. By analyzing the resulting partial trajectory, the system can then decide whether to continue with the cheaper model or escalate the task to a more capable, expensive model if the problem proves more complex. A Bayes-optimality theorem supports that conditioning on partial trajectories never harms routing and is strictly better when exploration provides informative signals. Across various weak and strong LLM pairs, SWE-Router demonstrated significant improvements in cost efficiency for software engineering tasks, while largely preserving the performance levels of the stronger, more expensive models. The researchers also released a multi-LLM trajectory dataset to facilitate reproduction and further research.

Why it matters

For organizations leveraging LLMs in software development, managing computational costs while maximizing performance is critical. SWE-Router offers a practical strategy to optimize resource allocation, making AI-assisted software engineering more economically viable and scalable.

How to implement this in your domain

  1. 1Analyze current LLM usage in software development to identify tasks that could benefit from tiered routing.
  2. 2Implement a multi-LLM agentic system that incorporates a routing mechanism like SWE-Router to optimize cost.
  3. 3Develop metrics to evaluate the cost-performance trade-off of different routing strategies in your specific development environment.
  4. 4Train engineering teams on how to structure tasks for optimal routing and interpret outputs from different LLM tiers.

Who benefits

Software DevelopmentIT ServicesFinTechAutomotiveGaming

Key takeaways

  • Routing all software tasks to expensive LLMs is inefficient.
  • SWE-Router uses partial trajectories to decide between cheap and expensive LLMs.
  • This temporal approach significantly improves cost efficiency for agentic tasks.
  • It maintains strong performance while optimizing resource allocation.

Original post by Seongho Son, Sangwoong Yoon, Jiahua Tang, Shuhan Wang, Lorenz Wolf, Ilija Bogunovic

"arXiv:2607.00053v1 Announce Type: cross Abstract: Large language models (LLMs) embedded in multi-turn agentic harnesses are reshaping software engineering (SWE), but routing every task to a frontier model is wasteful when many issues admit cheap fixes. Existing LLM routers operat…"

View on X

Originally posted by Seongho Son, Sangwoong Yoon, Jiahua Tang, Shuhan Wang, Lorenz Wolf, Ilija Bogunovic on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses