The interview problem

Practice prompt

Route an assistant's requests between a fast inexpensive model and a slower, more capable model. Reduce total cost while preserving task success and a latency objective. Handle unfamiliar requests, provider outages and expensive retries.

Original practice, informed by model-routing research rather than a reported interview. Reviewed September 26, 2026. Model names, prices and performance assumptions below are hypothetical.

1. Define the objective and allowed choices

Clarify task types, success criteria, deadlines, privacy constraints and whether streaming is required. Assume support drafting and document extraction, with an abstention or human-review path for unsupported tasks. Define a quality floor separately for each important task class; aggregate preference scores can hide rare but consequential failures.

Minimize expected cost per successful task subject to quality and latency constraints. Costs include routing, model calls, retries, validation and human review. A model is eligible only if it supports the required context, output format, tools and data-handling boundary. Spend 5 interview minutes on objectives, 10 on labels, 10 on routing, 10 on evaluation and 10 on operational failure.

2. Filter eligibility before predicting difficulty

Logical flow: authenticated request → capability/policy filter → router → budget admission → chosen model → task validator → response or bounded escalation. Store a routing decision ID with router version, eligible model set, selected model version, features, score, threshold and eventual outcome. Record queue state used for the decision so later analysis can explain a latency failure.

Begin with transparent rules: unsupported context lengths, required structured output and explicit user model selection determine eligibility; simple known tasks may use the cheaper model. A learned router should estimate the benefit of using the stronger model, not merely classify whether the prompt looks long. Short arithmetic or ambiguous instructions can be harder than a long templated extraction.

Keep policy constraints outside the statistical score. A high predicted quality gain does not authorize sending private data to an ineligible provider. If no eligible model can meet the request, explain the limitation instead of silently weakening the contract.

3. Collect labels that match the decision

Sample representative authorized tasks and obtain outputs from both models offline. Label task success, relative quality and latency using independent checks and blinded human comparisons where appropriate. A preference winner can still be wrong; retain absolute success labels. Preserve ties and evaluator disagreement rather than forcing every example into a confident winner.

Train a lightweight router using request features such as task family, language, input length and learned representations. Split by time and related task/customer groups to reduce leakage. Compare against always-cheap, always-strong and simple-rule baselines. Set thresholds on held-out data according to the quality floor and capacity, then evaluate on a separate test set.

Production logs reveal outcomes only for selected models. Training exclusively on them creates selection bias: hard tasks routed to the strong model provide little evidence about cheap-model success. Use a bounded, authorized shadow sample or carefully designed exploration where failures are acceptable. Do not send sensitive prompts to additional models solely for experimentation without the required data permissions.

4. Include escalation in the economics

Assume one million requests, a $0.002 cheap-model cost and a $0.020 strong-model cost per request at the observed workload. Route 70% cheaply and 30% directly to the strong model. Base cost is 700,000 × $0.002 + 300,000 × $0.020 = $7,400. If 10% of cheap-path requests escalate, another 70,000 strong calls cost $1,400. At $0.0001 routing cost per request, total becomes $8,900, versus $20,000 for always-strong: 55.5% savings before other costs.

This is worthwhile only if quality meets the constraint. If 25% of cheap requests escalate, total becomes $11,000, not $7,400. Request-level prices here assume comparable token lengths; production accounting must use actual input/output lengths and pricing categories. Longer outputs from one model can erase an apparent per-token advantage.

At an arrival rate of 100 requests/second, the first scenario sends 30 + 7 = 37 requests/second to the strong model on average. Provision for correlated bursts, not just that average. With illustrative 0.4-second cheap and 1.2-second strong service times, sequential escalation needs at least 1.6 seconds before routing, validation and queueing. A one-second end-to-end objective cannot hold for that path without changing the policy or service times.

5. Decide when escalation is justified

Use deterministic validators for properties they can establish: schema validity, required fields, executable tests or citation existence. These do not prove factual correctness. A model's self-reported confidence is not a calibrated probability of success. If a learned failure detector triggers escalation, evaluate its false negatives and extra cost separately from the initial router.

For streaming answers, replacing a half-delivered cheap answer with a stronger answer can confuse users and repeat content. Choose the route before streaming, delay delivery until a validation boundary, or explicitly restart with a visible explanation. Parallel hedging reduces some latency but pays for both calls unless cancellation actually stops billable work.

Bound escalation depth and preserve one logical task identity. A timeout does not prove the first provider stopped running. Avoid repeatedly switching providers during an outage; circuit breakers, queue limits and explicit degraded modes are more predictable than unlimited fallback.

6. Check the whole routing policy

Plot quality against total cost at several thresholds, with uncertainty intervals and slices for language, task type, length and customer segment. Measure end-to-end p95/p99 latency from complete request traces; averaging path percentiles is invalid. Track abstentions, escalations and failed tasks in the denominator instead of reporting success only among completed answers.

Canary a policy against the existing baseline with predefined quality, cost and latency stop conditions. Use a stable task mix or account for mix changes. A price decrease or model upgrade changes the decision boundary; version the policy and rerun evaluation rather than assuming an old router transfers perfectly.

Monitor router feature drift, model eligibility failures, per-path queue time and cost per successful task. When the router is unavailable, use an explicitly configured eligible fallback with budget controls. Always-strong may exceed capacity or budget; always-cheap may violate quality. Neither is automatically a safe default.

7. Defend the trade-off

Foundation: distinguish cheap first from direct routing. Senior: show how escalation changes cost and latency. Staff: adapt to a provider outage without violating privacy or hiding quality degradation.

Score 0–2 each for eligibility rules, relevant labels, complete economics, unbiased evaluation and bounded failure recovery. Full marks require mechanisms and limits. Continue with usage accounting and probability calibration.

Sources and next steps

The architecture, examples and acceptance criteria here are original practice. The paper's benchmark results are not guarantees for this hypothetical workload.

Continue your preparation

Choose a connected learning path or browse more ML system design questions. Read our editorial method and attribution policy.