Model Routing as a Cost-Reduction Primitive
A dynamic broker evaluates every request (task type, token length, embedding similarity, confidence) and sends simple queries to a cheap model, escalating complex ones to a frontier model. This is also called model cascading. Production case studies show 20-60% cost reduction at iso-quality across US/UK/EU deployments, and a 30% routing efficiency improvement on high-volume SaaS turns into six-figure annual savings. The 2026 context is that LLM inference prices dropped ~10x per year: a GPT-4-class token went from $20/M to ~$0.40/M from late 2022 to 2026. Most of the drop is better serving stacks (Phase 17 · 04-09), not hardware. Routing is how you convert that price drop into margin without product regression. The failure mode is cheap-model drift. The route pushes 40% to a weaker model, quality drops 3-5% on reasoning tasks, and no one notices for a quarter. Gate routes by online quality metrics, not just offline eval sets.
Learning Objectives
- Explain model cascading: cheap-first with confidence check, escalate on low confidence.
- Enumerate the four routing signals (task classification, prompt length, embedding similarity to known-hard set, self-confidence from first-pass).
- Compute expected blended cost at target routing split and quality loss tolerance.
- Name the drift-monitoring metric (online quality gate) that catches cheap-model creep.
The Problem
Your service costs $80k/month on GPT-5. Your analytics show 70% of queries are simple: "what time is it in Paris?" "rephrase this sentence." A Haiku-class model handles those well at 3% of the cost. The other 30% need GPT-5's reasoning: coding, math, multi-step planning.
If you route the 70% to cheap and 30% to expensive, your bill drops ~65% at the same product quality. This is routing. The hard part is building the broker without regressing quality.
The Concept
Four routing signals
-
Task classification: simple/complex/codegen/math/chat. It can be a rules-based classifier, a small LLM (Haiku-class at $0.25/M), or embedding similarity to labeled buckets. The output is a route: cheap, balanced, or frontier.
-
Prompt length: prompts over 4K tokens often need frontier for coherence. Prompts under 500 tokens usually don't.
-
Embedding similarity to known-hard set: if the query is close (cosine > 0.88) to a known-hard bucket, escalate to frontier directly.
-
Self-confidence from first-pass: send to cheap; if model's log-probs show low confidence OR it refuses OR outputs hedging language, retry on frontier. This adds P95 latency on ~10% of traffic but saves 50%+ on the other 90%.
Three patterns
Pre-route (classifier up front) adds ~5-10ms of latency and is the fastest overall.
Cascade (cheap-first, escalate on low confidence) runs at ~1.2x median latency (cheap run plus verify) and ~2x on escalated requests. It has the best quality floor.
Ensemble route runs cheap and frontier in parallel for a sample and lets a reward model pick. It has the highest quality and the highest cost, so save it for critical A/B tests.
Implementation
AI gateways (Phase 17 · 19) expose routing. LiteLLM has a router config with fallback and cost-routing, Portkey has guards plus routing, and Kong AI Gateway has plugin-based routing. OpenRouter's model marketplace exposes a recommendation API.
Open-source: RouteLLM (LMSYS), Not Diamond (commercial), Prompt Mule.
The 2026 price curve
| Model class | Late 2022 | 2026 | Change |
|---|---|---|---|
| GPT-4-level quality | ~$20/M | ~$0.40/M | 50x cheaper |
| Frontier (GPT-5, Claude 4) | n/a | ~$3-10/M | new tier |
Most of the improvement is serving efficiency. The core lessons in Phase 17 · 04-09 turned into provider-side cost drops, and routing lets you capture those gains at the app layer instead of waiting for all your users to migrate to the cheap tier.
Drift is the real risk
Say your route sends 40% to the cheap model. Over six months the task distribution shifts: users get more sophisticated and ask longer questions. The router doesn't notice because its classifier was trained on Q1 data, so quality drops silently and nobody complains loudly enough. You find out when you lose a competitor benchmark.
Gate routes by online quality metrics:
- User thumbs-up / thumbs-down per route.
- Automated LLM-judge on a held-out sample (5%) per route.
- Escalation rate: if the cascade is kicking up-route more than 30% of the time, the cheap model is being over-routed.
- Refusal rate per route.
Numbers you should remember
- 2026 routing savings at iso-quality: 20-60% case studies.
- LLM price drop 2022-2026: ~10x per year aggregate.
- GPT-4-level 2022 vs 2026: ~$20/M → ~$0.40/M.
- Cascade latency impact: ~1.2x median, ~2x escalated (~10% of traffic).
Use It
code/main.py simulates an all-frontier baseline, pre-route, and cascade on a mixed workload of 1000 requests. It reports blended cost, savings against the baseline, mean quality, and escalation count.
Ship It
This lesson produces outputs/skill-router-plan.md. Given workload and quality budget, picks a routing pattern and signals.
I'd run main.py first and read the three result rows before the prose. It is stdlib only, builds 1000 requests from a fixed seed, and prints cost, savings against the all-frontier baseline, mean quality, and escalation count for no routing, pre-route, and cascade.
The row worth staring at is cascade. It pays for the cheap model on every request and adds the frontier cost on top for the ones that escalate, so the escalation count is what decides whether it saves money. In the toy, hard requests always escalate and half of the medium ones do. Pre-route sends every non-simple request straight to frontier, so it saves less here. Cascade gives up a little quality for that extra saving, and the extra latency on escalated requests is the price you pay for the quality floor.
Keep the toy in proportion. The pre-route "classifier" reads the difficulty label straight off the request, so it is right every time, which flatters it. The cheap-model quality numbers are a hardcoded table per difficulty, and the cascade's confidence check is a coin flip on medium requests. Nothing in it measures drift. That part you have to build yourself, with the online quality gate from the Concept section, before you trust any split you get from a simulator.
Exercises
- Run
code/main.py. At what accuracy floor does cascade beat pre-route? - Your user base is 30% enterprise (complex queries), 70% free tier (simple). Design the routing split. What online metric gates it?
- A route drops quality by 2% but saves 40%. Is that a ship? It depends on the product, so argue both sides.
- Implement a confidence check using logprobs from OpenAI / Anthropic APIs. What's the threshold you start with?
- Over six months, escalation rate climbs from 8% to 22%. Diagnose three causes and the fix for each.
Key Terms
| Term | What people say | What it actually means |
|---|---|---|
| Model routing | "cost broker" | Dynamic choice of model per request |
| Model cascade | "cheap-first escalate" | Run cheap, fall through to frontier on low confidence |
| Pre-route | "classify first" | Classifier up front; no re-run |
| Ensemble route | "parallel pick" | Run multiple, reward-model picks best |
| Escalation rate | "uprouted %" | Fraction of cascade requests that escalated |
| RouteLLM | "LMSYS router" | OSS router library |
| Not Diamond | "commercial router" | SaaS model-routing product |
| Drift | "cheap creep" | Distribution shift without router noticing |
| Online quality gate | "live check" | Automated LLM-judge sampling live traffic |
Further Reading
- AbhyashSuchi, Model Routing LLM 2026 Best Practices
- Lukas Brunner, Rise of Inference Optimization 2026
- RouteLLM paper / code
- Not Diamond, model routing
- OpenRouter: multi-model gateway with routing primitives.