28/38
Part 5 of 6 · Evaluation and the online testLearn and do

Calibrate the LLM judge against people

Experts can't grade thousands of suggestions a week. An LLM judge, a model that grades another model's output, can, once you know how far to trust it.

  • Zheng and coauthors found that strong LLM judges like GPT-4 can match both controlled and crowdsourced human preferences well, with over 80% agreement, the same level at which humans agree with each other. They also documented judge biases, including position, verbosity and self-enhancement.
  • In Airbnb's walkthrough, the faithfulness judge first agreed with the product manager's labels 78% of the time. It was penalizing accurate paraphrases as unfaithful. They fixed the rubric, and agreement rose to 88%.

So agreement on your rubric is something you measure. Airbnb's warning: a judge that hasn't been calibrated is worse than no judge at all, because it gives you false confidence.

Work a calibration by hand. Experts and the judge grade the same 200 suggestions for faithfulness:

Expert says unfaithfulExpert says faithful
Judge says unfaithful226
Judge says faithful8164

Raw agreement is (22+164)/200=93%(22 + 164)/200 = 93\%. The judge catches 22/30=73%22/30 = 73\% of the unfaithful suggestions, and 22/28=79%22/28 = 79\% of its flags are right.

93% sounds better than it is, because most suggestions are faithful. So subtract the agreement you'd get by chance.

Chance agreement, pep_e, is how often the two would agree if each guessed at its own rate. The judge says unfaithful 28 times in 200 (0.14) and the experts 30 times (0.15). So at random they'd agree on unfaithful 0.14×0.150.14 \times 0.15 of the time, and on faithful 0.86×0.850.86 \times 0.85:

pe=0.14×0.15+0.86×0.85=0.752p_e = 0.14 \times 0.15 + 0.86 \times 0.85 = 0.752

Cohen's kappa, κ\kappa, is the agreement left after chance, scaled so 1 is perfect and 0 is no better than chance:

κ=0.93−0.7521−0.752=0.72\kappa = \frac{0.93 - 0.752}{1 - 0.752} = 0.72

In the editor, write kappa(table): Cohen's kappa for the calibration table above. It should give 0.72.