Sub topic 11
Checking the judge against human labels
This chapter assumes you can read Python and know what a pointwise judge prompt and a rubric are. It also assumes you know proportions and averages.
A judge's score is a proxy for human judgment. Before you trust it, measure how closely it agrees with people on your task.
Build a human-labeled calibration set
Sample 50 to 200 items from the traffic or test cases you plan to evaluate. Have people label them with the same rubric the judge uses. Two things make the labels more useful:
- Include hard and borderline cases, not only easy ones. A judge looks good on obvious items.
- Have at least two people label some items. If humans disagree with each other, the judge cannot be expected to agree with them more than they agree among themselves.
Keep this set separate from any examples you put inside the judge prompt. Otherwise you are testing the judge on material it has already seen.
Raw agreement is not enough
Raw agreement is the fraction of items where judge and human give the same verdict. It is easy to read, but it misleads on skewed data. If 90% of answers are good, a judge that always says "pass" agrees with humans 90% of the time and detects nothing.
Cohen's kappa corrects for this. It compares observed agreement with the agreement expected if the judge and human labeled independently at their own base rates:
kappa = (observed - expected) / (1 - expected)
A kappa of 1 means perfect agreement. A kappa of 0 means no better than chance.
from collections import Counter
def cohens_kappa(human, judge):
n = len(human)
observed = sum(h == j for h, j in zip(human, judge)) / n
hc, jc = Counter(human), Counter(judge)
expected = sum(hc[k] * jc[k] for k in hc) / (n * n)
return (observed - expected) / (1 - expected)
human = ["pass", "pass", "fail", "pass", "fail", "fail"]
judge = ["pass", "pass", "fail", "fail", "fail", "pass"]
print(round(cohens_kappa(human, judge), 3))This prints 0.333. Observed agreement is 4/6 (0.667), but chance agreement is 0.5, so the judge is only modestly better than chance.
A common rule of thumb reads kappa above 0.6 as substantial agreement and above 0.8 as strong. These bands are conventions, not guarantees. Decide your threshold by the cost of being wrong in your application.
Look at errors, not just the number
Break the disagreements down by type:
- False passes: the judge accepts what humans rejected. These let bad outputs ship.
- False fails: the judge rejects what humans accepted. These waste engineering effort.
Read a sample of each. Patterns point to fixes. For example, the judge may reward long answers (verbosity bias), or your rubric may be ambiguous about what counts as "supported". Revise the rubric, re-run the judge, and recompute kappa on the same set.
Common mistakes
- Tuning the prompt until it fits the calibration set, then reporting that score. Hold out a second set for the final check.
- Using a calibration set that is too small. With 20 items, one flipped verdict moves agreement by 5 points.
- Treating one overall kappa as enough. Compute it per category, such as topic or answer length, because a judge can be reliable on short answers and unreliable on long ones.
- Never re-checking. Re-run the comparison whenever you change the judge model or the rubric.
Exercise
On a test set where 95% of answers are good, a judge labels every answer "pass". What are its raw agreement with humans and its kappa?
Show answer
Raw agreement is 95%, since the judge matches every human "pass". Kappa is 0. The judge's "fail" rate is 0, so expected agreement is 0.95 (0.95 x 1.0 plus 0.05 x 0). Observed minus expected is 0, so kappa is 0. This shows why kappa is the better check on skewed data.