Papa Programmer
Lesson 29 of 36

Human review and model judges

9 min read

Optional

When a metric is not enough

Metrics for classification and generation covered measures a program can compute. Many things you care about in a tuned model are not on that list: is the answer correct and complete, does it use the evidence given, does it admit when the information is missing, is the tone right. For these you need a judgement, and the judgement needs structure.

Write a rubric

A rubric turns "good" into checks that two people can apply in the same way.

  • Observable criteria. "States the refund window from the policy text" can be checked. "Is helpful" cannot.
  • A small scale. Pass or fail, or three levels, with an example of each. More levels give more disagreement, not more information.
  • The evidence. Give the reviewer the source document, the question and the expected facts, so they judge against something.
  • A way to flag. Let reviewers mark unclear cases and unsafe outputs instead of forcing a score.

Run a small pilot of about 20 cases first. If reviewers keep arguing about one criterion, rewrite it before you scale up.

Blind side by side

To compare two models, show each reviewer both answers to the same input, without saying which model wrote which, in random order. Allow a tie. Record a one-line reason for each choice. Without this, reviewers tend to favour whichever answer they expect to be the new one.

Check that raters agree

Two reviewers who disagree half the time are not giving you a measurement. Raw agreement can also flatter a rubric: if most outputs are good, two reviewers who both say "pass" nearly every time will agree a lot by chance. Cohen's kappaA score for how much two raters agree beyond what chance alone would give. It corrects raw agreement when most items get the same rating. corrects for that chance agreement. The program below compares two reviewers and a model judge on 12 cases scored pass (P) or fail (F), and then tests the judge for position bias on 10 side-by-side comparisons.

python
from collections import Counter

reviewer_a = "PPFPPFPPPFPP"
reviewer_b = "PPFPFFPPPPPP"
judge      = "PPFPPFPFPFPP"

def agreement(x, y):
	return sum(a == b for a, b in zip(x, y)) / len(x)

def kappa(x, y):
	observed = agreement(x, y)
	cx, cy = Counter(x), Counter(y)
	chance = sum(cx[k] / len(x) * cy[k] / len(y) for k in set(x) | set(y))
	return (observed - chance) / (1 - chance)

print(f"reviewer A vs B:  agree {agreement(reviewer_a, reviewer_b):.0%}, kappa {kappa(reviewer_a, reviewer_b):.2f}")
print(f"judge vs A:       agree {agreement(judge, reviewer_a):.0%}, kappa {kappa(judge, reviewer_a):.2f}")
print(f"judge vs B:       agree {agreement(judge, reviewer_b):.0%}, kappa {kappa(judge, reviewer_b):.2f}")

winner_when_a_first = "AAABAABAAB"
winner_when_b_first = "ABABABBBAB"
same = sum(x == y for x, y in zip(winner_when_a_first, winner_when_b_first))
first_picks = sum(w == "A" for w in winner_when_a_first) + sum(w == "B" for w in winner_when_b_first)
print(f"judge keeps its winner after swapping order: {same} of 10")
print(f"judge picks whichever answer comes first: {first_picks} of 20 verdicts")

It prints:

text
reviewer A vs B:  agree 83%, kappa 0.56
judge vs A:       agree 92%, kappa 0.80
judge vs B:       agree 75%, kappa 0.40
judge keeps its winner after swapping order: 7 of 10
judge picks whichever answer comes first: 13 of 20 verdicts

The two reviewers agree on 10 of 12 cases, but their kappa is only 0.56, because both pass most outputs and would agree often by luck. The judge agrees with reviewer A on 92% of cases (kappa 0.80) and with reviewer B on 75% (kappa 0.40), so which person you calibrate against changes the answer. These are small samples, so read them as a way to see the method and not as general numbers.

The position test is the more worrying one. When the same pair is shown in swapped order, the judge changes its winner in 3 of the 10 pairs, and it picks the answer shown first in 13 of its 20 verdicts. A fair judge would not care about order. A judge that does should not be trusted until you fix it, for example by running each pair in both orders and counting only the pairs where the winner stays the same.

Using a model as a judge

A model judge applies your rubric to many outputs cheaply. To get useful scores:

  1. Give it the rubric, the evidence and the output. Ask for a short reason first and the score second, so the score follows from the reasoning.
  2. Run each comparison in both orders. Count only consistent verdicts, and treat the rest as ties.
  3. Do not let it judge itself. A model can favour its own style, and longer answers often score higher. Control for length where you can.
  4. Do not treat it as ground truth. It is a measurement tool that has to be calibrated.

Calibrate against people

Have people score a sample of about 50 to 100 outputs independently of the judge. Compute agreement and kappa as above, then read the cases where they disagree: sometimes the judge is wrong, and sometimes the rubric is unclear. Repeat the check whenever the task, the rubric, the judge model or the models being judged change. Keep a small set of cases that people scored carefully, and use it to check every new judge setup.

Protect private data. Reviewers and judges see real inputs, so use only text you are permitted to share and remove personal details first, as Cleaning data and checking quality describes.

  1. RubricWrite observable criteria with examples.
  2. PilotScore 20 cases and fix unclear criteria.
  3. BlindHide model names and randomise the order.
  4. AgreeCompute agreement and kappa between raters.
  5. CalibrateCompare any model judge with people on a sample.
Set up a review
Write it downA rubric lets two people score the same output the same way.
Correct for chanceKappa shows how much agreement is real when most outputs pass.
Test for biasSwap the order of answers and see whether the judge changes its mind.

Your reading position is saved

0%

0 of 36 complete

Contents

Learning tools