Proving a Model Upgrade Is Ready: A Frozen Golden Set, a Calibrated Judge, the Right Layer and a Release Gate
A maintenance triage classifier runs on a Haiku-tier model and a newer tier is out. Replay a frozen 12-case golden set, calibrate the judge against people, find a format drift, and let a small gate decide hold or stage.
What you will learn
- Build a small golden set that is independent of the prompt and frozen as a version
- Trust an LLM judge only after it agrees with people above a bar you set
- Tell a format drift in the integration layer from a real model error
- Write a release gate that holds on the binding constraint and stages a canary when it passes
Before you start
- Building a golden dataset for LLM evals
- LLM-as-judge basics
- Basic Python
A block of flats has a maintenance desk. A tenant writes: The heating has been off since last night and it is freezing. A classifier reads that and puts it in one of three queues:
- urgent: send someone now,
- schedule: a routine repair,
- redirect: not a repair, the office handles it.
Today the classifier runs on a Haiku-tier model, in service. A newer tier is out, and the obvious question is whether it can take over. One rule matters more than any other: no urgent request may be missed. A higher overall score is not proof of that. The proof has to come first.
Pinning the model ID and staging the rollout are covered in pinning Claude model IDs and upgrading safely. This walk-through is about the proof itself.
Five steps before a switch
The example project runs against a stand-in: the real Anthropic SDK talks to a mock transport that answers like the Messages API. Every reply is scripted test data, not a measurement of a real model. The point is the process, not the scores.
Step 1: a golden set that is fair
Here's a tempting mistake. The team wrote the triage prompt using last week's requests as examples, then built the golden set from those same requests. The prompt scores well. Of course it does: it has seen the answers.
A golden set only measures something if it is independent of the prompt and frozen. This one has 12 cases, covers every label, includes one edge case (a smoke alarm that only chirps), and changes only as a new version.
"""Golden set golden-v1 for maintenance triage. Frozen: it changes only as golden-v2."""
VERSION = "golden-v1"
CASES = [
{"id": "g01", "expect": "urgent",
"text": "There is a strong smell of gas in the stairwell."},
{"id": "g03", "expect": "urgent",
"text": "The heating has been off since last night and it is freezing."},
{"id": "g09", "expect": "redirect",
"text": "Please move my parking permit to my new car."},
{"id": "g11", "expect": "redirect",
"text": "My neighbour plays loud music at night."},
{"id": "g12", "expect": "schedule",
"text": "The smoke alarm chirps once a minute, probably the battery."},
# ... 12 cases in all: urgent 4, schedule 5, redirect 3
]
EXPECT = {c["id"]: c["expect"] for c in CASES}
Three ways this goes wrong: padding the set with near copies of the same requests (no new coverage), letting the classifier propose its own labels (the set then measures the model against itself), and editing cases whenever the prompt changes (the target moves and hides a regression). More on writing cases in building a golden dataset.
Step 2: replay, and look at the misses
The same 12 cases go to each model, and each answer is compared with the expected label. Notice the replay keeps two kinds of miss apart: a real wrong label, and a label that is right after normalising.
def run(client, model):
exact, wrong, drift = 0, {}, {}
for case in golden.CASES:
raw = classify.ask(client, model, case["text"])["label"]
if raw == case["expect"]:
exact += 1
elif classify.normalize(raw) == case["expect"]:
drift[case["id"]] = raw
else:
wrong[case["id"]] = raw
return Result(model, exact, wrong, drift)
def normalize(label):
return label.strip().lower()
golden-v1 12 cases urgent 4 schedule 5 redirect 3
claude-haiku-5-5 (in service)
exact match 9/12
g03 expected 'urgent', got 'schedule'
g09 expected 'redirect', got 'Redirect'
g12 expected 'schedule', got 'urgent'
g09 is format drift: the label is right, the spelling is not
after normalizing 10/12 urgent 3/4
Look at g09, the parking permit. The model said Redirect with a capital R. An exact comparison marks it wrong and accuracy reads 75 percent. But the model's answer was right. The failure sits in the integration layer, in the check, not in the model. The fix is to compare normalised labels, or to constrain the label with structured outputs. Moving to a bigger tier or adding more redirect examples would aim at the wrong layer. Writing it down as an accepted exception would hide the symptom until the next spelling drift.
Step 3: trust the judge only after it agrees with people
The classifier also writes a one-line reason, and a judge model grades each reason. Before you believe the judge, people grade the same 12 reasons, and you measure how often the judge agrees with them. Picking a bigger judge model doesn't show agreement with your people. Asking the judge to explain itself gives you a confident paragraph, not a measurement. Running the judge twice and keeping matches only shows it is consistent, and a judge can be consistently lenient.
JUDGE_V1 = (
"You grade the reason given for a triage label. "
"Answer pass if the reason sounds sensible, otherwise fail."
)
JUDGE_V2 = (
"You grade the reason given for a triage label. Answer pass only if the "
"reason names the detail in the request that decides the label, and fits "
"the label. A short or vague reason fails. Judge content, not length."
)
judge claude-opus-5-5 against people (12 reasons)
judge-v1 agree 9/12 = 75% bar 85% not trusted
judge-v2 agree 11/12 = 92% bar 85% trusted
The first prompt accepts anything that "sounds sensible", including a reason like Seems fine. It agrees with people 9 times out of 12, below the 85 percent bar. The revised prompt says what a passing reason must contain, and agrees 11 times out of 12. The bar is your own number. The full method is in LLM-as-judge: write a rubric and check every verdict.
Step 4: the gate
Now the candidate tier gets the same replay:
claude-sonnet-5-5 (candidate)
after normalizing 11/12 urgent 4/4
fixed g03 g12
broken g11
It gets every urgent case right, fixes the heating case and the smoke alarm, and breaks one case: the noise complaint, which it now sends to scheduling. Is that good enough? The gate decides, in a few lines of plain code. It is your own release rule, not a platform feature.
"""Release gate: may a candidate model take over?"""
import golden
# The judge must agree with people this often.
BAR = 0.85
def gate(judge_rate, now, cand):
if judge_rate < BAR:
return "hold", "judge not trusted yet"
urgent = [c for c in cand.wrong
if golden.EXPECT[c] == "urgent"]
if urgent:
return "hold", "urgent missed: " + ", ".join(urgent)
broken = sorted(set(cand.wrong) - set(now.wrong))
note = ", ".join(broken)
return "stage", "canary first, broken: " + note
- If the judge is below the bar, nothing else is worth reading. Hold.
- If the model misses any urgent case, hold. That is the binding constraint from the scene.
- Cases the old model got right and the candidate gets wrong are listed, not hidden.
- If all of that passes, the answer is stage, not "switch".
gate
judge-v1, candidate -> hold: judge not trusted yet
judge-v2, today's model -> hold: urgent missed: g03
judge-v2, candidate -> stage: canary first, broken: g11
Note the middle line: today's model fails its own gate, because it misses the heating case. Staying put isn't the safe option either.
Step 5: stage it
Passing the golden set earns a staged rollout, not a full switch. Send a small share of requests to the candidate, watch urgent misses and the broken noise case, and keep the old model pin ready. A full switch now would skip the watch period and the way back. Jumping to the largest tier instead would be a guess, since it was never replayed on the golden set. For the rollout mechanics, see shadow, canary and rollback.
Recap
| Step | What it protects against |
|---|---|
| Frozen golden set, independent of the prompt | A score that only measures what the prompt has already seen |
| Replay with exact and normalised comparison | Blaming the model for a check that is too strict |
| Judge calibrated against people | Trusting grades from a lenient grader |
| Gate on the binding constraint | A higher average hiding a missed urgent case |
| Canary with the old pin ready | Finding the broken case in production with no way back |
Prove it, then stage it.
Try it yourself
Add a thirteenth case to a golden-v2, say "The front door lock is broken and won't close", and decide its label before you run anything. Then add a second rule to gate(): hold if more than one case breaks. Which result changes?
Related course on Udemy
Claude Certified Developer - Foundations (CCDV-F) Exam Prep
Build and ship Claude apps: the API, agents, tools and MCP, prompts, evals, security and model choice.View on Udemy ↗: Claude Certified Developer - Foundations (CCDV-F) Exam Prep (paid course, opens in a new tab)Related posts
The Claude Messages API: Your First Call, Field by Field
One request in, one Message out. The four fields of a Messages API call (model, max_tokens, system, messages), how to read content blocks, stop_reason and usage, and why every turn resends the history.
Claude Tool Use: How tool_use and tool_result Work in the Messages API
Follow one order question through Claude's tool round trip: define a tool, read the tool_use block, run your own function and send a matching tool_result back, including parallel calls and is_error.
Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
Every Claude client SDK wraps the same REST request: a POST to /v1/messages with a JSON body. See it built by hand, through the Python and TypeScript SDKs, as typed errors, and as async calls that wait together.
Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
Configure the Anthropic SDK client (timeout, max_retries, with_options, async, pagination), see which errors it retries by itself, then repair a retry wrapper so a 429, a 529, a 400 and a timeout each get the move the docs support.