Module: L2-M04 · Duration: ~120 min (estimate, including the independent exercise) · Previous: L04 · Next: L2-M05-L01 (module Human Evaluation and Evaluator Reliability, not yet written)
1. Introduction
A calibrated judge (L04) can still fail quietly: someone changes one line of the rubric, the provider retires a model, an infrastructure update shifts behaviour, or the bill triples because a swap-order step was added. This lesson teaches three things so that a judge is measurable over time: record the judge configuration for every run (so you know whether two figures are comparable), estimate cost and stability, and monitor with a fixed canary set (unlike the tripwire of L2-M01-L03: a canary set has human labels so it can measure agreement).
The judge and labels in the lab are still simulated; prices are illustrative, not the price of any provider. What real models can do is quoted from documentation that was read (§12). The output of this lesson is a judge configuration record for every run, with a comparability check and a drift check.
2. Learning objectives
- Record a complete judge configuration and check it with a lint, computing its hash. Practice: §8.2 part A, §9 (TODO 4).
- Explain the difference between a pinned model and an alias, and decide whether two runs are comparable. Practice: §8.2 part A, §9 (TODO 1).
- Estimate cost from the number of calls, the number of order swaps and the number of repeats. Practice: §8.2 part B, §9 (TODO 2).
- Measure stability under repeated scoring. Practice: §8.2 part C.
- Detect a drifting judge with a canary set and state when it must be recalibrated. Practice: §8.2 parts D, E, §9 (TODO 3).
3. Prerequisites and tools
- L2-M04-L04: calibration, kappa, false-accept rate; L2-M01-L05: the decision rule based on the Wilson interval; L2-M01-L01: the dataset fingerprint.
- The code lab
code-labs/l2-m04(self-contained, simulated judge, no model calls).
4. Concepts
4.1 The judge configuration is part of the measurement
A score given by a judge depends on the model, prompt, rubric, temperature, whether orders are swapped and the number of repeats. Zheng et al. note that absolute scores fluctuate more than pairwise comparison results when the judge changes [R5 §3.1]: changing the judge changes the yardstick. So every run must record model, model_pinned, version, prompt_sha, rubric_sha (hashes of the prompt and rubric content), temperature, swap_orders, repeats and calibration_run (which calibration run vouches for this configuration), together with the dataset fingerprint. ops.lint_config checks that the fields are present and valid; ops.config_hash hashes normalised JSON into 12 characters (key order does not change the hash, one changed value does); ops.comparable(run_a, run_b) returns (True, []) only when the judge configuration and the dataset are the same, otherwise it returns a list of reasons.
4.2 Pinning a version
Anthropic states that each Claude model ID is a pinned version: the underlying model does not change for the lifetime of that ID. From generation 4.6 onward, a dateless ID such as claude-sonnet-4-6 is not a "latest" pointer but the snapshot itself; for older models, an alias such as claude-sonnet-4-5 points to the most recent dated snapshot. According to the same page, the serving infrastructure (the router, safety classifiers, sampling) can change, and sometimes causes small differences in behaviour even though the ID and weights do not change [R1]. Anthropic also says it regularly retires older models and each ID has its own deprecation schedule [R1, R2]. OpenAI's graders documentation lists the models usable for a score model grader by dated names, such as gpt-4o-2024-08-06 [R3].
The lesson for a judge: record the ID exactly as the provider defines it; know what "pinned" means at your provider (the two pages above speak for two providers, with different conventions); and keep monitoring anyway, because even a pinned ID can change behaviour because of infrastructure. The lab's lint requires the field model_pinned to be True and rejects names containing latest, alias or default, but that is only the configuration author's own declaration.
4.3 Cost
Number of calls = number of items × (2 if both orders are scored, otherwise 1) × number of repeats; units = number of calls × (prompt units + output units); cost = units × price / 1000. The lab uses words in place of tokens and a made-up price (0.01 dollars per 1000 units). Real price lists are per token, price input separately from output for each model, and also have entries for prompt caching and batch [R4]; the lab does not simulate them. Few-shot makes the prompt longer: Zheng et al. record that long prompts make each call 4 times as expensive [R5 §3.4].
4.4 Stability and drift
Anthropic lists "non-deterministic" as a weakness of model graders [R6]. OpenAI notes that for reasoning models the temperature cannot be changed [R3]: you cannot always set a temperature of 0. So measure stability instead of assuming it: score the same item k times and count the share of items whose scores are identical. Drift is when the same judge gives different results over time: an infrastructure update, a model replacement, or a change in the input data. The way to catch it: keep a small canary set with human labels, rescore it periodically and compare the agreement with the baseline measured at calibration. Descript, in Anthropic's example, uses an LLM grader with criteria set by the product team and calibrates against humans periodically [R6].
5. Technical deep dive
5.1 The configuration record and comparability
Part A of the demo: the complete configuration passes the lint ([]); the broken configuration (a model named judge-latest, a wrong model_pinned, no calibration_run) gives three problems. The hash of the good configuration is c9709317f65b, unchanged when the key order is reversed, and becomes b9164586d37a when rubric_sha changes by one character. Two runs with a different rubric_sha and a different dataset give comparable as False with two reasons: judge.rubric_sha: d4e5f6 -> d4e5f7 and dataset_fingerprint: d-1 -> d-2. A rise of 7 percentage points between two such runs says nothing yet about the system.
5.2 Cost and stability
Part B of the demo (400 items, prompt 220 and output 40 units, illustrative price): one pass gives 400 calls, 104000 units, 1.04; scoring both orders gives 800 calls, 2.08; both orders and three repeats give 2400 calls, 624000 units, 6.24. Cost multiplies with each choice: both orders (L03) and repeats are measures that raise reliability at a price.
Part C: the default judge scores the same 200 replies three times; among the 193 replies readable all three times, 169 have identical scores (7 replies with an unreadable run are dropped); with noise=0 and format_error=0 it is 200/200. In the simulation, what makes scores differ between repeats is only the noise term and the format errors; "being misled" and "seeing a condescending reply" are fixed blind spots of each reply (the lab is designed that way). A real judge is not stable in that way, and even at temperature 0 it is not certain to reach 100%.
5.3 Drift and the canary set
Part D (the judge with a reference answer, threshold 5 as in L04): the baseline judge matches the human label on 168/198 replies (false-accept rate 0.255); the same judge with lenience=15 (simulating an update that made it more lenient) matches 149/198 (false-accept rate 0.445). Nobody changed the prompt or rubric, yet the score of the system being scored will rise because the judge is more lenient. Part E: with a baseline of 85/100, four canary days give ['OK', 'WARN', 'ALERT', 'TOO_FEW'] corresponding to 86/100, 79/100, 72/100 and 25/29. canary returns TOO_FEW when n is below 30 (the lab's threshold), ALERT when the whole 95% Wilson interval of today lies below the baseline, WARN when the rate falls by more than 0.05 but the interval still touches the baseline, otherwise OK. pass_rate_shift compares the two Wilson intervals of the pass rate and reports SHIFT only when they do not overlap; overlapping intervals do not prove that there is no shift.
6. The QA perspective
6.1 What the lint, the hash and the canary set do not see
lint_configtrustsmodel_pinned; it does not know whether that ID is really fixed, whether the hash matches the real prompt, or whethercalibration_runis still valid.comparableonly compares the recorded fields: a change that was not recorded (the provider's infrastructure) does not show up here, which is why a canary set is needed.- The canary set only speaks for the distribution of the canary set: the judge may drift on kinds of replies that are not in it.
- The thresholds of 30, 0.05 and the rule based on the Wilson interval are chosen by the lab. With a small n almost nothing is detected.
- A good configuration does not replace calibration: it only tells you what was calibrated.
- The illustrative cost is not the real price; a real bill is per token and may have discounts for batch or caching.
6.2 When to recalibrate, and what to report for each run
Recalibrate when: the model, prompt or rubric changes; the dataset or the input distribution changes; the canary set reports ALERT (or a prolonged WARN); the provider announces a model retirement. Each run stores: the configuration record, the dataset fingerprint, the number of items, the number of unreadable outputs, the results, the cost and the configuration hash. Before comparing two runs, call comparable; if it returns False, rescore the old data with the new configuration instead of comparing two figures.
7. Real-world scenarios
Scenario 1 (fictional): "A 7-point jump overnight". The HocVui Tutor score rose by 7 percentage points compared with last week and someone wanted to announce it. comparable returned False with the reason that judge.rubric_sha changed, because someone had edited the rubric this week. The team rescored last week's outputs with the new rubric and found the rise was only 1 percentage point.
Scenario 2 (fictional): "The judge's model is about to be retired". A notice said that the model ID used as the judge would be deprecated. Because the configuration recorded the pinned ID, prompt_sha, rubric_sha and calibration_run, the team knew exactly which calibration to repeat with the replacement model, on the same dev and test sets, and compared kappa and the false-accept rate with the old version before switching.
8. Hands-on tutorial
8.1 Setup
cd academy-content/code-labs/l2-m04
python3 -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install -r requirements.txt
python -m pytest # 79 passed
8.2 Run the demo
python -m lab.demo l05
Output (copied from a real run on Python 3.14.6 and 3.12.14, 2026-11-03; the two versions give identical output):
A. config lint: good -> []
bad -> ['model_pinned must be True: record a pinned model id, not an alias that can move', 'the model name looks like a moving alias', 'no calibration_run: this judge was never compared with human labels']
hash good c9709317f65b same keys reordered c9709317f65b one field changed b9164586d37a
comparable(run1, run2): (False, ['judge.rubric_sha: d4e5f6 -> d4e5f7', 'dataset_fingerprint: d-1 -> d-2'])
B. cost of 400 items (illustrative price, words as units): calls / units / cost
one pass 400 104000 1.04
both orders 800 208000 2.08
both orders, 3 repeats 2400 624000 6.24
C. same judgment 3 times, noise 6 (default): identical on 169/193 items (7 unreadable)
C. same judgment 3 times, noise 0: identical on 200/200 items (0 unreadable)
D. baseline judge agreement 168/198 false-accept 0.255
D. same judge, lenience +15 agreement 149/198 false-accept 0.445
E. canary against a baseline of 85/100: ['OK', 'WARN', 'ALERT', 'TOO_FEW']
configs shipped in data/judge_configs.json: ['judge-sim fair (no bias, no noise)', 'judge-sim v1 (as shipped)', 'judge-sim v1 with the lenience drift']
Reading the output:
- A. Lint of a good and a broken configuration; the hash;
comparablewith two reasons. - B. Cost for three choices (illustrative price).
- C. Stability under repeated scoring, with and without noise.
- D. Simulated drift: matches fall from 168/198 to 149/198, the false-accept rate rises from 0.255 to 0.445.
- E. The four canary statuses; the last line lists the sample configurations in
data/judge_configs.json.
8.3 Try it yourself
Save it as try_l05.py in the lab's root folder (next to lab/), run python try_l05.py, then delete the file:
from lab import ops
cfg = {"model": "judge-sim-1", "model_pinned": True, "version": "v1", "prompt_sha": "a1b2c3",
"rubric_sha": "d4e5f6", "temperature": 0, "swap_orders": True, "repeats": 1, "calibration_run": "cal-001"}
print(ops.lint_config({**cfg, "model": "judge-default", "repeats": 0}))
print(ops.lint_config({**cfg, "model": "some-vendor-model"}))
e = ops.estimate({"items": 1000, "swap_orders": False, "repeats": 1, "prompt_units": 150, "output_units": 30})
print(e["calls"], e["units"], e["cost"])
print(ops.canary([80, 100], [75, 100]), ops.canary([80, 100], [74, 100]), ops.canary([80, 100], [24, 29]), ops.canary([80, 100], [24, 30]))
print(ops.pass_rate_shift([6, 10], [3, 10]), ops.pass_rate_shift([600, 1000], [500, 1000]))
Output (identical on Python 3.14.6 and 3.12.14):
['the model name looks like a moving alias', 'repeats must be an int >= 1']
[]
1000 180000 9/5
OK WARN TOO_FEW OK
NO_SHIFT SHIFT
Reading: line 1 reports two problems (a name that looks like an alias, repeats equal to 0); line 2 is a blind spot: an unfamiliar name still passes the lint because the lint trusts model_pinned; line 3: 1000 calls, 180000 units, cost 9/5 (1.8, illustrative); line 4: a drop of exactly 0.05 is still OK (the tolerance is inclusive), a drop of 0.06 is WARN, and n equal to 29 is TOO_FEW while n equal to 30 is scored; line 5: a drop of 30 points on 10 items is not detected, a drop of 10 points on 1000 items is.
8.4 Run the lesson's tests
python -m pytest tests/test_l05_ops.py tests/test_data.py -v
Result: 19 passed (14 tests for this lesson, 5 data checks). Read test_the_lint_trusts_the_pinned_flag_it_cannot_verify, test_canary_statuses_and_boundaries and test_a_silent_lenience_drift_is_visible_to_the_calibration_set_and_to_the_canary.
8.5 Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
lint_config returns missing ... |
The configuration lacks a key from ops.REQUIRED |
Add all nine keys |
ValueError: items must be a positive int |
The number of items is 0 or not an integer | Pass a positive integer |
comparable is always False |
The dataset or rubric really differs | Read the list of reasons; rescore, do not compare |
9. Independent exercise
Problem: Compare two judge runs, estimate the cost of a scenario, read a canary series and record the configuration for your own judge.
Requirements: complete exercises/test_l05_ops.py:
- TODO 1: fill in
COMPARABLE(True/False) andREASONS(a list of reasons) for the two runs inexercises/ops.json. - TODO 2: fill in
COST(a fraction string"p/q") andCALLSfor the scenario inops.json, using the lab's illustrative price. - TODO 3: fill in
STATUSES: the canary status for the four days against the baseline inops.json. - TODO 4: fill in
MY_CONFIG: a complete judge configuration for your own judge (all nine keys ofops.REQUIRED) that passeslint_config, withswap_ordersequal toTrue, a model other thanjudge-sim-1and a hash different from the configuration of the first run.
Test data: exercises/ops.json (two runs, a baseline, four canary days, a scenario).
Deliverable: the four groups of variables at the top of the file exercises/test_l05_ops.py.
Acceptance criteria: python -m pytest exercises/test_l05_ops.py passes (4 tests). The test recomputes every value from ops.json with lab.ops; the test does not check whether the model you record is real.
Hint: read each field of the two runs carefully before calling comparable; for cost, work out each step by hand (the number of calls, then the units) and compare with ops.estimate; for the canary, watch for a day with a small n and a day whose drop is just beyond the tolerance.
10. Knowledge check
0/18 done · Results are kept in this browser only.
P02 · True or false
P04 · Select all that apply
P05 · Put in order
P06 · Match
P07 · Spot the bug
The cost-estimate function below gets the factor wrong when repeats is greater than 1: the real bill is three times the estimate with repeats = 3. Find the bug.
calls = scenario["items"] * (2 if scenario["swap_orders"] else 1)
units = calls * (scenario["prompt_units"] + scenario["output_units"])
cost = units * price_per_1k_units / 1000P08 · Short answer
HocVui Tutor's pass rate this week is higher than last week by 6 percentage points (made-up number). ops.comparable(run_cu, run_moi) returns (False, ['judge.prompt_sha: 9f8e7d -> 9f8e7e', 'judge.swap_orders: False -> True']) (run_cu is the old run, run_moi the new run). What do you do with the 6-point increase?
P09 · Essay
HocVui wants to monitor a calibrated judge (agreement 0.85 with humans at calibration time, with 100 labeled canary items). Write 5-8 sentences: how do you set up the canary, how often do you regrade, what do you do at each status, and when do you recalibrate?
P11 · Recall
Lesson: L2-M04-L04P12 · Recall
Lesson: L2-M04-L02P13 · Multiple choice
P14 · True or false
P15 · Select all that apply
P16 · Fill in the blank
P17 · Short answer
The provider announces that the model ID you use as the judge will be retired. Your configuration has a pinned ID, prompt_sha, rubric_sha and calibration_run. What do you do before switching to the replacement model?
P18 · Multiple choice
11. Summary
- Concepts: the judge configuration is part of the measurement; pinning a version; cost multiplies with the number of calls; stability is measured by repeated scoring; drift is caught with a canary set; recalibrate when the configuration or the data changes.
- Skills: lint and hash a configuration,
comparable, estimate cost, repeated scoring, a canary set based on the Wilson interval. - Traps: comparing the scores of two different judges; trusting a "pinned" name without reading the provider's convention; not recording the configuration; dropping the canary set because "it is pinned"; treating the illustrative cost as a real price.
- You can now: for each run, store enough for others to know which judge scored, whether it is comparable and whether it can still be trusted; and close the module with a judge that is calibrated, has known biases and has its configuration recorded.
12. References
| ID | Title | Publisher | URL | Accessed | Relevance |
|---|---|---|---|---|---|
| R1 | Model IDs and versioning | Anthropic | https://platform.claude.com/docs/en/about-claude/models/model-ids-and-versions | 2026-11-03 | Whole page: pinned IDs, aliases, infrastructure changes |
| R2 | Model deprecations | Anthropic | https://platform.claude.com/docs/en/about-claude/model-deprecations | 2026-11-03 | Read the beginning: model status, deprecation |
| R3 | Graders | OpenAI | https://developers.openai.com/api/docs/guides/graders | 2026-11-03 | Whole page; the list of models for a score model grader, temperature |
| R4 | Pricing | Anthropic | https://platform.claude.com/docs/en/about-claude/pricing | 2026-11-03 | The price table section; input, output, caching, batch |
| R5 | Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena (Zheng et al., 2023) | arXiv | https://arxiv.org/abs/2306.05685 | 2026-11-03 | Full-text PDF; §3.1, §3.4 |
| R6 | Demystifying evals for AI agents | Anthropic | https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents | 2026-11-03 | Whole page; model graders, periodic calibration |
Key terms (English ↔ Vietnamese)
| English | Tiếng Việt |
|---|---|
| Pinned model ID / alias | ID model ghim phiên bản / alias (con trỏ có thể đổi) |
| Judge configuration | Cấu hình judge ghi theo từng lần chạy |
| Canary set | Tập canary: mục có nhãn người, cố định, để bắt trôi |
| Drift | Trôi: cùng judge cho kết quả đổi theo thời gian |
| Repeat consistency | Độ ổn định khi chấm lặp |
| Comparable runs | Hai lần chạy so được với nhau |