LESSON 15 / 215·2 min readFoundation

Model selection, routing, fallback, latency, and cost

Must knowConcept lesson
01 Understand02 Recall03 Prepare

Words made simple

A few useful meanings before you read the explanation.

Latency
How long a request takes to return a result. Lower latency usually means a shorter wait for the user.
Token
A small piece of text processed by a model. It may be a whole word, part of a word, or punctuation.
Retrieval
Finding and fetching information that is useful for the current question.
More words from this lesson
Grounding
Connecting an answer to supplied evidence, such as a policy document or a verified database result.
Deterministic
Following steps or rules defined by code. The model does not decide which step should run next in a deterministic workflow.
Evaluation
Checking results against examples and clear criteria to find whether the system works well and where it fails.

Overview

  • Model selection chooses a model for a task.
  • Routing chooses among models or processing paths per request, while fallback handles a failed or unavailable preferred path.
  • Latency is waiting time; cost includes tokens, tools, retrieval, infrastructure, and review.

Why this matters

One large model for every request can be slow and expensive, while one small model may fail difficult cases.

An everyday example

Simple service requests go to the front desk; complex cases go to a specialist, with a backup if the specialist is unavailable.

A technical example

Rules handle a known claim ID; a small model classifies intent; a stronger model handles a complex grounded explanation.

How it works

  1. Establish quality targets
  2. Benchmark models
  3. Define routing rules
  4. Enforce limits
  5. Attempt preferred route
  6. Apply approved fallback
  7. Monitor quality and cost by route.

Architecture and flow

Task + risk + budget → route → provider → validated result or bounded fallback.

The insurance assistant example

If generation fails, return verified claim status in a deterministic template rather than retrying five expensive models.

When to use it

Routing is valuable when task difficulty, volume, or privacy needs differ meaningfully.

When to avoid it

Avoid routing complexity before you have a baseline. Never silently fall back to a provider outside approved data regions.

Interview answer

“I choose models using task evaluations, latency, cost, and data requirements. Routing and fallback preserve those requirements while improving efficiency and availability.”

Benefits, trade-offs, and production considerations

  • A model's self-reported confidence is not a calibrated probability.
  • Use empirical route performance, deterministic risk signals, and measured abstention.
  • Compare cost per successful task, not just price per token.
PAUSE & RECALL

Can you explain it without the notes?

Model selection, routing, fallback, latency, and cost

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

Model selection chooses a model for a task. Routing chooses among models or processing paths per request, while fallback handles a failed or unavailable preferred path. Latency is waiting time; cost includes tokens, tools, retrieval, infrastructure, and…

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Provider ecosystems: OpenAI, Anthropic, Gemini, and Azure OpenAI

Adapted from 13_AI.MD · “Model selection, routing, fallback, latency, and cost”. Examples are study fragments; framework behavior can depend on your version.