AI Engineering Interview Questions: Model Routing in Production
Reviewed by Mark Dickie · Last updated
Model routing is the practice of directing incoming inference requests to different AI models based on factors like cost, latency, capability, and input characteristics. For interviews, you should understand when to route a request to a cheaper, smaller model versus a frontier model, how to measure and enforce latency budgets per request, and how fallback chains behave when a primary model fails or times out. Expect questions on cost-per-token tradeoffs, caching strategies that short-circuit the router entirely, and the metrics a routing layer must expose for observability.
What does an AI engineering interview test on model routing?
Interviewers want to see that you can reason about the full request lifecycle, not just pick a model off a shelf. A strong answer connects routing decisions to production constraints: token cost, p99 latency, rate limits, content policy, and model availability.
| Routing signal | Example decision | Production concern |
|---|---|---|
| Input token count | Long context → route to a model with higher context window | Cost scales with tokens; misrouting can 10x spend |
| Task type | Classification task → route to a small fine-tuned model | Over-provisioning a frontier model wastes budget |
| Latency budget | Real-time chat → route to lowest-latency endpoint | p99 targets differ per user-facing surface |
| Model availability | Primary model 503 → failover to secondary | Fallback chains must preserve output contract |
| Confidence score | Low-confidence output → escalate to stronger model | Cascading adds latency; needs backpressure |
How do you decide between a small model and a frontier model?
There is no single rule, but a common framework starts with the cheapest model that can plausibly handle the task and escalates only when quality or safety thresholds are not met. Interviewers often push on the escalation path itself.
-
Start with a small, cheap model for the request and capture its output along with a confidence or quality signal.
-
If the signal falls below a threshold, re-route to a mid-tier model or append the first output as context for a stronger model to refine.
-
If the task involves code generation, long-context reasoning, or safety-sensitive content, route directly to the frontier model and skip the cascade to avoid compounding latency.
-
Log the routing decision, the signal values, and the final outcome so you can tune thresholds offline without replaying live traffic.
What metrics should a model routing layer expose?
A routing layer that cannot be observed cannot be tuned. At minimum it should surface per-model p50 and p99 latency, cost per request, error and timeout rates, and the fraction of requests that hit each tier or fell through a fallback. Interviewers may ask you to design a dashboard from scratch or explain how you would alert on routing anomalies such as a sudden spike in fallback rate that signals an upstream model outage.
Key facts
- Tarmac has 27 AI Engineering interview questions on this topic, 10 of them on this page, at difficulty 1–4 of 5.
- Tarmac tracked 4,175 job postings asking for AI Engineering in August 2026.
- Roles asking for AI Engineering advertise a median base salary of US$180,000, across 757 job postings as of August 2026.
- Tarmac last reviewed these AI Engineering interview questions on 31 August 2026.
At a glance
| Questions | 10 shown · 27 in the bank |
|---|---|
| Difficulty | 1–4 of 5 |
| Formats | Multiple choice, Flashcard, True / false, Short answer, Ordering, Multiple answer, Find the bug |
What you'll review
- model routing
- latency cost
Practice questions
Try one before you open the answer. Pick an option and press Check; it's marked on the spot.
AI Engineering/ai-production/model-routing
Your endpoint handles high volume: ~90% of requests are simple intent classifications, ~10% are open-ended reasoning that genuinely needs your most capable (expensive) model. You want to cut cost without hurting quality on the hard 10%. What is the most effective architecture?#
Options
Show answer
Route by difficulty: cheaply classify each request and send the easy majority to a small model, escalating only the hard cases to the large model — a model cascade. This matches each request to the cheapest model that can handle it, so you pay the premium only where it buys quality. Sending everything to the small model sacrifices the hard 10%, capping max_tokens truncates exactly the open-ended cases that need room, and caching only helps repeated inputs.
Model routing (a cascade) matches each request to the cheapest model that can handle it: a fast classifier sends the easy 90% to a small model and escalates only the hard 10% to the expensive one, so you pay the premium where it actually buys quality (d). Small-model-for-everything (a) sacrifices the 10% that needed the big model. Capping max_tokens (b) just truncates outputs — it hurts exactly the open-ended cases that need room. Caching (c) only helps repeated inputs and does nothing for the volume of distinct queries.
AI Engineering/ai-production/model-routing
In one sentence, what is model routing in an LLM application?#
Show answer
Choosing which model, tier, or provider handles a given request — instead of sending every request to the same fixed model — based on signals like task difficulty, latency budget, cost budget, or which provider is currently healthy, so you pay for the most capable (and most expensive) model only on the requests that actually need it.
Model routing is the application-layer decision of which model answers a request, distinct from picking a model once at build time. It matters because LLM pricing and latency vary by 10-100x across tiers (a mini/flash model versus a frontier model), and most production traffic isn't uniformly hard — an FAQ lookup and a multi-step reasoning task don't need the same model. Routing is what lets a team serve both cheaply and reliably at scale instead of over-paying for every call or under-serving the hard ones.
AI Engineering/ai-production/model-routing
A model cascade and a single-shot classifier-based router both aim to send easy requests to a cheap model and hard requests to an expensive one. What is the key structural difference between them?#
Options
Show answer
A classifier-based router decides which model to call before any LLM call runs, based on a prediction about the request such as its length, a difficulty score, or task type. A cascade instead always calls the cheap tier first and only escalates to the expensive model after judging that tier's actual response against a quality or confidence threshold. The router pays for one round trip either way but has no automatic recovery from a misclassification, while the cascade grounds its escalation in observed evidence at the cost of a second round trip on requests that do escalate.
A classifier router inspects the incoming request up front — prompt length, a lightweight classifier's difficulty score, task type — and sends it to exactly one model: a single round trip either way, but a misclassified hard request has no automatic recovery unless a separate fallback is layered on top. A cascade instead always pays for the cheap tier's call first, evaluates that actual output against a quality or confidence threshold, and only escalates to the expensive model when the cheap tier's real response falls short — grounding the decision in observed evidence rather than a prediction, at the cost of a second, sequential round trip on the requests that do escalate. Neither pattern fans requests out to every model in parallel (b), provider hosting model is unrelated to which pattern you use (c), and neither requires a human in the loop (d) — cascades and routers are both automated decision points.
AI Engineering/ai-production/model-routing
OpenRouter's default load-balancing strategy, when one model is served by multiple providers, weights the choice toward the cheapest provider that hasn't had a significant outage recently — it does not split traffic evenly across providers by default.#
Options
Show answer
True. OpenRouter's default load balancing first prioritizes providers that have not seen a significant outage in the last 30 seconds, then weights selection among the remaining stable providers by the inverse square of price — a provider at $1/million tokens is roughly 9x more likely to be picked than one at $3/million tokens, not split evenly. Setting a fixed provider order or a sort preference such as throughput turns this automatic price-weighted load balancing off.
OpenRouter's documented default behavior does exactly this: it first prioritizes providers that have not seen a significant outage in the last 30 seconds, then among the remaining stable candidates it weights selection by the inverse square of price — so, in OpenRouter's own example, a provider at $1/million tokens is roughly 9x more likely to be chosen than one at $3/million tokens, not split 50/50. This price-weighted default only applies when you leave routing unconfigured; explicitly setting a fixed provider order or a sort preference (e.g. for throughput) turns the automatic load balancing off and tries providers in the order/priority you specified instead.
AI Engineering/ai-production/model-routing
A chat product routes each turn of a multi-turn conversation independently — sometimes to a different provider for the same conversation, to squeeze out the cheapest price per call. A teammate says this can hurt overall cost and latency for long conversations, even though each individual call is routed cheaply. Explain why, and what you'd change.#
Show answer
Prompt caching (server-side reuse of a previously-processed prompt prefix, offered by most major providers) discounts the tokens in a request's prefix when that exact prefix was seen recently by the same provider and model — and a long conversation's growing history is exactly that repeated prefix. If turn N is routed to a different provider or model than turn N-1, the new provider has never seen that history, so there is no cache hit: it reprocesses the entire growing transcript from scratch as fresh, full-price input tokens, with full prefill latency instead of a fast cached lookup. Picking the cheapest per-call price while ignoring this throws away the much larger saving from cache hits, so blended cost and latency for the whole conversation go up even though each individual hop looked optimal in isolation. The fix is sticky routing: pin an entire conversation, or at least a session, to the same model/provider once it starts, and only reconsider that choice for the next new conversation or when a hard failure forces a genuine fallback.
Model routing decisions don't exist in isolation from caching — a per-call-optimal choice can be a per-conversation loss. The interview signal here is recognizing that prompt/prefix caching is provider- and model-scoped, so hopping providers turn-by-turn resets it every time, and that the fix (sticky routing / session affinity) is a standard pattern in LLM gateways for exactly this reason.
AI Engineering/ai-production/model-routing
Order the steps of one request passing through a model cascade that ends up escalating.#
Put these in order
Show answer
A model cascade that escalates runs through five steps in order:
- Send the request to the cheapest/fastest model tier first
- Score that tier's response against a quality or confidence threshold
- Detect that the score falls below the threshold
- Escalate the same request to a stronger, more expensive tier
- Return the stronger tier's response to the caller
A cascade always pays for the cheap tier first rather than predicting difficulty up front. It then scores that real response against a quality/confidence threshold — a validator, a judge, self-consistency, or the model's own confidence — and if the score falls short, the identical request is escalated to the next, more capable and more expensive tier, whose response is what actually gets returned. Grounding the escalation decision in the cheap tier's observed output, rather than a prediction made before calling anything, is what distinguishes a cascade from a single-shot classifier router.
AI Engineering/ai-production/model-routing
Your platform routes requests to different LLMs based on task properties. Which of the following are sound model-routing strategies? Select all that apply.#
Options
Pick every one that applies.
Show answer
Sound strategies are classifying queries by complexity and routing simple ones to a smaller cheaper model, trying the small model first and escalating to the large one only if confidence or quality is below threshold, routing by task type (a code-specialized model for code, a general model for open-ended reasoning), and maintaining a fallback chain so an error or timeout fails over to the next model. Fanning out every request to all models is not a routing strategy — it multiplies cost and only suits offline evaluation, not latency-sensitive production.
Effective routing reduces cost and latency without sacrificing quality. Complexity-based routing (a) is the foundational pattern: easy queries (FAQ, classification, extraction) rarely need the largest model. Speculative / cascade routing (b) — try small first, escalate if needed — is a principled way to get quality guarantees while paying small-model prices on the majority of traffic. Capability-based routing (d) sends work to the model best fit for the task domain. A fallback chain (e) is essential production hygiene: no single provider has 100% uptime. Fan-out to all models on every request (c) is not a routing strategy — it multiplies cost by the number of models and is only justified for evaluations or tie-breaking in offline settings, not latency-sensitive production traffic.
AI Engineering/ai-production/model-routing
This fallback chain is supposed to drop to a cheaper model only when the primary is rate-limited or temporarily overloaded. Which line makes it silently mask real failures instead?#
const CHAIN = ["gpt-4o", "gpt-4o-mini"]; // primary, then cheaper fallback
async function complete(prompt: string) {
for (const model of CHAIN) {
try {
return await callModel(model, prompt);
} catch {
continue; // primary failed — fall back to the next model
}
}
throw new Error("all models in the chain failed");
}Show answer
The bug is on line 7.
Line 7's bare catch { swallows every error indiscriminately and falls through to the cheaper model. So a non-transient failure — a malformed request, an auth error, a content-policy block, or a bug in your own code — is silently downgraded to a weaker model (and reported only as the generic 'all models failed' if the whole chain is exhausted) instead of being surfaced. Worse, because the bare catch discards the error object, the code cannot implement the very policy it was written for: 'fall back only on 429/503.' The fix is to inspect the error and fall back only on transient/overload statuses, rethrowing everything else: catch (err) { if (isRetryable(err)) continue; throw err; }.
AI Engineering/ai-production/latency-cost
A product sends every request to the largest, most capable model. Describe a model-routing strategy that cuts cost and latency without tanking quality, and the risk you must guard against.#
Show answer
Not every request needs the frontier model, so route by difficulty: send simple, high-volume requests (classification, extraction, short factual lookups, formatting) to a smaller, cheaper, faster model, and reserve the large model for hard or high-stakes requests (complex reasoning, long-context synthesis). Routing can be rule-based (by task type, prompt length, or which feature is calling), or a cheap classifier/router model that scores difficulty, sometimes with a cascade: try the small model first and escalate to the large one only when its output fails a confidence or validation check. This cuts average cost and latency because most traffic is easy. The risk to guard against is quality regression on the requests that get the small model — so you must hold out an eval set per route, monitor the escalation/fallback rate, and tune the routing threshold rather than assuming the small model is good enough.
Model routing matches model to request difficulty instead of paying frontier prices for trivial work. Cheap/fast models handle the easy, high-volume majority (classification, extraction, formatting); the large model is reserved for hard or high-stakes calls. Implement it with rules (task type, length, calling feature), a lightweight router/classifier, or a cascade that starts small and escalates on a failed confidence/validation check. Average cost and latency drop because most traffic is easy. The guardrail is quality: the small model can silently regress on the requests it now handles, so you need per-route evals, monitoring of the escalation/fallback rate, and a tuned threshold — not a blanket assumption that the cheaper model suffices.
AI Engineering/ai-production/model-routing
This router is supposed to retry across PROVIDERS with backoff, falling through to the backup providers if the primary is down. Which line keeps it stuck on a single provider no matter how many are configured?#
const PROVIDERS = ["primary-a", "primary-b", "backup-c"];
async function routeRequest(prompt: string) {
for (let attempt = 0; attempt < 6; attempt++) {
try {
return await callProvider(PROVIDERS[0], prompt);
} catch (err) {
if (!isRetryable(err)) throw err;
await sleep(200 * 2 ** attempt);
}
}
throw new Error("all attempts exhausted");
}Show answer
The bug is on line 6.
Line 6 always calls PROVIDERS[0]. The loop varies attempt, and attempt is used correctly on line 9 to grow the backoff delay, but it is never used to select a different entry from PROVIDERS. So if primary-a is down, all six attempts retry the exact same dead provider with growing delays; primary-b and backup-c are configured but never called once, and the whole request fails even though healthy backups exist. Retry-with-backoff (line 9) is doing its job for a transient blip on one provider, but it is not a substitute for actually walking the fallback list. The fix is to index into PROVIDERS by attempt (e.g. PROVIDERS[attempt % PROVIDERS.length]), or, more cleanly, to separate the two concerns: retry the current provider a bounded number of times, then advance to the next provider in the chain.
Related interview questions
Job market
See ai-engineering salaries and hiring demand from live job postings.
The other 17 questions
This page shows 10 and marks what you pick. That's as far as a page can go. A free account opens the other 17 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.
Free · the whole bank · 100 marked answers per 30 days · written feedback on the paid plan