Evals 2: Graders, LLM Judges, and the Statistics of Evals
An eval is only as good as the thing that scores it. This page covers how to pick the scorer, how to prove an LLM judge agrees with your expert, and how to tell whether a change in the score is real.
Graders: code checks, reference metrics, LLM judges, humans
After error analysis you have a list of named failure modes, and after dataset work you have traces to test. Now you need something that looks at a trace and says pass or fail. That something is a grader — any function that takes a model output (and often the input, a reference, or the full trace) and returns a score. Everything in the rest of this guide, from CI gates to A/B tests, is only as good as the graders under it.
The rule of this section is simple: use the cheapest grader that can see the failure. Graders form a ladder. Higher rungs are cheaper, faster and give the same answer every run. Lower rungs can judge more things but cost more, vary more, and need proof that they can be trusted. In the Phase 3 build you wrote llm-rubric assertions in promptfoo (Week 12). Here we look at what is under that one line, and when it is the wrong choice.
Rung 1: code-based checks
A code-based check is ordinary code that inspects the output or the trace and returns true or false. It has no model in it, so it costs nothing, runs in milliseconds, and gives the same answer every time. If a failure can be written as an if statement, write the if statement.
For the support copilot, these failure modes need no model at all:
- Format. The draft must be valid JSON with
replyandtonefields. Parse it with a schema validator. - Tool-call rules. "Never call
issue_refundfor more than $50 unless a human approved it." This is a check on the trace, not on the reply text. - Argument correctness. The
order_idpassed toget_ordermust be the one in the ticket. - Limits and banned strings. Reply under 180 words. No internal ticket tags such as
[INTERNAL]. No competitor names. - Execution. If an agent writes code (a SQL query for a report, a script), run it in a sandbox and check the exit code and output. This is the strongest check there is for code: SWE-bench-style benchmarks grade by running tests, not by reading the patch.
Here is the refund rule as a check. It reads a trace shaped like the ones you collected in Evals 1: Error analysis: read your data before you measure it: a list of steps, each with a tool name, arguments and an approval flag.
def refund_rule_ok(trace: list[dict], limit: float = 50.0) -> tuple[bool, str]:
"""Fail if any issue_refund call is over the limit without approval."""
for step in trace:
if step.get("tool") != "issue_refund":
continue
amount = float(step["args"]["amount"])
if amount > limit and not step.get("human_approved", False):
return False, f"refund ${amount:.2f} issued without approval"
return True, "ok"Note what this check does not say. It does not care what the reply tells the customer. A trace can pass this check and still send a reply that promises a refund that never happened. Each check covers one failure mode, and you need one check per mode.
Rung 2: reference-based metrics
A reference-based metric compares the output with a known-good reference answer and returns a number. They are cheap and need no model, but they need a reference for every test case, and they only work when the reference is a good stand-in for "correct".
- Exact match — output equals the reference after cleaning (lower-case, trim). Right for closed answers: ticket category, a refund-eligible yes/no, an extracted order ID.
- F1 (token overlap) — treat output and reference as bags of words; precision is the share of output words that are in the reference, recall is the share of reference words that are in the output, F1 is their harmonic mean. Fine for short extractive answers.
- BLEU and ROUGE — count overlapping n-grams (runs of 1, 2, 3 words) between output and reference. BLEU came from machine translation and leans on precision; ROUGE came from summarization and leans on recall.
- Embedding similarity — turn both texts into vectors and take the cosine. It sees meaning more than word overlap does.
For open-ended text, word-overlap metrics fail for a plain reason: there are many correct replies and the reference is only one of them. "I've sent your refund request to billing" and "Billing now has your refund request" share almost no words and mean the same. In the other direction, "Your refund is approved" and "Your refund is not approved" share most of their words and mean opposite things. Liu et al. (EMNLP 2016) tested these metrics on dialogue and found they "correlate very weakly with human judgements" in a casual domain and show almost none in a technical one. That was for dialogue systems, but the failure is built into the method, so you should expect it for support replies too.
Embedding similarity has its own traps. Embeddings capture topic better than truth: a reply that says the opposite about the same refund policy often scores very close to the right reply in vector space, because both are "about refund policy". A threshold such as "cosine above 0.85 means pass" therefore passes confident wrong answers. Embeddings are a good tool for retrieval (Evals 3: Evaluating RAG: retrieval and generation, separately) and for finding near-duplicate traces in a dataset (Evals 1: Eval datasets: golden sets, synthetic data, coverage). They are a weak tool for deciding that a reply is correct.
Where reference metrics earn their place: classification-shaped steps of the copilot, where the answer is one of a fixed set. A router that labels each ticket as billing, bug, how-to or other should be scored with exact match against human labels, plus a per-class precision and recall. You do not need a judge for that.
Rung 3: LLM-as-judge
An LLM judge is a second model call that reads the trace (and a rubric) and returns a verdict. It is the only automated rung that can read meaning, so it is the one you use for "did the reply promise something the policy does not allow". It is also the rung most likely to give you a confident, wrong number. Treat it as an instrument that must be calibrated — that is the whole of Trusting your judge: validating LLM-as-judge.
Three ways to ask the question
| Mode | What the judge sees | Use it for |
|---|---|---|
| Direct scoring | One output and a rubric | Absolute checks on one failure mode, run on every trace. The default. |
| Reference-guided | Output, rubric and extra ground truth (policy text, KB articles, gold answer) | Anything where the judge cannot know the facts alone. Cuts false passes. |
| Pairwise | Two outputs, A and B; picks the better | Choosing between two prompt versions or models. Subtle quality gaps. Needs order swapping (Known judge biases, and how to test for them). |
Direct scoring cannot tell you which of two versions is better by itself, but it gives you a pass rate you can track over time. Pairwise gives you a win rate, which is easier for a judge (comparing is easier than scoring) but says nothing about whether either version is acceptable. Use pairwise when you are choosing, direct scoring when you are gating.
Binary with a critique, not a 1 to 5 scale
Hamel Husain recommends binary pass/fail verdicts, each with a written critique, and warns against Likert scales when you are starting out: "People don't know what to do with a 3 or 4." The reasons are practical:
- Humans disagree more on a 5-point scale. Two experts rarely agree on 3 versus 4, so you cannot measure judge agreement cleanly (Trusting your judge: validating LLM-as-judge) — there is no ground truth to agree with.
- Scales drift. A judge's "4" shifts when the model, the prompt or the output style changes. A pass/fail line anchored to a written rule shifts less.
- A pass rate is a count of failures you can fix. An average of 4.1 is not. You cannot open a ticket titled "raise 4.1".
The trade-off is real: a binary verdict throws away gradation. If you need it, split the one scale into several binary questions ("Is the policy cited? Is the next step stated?") instead of keeping one fuzzy number.
One judge per failure mode
Do not write one judge that scores "overall quality". It will merge your five failure modes into one number that moves for reasons you cannot name, and its rubric will be too vague to validate. Write one judge per failure mode, each with a rubric of a few lines that decides one thing. In the Evals 1: Error analysis: read your data before you measure it sample of 100 traces, 41 failed, and only one mode needed meaning to detect: promises a refund the policy does not allow (10 traces). The others were mostly checkable by code or by trace inspection (did it call get_order? did it escalate?). So you start with one judge. If the suite grows to five (say promises_beyond_policy, unsupported_by_kb, dismissive_tone, missed_the_question, wrong_next_step), each can be validated on its own labels, and each gives a pass rate that points at one fix.
A real judge for one failure
The failure: the reply promises something the refund policy does not allow. This is a reference-guided judge: it gets the relevant policy text, because without it the judge would guess. The rubric is concrete, with a pass example and a fail example taken from real traces.
You are grading one reply from a support copilot. Decide one thing:
does the reply PROMISE the customer something our refund policy does
not allow?
REFUND POLICY (the only source of truth):
- Refunds up to $50 can be issued by the copilot.
- Refunds over $50 need human approval. The copilot may only say a
request has been submitted for review; the team replies within
1 business day.
- Refunds are for purchases in the last 30 days.
- Never state or imply a delivery or refund date not listed here.
FAIL if the reply does any of these:
- says or implies a refund over $50 has been, or will be, issued
- gives a refund date or amount the policy does not give
- offers a refund for a purchase older than 30 days
- guarantees an outcome ("we guarantee", "you can count on")
PASS if the reply stays inside the policy, even if unhelpful.
Do not grade tone, accuracy of other facts, or length.
Example, FAIL:
Ticket: order of $120, 12 days ago, item arrived broken.
Reply: "Sorry about that! I've refunded the $120. You'll see it
in your account by Friday."
Critique: Issues a $120 refund (over $50, needs approval) and
gives a date the policy does not allow.
Example, PASS:
Ticket: same.
Reply: "Sorry about that. I've asked our billing team to review
a $120 refund. You'll hear from them within 1 business day."
Critique: Stays within policy: submits for review, names the
allowed time frame, promises no outcome.
Write the critique first (2-3 sentences, quote the offending
words if any), then give the verdict.The code that calls it uses the Anthropic Python SDK. Three things in it are current as of October 2026 and differ from older tutorials. First, the model id is claude-sonnet-5-5; every Claude model id is a pinned snapshot, so using the id is pinning. Second, structured output is done with messages.parse() and a Pydantic model, which sends the schema as output_config.format and validates the reply. Third, Sonnet 5.5 returns a 400 error if you set temperature, top_p or top_k, so the old advice "set temperature to 0 for the judge" no longer applies; handle variance by measurement instead (see the trap below).
from typing import Literal
import anthropic
from pydantic import BaseModel
JUDGE_MODEL = "claude-sonnet-5-5" # pinned snapshot id
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY
class Verdict(BaseModel):
critique: str # field order = generation order:
verdict: Literal["pass", "fail"] # reasoning first, then the verdict
def judge_promises(ticket: str, reply: str) -> Verdict:
resp = client.messages.parse(
model=JUDGE_MODEL,
max_tokens=2000, # thinking tokens count toward this
system=PROMISE_JUDGE_PROMPT, # the prompt above
messages=[{"role": "user", "content":
f"TICKET:\n{ticket}\n\nREPLY:\n{reply}"}],
output_format=Verdict,
)
return resp.parsed_output # a validated Verdict objectWhy the critique field comes first: a model writes its output left to right, so a verdict written before the reasoning is a guess that the reasoning then defends. Putting the critique first makes the verdict follow from it. The critique has a second use that matters more in practice: when the judge and a human disagree, you read the critique to find out which of them misread the rubric. This exact snippet was not run against the live API when this guide was written; the parameters come from the current Messages API and structured-outputs docs, so run it once on three known traces before you trust it.
Choosing the judge model, and what it costs
The judge should be at least as capable at the judging task as the model being judged, but it does not have to be the biggest model. The task is narrow: read a short policy and one reply. Start with a mid-tier model, validate it (Trusting your judge: validating LLM-as-judge), and only move up if TPR or TNR is poor. Also consider using a different model family from the one that wrote the reply, because models tend to prefer their own output (Known judge biases, and how to test for them).
The cost is small but it multiplies. Assume the prompt above plus a ticket and reply is about 1,500 input tokens and the critique and verdict are about 300 output tokens. At Sonnet 5.5 prices ($2 per million input tokens, $10 per million output) that is 1,500 × $2/1M + 300 × $10/1M = $0.003 + $0.003 = $0.006 per check. The copilot handles about 400 tickets a day. If the suite grows to five judges, running all five on every ticket costs 400 × 5 × $0.006 = $12 a day, or $4,380 a year. One judge alone is $2.40 a day. The Batch API takes 50% off (about $2,190 a year for five) for runs that can wait, and prompt caching on the shared policy prefix cuts input cost further (cache reads are 5% of the input price on Sonnet 5.5). Adaptive thinking adds output tokens you also pay for, so measure real usage from resp.usage before you budget.
Rung 4: human grading
A human grader is a person who reads the trace and applies the rubric. Humans are the most expensive rung and the slowest, and they are also the only source of ground truth. You do not use them to grade everything. You use them where nothing else works:
- To create the labels that validate every judge (Trusting your judge: validating LLM-as-judge). This is the main job.
- For new failure modes you have not yet turned into a rule — the open-ended reading of Evals 1: Error analysis: read your data before you measure it.
- For judgment calls with money or trust at stake: refund edge cases, legal wording, a customer who is clearly upset.
- For periodic audits of a judge that has been running unattended (Drift: the judge changes, and so do your criteria).
Three rules make human grading usable. Write the rubric first, as pass/fail rules with examples, the same text you will later give the judge. Use a domain expert: for the copilot that is a senior support agent who knows the refund policy, not an engineer guessing. Measure agreement between humans on a shared sample of 30 to 50 traces using Cohen's kappa (Measure: TPR, TNR, and why accuracy misleads). If two experts disagree, the rubric is unclear and no judge can fix that. A rubric that humans cannot agree on is a rubric problem, and it is cheaper to find it now.
Which grader for which failure
Walk down the ladder for each failure mode you found in error analysis. Stop at the first rung that can actually see the failure.
| Failure mode (support copilot) | Grader | Why |
|---|---|---|
| Draft is not valid JSON, field missing | Code: schema validator | Pure format; zero cost. |
| Refund over $50 issued without approval | Code: trace rule | Visible in tool calls; no need to read the reply. |
| Wrong order ID quoted in reply | Code: compare with get_order result | The truth is in the trace. |
| Ticket routed to the wrong category | Reference: exact match + per-class recall | Closed set of labels. |
| Reply promises beyond policy | LLM judge, reference-guided (policy) | Needs meaning; policy text fixes the facts. Validate. |
| Reply states facts not in the KB articles | LLM judge, reference-guided (retrieved articles) | Needs meaning (see Evals 3: Evaluating RAG: retrieval and generation, separately). |
| Tone is dismissive to an upset customer | Human first, then a judge | Subjective; label 100 before automating. |
| New prompt vs old prompt: which is better? | Pairwise judge (both orders), humans on ties | Choosing, not gating. |
| Policy is ambiguous for this case | Human expert | The rule itself is in question. |
Next: every judge from rung 3 is a classifier, and so far you have no idea how good a classifier it is. Trusting your judge: validating LLM-as-judge shows how to find out.
Trusting your judge: validating LLM-as-judge
An LLM judge is a classifier whose labels you are about to use to make product decisions. Nobody ships a fraud classifier without measuring its precision and recall on labeled data. A judge gets the same rule. An unvalidated judge is an unvalidated instrument: the number it reports might track quality, or it might track reply length, or the judge's own taste. You cannot tell which by reading the number.
This section is a recipe. A domain expert labels a set of traces. You split the labels three ways. You tune the judge on one part and measure it, once, on another. You report TPR and TNR instead of accuracy. Then you use those two numbers to correct the pass rate the judge reports. The recipe follows the workflow Hamel Husain describes in his LLM-judge guide and the research behind it (Shankar et al., Lee et al.); where the guide adds its own judgment, it says so.
What "the judge works" means
For one failure mode, the judge makes a binary call on each trace. Call a good trace a pass and a bad one a fail. Compare the judge with a human expert on the same trace:
- True positive (TP) — human says pass, judge says pass.
- False negative (FN) — human says pass, judge says fail. A good reply gets blocked. Cost: wasted engineering time chasing a phantom failure.
- False positive (FP) — human says fail, judge says pass. A bad reply gets through. Cost: a real failure you do not see.
- True negative (TN) — human says fail, judge says fail.
In this section "positive" means pass. That matches the correction formula in Iterate, then correct the pass rate for judge error. If you care mostly about catching failures, you can swap the labels and talk about precision and recall on failures; recall on failures is the same number as TNR here. Pick one convention and write it at the top of every judge report.
Label a set, then split it three ways
Start with human labels. A principal domain expert — for the copilot, a senior support agent who knows the refund policy — reads each trace and writes a pass/fail verdict plus a one- or two-sentence critique. The critique is not decoration: the best ones become few-shot examples, and they are how you find out why the judge and the expert disagreed.
Sample on purpose. A random sample of production traces is mostly passes. With 10% of replies breaking the policy, a random 200 gives about 20 failures, and your estimate of how well the judge catches failures rests on 20 cases. Instead, build a stratified set: pull failures you found in error analysis (Evals 1: Error analysis: read your data before you measure it) and passes from the same period, aiming for roughly half and half. (In the Evals 1: Error analysis: read your data before you measure it sample, only 10 of 100 traces had the refund-promise failure, so a random 200 would give you about 20 failures.) Balanced labels do not bias TPR or TNR, because each is a rate within one class. They do bias raw accuracy, which is one more reason not to use accuracy (Measure: TPR, TNR, and why accuracy misleads).
Now split. For 200 labeled traces, 100 pass and 100 fail, this guide uses:
| Split | Size | Job |
|---|---|---|
| Train | 40 | Source of the 2 to 4 few-shot examples inside the judge prompt. Pick clear ones, both classes. |
| Dev | 60 | Run the judge, read every disagreement, edit the prompt, run again. These examples stay out of the prompt. |
| Test | 100 (50 pass, 50 fail) | Untouched until the prompt is frozen. Run once. This is the number you report. |
Husain and Shankar's evals FAQ says to plan for 100 to 200 labeled examples per failure mode, with about 10 to 20% in train, 40 to 45% in dev and 40 to 45% in test, and at least 50 passes and 50 fails overall so you can diagnose disagreements in both classes. This split puts more in test (50%) than the FAQ does, because the test split decides how wide your interval is (Iterate, then correct the pass rate for judge error) and the few-shot pool needs only a handful of examples. Treat the counts as a starting point. The shape is the part that matters: a small train set for examples, a dev set for iteration, and a test set run once on a frozen prompt.
Measure: TPR, TNR, and why accuracy misleads
Run the frozen judge on the test split and fill in the table. Here is the result for the "promises beyond policy" judge on the 100 test traces:
TPR = TP / (TP + FN) = 45 / 50 = 0.90 TNR = TN / (TN + FP) = 40 / 50 = 0.80TPR: of the traces a human passed, the share the judge passed. TNR: of the traces a human failed, the share the judge failed.
Why not just report accuracy, here (45 + 40) / 100 = 0.85? Because accuracy mixes the two classes in whatever ratio your data has, and when failures are rare it hides how the judge treats them. Husain makes this point directly: a judge that always says "pass" scores 95% agreement when only 5% of examples fail. Compute our judge on the same 5%-failure data: 0.95 × 0.90 + 0.05 × 0.80 = 0.895. Our real judge looks worse than the useless one, 89.5% against 95%, although it catches 80% of failures and the useless one catches none. Accuracy ranked them backwards. TPR and TNR do not depend on how common failures are, which is why they transfer from your balanced test set to production.
Human-human agreement comes first. A judge cannot agree with humans more than humans agree with each other. Have two experts label the same 50 to 100 traces, then compute Cohen's kappa — agreement corrected for the agreement you would get by chance. With observed agreement po and chance agreement pe (computed from how often each rater says pass):
κ = (po − pe) / (1 − pe)κ = 1 is perfect agreement, κ = 0 is no better than chance.
Example: two experts label 100 traces. Both pass 70, both fail 15, A passes and B fails 8, A fails and B passes 7. Then po = 85/100 = 0.85. A passes 78 and B passes 77, so pe = 0.78 × 0.77 + 0.22 × 0.23 = 0.651. κ = (0.85 − 0.651) / (1 − 0.651) = 0.57. Raw agreement of 85% sounds fine, but κ = 0.57 is only moderate by the usual rough convention (0.41 to 0.60), and it tells you the rubric has gaps. Read the 15 disagreements together, fix the rubric text, and re-label. Do this before you build the judge, because the rubric you write for the humans is the rubric you give the judge.
Iterate, then correct the pass rate for judge error
Iterate on dev. Run the judge on the dev split, list every disagreement, and read both critiques. Most fixes are one of four kinds: the rubric is vague (add a rule), the boundary is unclear (add an example), the judge lacks a fact (add the policy text), or the human was wrong (fix the label, and tell the other raters). Re-run. Husain reports reaching over 90% agreement in three iterations in his example; yours may take more or fewer. Stop when TPR and TNR are good enough for the decision the number feeds. A judge that gates a release needs a high TNR (missing a bad reply is costly). A judge that sorts a review queue can live with a lower one.
Then correct. A judge with TPR below 1 or TNR below 1 reports a pass rate that is wrong in a known direction. Suppose the true pass rate is θ. The judge passes a good trace with probability TPR and passes a bad trace with probability 1 − TNR. So the pass rate you observe is:
pobs = θ · TPR + (1 − θ) · (1 − TNR)Observed pass rate = real passes the judge keeps + real fails the judge lets through.
Solve for θ and you get the estimator:
θ̂ = (pobs + TNR − 1) / (TPR + TNR − 1)Clip to [0, 1]. It breaks when TPR + TNR is near 1, which means the judge is no better than chance.
This is the Rogan–Gladen estimator (Rogan and Gladen, 1978), from epidemiology, where it corrects the share of people testing positive for the error of the test. In the primary sources, Lee et al. (2025, arXiv 2511.21140, "How to Correctly Report LLM-as-a-Judge Evaluations") apply the same formula to LLM judges (their q1 is sensitivity, or TPR, and q0 is specificity, or TNR) and require q0 + q1 > 1. The judgy Python package, published under the ai-evals-course GitHub organization, implements the same correction with a bootstrap interval. One thing to know: Husain's judge article itself tells you to report TPR and TNR on unseen data but does not give this formula. The formula comes from the epidemiology and the Lee et al. paper, and from tooling around Husain and Shankar's course.
Worked example. The judge has TPR 0.90 and TNR 0.80 on the test split. You run it on 2,000 new production traces and it passes 1,640, so pobs = 0.820. Then θ̂ = (0.820 + 0.80 − 1) / (0.90 + 0.80 − 1) = 0.62 / 0.70 = 0.886. The judge was too harsh overall: it fails 10% of good replies and catches only 80% of bad ones, and with this prevalence the false alarms outnumber the misses. The correction is 6.6 points.
Two more facts follow from the same numbers. First, the correction multiplies noise: 1 / (TPR + TNR − 1) = 1 / 0.70 = 1.43, so a 3-point change in the observed pass rate means roughly a 4.3-point change in the true one, and any sampling noise grows by the same factor. Second, look at what the judge's fail flags mean at production prevalence. The true fail rate is 1 − 0.886 = 11.4%, about 229 of 2,000 traces. The judge flags 360. About 229 × 0.80 = 183 are real failures and about 177 are false alarms, so only 51% of flags are real. If a person triages those flags, they will see one false alarm for every real failure, and they will stop reading.
Now the interval. TPR and TNR are themselves estimates from 50 passes and 50 fails, so θ̂ has two sources of uncertainty: the test split and the production sample. A bootstrap handles both: resample the test pairs with replacement, resample the production verdicts, recompute θ̂, repeat 5,000 times, and take the 2.5th and 97.5th percentiles.
import random
def rates(human, judge):
"""human, judge: lists of 1 (pass) / 0 (fail) -> (TPR, TNR)."""
pos = [j for h, j in zip(human, judge) if h == 1]
neg = [j for h, j in zip(human, judge) if h == 0]
return sum(pos) / len(pos), sum(1 - j for j in neg) / len(neg)
def corrected(p_obs, tpr, tnr):
"""Rogan-Gladen: true pass rate from the judge's observed rate."""
denom = tpr + tnr - 1
if denom <= 0.05:
raise ValueError("judge is barely better than a coin flip")
return min(1.0, max(0.0, (p_obs + tnr - 1) / denom))
def bootstrap_ci(human, judge, prod, n_boot=5000, seed=7):
rng = random.Random(seed)
k, out = len(human), []
for _ in range(n_boot):
i = [rng.randrange(k) for _ in range(k)]
try:
tpr, tnr = rates([human[x] for x in i], [judge[x] for x in i])
p = sum(rng.choices(prod, k=len(prod))) / len(prod)
out.append(corrected(p, tpr, tnr))
except (ValueError, ZeroDivisionError):
continue
out.sort()
return out[int(0.025 * len(out))], out[int(0.975 * len(out))]
human = [1] * 50 + [0] * 50 # test split: expert labels
judge = [1] * 45 + [0] * 5 + [0] * 40 + [1] * 10 # judge verdicts, same traces
prod = [1] * 1640 + [0] * 360 # judge verdicts, 2,000 new traces
tpr, tnr = rates(human, judge)
p_obs = sum(prod) / len(prod)
print(f"TPR={tpr:.2f} TNR={tnr:.2f}")
print(f"observed={p_obs:.3f} corrected={corrected(p_obs, tpr, tnr):.3f}")
lo, hi = bootstrap_ci(human, judge, prod)
print(f"95% CI: {lo:.3f} to {hi:.3f}")TPR=0.90 TNR=0.80
observed=0.820 corrected=0.886
95% CI: 0.789 to 1.000The interval is 0.789 to 1.000: the upper end is the clip at 1. That is honest. With only 50 failures in the test split, TNR could plausibly be anywhere from about 0.67 to 0.89 (a 95% Wilson interval for 40 of 50), and the formula divides by TPR + TNR − 1, so small changes in TNR swing the answer. Lee et al. give a closed-form interval for the same estimator; for these numbers it agrees (about 0.78 to 1.0 after truncation). Rerun with a 300-trace test split (150 pass, 150 fail) at the same rates and the interval tightens to 0.824 to 0.959.
What goes in a judge's validation report
Keep one short record per judge, next to the prompt in version control. A reviewer who reads it should be able to decide in two minutes whether to trust the number.
- Identity: failure mode, convention ("positive = pass"), judge model id, prompt hash, rubric version.
- Data: who labeled, how many labels, the train/dev/test sizes, and how many fails are in the test split.
- Results: TPR and TNR with 95% intervals, the flip rate across two runs, and TNR on short versus long replies.
- Human ceiling: Cohen's kappa between two experts on the shared sample.
- Known limits: what the judge was not tested on (for example, non-English tickets), and the date to re-check.
Known judge biases, and how to test for them
A judge is a language model, so it brings language-model habits. Zheng et al. (2023, "Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena") named the main three and measured how strong judges such as GPT-4 can reach over 80% agreement with human preferences, about the level of agreement between humans, despite them:
| Bias | What happens | Mitigation and test |
|---|---|---|
| Position bias | In a pairwise comparison, the judge favors the answer shown first (or second). | Run both orders. Count a win only if both agree; call the rest a tie. Test: the share of pairs whose verdict flips on swap. |
| Verbosity bias | Longer answers win, even when the extra words add nothing. | Write "length is not quality" in the rubric. Test: in your labeled set, compare reply length for judge-pass against human-pass. |
| Self-enhancement bias | A model rates its own outputs higher than other models' outputs. | Judge with a different model family than the generator. Test: score the same replies with two judge families and compare. |
Later work sharpens each point. Shi et al. (2024, "Judging the Judges") studied position bias on 15 judges and over 150,000 evaluations, and found it is not random chance, varies a lot across judges and tasks, and depends most on the quality gap: it bites hardest when the two answers are close, which is exactly the case you use pairwise comparison for. Panickssery et al. (2024) showed that models can recognize their own text and that the strength of self-preference tracks that recognition, so the bias is not only a quirk of one family. A further finding in the literature is that judges are better at confirming good output than at catching bad output, which is the TNR below TPR you saw in our example.
Position bias only matters for pairwise judges. Verbosity and self-preference matter for direct scoring too. The copilot's binary judges are exposed to verbosity bias: if the "promises beyond policy" judge sees a long, hedged reply, it may pass it because it sounds careful. Add a length check to your validation: split the labeled set into short and long replies, and compute TNR on each.
Drift: the judge changes, and so do your criteria
Judge drift is when the same judge prompt gives different verdicts because the model under it changed. Current Claude model ids are pinned snapshots, so storing claude-sonnet-5-5 in your config pins the model; an alias that moves to a new snapshot would not. Pinning is necessary but does not last: Anthropic publishes a retirement date for each model (not sooner than September 28, 2027 for claude-sonnet-5-5, at the time of writing), and at some point you migrate. The rule is: a judge is the triple of model id, prompt text and rubric version, and any change to any one of them means re-running the test split. Store all three with every result, and compare TPR and TNR before and after. Because you will touch the test split on each migration, it ages into a dev set; refresh it with newly labeled production traces at least once a year.
Criteria drift is a human problem. Shankar, Zamfirescu-Pereira, Hartmann, Parameswaran and Arawjo (2024, "Who Validates the Validators?") studied people building and aligning LLM evaluators and named it: "users need criteria to grade outputs, but grading outputs helps users define criteria." You cannot write the perfect rubric first, because you do not know what bad outputs look like until you have read some. So your labels from the first day and the labels from the fiftieth day apply slightly different standards. If you ignore this, the judge is validated against a moving target, and some of its "errors" are the label noise.
Four practices keep it under control. These are practical suggestions built on that finding, not recommendations from the paper:
- Label in rounds. Label 30 traces, update the rubric, then continue. Record the rubric version on every label.
- Re-label a sample of your own early labels. After 100 labels, re-grade 20 of the first 30 without looking at the old answers. If you disagree with yourself on more than 2 or 3, the criterion is still moving.
- Add rubric rules for each argument you had. Every disagreement between raters should end as one more line or example in the rubric.
- Schedule a re-check. Label about 30 fresh production traces each month, run the judge on them, and watch TPR and TNR. A drop means a model change, a new failure mode, or a rubric that no longer matches what the team cares about.
Validation is not a gate you pass once. It is a maintenance task with an owner and a date. The statistics of evals: noise, sample size, error bars turns the interval you just computed into a rule for how much change in a pass rate you can believe, and Evals 5: Leading with evals: launch reviews, model migrations, ownership covers who owns the re-check.
The statistics of evals: noise, sample size, error bars
Your new prompt scores 87% and the old one scored 84%. Ship it? Most teams say yes. Often that 3-point gain is noise, and the next run would show the reverse. This section gives you the tools to know when it is real. It follows Evan Miller's Anthropic paper Adding Error Bars to Evals (2024), which argues that evals are experiments and should be analysed like experiments.
It pairs with Evals 1: Eval datasets: golden sets, synthetic data, coverage, which is about which cases to include. Here the question is how many.
Two sources of noise
A pass rate on a fixed set looks like a fact. It is an estimate, with two kinds of error.
- Question sampling noise — your 100 cases are a sample from all the tickets you could get. A different 100 would give a different score. Even a perfectly stable model has this error.
- Model non-determinism — the same model on the same question can pass once and fail the next time. Miller calls the spread inside one question the conditional variance.
Miller's framing: imagine the questions were drawn from a very large (unseen) population of questions. The score you want is the average over that population. Your set is one random draw from it. This idea is what makes the formulas below valid.
Standard error and the 95% interval
Standard error (SE) — how much a measured average would typically move if you repeated the whole measurement with a fresh sample. Small SE means a steady number.
For pass/fail scores, where each case is 0 or 1 and the pass rate is p over n cases:
SE = √( p(1 − p) / n ) 95% interval ≈ p ± 1.96 × SE Miller derives this from the Central Limit Theorem. It holds for any score with finite variance when n is large enough. For scores that are not 0/1 (such as a 0-1 F1), use the sample standard deviation of the case scores instead: SE = s / √n. The pass/fail formula is then too wide.
Worked numbers, pass rate 85%:
| Cases n | SE (points) | 95% interval |
|---|---|---|
| 50 | 5.0 | 85 ± 9.9 |
| 100 | 3.6 | 85 ± 7.0 |
| 200 | 2.5 | 85 ± 4.9 |
| 400 | 1.8 | 85 ± 3.5 |
| 1000 | 1.1 | 85 ± 2.2 |
So 85% on 100 cases really means "somewhere between 78% and 92%". A move from 84% to 87% is far inside that. It tells you nothing.
The curve shows why more cases has diminishing returns. Error shrinks as 1/√n, so halving the interval costs four times the cases.
How many cases do you need?
Turn the question around. You want to detect a real change of size δ. Miller gives a sample-size formula from power analysis. Power is the chance that your eval notices a difference when one truly exists. Minimum detectable effect (MDE) is the smallest difference you can reliably notice.
n = (zα/2 + zβ)² × V / δ² Where V is the variance of the per-question difference between the two systems, δ is the effect you want to detect, zα/2 = 1.96 for a 5% false-positive rate, zβ = 0.84 for 80% power. So (1.96 + 0.84)² ≈ 7.8. Miller's V for paired data also includes the within-question sampling variance divided by the number of answers drawn per question.
Worked example. You compare two versions at around 80% and 85% and want to detect a 5-point gain.
- Two separate groups of questions (unpaired): V = 0.8×0.2 + 0.85×0.15 = 0.2875, so n = 7.8 × 0.2875 / 0.05² ≈ 900 cases.
- Same questions for both versions (paired), where the two versions disagree on 17% of cases: V ≈ 0.17 − 0.05² = 0.1675, so n ≈ 525 cases.
- If they disagree on only 10% of cases (a small prompt tweak): n ≈ 306 cases.
All of this assumes the real gap is 5 points. For a 2-point gap the numbers grow by 6.25× (the square of 5/2). Most prompt tweaks give 1-3 points. A 400-case set cannot tell you about them. Decide before you run: what is the smallest change I would act on, and can this set see it?
Paired comparisons: same questions, both versions
The second big idea: when comparing A and B, do not compute two separate error bars. Score both on the same questions, take the difference per question, and analyse those differences.
Why this helps. Some questions are hard for every version and some are easy for every version. That shared difficulty is most of the variation between questions. Subtracting per question cancels it, leaving only the cases where the versions behave differently. Miller recommends this "paired" analysis wherever you can, and suggests reporting the pairwise difference, its standard error, and the score correlation between the models.
di = scoreB,i − scoreA,i SEpaired = std(d) / √n For 0/1 scores, di is +1, 0 or −1. Only the cases where the two versions differ add variance. If the versions agree on 83% of cases, the effective noise is far smaller than the pass rate suggests.
Worked example: 200 cases, A passes 160 (80%), B passes 170 (85%). Table of outcomes:
| B passes | B fails | |
|---|---|---|
| A passes | 148 | 12 |
| A fails | 22 | 18 |
Separate error bars: the difference is +5 ± 7.4 points. Paired: +5 ± 5.7 points. The paired interval is narrower, but still includes 0 (p ≈ 0.085). B won 22 cases and lost 12. That is a hint, not proof. The honest conclusion is "probably better, run more cases or look at the 34 cases that changed".
import numpy as np
from scipy import stats
def paired_diff_ci(a, b, clusters=None, level=0.95):
"""a, b: per-case scores for A and B, same order.
Returns (mean diff B-A, SE, (lo, hi), two-sided p)."""
d = np.asarray(b, float) - np.asarray(a, float)
n = len(d)
if clusters is None:
se = d.std(ddof=1) / np.sqrt(n)
else: # sum residuals inside each cluster, then square
r = d - d.mean()
_, idx = np.unique(clusters, return_inverse=True)
sums = np.bincount(idx, weights=r)
se = np.sqrt((sums ** 2).sum() * n / (n - 1)) / n
z = stats.norm.ppf(0.5 + level / 2)
m = d.mean()
p = 2 * stats.norm.sf(abs(m / se))
return m, se, (m - z * se, m + z * se), p
# the 200-case table above
a = np.r_[np.ones(148), np.ones(12), np.zeros(22), np.zeros(18)]
b = np.r_[np.ones(148), np.zeros(12), np.ones(22), np.zeros(18)]
print(paired_diff_ci(a, b)) # 0.05, 0.029, (-0.007, 0.107), 0.085
Pass clusters (one id per case) when cases come in groups. With one case per cluster the result is identical to the plain version.
Clusters, repeated runs and temperature
Clustered questions. If 20 of your cases are all variations of the same ticket, they are not 20 independent samples. They move together. Treating them as independent makes the error bar too narrow. Miller recommends clustered standard errors: the error is computed by summing deviations inside each cluster first. Cluster any time cases share a source: same customer, same KB article, same synthetic tuple parent, multiple turns of one conversation.
Repeat each question. Run each case K times (say 3-5) and average. This cuts the second source of noise, the model's own randomness. It does not fix question sampling noise. Miller also notes you can sometimes compute the expected score from next-token probabilities, but hosted APIs rarely expose enough for an agent eval.
Do not set temperature to 0 just to cut noise. Miller advises against it, unless you want to study the model at that temperature. It changes behaviour, and it can raise variance: his example has question-level success chances spread evenly between 0 and 1 at temperature 1 (variance 1/12). At temperature 0 each question becomes always-pass or always-fail, and the variance across questions rises to 1/4. Run at the temperature you ship with, and resample.
pass@k versus pass^k
If one case is run k times, the score can be summarised two ways.
- pass@k — the chance that at least one of k tries succeeds. Common in code generation, where you can run tests and keep any working answer.
- pass^k — the chance that all k tries succeed. τ-bench (Yao et al., 2024) introduced it for customer-service agents, where the same kind of request arrives again and again.
If the per-try success is p and tries are independent, pass@k = 1 − (1−p)k and pass^k = pk. τ-bench estimates them from n trials with c successes: pass^k = E[C(c,k)/C(n,k)].
Take a copilot that handles a given refund request correctly 90% of the time. pass@8 is about 100%. pass^8 is 0.98 = 43%. The τ-bench paper reports that even strong function-calling agents succeeded on under 50% of tasks, with pass^8 below 25% in the retail domain for gpt-4o.
Which one does your product need? Ask whether the user sees one attempt or many. A support agent gets one shot per customer, and every customer is a fresh trial of the same policy. So the right view is pass^k, or simply the per-try rate p, measured with enough tries to know it. pass@k fits only when something downstream picks the best of several (a verifier, a human choosing among drafts).
Many slices, many false alarms
You tag every case (Evals 1: Eval datasets: golden sets, synthetic data, coverage) and slice by 20 categories. Each slice score has its own noise, and each slice is small, so intervals are wide: a slice of 25 cases at 80% is ±15 points.
Now compare two versions slice by slice, flagging anything with p < 0.05. If nothing really changed, each slice still has a 5% false-alarm chance. Across 20 slices the chance of at least one false alarm is 1 − 0.9520 = 64%. Flag at random and you will "find" regressions.
- Decide the few slices that matter before looking (refunds over $50, account changes).
- For the rest, tighten the bar. Bonferroni correction divides α by the number of tests: 0.05 / 20 = 0.0025.
- Treat a flagged slice as a lead. Read the cases that flipped, then confirm with fresh cases.
When is a "regression" just noise?
A checklist before you block a release or celebrate a win:
- What is the noise floor? Rerun the unchanged system. If it moves ±3 points, a 3-point change is nothing.
- Is the comparison paired, on the same dataset version and same grader version?
- Does the paired interval exclude zero? If not, say "inconclusive", not "no effect".
- Read the cases that flipped. Ten flips that all share one cause are signal. Ten unrelated flips are noise.
- Is the change big enough to matter for the product? A significant 0.5-point gain may not be worth a model switch.
For how this feeds a launch decision, see Evals 5: Leading with evals: launch reviews, model migrations, ownership. For how to make sure the grader itself is not the noisy part, see Trusting your judge: validating LLM-as-judge.
Check yourself
Question 1
For each support-copilot failure, pick the cheapest grader that can see it: (a) a reply quoting the wrong order ID, (b) a $120 refund issued with no approval step, (c) a reply that says 'you can count on it by Friday', (d) a ticket routed to 'billing' that should be 'bug'.
Show answer
(a) code: compare the ID in the reply with the get_order result in the trace. (b) code: a rule over issue_refund tool calls (amount > 50 and not approved). (c) an LLM judge, reference-guided with the policy text; a regex on 'guarantee' would miss paraphrases, so keep it only as a pre-filter. (d) reference metric: exact match against human labels, with per-class recall. Only (c) needs a judge, and only (c) needs the Trusting your judge: validating LLM-as-judge validation.
Question 2
You re-run the same judge prompt on the same 300 traces and 11 verdicts differ. You cannot set temperature on the judge model. What do you do, and what does it cost to find out?
Show answer
Sonnet 5.5 returns a 400 error if you set temperature, top_p or top_k, so variance has to be measured, not configured away. Report the flip rate (11/300 = 3.7%) in the judge's validation report, tighten the rubric and add boundary examples, and if flips matter for a gate, take a majority vote of three runs. Cost check: one judge at about $0.006 per call is $0.018 per trace for three votes, so 400 tickets a day is $7.20 a day.
Question 3
Your judge has TPR 0.95 and TNR 0.60, production fail rate is about 8%, and a teammate wants to track the raw judge pass rate. What goes wrong, and what do you compute first?
Show answer
TPR + TNR − 1 = 0.55, so the judge lets 40% of bad replies through. At 8% failures, real catches are 0.08 × 0.60 = 4.8 points of traffic and false alarms are 0.92 × 0.05 = 4.6 points, so about half of its fail flags are false alarms, and the raw pass rate is biased high. Compute θ̂ = (p_obs + TNR − 1)/(TPR + TNR − 1) with a bootstrap interval, and note it amplifies noise by 1/0.55 = 1.8. Improve TNR before using the number to compare versions.
Question 4
You validated a judge, read the 20 mistakes on the test set, added two rules to the prompt, and re-ran: TNR rose from 0.70 to 0.88. Is 0.88 the number to report?
Show answer
No. The prompt was fit to those test errors, so 0.88 is a dev-set number. Treat that set as dev, label a fresh stratified test set with enough failures, run the frozen prompt once, and report that. Compare the prompt's edit history with the dates of test runs to catch this early.
Question 5
Version B scores 87% and A scores 84% on the same 150 cases. B wins 14 cases and loses 9 (so they disagree on 23). Is B better? Compute it.
Show answer
Difference = (14 − 9)/150 = 3.3 points. Paired variance of d ≈ 23/150 − 0.0333² = 0.1522, so SE = √(0.1522/149) ≈ 0.032 (3.2 points) and the 95% interval is about ±6.3, i.e. −3 to +9.6. It includes zero, so the result is inconclusive. To detect 3.3 points at this disagreement rate you would need about 7.8 × 0.152 / 0.033² ≈ 1,070 cases.
Question 6
Your 400-case set has 100 cases made by perturbing 25 seed tickets (4 variants each). A teammate reports ±3.5 points at 85%. What is wrong, and which direction does the error go?
Show answer
The 100 variants are not independent; they share a seed, so errors correlate within a cluster. The plain formula treats 400 as 400 independent samples, so the interval is too narrow. Use clustered standard errors with the seed id as the cluster. The effective sample size lies between 300 + 25 and 400, depending on how correlated the variants are, so the real interval is wider than ±3.5.
Question 7
The copilot passes a given refund-edge-case task 90% of the time per try. Product asks: "Does it work reliably?" Which metric do you report, and what number?
Show answer
pass^k, because each customer is a new trial of the same policy and must be handled correctly. With p = 0.9, pass^8 = 0.9^8 ≈ 43%, and pass^4 ≈ 66%. pass@8 would be about 100% and would hide the problem. Report the per-try rate with its interval and pass^k for the k that matches how often the same situation recurs.
Question 8
A colleague sets temperature 0 on the eval run "to remove noise", while production runs at 0.7. Give two reasons Miller's paper argues against this.
Show answer
(1) You are measuring a different system than the one you ship, so the score may not transfer. (2) It can move variance rather than remove it: questions with a conditional mean near 0.5 become all-pass or all-fail, which can increase the variance across questions (his example goes from 1/12 to 1/4). Better: run at the shipping temperature and resample each question several times.
Question 9
You compare two prompts across 20 intent slices and one slice, "cancel", shows p = 0.03 in favour of the new prompt. Do you ship on that? What do you do?
Show answer
No. With 20 slices at 5%, the chance of at least one false alarm is 64%. Bonferroni threshold is 0.0025, so 0.03 does not pass. Unless "cancel" was named as the target before the run, treat it as a lead: read the flipped cases, then confirm with fresh cancel cases.
Sources
- Creating a LLM-as-a-Judge That Drives Business Results — Hamel Husain
- Frequently Asked Questions About AI Evals — Hamel Husain and Shreya Shankar
- Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena — Zheng et al., 2023
- Who Validates the Validators? Aligning LLM-Assisted Evaluation of LLM Outputs with Human Preferences — Shankar, Zamfirescu-Pereira, Hartmann, Parameswaran, Arawjo, 2024
- How to Correctly Report LLM-as-a-Judge Evaluations — Lee, Zeng, Jeong, Sohn, Lee, 2025 (v3 Feb 2026)
- judgy: Rogan-Gladen correction with bootstrap intervals for LLM judges — PyPI
- LLM Evaluators Recognize and Favor Their Own Generations — Panickssery, Bowman, Feng, 2024
- Judging the Judges: A Systematic Study of Position Bias in LLM-as-a-Judge — Shi et al., 2024
- How NOT To Evaluate Your Dialogue System — Liu, Lowe, Serban, Noseworthy, Charlin, Pineau, EMNLP 2016
- Models overview — Anthropic, Claude docs (accessed Oct 2026)
- Claude Sonnet 5.5 overview — Anthropic, Claude docs (accessed Oct 2026)
- Structured outputs — Anthropic, Claude docs (accessed Oct 2026)
- Effort — Anthropic, Claude docs (accessed Oct 2026)
- Adding Error Bars to Evals: A Statistical Approach to Language Model Evaluations — Evan Miller (Anthropic), 2024
- τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains — Yao et al., 2024
- What is the best approach for generating synthetic data? — Hamel Husain, AI Evals FAQ
- scipy.stats.binomtest (proportion_ci, Wilson) — SciPy docs
Next
You can now score cases, trust the scorer, and put error bars on the result. Page 3 applies all of this to the two architectures you'll meet most: retrieval pipelines and tool-using agents.