Inference & Serving · core

Model Routing

Sending each request to the cheapest model that can handle it.

inference-servingai-systemsllm-apps

Mental model

Not every request needs the frontier model. A router classifies difficulty and dispatches: small/cheap model for easy calls, large model for hard ones — with cost and latency tracked per route.

How to study Model Routing

Begin by restating the mental model in your own words, then connect it to a concrete system you have built or operated. Name the mechanism, the constraint it addresses, and the trade-off it introduces. Use Building Effective AI Agents (Anthropic Engineering), FrugalGPT: Using LLMs While Reducing Cost and Improving Performance (Chen et al.), How to Scale Your Model (JAX ML scaling book) to check details, but close the source before writing your explanation. Retrieval is the learning step; rereading is only preparation.

Next, compare Model Routing with LLM Evals, Prompt & Version Logging. Ask what changes in correctness, latency, resource use, operability, and failure recovery. Complete Route by cost and difficulty and preserve the command, input, output, and one failed attempt as evidence. Finish by explaining the idea without jargon to someone who has not studied the track.

Proof of understanding

  • Explain the mechanism from first principles and identify the state it reads or changes.
  • Give one situation where the concept is the right choice and one where it is not.
  • Predict a realistic failure mode before running the drill, then compare the prediction with evidence.
  • Connect the result to a roadmap or build artifact instead of treating the concept as isolated trivia.

Where it matters

Cost optimization in production LLM apps, the free-AI-first principle.

Common mistakes

  • Routing without evals, so quality silently drops
  • No fallback when the cheap model fails

Learn from primary sources

Practice and explain it back

Route by cost and difficulty

Classify queries: "2+2" → small model; "design payment system" → large model. Write a 2-rule router on length and keyword "design".

Expected evidence: Rule-based router with fallback to large on low confidence.

Open the interactive drill →

Review prompts

  • Why must model routing be backed by evals?

Build evidence

Model router

Route each request to the cheapest model that passes evals for that request class.

  • Classify request difficulty
  • Dispatch to a cheap or strong model accordingly
  • Track cost and latency per route

Synthesize: Inference & Serving

Build a production mental model for inference engines, memory, kernels, routing, hardware, and serving economics. Produce one working system, benchmark, or evidence-backed design that integrates the path.

  • Implements or precisely models the core mechanisms from all three milestones
  • Includes at least one injected failure or adversarial case and demonstrates recovery
  • Reports quality, latency, resource, reliability, or usability measurements relevant to the domain
  • Ships a concise architecture note explaining decisions, trade-offs, and remaining risks

Prerequisites

Related concepts

Learning paths