LLMRouter: Unified Infrastructure for Developing, Evaluating, and Deploying LLM Routers

Tao Feng, Fangxu Yu, Haozhen Zhang, Zhongjie Dai, Liangqi Yuan, Zijie Lei, Weizhi Zhang, Kunlun Zhu, Haodong Yue, Keyang Xuan, Ge Liu, Jiaxuan You

A unified infrastructure for developing, evaluating, and deploying LLM routers across diverse tasks and cost constraints.

How can we unify the fragmented landscape of LLM routing methods into a single, evaluatable infrastructure?

Researchers currently struggle to compare LLM routers because each method uses incompatible codebases, distinct formalisms, and isolated evaluation protocols that make it impossible to isolate which design choices actually drive performance. LLMRouter solves this by formulating all routing as a sequential decision process, providing a standardized library where any router is defined by five modular components—context encoders, model encoders, scoring functions, decision rules, and learning signals—that operate on a shared data pipeline. This infrastructure enables direct comparison on xRouteBench, revealing that learned routers consistently outperform fixed-model baselines by selecting smaller, cheaper models for queries that do not require frontier-scale compute.

Paper Primer

The core mechanism hinges on a unified MetaRouter interface that abstracts away the internal logic of diverse routing families. Whether a router uses nearest-neighbor retrieval or autoregressive decoding, the system treats it as a single decision-making agent that maps a state—comprising the query, user context, and interaction history—to a specific model dispatch action.

Learned routing policies provide superior performance-to-cost efficiency compared to fixed-model baselines.

Learned routers identify queries that smaller, cheaper models can solve correctly, avoiding the high cost of always defaulting to the largest available model. 14.6% relative improvement over the strongest fixed-model baseline.

The system automates the construction of routing supervision through a three-stage pipeline: query curation, response collection across a pool of 18 candidate models, and metric scoring. This creates a dense query-model matrix that serves as both the training supervision and the test bed, allowing researchers to swap candidate pools or tasks via simple configuration changes.

Why does the field need a unified formulation for routing?

Existing routers are developed under distinct, incompatible formalisms, making it impossible to determine if performance gains stem from the routing method itself or from differences in the underlying experimental stack.

Does multi-turn routing consistently outperform single-turn routing?

No. The authors find that additional rounds of decomposition and aggregation often introduce redundant information and computational overhead without providing consistent gains over a single, well-chosen routing decision.

The Need for Unified Routing

We expose the fragmented state of LLM routing and motivate a unified decision‑process formulation.

Large language models vary widely in cost and capability, so no single model can serve every query efficiently. Current routing approaches—binary quality predictors, cost‑aware cascades, graph‑based, and agentic routers—are built on disparate formalisms and incompatible codebases, and there is no shared evaluation pipeline to compare them fairly.

Because routing methods are scattered across incompatible architectures, researchers cannot isolate which design choices truly drive performance or reuse components across studies.

**Figure 1.** Overview of LLM routing. Routing is driven by three needs (left), namely cost efficiency, capability matching, and user preference. Our unified formulation (right) casts all of them as one decision process: a context encoder $E_q$ represents the routing state of query, persona, and interaction history, a model encoder $E_m$ represents each candidate, and the router dispatches the query or its sub-queries to selected models and aggregates their responses into the answer. The single-turn, multi-turn, and personalized families differ only in which part of the state they observe.

The field’s current fragmentation of routing approaches hinders reproducibility and fair comparison.

Routing as a Decision Process

We recast all router designs as a step‑by‑step decision process.

Existing routers appear in many incompatible forms—binary selectors, cost‑aware cascades, graph‑based policies, and RL‑trained agents—making systematic evaluation difficult.

Routing is treated as a policy that repeatedly looks at the current query, optional user context, and the answers gathered so far, then either calls another model or stops.

How does this sequential decision process differ from a single‑turn router?

A single‑turn router makes one dispatch and immediately returns a result; the sequential process can call multiple models, updating the history after each call, and uses that history to inform later decisions, enabling adaptive multi‑turn interaction.

Step 1: $h_1 = \varnothing \cup y_1 = \{y_1\}$.

Step 2: New state $s_2=(q,\varnothing,h_1)$ is encoded; $m_1$ now scores higher because $h_1$ matches its expertise, so $a_2=m_1$ is dispatched.

Step 2 response $y_2$ is appended: $h_2 = h_1 \cup y_2$.

Since $T=2$ the terminating action $a_3=K$ is taken, aggregating $y_1$ and $y_2$ into the final answer $y$.

The process can adapt its next choice based on the content of earlier responses, something a one‑shot router cannot do.

**Table.** Comparison of different routing families.

Evaluating Routing Performance

Benchmark design quantifies router quality versus cost across diverse tasks.

GraphRouter achieves the highest average benchmark score across all tracks.

Average score 45.46, beating the second‑best method by 2.1 points.

xRouteBench is a unified benchmark that evaluates LLM routers on diverse scenarios while jointly measuring answer quality and inference cost.

The Performance‑Cost Objective collapses a router’s answer quality and its inference cost into a single scalar, letting users trade accuracy for efficiency.

How does the Performance‑Cost Objective differ from a plain accuracy metric?

Accuracy alone ignores the computational expense of generating an answer. $R$ subtracts a cost term, so a router that achieves the same accuracy but uses fewer tokens receives a higher score, enabling explicit trade‑offs between quality and efficiency.

**Figure 2.** Task composition of xRouteBench. The benchmark covers generic LLM tasks, memory, vision, time-series, and personalized routing, with percentages indicating the proportion of test queries contributed by each dataset.

**Table 1.** Evaluation Protocol. We score each router by a weighted reward $\alpha \cdot \text{perf} - \beta \cdot \text{cost}$. We sweep five weight settings from the quality-only $(\alpha, \beta) = (1.0, 0.0)$ to the heavily cost-weighted $(0.2, 0.8)$. Multi-round and RL-based routers cannot optimize this weighted objective and are therefore run once under a single configuration. On the personalized track, answers are scored by a persona-conditioned LLM judge (DeepSeek-V3.1) as win, tie, or loss (1, 0.5, 0), and the judge's own cost is excluded from the reported cost.

Balancing answer quality against inference cost is essential for realistic LLM routing evaluation.

The LLMRouter Library

LLMRouter Library provides a modular, plug‑and‑play system that unifies routing components into a single API.

The LLMRouter library stitches together data construction, routing logic, training, inference, evaluation, and deployment into a single, interchangeable framework. By exposing only five router components to the user, it turns what used to be a fragmented ecosystem into a plug‑and‑play experience.

Think of the library as a universal socket: any routing strategy can be plugged in, while the surrounding wiring automatically supplies power, handles the plug‑in’s wiring, and routes the output to the device.

Step 1: The matrix is filled with per‑token prices: [[0.5, 0.8, 1.2], [0.5, 0.8, 1.2]].

Step 2: A router (e.g., kNNRouter) encodes each query with $E_q$, each model with $E_m$, computes scores via $g$, and selects the highest‑scoring model $d$ for each row.

Step 3: For Q₁ the router picks M₂, for Q₂ it picks M₁; the resulting actions are stored in the query dictionaries.

Step 4: The Route Engine dispatches Q₁ to M₂ and Q₂ to M₁, collects the responses, and returns the final answers.

This toy example shows that swapping the router class changes only the scoring step; the surrounding Data Engine, Route Engine, and Deployment remain untouched.

How does the LLMRouter library differ from ad‑hoc router scripts that people usually write?

Ad‑hoc scripts embed data loading, scoring, and inference logic together, so changing the routing rule forces a rewrite of the whole pipeline. LLMRouter separates those concerns: the Data Engine, Route Engine, and Evaluation are fixed, and only the four router components ($E_q$, $E_m$, $g$, $d$) need to be reimplemented, making experimentation a one‑line subclass change.

**Figure 3.** Architecture of LLMRouter. The system consists of six modules that support routing data construction, router implementation and training, inference, evaluation, and deployment.

Defining a custom router and its trainer using the LLMRouter library.

Experimental Results

Key results reveal how router performance shifts with cost sensitivity.

The unified LLM Router premise treats routing as a sequential decision process, enabling consistent evaluation. This section now shows how different routers actually perform.

Smallest‑LLM attains the highest average xRouteBench score (80.54) under the performance‑first setting.

Table 2 reports Smallest‑LLM with an average of 80.54, surpassing every other router.

**Figure 5.** Router rankings across the Generic LLM Tasks, memory, vision, and time-series tracks as the cost weight $\beta$ increases. Each cell gives a router's rank under the weighted performance–cost objective, with smaller rank values indicating better performance.

**Figure 6.** Performance–cost trade-offs of routers averaged across the xRouteBench tracks. Each point represents an operating setting with a different cost weight $\beta$, where higher performance and lower per-query inference cost are preferred.

**Table 1.** Comparison of different router methods based on accuracy.

Performance trade‑offs vary markedly with the cost weight $β$, so selecting a router requires matching $β$ to deployment constraints.

Deployment and Multi-Agent Systems

Recall that LLM routing is unified as a sequential decision process, enabling standardized evaluation and deployment.

Routing in deployment moves beyond static benchmarks, exposing routers to live user feedback and multi‑agent coordination.

Real‑user routing uses the OpenClaw server to serve LLMRouter behind Slack, collecting 234 pairwise preference records from fifteen users across 40 sessions.

The table compares the accuracy (Acc.) of various router models.

When the same routers are evaluated on the Slack deployment, GMTRouter, which excelled under persona‑based judging, drops to sixth place, highlighting the gap between simulated and real feedback.

Multi‑agent routing treats each agent node as a separate decision point, selecting the most suitable LLM for its prompt across five coordination topologies.

**Table 4.**

**Figure 7.** Representative multi-agent system architectures and coordination topologies: (a) star-based centralized coordination, (b) hierarchical tree-based delegation, (c) graph-based peer interaction, (d) sequential chain collaboration, and (e) planner–executor–summarizer workflow.

Questions & answers

What is the main contribution of LLMRouter?

LLMRouter introduces a unified infrastructure that formalizes all LLM routing as a sequential decision process and provides a standardized library where any router is defined by five modular components—context encoders, model encoders, scoring functions, decision rules, and learning signals—operating on a shared data pipeline, enabling fair cross-method comparison.

What problem does LLMRouter address?

LLMRouter addresses the fragmentation of LLM routing research, where each method uses incompatible codebases, distinct formalisms, and isolated evaluation protocols, making it impossible to determine whether performance gains stem from the routing method itself or from differences in the underlying experimental stack.

Why does the field need a unified formulation for LLM routing?

Existing routers are developed under distinct, incompatible formalisms, making it impossible to isolate which design choices actually drive performance, hindering reproducibility and fair comparison across routing approaches.

How does LLMRouter formalize routing technically?

LLMRouter treats routing as a sequential decision process through a unified MetaRouter interface that maps a state—comprising the query, user context, and interaction history—to a specific model dispatch action, abstracting away the internal logic of diverse routing families such as nearest-neighbor retrieval or autoregressive decoding.

What are the five modular components that define a router in LLMRouter?

A router in LLMRouter is defined by context encoders (Eq), model encoders (Em), scoring functions (g), decision rules (d), and learning signals, all of which operate on a shared data pipeline and can be reimplemented independently without rewriting the rest of the framework.

How does LLMRouter differ from ad-hoc router scripts?

Ad-hoc scripts embed data loading, scoring, and inference logic together so that changing the routing rule forces a rewrite of the whole pipeline, whereas LLMRouter separates those concerns into a fixed Data Engine, Route Engine, and Evaluation layer, requiring only a one-line subclass change to swap router components.

What is xRouteBench and how is it constructed?

xRouteBench is the benchmark used to evaluate routers within LLMRouter; it is constructed through a three-stage pipeline of query curation, response collection across a pool of 18 candidate models, and metric scoring, producing a dense query-model matrix that serves as both training supervision and a test bed.

What are the key experimental findings regarding learned versus fixed-model routers?

On xRouteBench, learned routers consistently outperform fixed-model baselines by selecting smaller, cheaper models for queries that do not require frontier-scale compute, demonstrating that routing intelligence translates to measurable efficiency gains.

How does the Performance-Cost Objective differ from plain accuracy?

The Performance-Cost Objective R subtracts a cost term from accuracy, so a router that achieves the same accuracy but uses fewer tokens receives a higher score, enabling explicit trade-offs between answer quality and inference efficiency rather than rewarding raw correctness alone.

Does multi-turn routing consistently outperform single-turn routing?

No. The authors find that additional rounds of decomposition and aggregation often introduce redundant information and computational overhead without providing consistent gains over a single, well-chosen routing decision.

How does LLMRouter handle real-world deployment evaluation?

LLMRouter uses an OpenClaw server to serve routers behind Slack, collecting 234 pairwise preference records from fifteen users across 40 sessions, providing real-user feedback that complements static benchmark evaluation.

What discrepancy was found between simulated and real deployment evaluation?

GMTRouter, which excelled under persona-based (simulated) judging, dropped to sixth place when evaluated on the Slack deployment, highlighting a significant gap between simulated and real user feedback in routing evaluation.

How does LLMRouter support multi-agent systems?

LLMRouter extends routing to multi-agent settings by treating each agent node as a separate decision point that selects the most suitable LLM for its prompt, evaluated across five coordination topologies.

How does the cost weight β affect router selection?

Performance trade-offs vary markedly with the cost weight β, so selecting a router requires matching β to deployment constraints; a higher β penalizes expensive models more heavily, shifting preference toward cheaper routing decisions.

How does a sequential decision process differ from a single-turn router?

A single-turn router makes one dispatch and immediately returns a result, whereas the sequential process can call multiple models, updating the interaction history after each call and using that history to inform later decisions, enabling adaptive multi-turn interaction.

What types of routing approaches does LLMRouter unify?

LLMRouter unifies binary quality predictors, cost-aware cascades, graph-based routers, and agentic (RL-trained) routers under a single sequential decision-process formalism and shared evaluation pipeline.

What venue, authors, or date are associated with this paper?

The paper does not specify author names, publication venue, or submission date in the provided text; it is available at arxiv.org/abs/2608.06867.

Key terms

LLM Router
A system that selects which large language model to use for a given query, balancing answer quality against computational cost.
MetaRouter
The unified interface in LLMRouter that abstracts the internal logic of any routing method, treating it as a single agent mapping a state to a model dispatch action.
Sequential decision process
A formalization of routing where a system can call multiple models in sequence, updating its history after each call to inform subsequent decisions.
xRouteBench
The standardized benchmark introduced alongside LLMRouter, built from a dense query-model performance matrix across 18 candidate models, used for training and evaluating routers.
Context encoder (Eq)
A modular router component responsible for encoding the input query and user context into a representation usable by the routing logic.
Model encoder (Em)
A modular router component that encodes information about candidate LLMs so the router can reason about their relative capabilities.
Scoring function (g)
A modular router component that computes a score for each candidate model given the encoded query and model representations.
Decision rule (d)
A modular router component that converts model scores into a final dispatch action, selecting which model to call.
Learning signal
The fifth modular router component that provides supervision or reward information used to train or update the router's parameters.
Performance-Cost Objective (R)
An evaluation metric that subtracts a cost term (weighted by β) from accuracy, rewarding routers that achieve high quality while using fewer computational resources.
Cost weight (β)
A scalar hyperparameter in the Performance-Cost Objective that controls how heavily inference cost is penalized relative to answer quality.
Data Engine
The LLMRouter subsystem responsible for query curation, response collection, and metric scoring to construct the routing supervision matrix.
Route Engine
The LLMRouter subsystem that executes routing logic at inference time, dispatching queries to selected models based on the configured router components.
OpenClaw server
The serving infrastructure used in LLMRouter's deployment experiments to expose routers to real users via a Slack interface.
Binary quality predictor
A routing approach that classifies whether a given model will produce a satisfactory answer for a query, used as a dispatch criterion.
Cost-aware cascade
A routing strategy that queries models in order of increasing cost, stopping when a sufficiently good answer is obtained.
Agentic router
A routing approach trained with reinforcement learning that treats model selection as a policy optimization problem over sequences of interactions.
Query-model matrix
A dense table recording the performance of each candidate model on each query, used as both training supervision and evaluation data in xRouteBench.

Read the original paper

Open the simplified reader on Paperglide

Browse all simplified papers