Skip to content
mentoor

Topic 4 of 6 · 4 min read

A test-set-first model switch

Goal: Write a switch plan that runs a test set, compares results, rolls out in stages and can roll back.

A safe model switch tests first, moves traffic in small steps and can be undone in minutes. The order is: golden test set, side-by-side run, staged rollout, rollback ready. Skip one and you learn about the problem from users.

Check yourself · 1 of 3

What belongs in a golden test set for a model switch?

Choose one answer

Why it matters

Hand testing shows whether the new model works. It does not show how often it fails, or on which kind of input. Only a fixed set of cases, run on both models, tells you whether quality went up, down or sideways, and by how much.

The steps

  1. Build a golden test set. 50 to 200 real inputs from your logs, with the expected answer or a clear grading rule. Include the hard and odd cases: empty input, very long input, other languages, requests that should be refused. Remove personal data first.
  2. Fix the metrics. Decide what counts as pass before you see results: exact match, a rubric, a judge model with checked grading, plus latency and cost per call. Write the bar down, such as "no more than 1 point below current quality, cost not above 120%".
  3. Run side by side. Same prompt, same inputs, old model and new model. Read the cases that differ, not only the average. A flat average can hide a new failure class.
  4. Fix and rerun. Adjust parameters first, then the prompt if needed, and rerun the whole set. Do not hand pick the winners.
  5. Stage the rollout. Shadow mode first, where the new model runs on live input but users see the old answer. Then 5% of traffic, then 25%, then all. At each step watch error rate, refusals, latency, cost and user signals such as thumbs down.
  6. Keep rollback ready. The switch is a config flag, not a deploy. Name who flips it and which metric triggers it. Keep the old model available until the new one has run a full cycle.

Before and after

Before: "Tried it on 5 prompts, looks better, shipped Friday."

After:

Switch plan: ticket-summary, model A -> model B
1. Golden set: 120 tickets from March logs, PII removed, 15 edge cases
2. Bar: rubric score >= current - 1, p95 latency <= 4 s, cost <= 120%
3. Side-by-side run, review all differing cases, fix prompt, rerun
4. Shadow 3 days, then 5%, 25%, 100%, one day each
5. Rollback: flag summary.model=A, owner on call, trigger: error rate > 2%

What goes wrong

  • Test set from the demo. It misses the cases that fail in production.
  • Judging by the average. One class of input can fall off a cliff while the mean moves 0.2.
  • Going 100% on day one. There is nothing to roll back to once the old model's capacity is gone.

Examples

Average hid a failure

A switch kept the average score at 91 against 92. Reading the differing cases showed every German input had dropped from 90 to 60. The team added German cases to the set, fixed the prompt and rerun before any user saw the problem.

Shadow mode catches cost

In shadow mode the new model's answers were 1.8 times longer. Quality was equal but the cost per call was above the bar. The team added a length instruction, reran the set and then started the 5% stage.

Key points

  • Write the pass bar before running the comparison so results cannot move the goalposts.
  • A golden test set comes from real inputs and includes empty, long, odd and should-refuse cases.
  • Read the cases that differ between models, because an unchanged average can hide a new failure class.
  • Roll out in stages from shadow mode to a small share to all traffic, watching errors, refusals, latency and cost.
  • Rollback must be a config flag with a named owner and a trigger metric, not a new deploy.

Common mistakes

  • Testing on a handful of demo prompts instead of a set drawn from real traffic.
  • Deciding what counts as better after seeing the scores.
  • Moving all traffic at once, with no tested way back.
  • Removing the old model from config as soon as the new one is live.

Check yourself · 2 of 3

In a staged rollout, what is shadow mode?

Choose one answer

Check yourself · 3 of 3

A rollout reaches 25% and the error rate climbs. The plan says rollback is a config flag. What should happen next?

Choose one answer

Practice items, not counted towards your mastery.

Start here