LLM Model Routing: Balance Quality, Cost, and Risk
Route requests by the capability and consequence the task requires. Use deterministic code where no model is needed, a lower-cost model for evaluated easy slices, a stronger or specialist model for harder work, and human review when uncertainty or authority crosses a declared boundary.
Choose destinations from task constraints
| Destination | Candidate task shape | Required gate | Fallback |
|---|---|---|---|
| Owned code or lookup | Exact rules, arithmetic, authorization, formatting, or known records | Inputs satisfy a deterministic contract | Typed error or clarification; do not improvise |
| Efficient general model | Common, bounded tasks that pass its quality slice | Task classifier and hard risk checks agree on eligibility | Stronger model when validation or confidence fails |
| Stronger general model | Complex reasoning, ambiguity, or long-form synthesis within evaluated scope | Budget, latency, context, and policy permit the route | Specialist, clarification, or human review |
| Specialist model | A narrow modality, domain, language, or structured task with demonstrated advantage | Versioned task match and specialist regression suite | General model or reviewed queue |
| Retrieval or tool workflow | Fresh facts, private data, computation, or external action is required | Authorization, evidence, and tool contracts are satisfied | Abstain or request missing context before action |
| Human review | Consequential judgment, unresolved conflict, low support, or required approval | Decision packet contains evidence, uncertainty, and proposed action | Pause safely until review or expiry |
The strongest model is not automatically the right destination, and the cheapest model is not automatically an acceptable default. Start with task requirements, then prove which destinations can meet them.
Separate hard gates from learned routing scores
Hard gates express conditions a score must never override: data residency, tool permission, customer tier, required modality, context capacity, approved provider, maximum consequence, or mandatory human approval. Evaluate them with ordinary code and policy tests before model selection.
A learned router or classifier can rank eligible destinations by predicted quality, difficulty, latency, or cost. RouteLLM is primary research on learning to choose between stronger and weaker models from preference data. Its results demonstrate one approach on its studied benchmarks; they do not establish transfer to your requests, providers, or risk profile.
Scores need explicit uncertainty behavior. Use the calibration and risk–coverage method in LLM confidence scoring and abstention. When the router is unsure, a safe path may gather more context, choose the stronger eligible model, or escalate. Avoid recursive routing loops by limiting attempts and recording the terminal reason.
Evaluate the whole policy, not only each model
Create slices for task type, difficulty, language, input length, evidence requirement, structured output, risk tier, and known incidents. The evaluation dataset design guide shows how to build representative cases and preserve provenance. Keep cases the router has not influenced for final comparison.
Compare against simple baselines: always efficient, always strong, deterministic rules, and any existing production policy. Measure task quality, hard-policy violations, abstention, route distribution, fallback, retries, latency, and cost on the same workload. Report results by slice; a favorable aggregate can hide a regression where the efficient model is incorrectly chosen for a rare critical task.
Test router overhead and failure. A routing model that adds another slow call can erase expected latency gains. An unavailable destination needs a declared fallback that still satisfies policy. A model upgrade requires re-evaluating both the destination and routing boundary because relative capabilities may change.
Model-routing failure cases
- Keyword routing: superficial terms choose a specialist while the underlying task differs. Evaluate paraphrases and adversarial wording.
- Cost-only objective: the policy learns to choose the cheapest route while hard tasks quietly degrade. Keep quality and risk as constraints.
- Router sees the answer: expensive generation happens before routing, so the apparent saving is not real. Include routing overhead in the trace.
- No destination health check: traffic moves to an unavailable model and cascades through retries. Use bounded, policy-compatible fallback.
- Aggregate evaluation: frequent easy tasks hide a severe minority failure. Gate by risk and task slice.
- Sticky historical labels: routing examples reflect an old model hierarchy. Re-label when destinations or prompts materially change.
A practical implementation sequence
- Inventory destinations. Record capabilities, limits, policy eligibility, latency, price basis, context, structured-output support, and failure behavior.
- Write hard routing gates. Encode permissions, approved providers, modality, context capacity, consequence, and human-approval boundaries outside a learned score.
- Build representative route cases. Label acceptable destinations and outcome quality across normal, hard, ambiguous, and incident-derived slices.
- Start with a simple baseline. Use deterministic rules before training a router; complexity must earn its operational cost.
- Evaluate end to end. Include routing overhead, destination quality, validation, fallback, retries, latency, and cost under the same workload.
- Release with drift checks. Version router, destinations, prompts, and case corpus; watch route mix and slice regressions through the latency optimization framework.
Decision summary
Adopt model routing when request classes differ enough that no single destination gives the desired quality, reliability, latency, and cost—and when an evaluated policy can identify those classes. Keep consequential routes behind hard gates and preserve a safe terminal fallback.
Primary and official sources
- Ong et al., “RouteLLM: Learning to Route LLMs with Preference Data” — primary research on learned routing between stronger and weaker models.
- OpenAI API: Working with Evals — official guidance for defining and running evaluations on representative data.