用探索轨迹判断是否升级模型,省钱又不丢性能。
SWE-Router: Routing in Multi-turn Agentic Software Engineering Tasks

- 让便宜模型先试几轮,看执行轨迹再决定是否换强模型。
- 在多个模型组合上,成本降低超60%且性能损失小于5%。
- 适合追求性价比的软件工程自动化团队使用。
嵌入多轮智能体的大语言模型正在重塑软件工程,但将每个任务都交给前沿模型效率低下,因许多问题其实只需简单修复。现有路由机制仅依赖任务描述,存在信息论上的贝叶斯误差下限:相似问题可能只是拼写错误或需跨模块重构,提示词无法区分。我们提出SWE-Router,一种基于价值的时间序列路由方法,让廉价模型先执行若干探索性步骤,分析其部分执行轨迹后再决定继续使用廉价模型或升级至昂贵模型。我们证明了该策略贝叶斯最优,只要探索有信息量,条件化轨迹就一定优于不依赖轨迹的决策。在覆盖当前成本-能力前沿的多组弱-强模型对中,SWE-Router显著提升软件工程任务的成本效率,同时保持强模型约95%的性能。我们还发布了多模型轨迹数据集,支持轨迹级路由的复现。
原文摘要 · Abstract (English)
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 operate on the task description alone, which inherits an information-theoretic Bayes-error floor in agentic settings: a similar issue can hide either a localized typo or a multi-module refactor, and the prompt does not separate the two. We introduce SWE-Router, a value-based temporal approach that lets a cheap model run for a few exploratory turns and reads the resulting partial trajectory before deciding whether to continue cheaply or to escalate to an expensive model. We provide a Bayes-optimality theorem showing that conditioning on the partial trajectory never harms routing and is strictly better whenever exploration is informative. Across the LLM pairs of weak and strong models spanning the contemporary cost--capability frontier, we show that SWE-Router greatly improves the cost efficiency of SWE tasks, while maintaining the majority of the performances of the stronger model. We additionally release a multi-LLM trajectory dataset which allows reproduction of our trajectory-level routing.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。