RouteWeaver: Weaving Mode Selection and Execution into Unified LLM Routing
Organizations: Nanyang Technological University · Huazhong University of Science and Technology · University of Illinois Urbana-Champaign
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.
Figures & tables
| Method | Math | Code | Knowledge | Reason | Recall | Avg |
|---|---|---|---|---|---|---|
| Single-round Router | ||||||
| Router-KNN | 61.7 | 34.8 | 38.3 | 68.3 | 40.4 | 48.7 |
| Router-MLP | 58.7 | 33.2 | 40.0 | 59.2 | 34.2 | 45.1 |
| RouterDC | 61.3 | 29.4 | 34.2 | 57.5 | 35.0 | 43.5 |
| GraphRouter | 64.6 | 36.1 | 34.2 | 69.2 | 39.6 | 48.7 |
| Multi-round Router | ||||||
| Accuracy (%) | Mode usage | ||||||
|---|---|---|---|---|---|---|---|
| Variant | Math | Code | Knowledge | Reason | Recall | Avg | S / M / A |
| RouteWeaver | 74.6 | 58.2 | 55.0 | 76.7 | 42.5 | 61.4 | .35 / .41 / .24 |
| w/o COMET-GRPO | 72.3 | 57.2 | 49.2 | 74.1 | 41.2 | 58.8 | .13 / .82 / .05 |
| w/o progressive exploration | 70.2 | 48.6 | 50.3 | 68.3 | 40.4 | 55.6 | 1.00 / .00 / .00 |
| Method | AIME | GPQA-D | BBH | Avg |
|---|---|---|---|---|
| GraphRouter (single-round) | 23.5 | 49.5 | 24.7 | 32.6 |
| Router-R1 (multi-round) | 45.6 | 62.1 | 28.6 | 45.4 |
| MasRouter (agentic) | 28.1 | 43.8 | 28.2 | 33.4 |
| RouteWeaver | 57.0 | 69.2 | 35.0 | 53.7 |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Element | Illustrative form | Produced by |
|---|---|---|
| Mode selection | <mode>agentic</mode> | Router |
| Worker call | <route model="worker_2" role="verifier" refs="n1"> Check the proposed solution.</route> | Router |
| Returned output | <observation id="n2">…</observation> | Environment |
| Final response | <answer>…</answer> | Router |
| Domain | Dataset | #Queries | Per batch |
|---|---|---|---|
| Math | Omni-MATH | 700 | 7 |
| Code | APPS, LiveCodeBench | 400, 300 | 4, 3 |
| Knowledge | SuperGPQA | 600 | 6 |
| Reason | SATBench | 700 | 7 |
| Recall | TriviaQA, PopQA ( Mallen et al., 2023 ) | 200, 300 | 5 |
| Total | 3,200 | 32 |
| ID | Model | Capability description in the router prompt |
|---|---|---|
| worker_1 | Qwen3-8B | Dense language model with 8.2B parameters. Supports multilingual instruction following, dialogue, mathematical and logical reasoning, and code generation. |
| worker_2 | Llama-3.1-8B-Instruct | Dense language model with 8B parameters. Instruction-tuned for multilingual dialogue, with capabilities in general reasoning, text generation, and coding. |
| worker_3 | Qwen3-30B-A3B-Instruct-2507 | Mixture-of-experts language model with 30.5B total and 3.3B active parameters. Supports instruction following, text comprehension, logical reasoning, mathematics, science, and coding. |
| worker_4 | Gemma-3-27B-IT | Dense language model in the 27B parameter class. Supports multilingual question answering, summarization, reasoning, mathematical problem solving, and code generation. |
| worker_5 | Llama-3.3-70B-Instruct | Dense language model with 70B parameters. Instruction-tuned for multilingual dialogue, with capabilities in reasoning, instruction following, and text and code generation. |
| worker_6 | Gemini-2.5-Flash-Lite | Sparse mixture-of-experts model with undisclosed parameter counts. Supports translation, classification, information extraction, coding, mathematics, and reasoning. |
| ID | Model | Input | Output |
|---|---|---|---|
| worker_1 | Qwen3-8B | 0.020 | 0.050 |
| worker_2 | Llama-3.1-8B-Instruct | 0.020 | 0.050 |
| worker_3 | Qwen3-30B-A3B-Instruct-2507 | 0.100 | 0.300 |
| worker_4 | Gemma-3-27B-IT | 0.119 | 0.200 |
| worker_5 | Llama-3.3-70B-Instruct | 0.100 | 0.320 |
| worker_6 | Gemini-2.5-Flash-Lite | 0.100 | 0.400 |
LLM Routing
Large language model routing selects models, tools, experts, or inference strategies to balance answer quality, cost, latency, and deployment constraints.
See all 345 papers