Model Routing & Cost Engineering
AI Engineer path · lesson 106 of 124Stream a live request mix through one of four policies — all-big, all-small, heuristic router, or confidence cascade — and watch cost, latency, and quality shift as you switch between them. A hands-on way to explore the tradeoffs every LLM product owner argues about.
Key insight
Watch the numbers with a live stream: all-big is a flat quality ceiling at high cost; all-small is cheap but degrades on hard requests; a shape-based heuristic gets 90% of the quality at 20-40% of the cost; a cascade wins when the small model is right most of the time and the escalation signal is well-calibrated.
Route a request by cost
Order a cost-aware routing path.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
- 1Drop a step here
- 2Drop a step here
- 3Drop a step here
- 4Drop a step here
- 5Drop a step here
- 6Drop a step here
Test your knowledge
The main reason "just use a smaller model" is often a worse cost lever than routing:
The short version
A model router is triage at an ER. Not every visitor needs a surgeon — the intake nurse routes sniffles to the small clinic and heart attacks to the surgeon, and only escalates when the first responder isn't sure.
In more depth
Model routing & cost engineering
A production LLM system rarely wants one model for every request. Requests differ in complexity, and models differ in cost by 10-50× — routing spreads a diverse workload across a tiered fleet.
Four common policies
Escalation signals
Why routing beats picking a smaller model outright
A smaller model saves money globally but drops quality on the hard tail. Routing preserves quality on the tail (small share of requests) while capturing most of the savings on the easy majority.
Instrument per-route
Blended quality hides regressions in one bucket. Alert on per-route quality, not the average — and re-tune thresholds when the model versions or traffic mix change.
Interview Questions
References & Further Reading
Love this visualization?
Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.
100% free • No credit card required