Sub topic 11
Checking a Judge Against Human Labels
An LLM judge is a measuring instrument, and an instrument needs calibration before you trust its readings. This chapter shows how to test a judge against human labels, which numbers to report, and how to decide whether the judge is good enough to use.
It assumes you have read the earlier chapters on claim-level faithfulness scoring and on LLM-as-a-judge biases. You should be comfortable with precision and recall from classification and with reading short Python programs.
Why a judge needs its own evaluation
When you score faithfulness with a judge, every number you report is true quality + judge error. If the judge marks unsupported claims as supported, your faithfulness score looks better than the system really is. If it flags supported claims, you chase problems that don't exist.
You can't see this error without a reference. The reference is a set of human labels on the same inputs the judge sees. Validating the judge means asking whether the judge agrees with humans on the decision you care about, and by how much.
Build a human-labelled calibration set
A calibration set is a collection of judge inputs with human verdicts. For claim-level faithfulness, each item is a triple: a claim, the context passage or passages, and a human label of supported or unsupported.
Follow these rules when you build it:
- Sample from real outputs. Use claims extracted from your own system's answers, not invented examples. Real answers contain the subtle errors the judge must catch.
- Include enough failures. If 95% of claims are supported, a judge that always says "supported" scores 95% agreement. Oversample claims from answers you already suspect are weak, or you will have too few unsupported items to measure anything.
- Write the labelling guideline first. Define what counts as supported. Decide whether a claim that is a reasonable inference but not stated in the context counts as supported. Without a written rule, annotators disagree and the disagreement looks like judge error.
- Use two annotators on at least a subset. Their agreement tells you how much of the task is ambiguous. Resolve disagreements by discussion and record the final label.
- Keep it separate from tuning. You will adjust the judge prompt while validating. Split the labelled items into a development part, where you iterate on the prompt, and a held-out part, which you score once at the end.
A common size is 100 to 300 labelled items, with at least 30 to 50 in the rarer class. Fewer than that gives intervals too wide to act on.
The workflow
The validation loop has a development stage and a final held-out check.
Choose the right numbers
Raw agreement, the share of items where judge and human match, is the first number people compute and the least informative. It rises with class imbalance, as the always-"supported" example above shows. Report these instead:
| Measure | What it tells you |
|---|---|
| Confusion matrix | The four counts: true and false positives and negatives |
| Precision of "unsupported" | Of the claims the judge flags, how many humans also flag |
| Recall of "unsupported" | Of the claims humans flag, how many the judge catches |
| Cohen's kappa | Agreement corrected for the agreement expected by chance |
| Human-human agreement | The ceiling: the judge can't reasonably beat the humans' agreement with each other |
Treat "unsupported" as the positive class, since finding unfaithful claims is the purpose of the metric. Low recall means hallucinations slip through and your faithfulness score is inflated. Low precision means the judge raises false alarms and your score is deflated.
Cohen's kappa is (p_o - p_e) / (1 - p_e). Here p_o is observed agreement and p_e is the agreement two raters would reach by chance given their label frequencies. A kappa of 0 means no better than chance and 1 means perfect agreement. Common rough readings are 0.4 to 0.6 moderate, 0.6 to 0.8 substantial, and above 0.8 near-perfect. These are conventions, not guarantees. Judge against what your task needs.
Compute the agreement numbers
This program computes the confusion counts, precision and recall of the "unsupported" class, and kappa. It also computes a paired bootstrap interval for kappa, resampling item pairs together so each human label stays matched to its judge label.
import random
SUPPORTED = "supported"
UNSUPPORTED = "unsupported"
def confusion(human, judge, positive=UNSUPPORTED):
tp = fp = fn = tn = 0
for h, j in zip(human, judge):
if j == positive and h == positive:
tp += 1
elif j == positive:
fp += 1
elif h == positive:
fn += 1
else:
tn += 1
return tp, fp, fn, tn
def precision_recall(human, judge, positive=UNSUPPORTED):
tp, fp, fn, _ = confusion(human, judge, positive)
precision = tp / (tp + fp) if (tp + fp) else None
recall = tp / (tp + fn) if (tp + fn) else None
return precision, recall
def cohens_kappa(human, judge):
n = len(human)
observed = sum(1 for h, j in zip(human, judge) if h == j) / n
labels = set(human) | set(judge)
expected = sum(
(human.count(l) / n) * (judge.count(l) / n) for l in labels
)
if expected == 1:
return None # both raters used one label throughout; kappa is undefined
return (observed - expected) / (1 - expected)
def bootstrap_kappa(human, judge, n_resamples=2000, alpha=0.05, seed=0):
rng = random.Random(seed)
n = len(human)
values = []
for _ in range(n_resamples):
idx = [rng.randrange(n) for _ in range(n)]
k = cohens_kappa([human[i] for i in idx], [judge[i] for i in idx])
if k is not None:
values.append(k)
values.sort()
lo = values[int((alpha / 2) * len(values))]
hi = values[int((1 - alpha / 2) * len(values)) - 1]
return lo, hi
# 20 labelled claims: humans marked 14 supported and 6 unsupported.
human = [SUPPORTED] * 14 + [UNSUPPORTED] * 6
judge = (
[SUPPORTED] * 12 + [UNSUPPORTED] * 2 # judge wrongly flags 2 supported claims
+ [UNSUPPORTED] * 4 + [SUPPORTED] * 2 # judge misses 2 unsupported claims
)
print(confusion(human, judge)) # (4, 2, 2, 12)
print(precision_recall(human, judge)) # (0.666..., 0.666...)
print(round(cohens_kappa(human, judge), 3)) # 0.524
print(bootstrap_kappa(human, judge)) # a wide interval around 0.52Raw agreement here is 16 of 20, or 0.80, which sounds good. Kappa is 0.524, only moderate, and the judge misses a third of the unsupported claims. With only 20 items the bootstrap interval is wide. A real calibration set should be larger, and you should report the interval along with the point estimate.
Look at the errors, not only the scores
A single kappa hides the pattern of mistakes. After computing the numbers, read the disagreements. Print each item where judge and human differ, then group them:
- The judge accepts a plausible claim that the context doesn't state. The judge is using its own world knowledge. Tighten the prompt to say that only the provided context counts.
- The judge rejects a correct paraphrase. It is matching wording instead of meaning. Add a paraphrase example to the prompt.
- The judge is swayed by a long, confident answer. This is verbosity bias. Check whether errors correlate with answer length.
- The humans disagree with each other on these items. The guideline is ambiguous. Fix the guideline before blaming the judge.
Run the checks for position and ordering bias too. If the judge compares two answers, swap their order and see whether verdicts change. A judge that flips on a swap isn't measuring quality.
Decide whether the judge is good enough
There is no universal threshold. Decide by what the score will be used for:
- Comparing two system versions. The judge may have some error if the error is the same for both versions. Systematic bias cancels in a difference. Random noise does not, so check consistency by running the judge twice and measuring agreement with itself.
- Reporting an absolute faithfulness number. You need low bias. Correct for known error rates or report the number with the judge's precision and recall beside it.
- Blocking a release automatically. You need high precision on the "unsupported" class, since false alarms stop good releases.
- Finding failures to fix. You need high recall, and a human reviews the flagged items anyway.
Compare the judge's agreement with the human-human agreement. If two annotators reach kappa 0.65, a judge at 0.60 is nearly at the ceiling, and further prompt work is unlikely to help.
Keep the validation alive
A judge's behaviour changes when the judge model, the prompt, or the data changes. Record the model name and version, the prompt text, and the temperature next to every result. Re-run the calibration set when any of them changes, and again on a schedule if your provider updates models without notice. Sample a few production items for human review each month to catch a shift in the kinds of questions users ask.
Common errors
- Reporting raw agreement on an imbalanced set.
- Using one annotator and treating their labels as truth.
- Validating on easy, hand-written examples rather than real system output.
- Reusing the development items for the final report.
- Validating the judge on faithfulness and then reusing it, unchanged, for context relevance or answer relevance. Each task needs its own calibration set.
- Forgetting to record the judge version.
Exercise
A judge scores 90 of 100 claims in agreement with humans. Humans labelled 92 claims as supported and 8 as unsupported. The judge caught 2 of the 8 unsupported claims and wrongly flagged none of the supported ones. What are the judge's recall and precision for "unsupported", and is 90% agreement a good sign?
Show answer
Recall for "unsupported" is 2/8 = 0.25. Precision is 2/2 = 1.0, since it raised no false alarms. Agreement is 94 of 100 (92 supported correct plus 2 unsupported caught), so the stated 90 doesn't match these counts, but the point stands under either figure: high raw agreement here comes from the large supported class. The judge misses 75% of the unsupported claims, so it would hide most hallucinations and inflate faithfulness scores. It is not good enough for finding failures. Report recall and kappa, and add more unsupported examples to the calibration set.