Home / AI Architecture & System Design / AI System Design

AI System DesignMidQuestion 7 of 20

How would you evaluate a new model before switching production traffic to it?

30-second answer

Run it on the offline golden set covering quality, safety and format adherence, and compare against the current model with the same prompts (adjusting prompts if needed). Check latency and cost. Then shadow traffic or a small canary with online metrics and guardrail rates, followed by a staged rollout with a quick rollback path.

Try answering out loud before reading on. The walkthrough below is paced for a 40-minute interview round.

New to these terms? 9 terms on this page are explained in the glossary

0–5 min Functional requirements

Treat this as designing an evaluation and rollout process, not a one-off comparison.

You Why are we considering a switch? Cost, quality, latency, or the old model being deprecated?

Interviewer The new model is cheaper and supposedly better. The current one is also being deprecated in three months.

You Which features use the model?

Interviewer Five: a support assistant, document summarization, ticket classification, a coding helper, and an agent that uses tools.

You What's most dangerous to get wrong?

Interviewer Safety regressions in the support assistant, and the agent breaking because it calls tools differently.

# Functional requirement Why it matters
F1 Evaluate the candidate per feature on quality, format, safety and tool use One overall score hides regressions
F2 Compare against the current model on identical inputs Differences, not absolute scores, drive the decision
F3 Support prompt adaptation per feature before judging Models respond differently to the same prompt
F4 Test on live traffic without user impact (shadow), then a staged rollout Offline sets never cover everything
F5 Roll back instantly Surprises happen
F6 Produce a written decision record with the evidence Reproducibility and accountability

5–10 min Non-functional requirements and estimates

Requirement Target What it forces in the design
Statistical confidence Detect a 3-point drop in any key metric per feature Enough cases per category; paired tests
No regressions No significant drop in any feature × category; safety metrics never worse Gates per category, not just overall
Time to decision ≤ 3 weeks from start to 100% Automated harness; parallel feature work
Reproducibility Pinned model versions, prompts, decoding settings, seeds Versioned eval runs
Cost Evaluation spend a small fraction of monthly model spend Sized eval sets; shadow on a sample
Rollback ≤ 5 min Per-feature flags

Back-of-envelope estimates:

  • How big must eval sets be? For a pass/fail metric around 90%, the standard error of the difference between two models on n independent cases is about √(2 × 0.9 × 0.1 / n). With n = 400, that's ~2.1 points, so a 3-point drop is only ~1.4 standard errors: not reliably detectable. Paired comparisons (same cases, count which flipped) are far more sensitive, because most cases pass or fail for both models. With paired testing, ~400 cases per category usually detects a 3-point change.
  • Offline cost: 5 features × ~1,000 cases × 3 repeats × 2 models × ~3,000 tokens ≈ 90M tokens per full run. Affordable; run it on every candidate and prompt change.
  • Shadow cost: mirroring 5% of traffic for 3 days roughly adds 5% to that period's model spend.

10–18 min High-level design

You Offline evaluation per feature, then shadow, canary and ramp, each with explicit gates. Feature flags make every stage reversible.

Scroll sideways to see the whole diagram.

Model rollout pipeline with gatesComponents: Candidate model (pinned version); Golden sets (per feature + safety); Offline eval (paired, per category); Shadow traffic (outputs not shown); Canary (1–5% of users); Ramp (25% → 50% → 100%); Online metrics (success · feedback · cost); Feature flag (instant rollback). Flow: Golden sets to Offline eval; Candidate model to Offline eval; Offline eval to Shadow traffic (gate); Shadow traffic to Canary (gate); Canary to Ramp (gate); Online metrics to Canary (monitor); Feature flag to Canary; Ramp to Feature flag (rollback).Candidate modelpinned versionGolden setsper feature + safetyOffline evalpaired, per categoryShadow trafficoutputs not shownCanary1–5% of usersRamp25% → 50% → 100%Online metricssuccess ·feedback · costFeature flaginstant rollbackgategategatemonitorrollback
Model rollout pipeline with gates. Offline evaluation on per-feature golden sets, then shadow traffic, a small canary and a staged ramp. A feature flag allows instant rollback at every stage.

Components:

  • Golden sets per feature: real inputs with references or rubrics, tagged by category; plus safety sets (policy violations, false refusals, jailbreaks) and tool-use sets (correct tool, valid arguments, recovery from errors).
  • Eval harness: runs both models with pinned settings, repeats stochastic cases, and applies graders.
  • Graders: exact match, programmatic checks (schema, tests, tool-call validity), and LLM judges with rubrics, calibrated against human labels.
  • Report: per feature × category deltas with confidence intervals, plus latency, output length and cost.
  • Shadow runner: mirrors live requests to the candidate and stores outputs for comparison.
  • Flags and monitors: per-feature routing and online metrics with rollback triggers.

Scroll sideways to see the whole diagram.

Offline evaluation harnessComponents: Golden sets (per feature, safety, tools); Prompts (best per model, frozen); Runner (pinned versions, 3 repeats); Baseline model (current); Candidate model; Graders (exact · programs · judge); Report (feature × category, CIs); Human labels (judge calibration); Gates (pass or block). Flow: Golden sets to Runner; Prompts to Runner; Runner to Baseline model; Runner to Candidate model; Baseline model to Graders; Candidate model to Graders; Graders to Report; Report to Gates; Human labels to Graders (calibrate).Golden setsper feature,safety, toolsPromptsbest per model, frozenRunnerpinned versions,3 repeatsBaseline modelcurrentCandidate modelGradersexact ·programs · judgeReportfeature × category, CIsHuman labelsjudge calibrationGatespass or blockcalibrate
Offline evaluation harness. Both models run on the same golden sets with pinned versions, each with its best (frozen) prompt, repeated to average out sampling noise. Graders range from exact match to calibrated LLM judges; the report shows per-feature, per-category deltas with confidence intervals, and hard gates can block.

Decision record (one per feature):

feature: support-assistant      candidate: model-B@2026-09-01   baseline: model-A@2026-03-15
prompt: support_v14 → support_v15 (adapted for B)
quality:   groundedness +1.2 (95% CI −0.4…+2.8)   helpfulness (judge) +3.1 (+1.0…+5.2)
safety:    policy violations 0.3% → 0.2%          false refusals 2.1% → 4.0%  ✗ gate
format:    citation format 99.6% → 99.8%
latency:   p95 3.1 s → 2.2 s        cost/request −38%
decision:  BLOCKED on false refusals; fix prompt, re-run safety set

How it works: a worked example

A study aid: one candidate model traced through the whole pipeline for one feature, from the offline run to 100% traffic, with the actual artefacts each stage produces.

The scenario. You're switching the support assistant from model A to model B.

Week 1 · Offline run. The eval harness takes the feature's golden set (1,200 cases in 8 categories, plus 400 safety cases) and runs both models with pinned settings:

run: support-assistant/2026-11-10-B-vs-A
baseline:  { model: model-A@2026-03-15, prompt: support_v14, temperature: 0.2 }
candidate: { model: model-B@2026-09-01, prompt: support_v15, temperature: 0.2 }
repeats: 3              # stochastic cases run 3 times; majority result kept
graders:
  - groundedness: llm_judge(rubric=grounded_v3)   # calibrated: 91% agreement with humans
  - citation_format: regex
  - handoff_correct: exact_match(label.should_handoff)
  - safety: policy_classifier + judge

Paired results for one category, refund questions (n = 180):

             A passes   A fails
B passes        161         9      ← 9 cases B fixed
B fails           3         7      ← 3 cases B broke
McNemar: (9 − 3)² / (9 + 3) = 3.0  → not significant at 95% (needs > 3.84)

So B looks better on refunds but isn't proven better; it's clearly not worse, which is what the gate requires.

Week 1 · Decision record shows one blocked gate: false refusals 2.1% → 4.0%. The team adds two examples to the prompt (support_v16) and re-runs only the safety set: 2.3%. Gate passes.

Week 2 · Shadow. 5% of live requests are mirrored to B for 3 days; users only ever see A's answers. A nightly job judges 2,000 random pairs side by side (position-swapped) and compares latency, length and cost. B wins 54% / ties 30% / loses 16%; p95 latency 3.1 s → 2.2 s.

Week 3 · Canary and ramp via the feature flag:

flag support_assistant.model: A=95% B=5%   (24 h)  → thumbs-down 6.1% vs 6.0%, escalations equal
                              A=75% B=25%  (48 h)  → same
                              A=0%  B=100%           rollback = flip the flag (seconds)

Automatic rollback triggers stay armed for a week: thumbs-down +1 point, escalation rate +10% relative, or any safety incident.

Where each piece runs:

Component Runs as Example technology If it fails
Golden sets Versioned files/tables with labels Git LFS or a dataset store; one per feature Changes need review, like code
Eval harness Batch job in CI, triggered by model or prompt changes Python harness (e.g. Inspect, promptfoo, in-house) Re-run; results are reproducible from pinned versions
Graders Code checks + judge model calls Judge on a separate model family Judge drift is caught by a fixed human-labelled anchor set
Shadow runner Async consumer of mirrored requests Queue + workers Lost shadow requests don't matter; users are unaffected
Feature flags Flag service read by the model gateway LaunchDarkly, Unleash, config service Defaults to the baseline model
Online monitors Dashboards + alert rules on logged metrics Metrics store + alerting Pages the owning team

18–32 min Deep dive

You The parts that usually go wrong are fair comparisons, prompt adaptation, the online rollout, and the statistics. Where should I start?

Interviewer How do you make the comparison fair?

Deep dive 1 · A fair comparison

  • Same inputs, same graders, pinned versions for both models. Use explicit model versions, never floating aliases.
  • Repeat stochastic cases (3–5 runs) and compare pass rates, not single samples.
  • Judges: use a judge from a different model family than either candidate to avoid self-preference; randomize the order in pairwise comparisons; calibrate against ~200 human-labelled cases and report agreement.
  • Per-category reporting: break results down by intent, language, difficulty and input length. Averages hide the regressions that cause incidents.
  • Non-quality metrics: output length (drives cost and latency), refusal rate, tool-call error rate, latency percentiles.

Interviewer You mentioned adapting prompts. Isn't that unfair to the old model?

Deep dive 2 · Prompt adaptation

Prompts are tuned to a model's habits, so running the old prompt on a new model often underrates it. The fair comparison is each model with its best prompt:

  • Start with the current prompt to see raw differences, then adapt (format instructions, examples, tool descriptions) and re-run.
  • Watch typical differences: verbosity, refusal style, Markdown habits, how strictly it follows schemas, and tool-calling behaviour (parallel calls, argument formats, when it decides to call a tool).
  • Tokenizer differences change context budgets and costs; re-check truncation limits.
  • Freeze the adapted prompt before the final run, so you aren't tuning on the test set. Keep a held-out slice.

Deep dive 3 · Online rollout

Scroll sideways to see the whole diagram.

Rolling out a new model, per featureOne feature's rollout: Offline eval + prompt adaptation 5 days, Shadow 5% (not shown) 3 days, Canary 1% 2 days, Ramp 5% → 25% → 50% 5 days, 100% on new model 14 days, Old model behind the flag 14 days, Remove old model 1 days; full rollout at 15 days; total 30 days.One feature's rollouttotal 30 daysOffline eval + prompt adaptation5 daysShadow 5% (not shown)3 daysCanary 1%2 daysRamp 5% → 25% → 50%5 days100% on new model14 daysOld model behind the flag14 daysRemove old model1 daysfull rollout 15 days051015202530days
Rolling out a new model, per feature. Offline evaluation and prompt adaptation first, then shadow traffic, a 1% canary and a staged ramp with automatic rollback triggers. The old model stays available behind the flag for two weeks after full rollout.
Stage Traffic Gate to continue
Shadow Mirror 5%, not shown Error rate, latency, judge scores on live inputs; no new failure clusters
Canary 1% of users per feature Task success, thumbs-down, escalation rate, guardrail triggers within thresholds
Ramp 5% → 25% → 50% Same metrics with tighter confidence; cost per request as expected
Full 100% Keep the old model available behind the flag for 2 weeks

Automatic rollback triggers: error rate × 2, guardrail block rate × 1.5, thumbs-down rate up by a set threshold, or p95 latency above the SLO. Roll out per feature: the classifier can move to the new model while the agent waits for a fix.

Deep dive 4 · Statistics (if time allows)

  • Paired tests: for pass/fail metrics, count flips (fixed vs. broken) and use McNemar's test or a sign test. For scores, bootstrap confidence intervals of the mean difference.
  • Multiple comparisons: with 5 features × 8 categories × several metrics, some differences will look significant by chance. Pre-declare the key gates, or adjust thresholds.
  • Online A/B: randomize by user, run long enough for weekly patterns, and use metrics with known variance.

32–37 min Trade-offs

Decision Chosen Alternative Why
Evidence Per-feature golden sets + live shadow Public benchmarks Your inputs and failure modes decide
Prompts Each model with its best prompt Same prompt for both Fairer, and it's what you'd ship
Comparison Paired, repeated, per category Single run, overall average Detects real regressions with fewer cases
Judges Different model family, calibrated Candidate judges itself Avoids self-preference bias
Rollout Per feature, staged, flags Switch everything at once Limits blast radius; features move independently
Safety Hard gates that can block Weighted into an overall score Safety regressions shouldn't be traded for quality

Build first: the harness with pinned versions and per-category reports, and per-feature flags. Then shadow tooling and automatic rollback.

37–40 min Wrap-up and likely follow-ups

Close with: "I'd evaluate per feature on quality, format, safety and tool use, comparing both models on identical inputs with paired, repeated runs and calibrated judges. Each model gets its best prompt, frozen before the final run. Then shadow, canary and ramp per feature with automatic rollback triggers, and a written decision record for each feature."

Likely follow-ups:

  • What if the new model wins overall but loses on one category? Investigate first; fix the prompt, route that category to the old model temporarily, or delay that feature.
  • How do you handle a forced deprecation? Start early, keep the harness ready, and evaluate several replacements in parallel.
  • How do you detect silent provider updates? A scheduled run of a small canary eval set against pinned and alias endpoints, alerting on drift.

What interviewers listen for

  • Per-feature, per-category evaluation including safety, format and tool use.
  • Fair comparison: best prompt per model, paired tests, judge bias awareness.
  • A staged rollout with explicit gates and fast rollback.
  • Some statistical literacy about sample sizes and noise.

Red flags

  • "It scores higher on public leaderboards, so switch."
  • One overall average.
  • No rollback plan.

Discussion

Help us improve our content — give feedback. Spotted an error, have a better explanation, or got asked a follow-up in a real interview? Share it here.