Summary (Overview)

  • LLMRouter is a unified infrastructure for developing, evaluating, and deploying LLM routers, addressing the lack of standardized foundations in the field by providing a common formulation, automated evaluation pipeline, and open-source library.
  • The paper introduces a unified formulation of LLM routing as a sequential decision process characterized by five components: context encoders, model encoders, scoring functions, decision rules, and learning signals, organizing existing methods into three families (single-turn, multi-turn, and personalized routing).
  • xRouteBench is a new multi-scenario benchmark spanning generic LLM tasks, memory-augmented, vision (image and video), time-series, and personalized routing scenarios, comprising 4,767 instances evaluated under a unified cost-aware protocol.
  • Key empirical findings: (i) no single router dominates across all tasks; (ii) learned routers achieve a 14.6% relative improvement over the strongest fixed-model baseline; (iii) multi-turn routing does not consistently outperform single-turn routing; (iv) personalization pays off but only when user context is modeled well.
  • The library implements more than 16 representative routers spanning all three families, with deployment support for real users via OpenClaw (Slack/Discord) and multi-agent systems.

Introduction and Theoretical Foundation

The paper addresses a critical problem in the LLM ecosystem: no single large language model is optimal across all queries and budget constraints, making model routing essential for cost-effective deployment. The authors identify two key obstacles hindering progress:

  1. Diverse formalisms and incompatible implementations — existing routers (binary quality predictors, cost-aware cascades, graph-based routers, agentic routers) are developed under distinct formalisms with incompatible interfaces, making it difficult to isolate design elements that drive performance.
  2. Lack of standardized evaluation pipeline — evaluating a router requires running every candidate model on every benchmark query and scoring each response, which is substantially more demanding than evaluating a single model.

The theoretical foundation is a unified formulation of routing as a sequential decision process. At step tt, the router observes a state st=(q,u,ht)s_t = (q, u, h_t) consisting of the query qq, optional user context uu, and interaction history hth_t, and takes an action atM{}a_t \in \mathcal{M} \cup \{\perp\}. The goal is to find an optimal policy:

π=argmaxπEq,τπ[perf(yq)λc(τ)],(1)\pi^{\star} = \arg \max_{\pi} \mathbb{E}_{q,\tau \sim \pi} \left[ \operatorname{perf}(y \mid q) - \lambda \cdot c(\tau) \right],\tag{1}

where perf(yq)\operatorname{perf}(y \mid q) aggregates task-specific quality metrics, c(τ)c(\tau) sums the monetary/token cost of every call in the routing trajectory, and λ0\lambda \geqslant 0 controls the performance–cost trade-off.

Methodology

Unified Formulation Components

A router is characterized by five components:

  1. Context encoder (EqE_q): Maps routing state to a representation. Two forms:

    • Embedding-based: state as a vector (e.g., kNN-style routers use off-the-shelf sentence embeddings; discriminative routers train lightweight encoders)
    • Text-based: state kept in natural language (e.g., cascades append draft responses; fine-tuned LM routers verbalize the state in the prompt)
  2. Model encoder (EmE_m): Encodes each candidate model via:

    • Static metadata (model size, capability description, pricing)
    • Historical profiles (past behavior, Elo ratings, latent factors)
    • Learned embeddings (jointly trained with context encoder)
    • Verbalized description (named directly in prompt)
  3. Scoring function (gg): Measures compatibility between encoded state and each candidate (embedding similarity, bilinear products, classification heads, message passing over graphs, next-token logits).

  4. Decision rule (dd): Converts scores to actions (greedy arg max, cost-aware thresholds, accept/escalate in cascades, sampling for exploration).

  5. Learning signal (L\mathcal{L}): Fits components toward the optimal policy (non-parametric, supervised pointwise, preference-based pairwise, or trajectory-level RL rewards).

Three Router Families

FamilyState ssEncoders Eq,EmE_q, E_mRouting action (scoring gg, decision dd)Learning signal L\mathcal{L}
Single-turn(q)(q)Eq(q),Em(m)E_q(q), E_m(m)a=argmaxmMg(Eq(q),Em(m))a = \arg \max_{m \in \mathcal{M}} g(E_q(q), E_m(m))fit gg to per-candidate reward perf(ymq)λcm\text{perf}(y_m \mid q) - \lambda c_m
Multi-turn(q,ht)(q, h_t)Eq(q,ht),Em(m)E_q(q, h_t), E_m(m)atd({g(Eq(q,ht),Em(m))}m)a_t \sim d(\{g(E_q(q, h_t), E_m(m))\}_m)maximize episode return Eτ[perf(yq)λc(τ)]\mathbb{E}_\tau[\text{perf}(y \mid q) - \lambda c(\tau)]
Personalized(q,u,ht)(q, u, h_t)Eq(q,u,ht),Em(m)E_q(q, u, h_t), E_m(m)a=argmaxmMg(Eq(q,u,ht),Em(m))a = \arg \max_{m \in \mathcal{M}} g(E_q(q, u, h_t), E_m(m))fit gg to comparisons m+>umm^+ >_u m^- observing perfu\text{perf}_u

Automated Pipeline

LLMRouter automates supervision construction and evaluation via three stages:

  1. Query Curation: queries sampled from source benchmarks, normalized into a unified schema, split into train/test
  2. Response Collection: each query dispatched to every candidate in the pool (18 models, 7B–671B parameters)
  3. Metric Scoring and Pricing: every response scored with task metrics and priced from token counts

xRouteBench Design

All tasks share a common query schema, supervision format, and evaluation protocol. Non-text assets are converted to self-contained textual queries with optional pointers to source images/videos/time series, separating routing from perception.

Empirical Validation / Results

Main Results (Performance-First Setting, (α,β)=(1.0,0.0)(\alpha, \beta) = (1.0, 0.0))

RouterGeneric LLM TasksLoCoMoLongMemEvalGeometry3KMathVistaVideoTimeSeriesAvg
Smallest-LLM57.5525.4436.7727.8735.0033.3349.6137.94
Largest-LLM70.2926.5935.5737.7033.0022.2245.6738.72
kNNRouter71.3725.2438.7431.1541.0029.6351.9741.30
SVMRouter74.2127.6438.6842.6247.0029.6355.9145.10
MLPRouter68.1226.7832.2727.8734.0029.6356.6939.34
EloRouter64.1525.7037.2745.9050.0025.9363.7844.68
GraphRouter80.5425.9433.9342.6250.0022.2262.9945.46
RouterDC80.5624.9336.7716.3924.0025.9345.6736.32
Router-R135.6424.6017.2814.7518.0022.2223.6222.30

Personalized Track Results

RouterAcc.RouterAcc.
GMTRouter68.78RouterDC56.44
PersonalizedRouter67.86MFRouter54.39
EloRouter66.40MLPRouter52.93
GraphRouter65.23kNNRouter51.76
SVMRouter65.08CausalLM46.78
Largest-LLM58.05Router-R145.46
Hybrid LLM57.91Smallest-LLM42.53

Real-User Deployment Results

RouterAcc.RouterAcc.
PersonalizedRouter83.05RouterDC65.25
EloRouter82.20kNNRouter60.17
MLPRouter78.81kNN-MultiRound60.17
SVMRouter77.12Smallest-LLM55.08
Hybrid LLM73.73MFRouter51.69
GMTRouter70.70Largest-LLM41.53
GraphRouter67.17CausalLM27.97

Multi-Agent System Results

RouterStarTreeGraphChainPlan-Exec-SumAvg
Largest-LLM69.0067.0077.2069.0075.2071.48
kNNRouter74.8078.6078.6076.6071.8076.08
SVMRouter76.2075.6080.0074.4075.2076.28
MLPRouter75.4076.6076.8078.0071.4075.64
MFRouter75.4074.2081.0078.6073.2076.48
EloRouter73.8072.4078.6076.6075.2075.32
GraphRouter68.2070.8066.2072.0069.0069.24
RouterDC77.6079.6074.2072.0076.2075.92

Key Findings

  1. No single router dominates: The best router varies across tasks and cost budgets; strong average performance reflects consistency rather than dominance.
  2. Learned routing beats fixed-model baselines: Learned routers achieve a 14.6% relative improvement over the strongest fixed-model baseline, as always selecting the largest model incurs the highest cost yet delivers only mediocre performance.
  3. Multi-turn routing does not consistently outperform single-turn: Additional rounds of decomposition and aggregation often add cost and redundant information; performance hinges on the capability of the base model.
  4. Personalization pays off but depends on modeling: GMTRouter ranks first under persona judge (68.78), while PersonalizedRouter leads on real human preferences (83.05), showing the two settings favor different designs.
  5. Router rankings reverse under tighter cost constraints: MLPRouter sits near the bottom under quality-first settings but becomes the best choice for every β0.4\beta \geqslant 0.4 in Vision.

Theoretical and Practical Implications

Theoretical Contributions

  • Provides a unified formulation that reconciles seemingly incompatible router designs (binary predictors, cascades, graph-based, agentic, personalized) under a single sequential decision process framework.
  • Establishes a standardized evaluation protocol that jointly measures response quality and inference cost, enabling fair comparison across router families.
  • The formulation reveals that the three router families differ only in which portion of the state the context encoder reads, enabling component-level ablations and cross-family transfer.

Practical Implications

  • Reduced implementation burden: Adding a new router requires only implementing a routing method and a loss function; data construction, training, inference, and evaluation apply unchanged.
  • Configuration-driven experimentation: Swapping routers, candidate pools, or training objectives requires only a configuration change rather than reimplementation.
  • Deployment readiness: Routers can be exposed as OpenAI-compatible servers for messaging platforms (Slack, Discord via OpenClaw) or through ComfyUI-based visual interfaces for code-free prototyping.
  • Multi-agent system routing: Treating model choice as a per-agent decision improves performance across five coordination topologies (Star, Tree, Graph, Chain, Plan-Exec-Sum), with six of seven learned routers beating always selecting the largest model.

Conclusion

LLMRouter provides a unified foundation for LLM routing by casting single-turn, multi-turn, and personalized routing as instances of a common sequential decision process. The system includes:

  • An automatic pipeline for constructing routing supervision and evaluation for new tasks and candidate pools
  • xRouteBench, a multi-scenario benchmark spanning five tracks under one protocol
  • An open-source library implementing more than 16 routers behind a unified interface with deployment support

Key takeaways and future directions:

  • The empirical study reveals that router rankings are highly sensitive to cost constraints, suggesting practitioners should select routers matching their deployment's performance–cost requirements.
  • Multi-turn routing needs better sufficiency estimation, early stopping, and more effective decomposition and aggregation to justify its additional computational overhead.
  • Personalized routing should be validated against real user feedback, as simulated persona judges and real human preferences favor different designs.
  • The framework enables future work on component-level ablations and cross-family router designs that were previously difficult to explore due to incompatible implementations.

Related papers