Last updated: Aug 25, 2026

Model Routing and Cascading for LLM Applications

Dan Lee, JoinAI Founder · AI Tech Lead

JoinAI Founder · AI Tech Lead

Aug 25, 20264 min read
LLM request router selecting a small or large model and escalating uncertain results

Model routing is a policy for choosing the cheapest and fastest execution path that still clears a task-specific quality gate. It is not “send short prompts to a small model.” Prompt length is a poor proxy for difficulty, and a router can save money while concentrating failures in rare or high-risk cases.

Start with a fixed baseline, label representative tasks, and introduce routing only when you can compare quality, latency, and cost per successful task across every route.

Separate routing from cascading

  • Routing chooses a model before generation using task metadata or a classifier.
  • Cascading runs a cheaper model first and escalates when its result fails a verification gate.
  • Fallback changes providers or models after availability failure; it is not a quality policy.

Google's architecture guidance recommends model routing based on task complexity, cost, or latency, while noting that larger thinking budgets can increase both latency and cost. Its gateway documentation also identifies constraints such as common host requirements and cold starts. See Google Cloud's component guidance and model-routing overview.

Write the routing table first

Task sliceDefault routeEscalation gateHard constraint
Deterministic extractionSmall model with strict schemaSchema or semantic validation failsNo unsupported field passes
Low-risk classificationSmall modelMargin below calibrated thresholdTrack minority-class recall
Grounded answerMid-tier model plus retrievalCitation or groundedness failsOnly allowed sources enter context
Consequential recommendationStrong model plus human reviewAlways reviewedModel cannot execute action
Complex synthesisStrong modelBudget or evidence insufficiencyReport missing evidence

The table makes business risk part of routing. A cheap route may be fine for reversible formatting and unacceptable for an account-closure recommendation.

Optimize cost per successful task

Text
effective_cost(route) = request_cost(route) / task_success_rate(route)
cascade_cost = first_pass_cost
+ escalation_rate × escalation_cost
+ review_cost

A route costing $0.01 with 50% task success has an effective cost of $0.02 before retries and review. Use current provider prices and measured token distributions.

The FrugalGPT paper formalized LLM cascades as a cost-performance tradeoff across model APIs. Its benchmark results apply to that setting, not automatically to yours. See FrugalGPT.

Route on observable features

Prefer features available before generation: authenticated product surface, task type, language, modality, required tools, context size, consequence class, and historical difficulty for the same labeled slice.

Do not route on protected attributes or opaque user-value scores. Do not let user text directly select a privileged model or bypass a policy route.

A model-based router adds latency, cost, and failure. Compare it with deterministic rules. If five product surfaces map cleanly to five task types, a classifier may add no value.

Calibrate escalation on held-out cases

Use deterministic validation, retrieval sufficiency, calibrated confidence, or a task-specific grader. Self-reported model confidence is not enough.

MetricWhy it matters
Task success by slice and routeDetects harm concentrated in a minority slice
Escalation precisionMeasures unnecessary expensive escalation
Escalation recallMeasures first-pass failures that were caught
Cost per successful taskConnects spend to outcomes
P50/P95 latencyCascades can hurt tail latency
Route stabilityDetects classifier or distribution drift

Store route policy version, selected model, reason code, gate result, escalation, and terminal outcome on one trace. The LLM observability guide provides that structure.

Roll out with shadow decisions

  1. Run the current fixed model as control.
  2. Compute the proposed route without applying it.
  3. Compare decisions with labeled outcomes and costs.
  4. Enable the cheap route for low-risk slices behind a flag.
  5. Keep a control sample on the baseline model.
  6. Alert on quality, escalation recall, and tail latency by slice.

Routing is justified when the policy remains simpler than the savings it creates. If traffic is low or tasks are homogeneous, pick one evaluated model. For broader cost work, use the LLM cost optimization playbook.

Sources and further reading

Build better AI systems

One practical engineering lesson in your inbox each week.

JoinAI Premium

Go from reading to shipping

Get guided learning, hands-on AI engineering projects, and premium practice.

Explore Premium
Dan Lee, JoinAI Founder · AI Tech Lead

About the author

JoinAI Founder · AI Tech Lead

Dan Lee is the founder of JoinAI and an AI tech lead with more than 10 years of industry experience across data engineering, machine learning, and applied AI. He previously worked as an engineer at Google.