Robots Atlas>ROBOTS ATLAS
Orkiestracja

Model Routing

2023ActivePublished: 13 July 2026Updated: 13 July 2026Published
Key innovation
Instead of always hitting a single large model, the system dynamically selects the best-fit model (small/large, cheap/expensive, generalist/specialist) for each query - optimising the cost-vs-quality Pareto curve.
Category
Orkiestracja
Abstraction level
Pattern
Operation level
OrchestrationApplicationTooling
Use cases
Coding agents routing simple refactoring to cheap models, hard debugging to flagship onesEnterprise customer support chatbots - cheap models for FAQ, flagship for escalationsBatch processing (document classification, data extraction) on the cheapest acceptable modelMulti-language routing - specialist language models (e.g. Qwen for Chinese) alongside global onesFallback / resilience - automatic failover to a candidate when the primary provider has an outage or rate limitPrivacy-aware routing - routing PII data to a local model, public queries to cloudBudget-capped applications - keeping monthly API cost below the limit by matching model to remaining quota

How it works

Typical Model Routing flow: (1) Query classification - the router (trained classifier or rules) extracts features: prompt length, detected domain (code, math, creative writing), complexity (heuristic or score from a small judge LLM), historical success rate on similar tasks; (2) Model selection - the router compares features against each candidate's profile (cost/token, p50/p99 latency, quality on domain benchmarks, current availability) and picks the best under the active optimisation policy; (3) Invocation and verification - request hits the chosen model, optionally with a verifier (tests, execution check, LLM-as-judge); (4) Escalation/fallback - if the verifier rejects the response or the model fails, the router iteratively escalates to a stronger candidate. Variants: offline routing (before inference), online (during streaming), agentic (per step in a tool chain), speculative (parallel calls with quorum voting).

Problem solved

Frontier LLMs are expensive (GPT-5 in the USD 10-30 per 1M tokens range), while quality gaps versus cheaper models (USD 0.10-1.00 per 1M) are marginal for most real tasks. Without routing, the user pays for the flagship model even on trivial queries. Model Routing solves this 'one model fits all' choice by dynamically matching compute power to actual task difficulty and business criteria (cost, latency, privacy, availability).

Components

Router / ClassifierSelects the target model per query

Decision component - can be rule-based (if-then), ML classifier (LoRA on a small judge LLM like Qwen 0.8B), MoA (mixture-of-agents), or an LLM agent invoking a routing function. Input: query features. Output: model identifier from the candidate pool.

Official

Model Pool / Candidate RegistryCandidate catalogue for the router

Registry of available backend models with their profiles: input/output/cache cost, p50/p99 latency, domain benchmark results, supported modalities, context limits, current availability (health check). Updated dynamically from production metrics.

Official

VerifierQuality gate and escalation trigger

Optional response-quality validator for the selected model. Variants: unit tests (for code), execution check (running code in a sandbox), LLM-as-judge (a stronger model rating a weaker one), schema validation (JSON), format checking. Its feedback drives escalation.

Official

Escalation PolicyControls the try/escalate strategy

Rule defining the retry sequence: cheap_chain (order of cheap candidates), escalate_to (stronger model on verifier reject), max attempts k, per-query budget. Critical for agentic routers like ACRouter.

Official

Metrics & Feedback LoopCloses the router learning loop

Collecting production data: per-request decision, chosen_model, cost, latency, verifier result, user feedback. Powers router training or tuning (offline retraining or online RL). Without it, routing degenerates to static rules.

Implementation

Implementation pitfalls
Router more expensive than the cheap candidateHigh

When the router is a strong LLM, its decision cost can exceed the savings from picking a cheap model - the 'router-as-a-tax' antipattern.

Fix:The router must be O(1000x) cheaper than the flagship candidate - hence the popularity of small LoRA classifiers (Qwen 0.8B) and rule-based routers.
Verifier as a single point of failureHigh

A bad verifier accepts weak responses (false positive) or rejects good ones (false negative). Either way, routing degenerates - always escalates or always sticks with cheap.

Fix:Calibrate the verifier on a held-out set; monitor accept-rate drift in production; use hybrid rules + LLM-as-judge.
Distribution shift - router trained on one distribution, deployed on anotherMedium

A router trained on Chatbot Arena data performs worse on real coding requests. Without a feedback loop, routing degenerates over time.

Fix:Collect chosen_model + verifier score metrics in production; do periodic retraining or online RL on own logs.
Latency budget explosion in the cascadeMedium

Try-then-escalate serially accumulates latency: cheap model (2s) + verify (0.5s) + expensive model (5s) = 7.5s instead of 5s without routing. Critical for real-time UX.

Fix:Speculative execution (parallel candidates), response streaming with interrupt capability, cache for repeated queries.
Reversed vendor lock-in - lock-in to the routerLow

Cascading business logic into the router (prompts, verifiers, policies) creates a new silo - hard to move to another routing provider without redesign.

Fix:Standardise the interface (OpenAI-compatible), separate policy from router (policy in config, not code), self-hosted router instead of SaaS when budget allows.

Evolution

Original paper · 2023 · arXiv 2305.05176 (Stanford) · Lingjiao Chen
FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance
Lingjiao Chen, Matei Zaharia, James Zou
2023
FrugalGPT (Stanford) formalises the LLM cascade with a verifier idea
Inflection point

Chen, Zaharia, Zou (arXiv 2305.05176) show that an LLM cascade (cheap → expensive with a condition) can lower cost by 98% while retaining GPT-4 quality on selected tasks.

2023
LLM Router (Anyscale, Llama-2 + GPT-4 hybridisation)

Anyscale describes production OSS + closed-source routing to lower cost - the first public case study of a router in a company.

2023
OpenRouter.ai debuts as a commercial routing marketplace

The service offers a single API to hundreds of models with automatic selection and fallback - popularises the pattern for developers.

2024
RouteLLM (LMSYS)

Open-source framework for training routers (matrix factorization, BERT classifier) using Chatbot Arena data - the first published ML router training methodology.

2024
Not Diamond, Martian - commercial routing platforms

Startups positioning routing as the main product - end of the 'router in a library' phase, start of 'router as SaaS'.

2026
ACRouter (Agent-as-a-Router) - agentic routing for coding tasks
Inflection point

Zhou et al. (arXiv 2606.22902) - router as an LLM agent with escalation and a verifier, OOD176 and CodeRouterBench benchmarks. Introduces 'agentic routing' and demonstrates integration with Claude Code / Codex / Opencode.

Hyperparameters (configurable axes)

Candidate pool sizeHigh

Number of models available to the router. More = finer selection granularity and better Pareto optimisation, but also higher catalogue, monitoring, and decision cost.

2Minimal setup: cheap + expensive with escalation.
5-10Typical production - mix of vendors and model sizes.
50+OpenRouter.ai-style marketplaces (hundreds of models with automatic selection).
Router typeCritical

Variant of the decision component. Impacts complexity, decision cost, quality, and tunability.

rule-basedRegexes, keywords, prompt length. Cheapest and simplest, but brittle.
ML classifierLoRA on a small judge LLM (e.g. Qwen 0.8B) - better quality, needs training data.
LLM-agentA stronger model decides (e.g. via tool call). Decision cost > cheap candidate cost.
agentic (ACRouter-style)Router as an LLM agent with escalation - try-then-escalate with a verifier.
Optimisation objectiveCritical

Metric that the router minimises/maximises - fundamentally shapes the decision policy.

Perf/$Response quality per dollar spent. Standard ACRouter benchmark.
AvgPerf @ budgetQuality maximisation under a hard budget cap.
Cumulative RegretDistance from the oracle best-model choice - used in RL.
p99 latencyRouting under SLA - cheap models if they respond fast.
Escalation depth (k)Medium

Maximum number of router attempts per query - controls worst-case cost.

1No escalation - one router decision, no retry.
2-3Typical setup - cheap model → verify → escalate to flagship.
5+Aggressive escalation - higher success chance, higher worst-case cost.

Execution paradigm

Primary mode
Conditional

Key distinction from MoE: MoE routes between expert subnetworks within a single end-to-end trained network. Model Routing routes between independently trained, often heterogeneous models from different vendors.

Activation pattern
Input dependent
Additional modes
SparseMixture
Routing mechanism

The router is external to backend models - it is not weights inside a single network (as in MoE) but an infrastructure layer that picks an entire model unit to invoke.

Parallelism

Parallelism level
Conditionally parallel

Routing is sequential in the try-then-escalate variant (the verifier must see the result before deciding on escalation). The speculative variant runs N candidates in parallel and picks a quorum - higher cost, lower latency.

Scope
InferenceAcross devices

Hardware requirements

Primary

Model Routing is an infrastructure pattern - runs on any hardware where candidates are hosted. The router itself (LoRA classifier or rules) is lightweight and has no hardware preferences.

Good fit

Classic rule-based routers or small classifiers (BERT, DistilBERT, Qwen 0.5B) work great on CPU - decision latency <50ms without GPU dispatch.