Judge agreement and uncertainty
Measure agreement, not truth
Two raters may disagree even when using the same rubric. Observed agreement is matching labels divided by paired cases. Cohen’s kappa adjusts this by the agreement expected under independent label draws from each rater’s empirical label frequencies: kappa = (observed - expected)/(1 - expected). Four simulated ratings have three matches; the first rater uses pass twice, the second once. Expected agreement = (2×1 + 2×3)/16 = 0.5, so kappa = 0.5. A value of 1 indicates perfect agreement when defined, 0 means agreement at the marginal-frequency baseline, and negative values indicate below-baseline agreement. These are fabricated labels, not observed human reviews. The function uses exact fractions; if expected agreement is 1, kappa is undefined and returns None, not a perfect score.
from collections import Counterfrom fractions import Fraction
def agreement(a, b): if len(a) != len(b) or not a: raise ValueError("nonempty paired ratings required") n = len(a) observed = Fraction(sum(x == y for x,y in zip(a,b)), n) ca, cb = Counter(a), Counter(b) expected = Fraction(sum(ca[k]*cb[k] for k in ca), n*n) kappa = None if expected == 1 else (observed-expected)/(1-expected) return observed, kappa
p,k = agreement(["pass","pass","fail","fail"], ["pass","fail","fail","fail"])print(float(p), float(k))print(agreement(["pass"], ["pass"])[1])Calibrate a judge against independent human labels
First give two human reviewers the same rubric, source evidence and blinded outputs. Collect labels independently, then adjudicate disagreements using a third reviewer or documented discussion. Keep the original labels and rationale. Compare the model judge against the adjudicated reference on a distinct calibration set: report confusion counts, false pass and false fail rates, raw agreement and kappa. High agreement does not imply correctness; both raters can share a bias. Kappa is sensitive to prevalence and marginal imbalance; report counts and class-specific errors rather than applying universal cutoffs. Test position bias by swapping answer order in paired comparisons, verbosity bias with equally correct short and long answers, and language-dependent errors. Repeat judge calls when randomness matters; log judge model, rubric, prompt, settings, version and outputs. A judge must not approve its own high-risk action.
Quantify sampling uncertainty
A sample success fraction is not the exact population success rate. For independent Bernoulli cases drawn from a stable target population, an approximate 95% Wilson interval is useful, including near zero or one. With p = successes/n and z = 1.96, center = (p+z²/(2n))/(1+z²/n); half-width = z√(p(1-p)/n+z²/(4n²))/(1+z²/n). Return center ± half-width, with exact endpoints at zero successes and all successes, and clipping for floating rounding. The first two examples have the same 75% point estimate but very different widths; the 0/10 interval still has a nonzero upper bound. The interval describes repeated-sampling coverage, not a 95% probability that a fixed unknown parameter is in this realized interval. The toy examples demonstrate arithmetic only: convenience samples, clustered paraphrases and repeated runs on the same case do not satisfy independent representative sampling.
from math import sqrt
def wilson(successes, total): if type(successes) is not int or type(total) is not int or not 0 <= successes <= total or total == 0: raise ValueError("require 0 <= successes <= positive total") z = 1.96 p = successes/total d = 1 + z*z/total center = (p+z*z/(2*total))/d half = z*sqrt(p*(1-p)/total+z*z/(4*total*total))/d return (0. if successes == 0 else max(0.,center-half), 1. if successes == total else min(1.,center+half))
for k,n in [(3,4),(75,100),(0,10)]: lo,hi=wilson(k,n) print(f"{k}/{n}: [{lo:.3f}, {hi:.3f}]")Benchmark without overstating evidence
Keep case IDs matched across candidate and baseline. Report paired differences and uncertainty using suitable methods, such as resampling independent case groups, rather than treating correlated outputs as independent. Distinguish between-case variance and repeated-generation variance. Record run counts, failures, model snapshot, prompt, temperature, retrieval version, tool settings, runtime, timestamp and cost basis. For slice reports include the sample size and avoid ranking tiny subgroups as if estimates were precise. A passing threshold on a synthetic set is evidence only about those fixtures; release additionally needs security, operational, human and representative evaluation. Adjudicate disputed labels before reporting a ground-truth score; never silently discard disagreements.
Practice a calibration report
Use the four paired ratings in the project. Find the disagreement, explain the two raters’ marginal distributions and compute raw agreement and kappa by hand. Mark the disputed case for adjudication; no truth label follows from agreement alone. Compare Wilson intervals for 3/4 and 75/100; explain why neither demonstrates actual model quality here. Plan a judge audit across language, difficulty and failure class, with blinded randomized order and a locked holdout. Reference: ref-ai-judge-agreement-and-uncertainty. Next chapter turns frozen cases into regression and defensive tests.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Judge agreement and uncertainty quiz
Assess evaluation design, rubric outcomes, judge agreement and uncertainty.
What is observed agreement for three matches among four ratings?
What is kappa if observed agreement is 0.75 and expected is 0.5?
What happens when expected agreement is one?
Why compare equal point estimates at different sample sizes?
How should a disputed label be handled?