RouteWeaver improves accuracy by smartly mixing language model uses

RouteWeaver: Weaving Mode Selection and Execution into Unified LLM Routing

Computation and Language

Summary

Choosing how to use different language models for various tasks is tricky because there are different ways to combine and run them. The authors created RouteWeaver, a system that learns to pick the best way to use these models depending on the task, all within one approach. They designed a training method that helps the system learn first how to use each way, then when to switch between them. Tested on tasks like math, coding, and reasoning, RouteWeaver performed better than previous methods, showing it can adaptively select the best strategy.

What this means in practice

  • For software engineers: Build AI assistants that dynamically combine multiple language models to improve task accuracy across diverse domains.
  • For data platform teams: Develop smarter pipelines that adaptively route queries to various language models for better resource use and answer quality.
  • For customer support teams: Integrate adaptive routing mechanisms to select optimized language models for faster and more accurate response generation.$Commercial implications: Enables advanced customer service bots that dynamically choose the best language model, improving reply quality and efficiency.

Authors

Xiaohan Wang, Haozhen Zhang, Qingyuan Liu, Tao Feng, Wenya Wang

Abstract

LLM routing dynamically selects and coordinates heterogeneous language models across diverse tasks. However, existing approaches are largely built around a predefined execution paradigm, such as single-round, multi-round, or agentic routing, which fixes how model calls are organized and limits adaptation to different query needs. We propose RouteWeaver, a unified routing framework that integrates these routing modes within a single LLM policy, jointly learning which mode to use and how to select models within that mode. To jointly optimize mode selection and within-mode execution, we develop COMET-GRPO (COordinated Mode-Execution Training), which decouples the trajectory-level advantage into separate signals for mode selection and within-mode execution, enabling more targeted credit assignment to each decision level. We further introduce progressive exploration, which gradually shifts training from externally assigned modes to autonomous selection, so that the router first learns how to execute each mode before deciding when to use it. We evaluate RouteWeaver across mathematics, coding, knowledge, logical reasoning, and factual recall. RouteWeaver achieves an average accuracy of 61.4%, an 11.03% relative improvement over the strongest baseline, and outperforms all compared baselines in each of the five domains. Ablations show that both COMET-GRPO and progressive exploration are important for adaptive routing; without progressive exploration, the routing policy collapses entirely to single-round execution.