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.

By Mario AlexandreLLM Performance & Reliability

Choose destinations from task constraints

Scope: a product with deterministic, model, and human destinations; actual eligibility requires local evaluation.
DestinationCandidate task shapeRequired gateFallback
Owned code or lookupExact rules, arithmetic, authorization, formatting, or known recordsInputs satisfy a deterministic contractTyped error or clarification; do not improvise
Efficient general modelCommon, bounded tasks that pass its quality sliceTask classifier and hard risk checks agree on eligibilityStronger model when validation or confidence fails
Stronger general modelComplex reasoning, ambiguity, or long-form synthesis within evaluated scopeBudget, latency, context, and policy permit the routeSpecialist, clarification, or human review
Specialist modelA narrow modality, domain, language, or structured task with demonstrated advantageVersioned task match and specialist regression suiteGeneral model or reviewed queue
Retrieval or tool workflowFresh facts, private data, computation, or external action is requiredAuthorization, evidence, and tool contracts are satisfiedAbstain or request missing context before action
Human reviewConsequential judgment, unresolved conflict, low support, or required approvalDecision packet contains evidence, uncertainty, and proposed actionPause 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

  1. Inventory destinations. Record capabilities, limits, policy eligibility, latency, price basis, context, structured-output support, and failure behavior.
  2. Write hard routing gates. Encode permissions, approved providers, modality, context capacity, consequence, and human-approval boundaries outside a learned score.
  3. Build representative route cases. Label acceptable destinations and outcome quality across normal, hard, ambiguous, and incident-derived slices.
  4. Start with a simple baseline. Use deterministic rules before training a router; complexity must earn its operational cost.
  5. Evaluate end to end. Include routing overhead, destination quality, validation, fallback, retries, latency, and cost under the same workload.
  6. 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

  1. Ong et al., “RouteLLM: Learning to Route LLMs with Preference Data” — primary research on learned routing between stronger and weaker models.
  2. OpenAI API: Working with Evals — official guidance for defining and running evaluations on representative data.