Everything K-culture — comebacks to K-beauty, straight to your inboxGet it in your inbox

METAL MEDIA

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

arXiv:2608.068672026-08-06

A shared toolkit that lets researchers fairly compare AI systems that decide which language model should answer each question

Systems that route each query to the cheapest suitable large language model (LLM) have been built in incompatible ways, making them hard to compare. This paper unifies LLM routing into one framework with five components and builds an open benchmark (xRouteBench) and open-source infrastructure (LLMRouter) with more than 16 routers evaluated under the same protocol. Learned routers beat the strongest single fixed model by 14.6% on average, and lightweight routers become more competitive when cost budgets tighten.

METAL MEDIA explanatory visual

LLMRouter's unified pipeline from query to answer

Evidence statusMeasured results reported

  1. Routing state inputA query, optional user context, and the conversation history so far are combined into the state the router observes.
  2. Five components define any routerContext encoder, model encoder, scoring function, decision rule, and learning signal are the five interchangeable parts used to describe every router type.
  3. Automated data pipelineQueries are curated, sent to all 18 candidate models, and scored for both quality and token cost, producing a query-model matrix used for both training supervision and testing.
  4. xRouteBench evaluation across five tracksGeneric LLM tasks, memory, vision, time-series, and personalized tracks compare more than 16 routers on the same candidate pool and metrics, balancing performance against cost.
  5. Real-world deployment checksLive Slack user preference collection and five multi-agent collaboration topologies test whether benchmark results hold up outside simulation.
An explanatory diagram made by METAL MEDIA, not a figure supplied by the paper's authors.

What they did

  1. Existing LLM routers were built with incompatible formulations and codebases, making fair comparison hard; this work unifies routing as a sequential decision process defined by five components: context encoder, model encoder, scoring function, decision rule, and learning signal.
  2. Using this unified formulation, the authors built an automated pipeline that runs every candidate model on every benchmark query to construct routing supervision jointly scoring answer quality and inference cost, producing the xRouteBench benchmark (4,767 test instances across five tracks: generic LLM tasks, memory, vision, time-series, and personalized routing).
  3. They released LLMRouter, an open-source infrastructure implementing more than 16 representative routers behind one shared interface, supporting deployment as an OpenAI-compatible server on messaging platforms and a code-free ComfyUI visual interface.
  4. Across 18 candidate LLMs (7B to 671B parameters, from two API providers) and the five xRouteBench tracks, learned routers outperformed the strongest fixed-model baseline by 14.6% relatively, lightweight routers became more competitive under tight cost constraints, and user-conditioned (personalized) routing consistently improved matching to individual preferences.
  5. The team also tested routers on 234 real pairwise preference records from 15 Slack users and on five multi-agent collaboration topologies, finding that offline benchmark rankings did not always transfer to real users.
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 Eq represents the routing state of query, persona, and interaction history, a model encoder Em 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.
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 Eq represents the routing state of query, persona, and interaction history, a model encoder Em 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.
Table 1: Instantiation of the unified routing formulation for the three router families. For each family, the table specifies the routing state s, the context and model encoders Eq and Em, the routing action defined by the scoring function g and decision rule d, and the learning signal ℒ used to optimize response quality and inference cost.
FamilyState sEncoders Eq,EmRouting action (scoring g, decision d)Learning signal ℒ (surrogate of Eq. 1)
Single-turn(q)Eq​(q),Em​(m)a=arg⁡maxm∈ℳ⁡g⁡(Eq​(q),Em​(m))fit g to per-candidate reward perf⁡(ym∣q)−λ​cm
Multi-turn(q,ht)Eq​(q,ht),Em​(m)at∼d⁡({g⁡(Eq​(q,ht),Em​(m))}m)maximize episode return 𝔼τ​[perf⁡(y∣q)−λ​c​(τ)]
Personalized(q,u,ht)Eq​(q,u,ht),Em​(m)a=arg⁡maxm∈ℳ⁡g⁡(Eq​(q,u,ht),Em​(m))fit g to comparisons m+≻um− observing perfu
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.
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 2: Results on xRouteBench under the performance-first setting (α,β)=(1.0,0.0). Scores are reported across the Generic LLM Tasks, memory, vision, and time-series tracks, together with their average. Following the original implementations where applicable, all multi-turn routers use Qwen2.5-3B-Instruct as the base model. Top two results are highlighted in bold and underline.
RouterGeneric LLM TasksMemoryVisionTimeSeriesAvg
LoCoMoLongMemEvalGeometry3KMathVistaVideo
Rule-based baselines
Smallest-LLM57.5525.4436.7727.8735.0033.3349.6137.94
Largest-LLM70.2926.5935.5737.7033.0022.2245.6738.72
Single-turn routers
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
MFRouter67.2324.4934.9140.9829.0022.2251.9738.69
EloRouter64.1525.7037.2745.9050.0025.9363.7844.68
Hybrid LLM64.6825.8936.5632.7937.0033.3351.1840.20
RouterDC80.5624.9336.7716.3924.0025.9345.6736.32
GraphRouter80.5425.9433.9342.6250.0022.2262.9945.46
CausalLM66.9025.4037.6024.6034.0033.3345.7038.22
Multi-turn routers
Router-R135.6424.6017.2814.7518.0022.2223.6222.30
kNN-MultiRound13.9924.7018.3216.3930.0025.9333.0723.20
LLM-MultiRound12.9824.6017.4414.2931.0325.9330.3322.37
Figure 3: Architecture of LLMRouter. The system consists of six modules that support routing data construction, router implementation and training, inference, evaluation, and deployment.
Figure 3: Architecture of LLMRouter. The system consists of six modules that support routing data construction, router implementation and training, inference, evaluation, and deployment.
Table 3: Performance comparison on the personalized track. Top two results are highlighted in bold and underline.
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
Figure 5: Router rankings across the Generic LLM Tasks, memory, vision, and time-series tracks as the cost weight β increases. Each cell gives a router’s rank under the weighted performance–cost objective, with smaller rank values indicating better performance.
Figure 5: Router rankings across the Generic LLM Tasks, memory, vision, and time-series tracks as the cost weight β increases. Each cell gives a router’s rank under the weighted performance–cost objective, with smaller rank values indicating better performance.
Table 4: Router performance on held-out real-user sessions collected through the Slack deployment. Accuracy measures how often each router’s model selection agrees with the users’ pairwise preferences.
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
Figure 6: Performance–cost trade-offs of routers averaged across the xRouteBench tracks. Each point represents an operating setting with a different cost weight β, where higher performance and lower per-query inference cost are preferred.
Figure 6: Performance–cost trade-offs of routers averaged across the xRouteBench tracks. Each point represents an operating setting with a different cost weight β, where higher performance and lower per-query inference cost are preferred.
Table 5: Router performance on the Generic LLM Tasks test split when each node in a multi-agent system is routed independently. Results are reported across five coordination topologies, with the final column showing the average performance.
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
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.
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.
Table 6: The eight test sets of xRouteBench. Sizes are the number of test queries; metrics are exact match (EM), multiple-choice accuracy (MC), token-level F1, execution-based code pass rate, math answer matching, and a persona-conditioned LLM judge.
CategoryTest setContent#TestMetric
Generic LLM TasksGeneric mix13 subtasks3,729EM/MC/F1/GSM8K/MATH/code
MemoryLoCoMolong-conversation QA314F1
LongMemEvallong-term memory QA101F1
TimeSeriesTimeSeries7 reasoning skills127MC
VisionGeometry3Kgeometry math (image)61EM
MathVistavisual math reasoning100EM/MC
Charades-Egoegocentric video27EM
PersonalizedChatbot Arena / MT-Benchpreference prompts308LLM judge
Total4,767
Figure 8: One example from each dataset in the Visual Reasoning track, shown with the description that Gemma-3-27B-IT produces for its image. Geometry3K (a) provides a geometry diagram, and MathVista (b) provides a scientific figure. Each description is appended to the problem text to form the query the router sees.
Figure 8: One example from each dataset in the Visual Reasoning track, shown with the description that Gemma-3-27B-IT produces for its image. Geometry3K (a) provides a geometry diagram, and MathVista (b) provides a scientific figure. Each description is appended to the problem text to form the query the router sees.
Table 7: Composition of the Generic LLM Tasks track. The table lists the 13 subtasks, their target skills, and the number of test queries, totaling 3,729 examples.
SubtaskSkill#Test
MBPPcode generation500
MATHmathematical reasoning500
GSM8Kmathematical reasoning500
MMLU-Proknowledge QA500
OpenBookQAknowledge QA500
ARC-Challengeknowledge QA500
MMLUknowledge QA500
CommonsenseQAcommonsense QA50
BoolQcommonsense QA50
SQuADreading comprehension50
HellaSwagcommonsense QA50
HumanEvalcode generation16
AIME (2020–2024)competition math13
Figure 11: Slack interface for collecting pairwise user preferences. Two anonymized model responses are shown as Answer A and Answer B in randomized order, and users select A, B, or a tie for each interaction turn.
Figure 11: Slack interface for collecting pairwise user preferences. Two anonymized model responses are shown as Answer A and Answer B in randomized order, and users select A, B, or a tie for each interaction turn.
Table 8: Built-in routers in LLMRouter, grouped by routing family. For each method, the table summarizes the information available to the routing decision (State) and the rule used to select or aggregate candidate models (Selection).
RouterStateSelection
Rule-based baselines
Smallest-LLMcandidate parameter countsalways selects the smallest candidate
Largest-LLMcandidate parameter countsalways selects the largest candidate
Single-turn routers
kNNRouterquery embedding and nearby logged queriesvotes over the models preferred by nearest neighbors
SVMRouterquery embeddingkernel classifier predicts a candidate
MLPRouterquery embeddingMLP classifier predicts a candidate
MFRouterquery and model latent factorsranks candidates by their interaction score
EloRouterlogged pairwise model outcomesalways selects the highest-rated candidate
RouterDCquery and candidate representationscontrastive query–model matching score
Hybrid LLMquery embedding and a small/large model pairpredicts whether the small model is sufficient
AutoMixsmall-model draft and verification signalaccepts the draft or escalates to the large model
GraphRouterquery–model interaction graphpredicts performance on query–model edges
CausalLM Routertextual query and candidate listgenerates the selected model name
Multi-turn routers
Router-R1query and accumulated search resultsiteratively searches specialists or terminates and aggregates
kNN-MultiRoundsub-queries and their embeddingsroutes each sub-query with kNN and aggregates the answers
LLM-MultiRoundtextual query, decomposition, and candidate listan LLM chooses routes for sub-queries and aggregates
Personalized routers
GMTRouteruser, session, query, model, and response interactionspredicts user-conditioned model preference
PersonalizedRouteruser features, task description, query, and modelpredicts preference for a user–query pair
Figure 12: The ComfyUI interface of LLMRouter. The source benchmarks and the candidate pool enter at the left, the data-engine node produces the query–model matrix, and each router node consumes the matrix and reports its evaluation, so the graph traces the routing pipeline from data construction to evaluation. Each router node exposes the hyperparameters of its library configuration as typed widgets.
Figure 12: The ComfyUI interface of LLMRouter. The source benchmarks and the candidate pool enter at the left, the data-engine node produces the query–model matrix, and each router node consumes the matrix and reports its evaluation, so the graph traces the routing pipeline from data construction to evaluation. Each router node exposes the hyperparameters of its library configuration as typed widgets.
Table 9: The 18 candidate LLMs, sorted by blended average price. Prices in USD per 1M tokens.
#ModelParamsInputOutputService
1gemma-2-9b-it9B0.100.10NVIDIA
2llama-3-8b-instruct-lite8B0.100.10Together
3gpt-oss-20b20B0.050.20Together
4rnj-1-instruct15B0.150.15Together
5mistral-7b-instruct-v0.37B0.200.20NVIDIA
6mistral-small-3-24b-instruct24B0.100.30Together
7qwen2.5-7b-instruct7B0.200.20NVIDIA
8qwen2.5-7b-instruct-turbo7B0.300.30Together
9gpt-oss-120b120B0.150.60Together
10llama-4-maverick402B0.270.85Together
11mixtral-8x7b-instruct-v0.146.7B0.600.60NVIDIA
12qwen3-next-80b-a3b-instruct80B0.151.50Together
13qwen3-coder-next200B0.501.20Together
14llama-3.3-70b-instruct-turbo70B0.880.88Together
15llama3-70b-instruct70B0.900.90NVIDIA
16deepseek-v3.1671B0.601.70Together
17mixtral-8x22b-instruct-v0.1140.6B1.201.20NVIDIA
18cogito-v2-1-671b671B1.251.25Together
Table 10: The five multi-agent topologies, their structures, and the number of LLM calls per query.
TopologyStructureLLM calls
Starplanner decomposes → 3 actors in parallel → planner consolidates6
Treeroot planner → 2 sub-planners refine → 2 actors → root consolidates7
Graph3 actors answer independently → one full-communication revision round7
Chain3 agents relay sequentially, each verifying and improving the previous answer4
Plan-Exec-Sumplanner emits 3 atomic sub-queries → 3 executors → summarizer merges6

Findings

  • Across 18 candidate LLMs and the five xRouteBench tracks, learned routers achieved a 14.6% relative improvement in performance over the strongest fixed-model baseline.
  • No single router dominated every task: RouterDC performed best on Generic LLM Tasks and SVMRouter on LoCoMo, while GraphRouter had the best average but was not the top performer in every individual task.
  • Multi-turn routing did not consistently outperform single-turn routing, with performance sensitive to the capability of the base model (Qwen2.5-3B-Instruct) used for decomposition and aggregation.
  • On the personalized track, GMTRouter reached 68.78 persona-judge accuracy, ahead of PersonalizedRouter (67.86) and the best user-agnostic router, EloRouter (66.40).
  • Router rankings shifted substantially as the cost weight increased (Figure 5/6), and always calling the largest model incurred the highest cost yet only mediocre performance compared to learned routers. On 234 real Slack preference records, PersonalizedRouter led with 83.05 accuracy while GMTRouter (top in simulation) dropped to sixth; across five multi-agent topologies, MFRouter achieved the best average score of 76.48 versus 71.48 for always using the largest model.

Where it can be used

  • Designing and tuning routing systems for services that operate multiple LLMs under cost and quality constraints
  • Developing new routing algorithms by reusing LLMRouter's shared data pipeline and evaluation tools via configuration changes instead of rebuilding infrastructure
  • Comparing routing performance across diverse input types such as long conversational history, images/video, and time-series data
  • Building personalized chat assistants that adapt model selection to individual user preferences
  • Assigning different models to different roles (planner, executor, summarizer) within multi-agent systems

Limits and open work

  • All multi-turn routers relied on the same base model (Qwen2.5-3B-Instruct) for decomposition and aggregation, so results may not generalize to other base models.
  • Rankings from the simulated persona-judge evaluation did not match rankings from real human preference data (GMTRouter dropped from first to sixth), indicating offline benchmark results may not directly transfer to deployment.
  • The candidate pool was limited to 18 open-weight models (7B to 671B) served through two specific API providers, so results on closed commercial models or different pricing structures were not tested.
  • The real-user study involved only 15 users, 40 sessions, and 234 pairwise records, a small sample for statistical generalization.
  • The Plan-Exec-Sum multi-agent topology reused the GraphPlanner design without retraining its planner, a simplification noted by the authors.

Why it matters

As AI products increasingly mix multiple LLMs to balance cost and quality, deciding which model handles which query becomes a core engineering problem, and this work gives practitioners a common yardstick and toolkit to build and compare routing strategies instead of reinventing evaluation pipelines each time.

Terms in this paper

  • LLM routing · Deciding, for each incoming query, which of several candidate language models should answer it
  • context encoder / model encoder · The part of a router that represents the query/conversation state (context encoder) and the part that represents each candidate model's characteristics (model encoder)
  • decision rule · The rule that turns computed scores into an actual choice of model or a decision to stop routing
  • xRouteBench · The benchmark built in this paper spanning generic QA, memory, vision, time-series, and personalized routing tasks
  • performance-cost trade-off · The balance between answer quality and the token/monetary cost spent to obtain it, tunable via a weighting parameter

Original abstract (English)

No single large language model (LLM) is optimal across all queries and budget constraints, making model routing essential for cost-effective deployment. Existing routers adopt diverse formulations and implementations, making fair comparison and extension difficult. We present 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, covering single-turn, multi-turn, and personalized routing. Based on this formulation, we develop an automated pipeline for constructing routing supervision and evaluating routers jointly on response quality and inference cost. The resulting benchmark, xRouteBench, spans generic LLM, memory-augmented, vision, time-series, and personalized routing tasks. We further introduce LLMRouter, an open-source modular infrastructure with more than 16 representative routers. Our empirical study shows that learned routers outperform the strongest fixed-model baseline by 14.6% relatively, lightweight routers become more competitive under tight cost constraints, and user-conditioned routing consistently improves personalization.

Authors · Tao Feng

Read on arXiv

Latest papers

All papers →

Latest from METAL MEDIA

Figures: Tao Feng et al., arXiv:2608.06867, CC BY 4.0