An LLM judge is a language model that grades another model's answers. You give it a question, one or two answers, and instructions. It returns a score, or it says which answer is better. Judges are how the field grades open-ended work, such as explanations, emails, medical advice, and plans, where no program can check the answer. They are fast and cheap. They are also often wrong, in ways that are easy to miss. This section is about how far to trust a judge, and how to measure it.
Two experiments show why that matters. Three popular leaderboards grade with a judge. AlpacaEval 2.0 and Arena-Hard-Auto have a GPT-4 model compare each answer with a fixed reference model's answer to the same prompt, and MT-Bench has GPT-4 score each answer from 1 to 10. A win rate is the share of those comparisons that the judge says the submitted model wins. A length-controlled win rate is the win rate the judge would give if both answers had the same length, which removes its taste for longer answers (§16.6). In October 2024 a team built a "model" that ignores every instruction and returns the same fixed text. It scored an 86.5% length-controlled win rate on AlpacaEval 2.0, an 83.0% win rate on Arena-Hard-Auto, and 9.55 out of 10 on MT-Bench, top-ranked numbers on all three (Zheng et al. 2024). The text had been written to confuse the judge, and it did.
The second experiment is simpler. Wang et al. (2023) asked ChatGPT to grade answers from Vicuna-13B against answers from ChatGPT itself, on 80 questions. With Vicuna's answer shown first, Vicuna won 2.5% of the questions. With the same two answers in the other order, it won 82.5%. Nothing about the answers changed, only their place on the page.
Both stories are about the grader. §22.1 wrote every evaluation as an estimate. You want the average true quality of a model's responses y to prompts x. What you compute is the average of some grader's scores over n benchmark items,
μ⋆=E[g⋆(x,y)],μ^=n1i=1∑ng(xi,yi).
In plain words,g⋆ is the true quality of a response and g is the grader you actually use. Whenever g differs from g⋆ on average, the estimate μ^ inherits that average difference, however many items you grade. Exact match, unit tests, and the answer-checking programs of §18.3 are graders whose mistakes you can list in advance. A judge is a grader whose mistakes you have to measure.
So this section treats a judge as a measuring instrument. It answers five questions in order. How should you ask a judge, and how do you write instructions that a judge and two humans apply the same way? What biases does it have, and how do you measure each one? How do you measure whether two graders agree? How precise is that measurement, and which statistic fits which data? And how can a judge be poor on single answers yet rank models well? It ends with the ways judges fail on the hardest problems, and what labs do about it.
What earlier sections established
Several earlier sections used judges. Here is what each one showed, in a sentence.
MT-Bench, 80 questions graded by GPT-4, showed that a strong judge can agree with expert humans about as often as experts agree with each other. The same section named four judge biases. A judge may favor the first or second slot, favor longer answers, favor its own model family, and grade badly the problems it cannot solve. It removed the first by judging every pair in both orders (§14.7).
A judge's average can be corrected with a few hundred human labels. You add the judge's average error on the labeled items to its average on all items. This is prediction-powered inference (§14.7).
A judge's flag rate can be corrected when you know two rates. Its sensitivity is how often it catches a true failure, and its specificity is how often it passes a true success. Inverting the two rates gives the true failure rate (§19.4).
The length-controlled win rate comes from a logistic regression of the judge's verdicts on the length difference. It reports what the judge would prefer at equal length (§16.6).
Position bias can be modeled as a constant added to the log-odds of whichever answer is shown first (§19.2).
A reward model is a judge that outputs a number instead of a verdict (§16.3).
Those sections needed a working judge. This one studies the instrument itself. It models all the biases at once and measures each one. It says how precise an agreement statistic is, and which statistic to use when the scale is ordered or the raters are many. It explains why a judge can be bad at single answers and still rank models well. And it shows how to tell when a judge has stopped measuring anything.
Four ways to ask a judge
You can ask a judge four kinds of question. Give this answer a score from 1 to 10. Which of these two answers is better? Does this answer agree with the correct one? Does this answer meet each item on this checklist? Most real judges combine two of them.
Why is a comparison more sensitive than a score? A small example shows it. Model A scores 9 on an easy prompt and 4 on a hard one. Model B scores 8 and 3. Each model's scores swing by 5 points with the prompt's difficulty, and the 1-point gap between the models hides inside that swing. Compare them prompt by prompt instead, and A wins both times by exactly 1. The difficulty moves both answers together, so it cancels in the comparison. This is why a paired test beats an unpaired one (§0.11), and why preference data is collected as comparisons (§16.2).
Comparisons have two costs. Their verdicts can depend on which answer is shown first, as Wang et al.'s experiment showed. And the number of pairs grows like m2, so most benchmarks compare every system with one fixed baseline instead. Scores still have their place. A score is the only format for an absolute decision, such as whether an answer is safe to send, and its cost grows only linearly with the number of systems.
A reference matters most where judges are weakest. Zheng et al. (2023) gave GPT-4 ten math questions with two answers each. Each pair was judged in both orders, so there were 20 verdicts, and they counted how often GPT-4 called a wrong answer correct. With their default prompt it failed 14 times out of 20. Asking it to solve the problem first, in the same prompt, cut the failures to 6. Even then it often repeated the mistake of the answer it had just read. So they had GPT-4 solve each problem in a separate call, without seeing the answers, and showed that solution to the judge as a reference. That cut the failures to 3. A judge that cannot solve a problem cannot reliably grade it, and a wrong answer in front of it makes things worse. The end of the section returns to this.
Rubrics are what large expert evaluations use. HealthBench (Arora et al. 2025) holds 5,000 health conversations. Each has its own rubric written by physicians, 48,562 criteria in all from 262 physicians. Each criterion carries between −10 and 10 points, with negative points for behavior that should not appear. A model grader decides, one criterion at a time, whether the response meets it. At release, o3 scored 60%. The grader was itself checked against physicians, and that check is what makes the number mean something.
The table sums up when to use which format.
format
returns
sensitivity to small differences
main bias
use it for
pointwise score
a number per response
low, scale drift and bunching
leniency, scale drift
absolute gates, cheap monitoring
pairwise
which of two is better
high, prompt difficulty cancels
position, length
comparing checkpoints or systems
reference-guided
agreement with y∗
high where a reference exists
form over substance
math, factual QA, extraction
rubric or checklist
yes or no per criterion
high per criterion
criteria omitted, leniency
expert domains, per-failure-mode gates
In practice, compare checkpoints pairwise, gate single responses with a rubric, and give the judge a reference whenever one exists. An interviewer will ask you to defend that choice, and the prompt-difficulty argument above is the answer.
Scores from probabilities
A judge that outputs "4" hides how sure it was. If the model exposes the probability of each output token, you can read that too. Say a judge puts the probabilities (0.05,0.05,0.20,0.45,0.25) on the scores 1 to 5. The most likely score is 4. The expected score is 0.05⋅1+0.05⋅2+0.20⋅3+0.45⋅4+0.25⋅5=3.8. A second answer with probabilities (0,0.02,0.08,0.48,0.42) also has 4 as its most likely score, but its expected score is 4.3. The expectation tells the two answers apart, and it moves smoothly as quality changes.
Liu et al. (2023) built a judge called G-Eval on exactly this idea. Write s1,…,sL for the possible scores and λ1,…,λL for the judge's log-probabilities of the tokens that write them. Then
sˉ=k=1∑Lp^ksk,p^k=∑k′=1Leλk′eλk.
In plain words, rescale the judge's probabilities over the score tokens alone so that they add up to one, then take the expected score. The rescaling matters, because some probability always goes to tokens that are not scores. When the API gave no probabilities, G-Eval estimated them from 20 samples at temperature 1. On news summaries it reached a Spearman rank correlation of 0.514 with human ratings, well above earlier automatic metrics. (Spearman's correlation is the ordinary correlation of the two lists' ranks, §1.6.) Its authors also warned that LLM graders may prefer text written by LLMs, the self-preference measured later in this section.
Warm-up
Expected scores from a judge's probabilities
Implement expected_score(logprobs, scores). The array logprobs holds the judge's log-probabilities for the score tokens, and scores holds the score each token stands for. The probabilities need not add up to one, and some log-probabilities may be -np.inf. Return the pair (expected, most_likely). The first entry is the probability-weighted score, after rescaling the probabilities over these tokens so they sum to one. The second is the score of the most likely token. The function must not overflow when the log-probabilities are large.
import numpy as np
def expected_score(logprobs, scores):
raise NotImplementedError
Tests, hints, verified solutions, and AI help, with Pro at $7.99 a month.
Checking that the probabilities mean what they say
An expected score, or a pass probability compared with a threshold, is only as good as the probabilities behind it. Nothing guarantees that a judge's probabilities match what humans would say. Post-training tends to make models overconfident. GPT-4's calibration error on a subset of MMLU grew about tenfold after post-training, from 0.007 to 0.074 (OpenAI 2023, §19.8). And a judge's probability describes the judge's own uncertainty, not a human's.
Check calibration on the human-labeled items that validation needs anyway. Fit the repair on one half of them and test it on the other half. Both maps keep the order of the items. So they move thresholds and averages, but they never change which of two responses the judge rates higher.
Here is a simulated judge that is too sure and too lenient. Its log-odds are twice the human ones, plus 0.5 toward passing.
Python · cell 1
Only after such a repair is the judge's average probability an estimate of the human pass rate. Prediction-powered inference, which returns at the end of the section, corrects the average without assuming calibration at all. In practice, never threshold a judge's raw probabilities. An interviewer who hears "we filter at p>0.9" will ask what fraction of those items humans actually pass.
Writing a rubric that people and judges apply the same way
A rubric is the part of a judge you control most directly. These eight habits come from the papers above and from practice, and each has a reason.
Decide what the judge is for before writing a word. A judge that decides about single responses (send or block, keep or filter, reward or not) must be right item by item. A judge that compares systems only needs to be right on average. That choice decides which agreement you must prove, as the part on system-level agreement shows.
Prefer yes or no criteria over one overall score. "Does the response state the dose in milligrams?" can be checked. "Rate the medical quality from 1 to 10" cannot. Yes or no criteria let you measure the judge's error on each criterion and fix the worst one. They also avoid the drift of long scales.
Describe every level of a scale. If you need a scale, write what a 1, a 3, and a 5 look like, with an example of each. Then two raters mean the same thing by "3".
Ask for reasoning first and the verdict last, in a fixed format. Reasoning before the verdict helps on problems that need it (the 14 math failures that fell to 6 above). A fixed final format makes the verdict easy to parse. Read the verdict, not the reasoning.
Give a reference when one exists, and say what counts as equivalent (units, rounding, order).
Do not trust an instruction to remove a bias. The judge prompts of both Zheng et al. (2023) and Wang et al. (2023) told the judge to ignore the order of the answers. Both judges kept a strong position bias. Measurement and design, such as swapping orders, are what work.
Treat the response as data, not as instructions. Put it between delimiters and tell the judge that the text inside them is the thing to grade. Then test the judge with responses that address it directly, like the fixed text from the opening and the prompt injections of §19.3.
Pilot it with two humans and the judge on 50 to 100 items. Measure how well the two humans agree first. Where they disagree, the rubric is ambiguous, so fix its wording before blaming the judge. Then measure the judge's agreement with the humans against that ceiling, with the statistics later in this section.
Here is what such a judge looks like in code. It grades with a rubric and a reference, judges pairs in both orders, and can poll a small panel of judges, called a jury. It calls a generic model client, so it is shown, not run.
A model of a biased judge
To measure biases you need a model of how they enter a verdict. Start from the Bradley-Terry model of §16.3. Each system i has one number, its rating ri. It beats system j with probability σ(ri−rj), where σ is the logistic sigmoid. If system i's rating is 0.4 higher, it wins σ(0.4)=0.60 of its comparisons with j. A biased judge adds three terms to that rating difference. It adds a bonus for whichever answer sits in the first slot, a bonus for being longer, and a bonus for coming from its own model family.
In plain words, the judge's verdict is a coin whose bias depends on true quality, plus three thumbs on the scale. The first thumb follows the slot. The other two follow the response.
That difference decides what swapping orders can fix. Collect everything that travels with the responses into one number,
uij=ri−rj+γlen(ℓi−ℓj)+γself(oi−oj),
where ℓi and ℓj are the two responses' log-lengths. It is system i's margin as the judge sees it, before the slot.
So swapping is the right design, but averaging the two orders hides how large the position bias is. Before fitting any model, two simple counts describe it directly.
Consistency is a noisy measure of bias. Take a pair of equally good answers, uij=0, and assume the two verdicts are independent. The pair is consistent with probability 2σ(bpos)σ(−bpos). That is 0.458 at bpos=0.6, and still only 21 at bpos=0, because a fair judge facing a tie flips a coin twice. So low consistency mixes noise with bias. The first-position rate rises above 21 only through bpos, provided every pair is shown in both orders. The cleanest single number is the fitted bpos, which the next part estimates.
Adding a few worked examples to the judge prompt raised GPT-4's consistency to 77.5%. The authors still used the plain prompt, because the longer one costs more and might bring biases of its own.
Length bias has its own published test. Zheng et al. took 23 MT-Bench answers that contained a numbered list. They made each one longer without adding information. GPT-4 rephrased the list, and the rephrased copy was inserted before the original. Then judges compared the padded answer with the original. GPT-3.5 and Claude-v1 preferred the padded answer in 91.3% of cases, and GPT-4 in 8.7%. Style biases run deeper than length. Feuer et al. (2024) found that judge preferences on alignment benchmarks did not track concrete measures of safety, world knowledge, or instruction following, and that judges weighted style over substance.
Measuring every bias at once
Let's build a judge with known biases and see what each measurement recovers. There are four systems. For every pair of them, both systems answer the same 2,000 prompts. Systems 0 and 1 are equally good, but system 1 writes answers about 35% longer (e0.3≈1.35) and comes from the judge's own family. System 2 is better and more concise, and system 3 is worse. The judge has bpos=0.6, γlen=0.8, and γself=0.4, and it judges every pair in both orders. A human with no biases judges each pair once.
Python · cell 2
The judge picks the first slot in 62.7% of verdicts and is consistent on only 53.0% of pairs. Against its equally good sibling, which is longer and from the judge's family, system 0 wins 48.2% when shown first and 22.7% when shown second. Averaging the orders gives 35.4%, while humans give 48.8%. Swapping removed the position effect and left a 13-point gap from length and self-preference. Against system 2, the averaged judge says system 0 wins 44.2%, while humans say 39.7%. System 2's short answers cost it under the judge's taste for length.
Swapping is a fix in the design. To measure the biases, fit the model. Each verdict becomes one row of a logistic regression. The row has +1 in the column of the system shown first and −1 in the column of the system shown second. It has a constant 1, whose coefficient is bpos, and the log-length difference, whose coefficient is γlen. Only differences of ratings affect a verdict, so we drop system 0's column, which sets r0=0.
We fit by Newton's method,
w←w+(X⊤SX)−1X⊤(y−p),S=diag(pt(1−pt)).
Here X stacks the rows, y holds the verdicts, p holds the fitted probabilities pt, and w holds the coefficients. This is the same iteration §16.6 used for the length-controlled win rate.
Python · cell 3
Why not estimate γself by adding an oi−oj column to the fit? Because that column is already built from the rating columns. With one own-family system it is identical to that system's column.
The other two biases can be estimated. Length varies within a system, from response to response, so its column differs from every rating column. Position varies within every pair. Self-preference is a property of a whole system, and from the judge's verdicts alone it looks exactly like that system being better. It can only be measured against another grader, such as humans or a judge from a different family, on the same pairs. This is a favorite interview point, because it explains why a judge that "likes its own model" cannot be caught by looking at its verdicts alone.
Interview
Ratings and position bias from a judge, fit jointly
A judge compared m systems in pairs. For verdict t, first[t] and second[t] are the systems shown first and second, and y[t] is 1 if the first-shown response won. Implement fit_judge_ratings(first, second, y, m). It fits the model P(yt=1)=σ(rfirst−rsecond+bpos) by Newton's method, with the constraint r0=0. It returns (r, b_pos), with r shifted to sum to zero. Real schedules can be lopsided, for example with the new model always in the first slot. Your fit must not let that system's rating absorb the position bias.
import numpy as np
def fit_judge_ratings(first, second, y, m, iters=50):
raise NotImplementedError
Tests, hints, verified solutions, and AI help, with Pro at $7.99 a month.
Self-preference needs a second grader
So the self-preference audit compares the judge with humans on the same pairs. Take pairs in which one response comes from the judge's own family and the other does not. Collect the judge's verdict on each pair, averaged over both orders, and a human verdict on the same pair. Then compare the two own-family win rates.
The common mistake is to compare the judge's own-family win rate with 21. The own-family responses may really be better, and only humans on the same pairs say by how much. Then ask how much of the excess is length. Refit both rates with the log-length difference as an extra input, and compare them at equal length, as the length-controlled win rate does.
The evidence that self-preference is real, and not only a matter of style, is strongest for summaries. Panickssery et al. (2024) found that GPT-4, GPT-3.5, and Llama 2 can tell their own summaries from others' better than chance, with no training. Fine-tuning GPT-3.5 and Llama 2 on 500 examples pushed this self-recognition above 90%. Across fine-tuned variants, the strength of self-preference rose linearly with self-recognition. Controlled experiments ruled out the obvious confounders, which the authors present as initial evidence that recognition causes the preference. Zheng et al. (2023) saw GPT-4 give itself a 10% higher win rate than humans gave it, and Claude-v1 25%. They noted that their data could not separate this from real quality differences, which is exactly the identifiability problem above.
Core
A self-preference audit
You have n matched pairs, each an own-family response against another family's. judge_own[i] is the judge's verdict that the own-family response wins, averaged over both orders, so it is 0, 0.5, or 1. human_own[i] is a human's verdict on the same pair (0 or 1). dlen[i] is the log-length ratio, own over other. Implement self_preference_audit(judge_own, human_own, dlen, n_boot, rng, level=0.95). It returns a dict with these entries.
"judge_rate" and "human_rate", the two own-family win rates.
"excess", the judge rate minus the human rate.
"ci", a percentile paired-bootstrap interval for the excess. Draw idx = rng.integers(0, n, size=(n_boot, n)) once and apply it to both arrays.
"lc_excess", the excess at equal length, σ(θ^0)−σ(ϕ^0). Here θ^ and ϕ^ are logistic fits of the judge's and the humans' verdicts on the inputs [1,dlen], from the fit_logistic helper.
"length_share", the part of the excess explained by length, 1−lc_excess/excess.
Tests, hints, verified solutions, and AI help, with Pro at $7.99 a month.
In production the same joint model is a few lines of PyTorch. The same fit works for any input you want to control for, such as length, markdown, or a refusal flag. This block simulates a judge comparing six systems. It recovers the ratings, the position bias, and the length slope with L-BFGS, an optimizer that approximates Newton's method from recent gradients.
🔥 In PyTorchfor a machine with PyTorch
Agreement between two graders
Every claim that a judge "works" is a claim that it agrees with some reference, usually humans. The simplest measure is raw agreement, the fraction of items on which two graders give the same label. It flatters graders who both use one label most of the time. Cohen's kappa corrects for that. It compares the agreement you saw with the agreement two graders would reach by chance, if they labeled independently and each kept their own label frequencies.
A tiny example first. Two raters each say "pass" on half of the items, and they agree on 80% of them. Two raters who flipped coins with those same rates would agree half the time, since 0.5⋅0.5+0.5⋅0.5=0.5. So the real raters beat chance by 0.3, out of the 0.5 by which anyone could beat it. Kappa is 0.3/0.5=0.6.
This is Cohen's kappa, defined in §14.7, and here is its general form again. Two raters each assign every one of n items to one of C categories. Let po be the fraction of items on which they agree, and p1c, p2c the fractions of items each rater put in category c. The chance agreement and kappa are
pe=c=1∑Cp1cp2c,κ=1−pepo−pe.
In plain words, kappa is the share of the possible improvement over chance that the raters achieved. It is 0 at chance and 1 for perfect agreement. §16.2 wrote the same quantities as A and Ae. Three questions remain. When does kappa mislead? How precise is a measured kappa? And what should replace it when categories are ordered or raters are many?
The kappa paradox
Here is the case that makes people distrust kappa. A judge and a human grade 200 answers as pass or fail. Each says "pass" 95% of the time, and they agree on 92% of the answers.
This is the first of two paradoxes that Feinstein and Cicchetti (1990) described. When one category is rare, the chance agreement pe approaches 1. The same raw agreement then leaves less and less room above chance. Hold po at 0.92 and let both raters pass a fraction q of the items. Kappa falls from (0.92−0.5)/0.5=0.84 at q=0.5 to 0.158 at q=0.95. It crosses zero near q=0.958, where q2+(1−q)2=0.92. At q=0.96 it is slightly negative, −0.04. That is the largest pass rate compatible with 92% agreement, and at it the raters never agree on a single failure.
Is the low kappa wrong? Not exactly. It is honest about the disagreement on failures. But it packs two numbers (the agreement on each class) and a prevalence into one. The result depends on the prevalence of the sample you happened to grade. One alternative changes only the chance model. Scott's pi (Scott 1955) computes chance agreement from the pooled marginals, pe=∑cpˉc2 with pˉc=(p1c+p2c)/2. That treats the two raters as interchangeable, and Thakur et al. (2024) used it to compare judges with humans. It shares the prevalence paradox.
The honest report for a judge validated against humans includes all of it. Give the prevalence, the raw agreement po, kappa with its interval, and the agreement on each class. Better still, give the judge's sensitivity and specificity for the failure class against the human labels, which are what the correction of §19.4 needs.
HealthBench's authors scored their grader in this spirit. They computed the F1 score (the harmonic mean of precision and recall) of each class, "met" and "not met", and averaged the two, so that a rare class counts as much as a common one. On its 34 consensus criteria, their GPT-4.1 grader reached 0.709 against physicians' labels. That beat the average physician in five of seven themes.
The widget below runs the paradox. Two raters each pass 97% of good answers and fail the share of bad answers you set, independently of each other, and you move the share of good answers. The first preset is the worked example. With the careful raters, who fail 90% of bad answers, slide good answers from 50% to 99%. Raw agreement climbs from 88% to 94% while kappa falls from 0.76 to 0.20, and kappa follows the agreement on fails all the way.
Why can two raters agree on 92% of answers and still get a kappa of only 0.16?
A judge and a human each pass 97% of good answers. Set how many bad answers each fails.
Loading interactive figure…
In practice, oversample failures when you build a validation set, so that agreement on them is measured precisely. Interviewers love this paradox, and the third interview question below is the classic version.
How precise is a kappa
A kappa from 200 items is an estimate, and reporting it without an interval invites the mistakes of §0.11. The tool for its variance is the delta method. Near the truth, a smooth function of a noisy estimate is almost a linear function of it. So its variance is almost the variance of that linear function. In symbols, let an estimate p^ have covariance Σ/n and let f be smooth. The first-order Taylor expansion f(p^)≈f(p)+∇f(p)⊤(p^−p) gives Varf(p^)≈∇f⊤Σ∇f/n.
The crude version treats pe as a known constant. Then κ^ is a linear function of p^o. That is a proportion over n independent items, with variance po(1−po)/n, so
SE(κ^)≈1−pepo(1−po)/n.
This is the approximation in the paper that introduced kappa (Cohen 1960). It ignores that pe is estimated from the same data. The full delta method does not.
∂ The delta method for kappa
The counts in the C×C table are multinomial. Flatten the table into a vector p. The cell proportions p^ab then have covariance (diag(p)−pp⊤)/n. Hence for any smooth f, nVarf(p^)≈∑abpab(∂abf)2−(∑abpab∂abf)2, writing ∂ab=∂/∂pab.
Now differentiate κ=(po−pe)/(1−pe). The cell pab enters po=∑cpcc only if a=b, so ∂abpo=1[a=b]. It enters pe=∑cpc⋅p⋅c twice. It is part of the row sum pa⋅, which is multiplied by p⋅a. It is also part of the column sum p⋅b, which is multiplied by pb⋅. So ∂abpe=p⋅a+pb⋅. By the quotient rule,
Substituting into the multinomial formula gives the theorem. For the mean term, ∑abpab1[a=b]=po, ∑abpabp⋅a=∑apa⋅p⋅a=pe, and likewise ∑abpabpb⋅=pe. So ∑abpabgab=po(1−pe)−2pe(1−po)=po+pope−2pe.
Here are both formulas on the paradox table, checked against 20,000 simulated studies of 200 items each.
Python · cell 4
Why does the crude formula overestimate here? At extreme prevalence the estimated po and pe move together, since a sample with more passes raises both. So part of their noise cancels in po−pe, and the crude formula misses that. Either way the lesson is the same. A kappa from a couple of hundred items at extreme prevalence is barely a measurement.
When no formula fits, use the bootstrap of §0.11. Resample items, each with both raters' labels, and recompute kappa each time. Never resample the two raters' labels separately, because that destroys the pairing that agreement is about.
Weighted kappa for ordered scales
On a 1 to 5 scale, a judge that says 4 when the human says 5 is closer than one that says 1. Cohen's kappa counts both as plain disagreement. Weighted kappa (Cohen 1968) charges each disagreement by its size on the scale.
In plain words, weighted kappa is one minus the ratio of observed disagreement to chance disagreement, where disagreement is measured in steps on the scale. Scaling every weight by the same constant leaves κw unchanged, since the constant cancels in the ratio. The division by C−1 matters only in the equivalent "agreement weight" form 1−wab that some software uses.
Quadratic weights have a second justification. With them, κw is closely related to the intraclass correlation of the two raters' numeric scores (Fleiss and Cohen 1973). So it measures how well the judge's numbers track the human's, like a correlation that also penalizes a constant offset. Here is a judge and a human on a 3-point scale (1 bad, 2 acceptable, 3 good) over 100 items, checked against scikit-learn.
Python · cell 5
In practice, report quadratic weighted kappa for a 1 to 5 judge scale, and say which weights you used, because the choice changes the number.
Interview
Cohen's kappa with an interval, and weighted kappa
This is the function you would write before trusting a judge with a launch decision. It has two parts.
First, implement weighted_kappa(r1, r2, categories, weights="quadratic") for two raters' labels. categories lists the scale in order, and it may include levels nobody used. weights is "linear", "quadratic", or None for Cohen's kappa. Return 1.0 when the chance disagreement is zero, which happens when both raters used one and the same category.
Second, implement kappa_with_ci(r1, r2, categories, weights=None, n_boot=2000, rng=None, level=0.95). It returns (kappa, lo, hi), where (lo, hi) is a percentile bootstrap interval over items. Draw the replicates as idx = rng.integers(0, n, size=(n_boot, n)).
Tests, hints, verified solutions, and AI help, with Pro at $7.99 a month.
Many raters and missing ratings
Real labeling projects have three judges and five humans, and not everyone labels every item. Cohen's kappa is defined for exactly two raters. Fleiss' kappa handles any fixed number of ratings per item. Its raters need not be the same people from item to item, which is how crowd labeling works. Krippendorff's alpha handles any number of raters, missing ratings, and any type of scale. It is the standard choice when the data are messy.
In plain words,Pu is the probability that two distinct ratings of item u, drawn at random, agree. Pˉe is the probability that two ratings drawn at random from the whole pool agree. With R=2, Pu is 1 when the two ratings agree and 0 when they do not, so Pˉ=po. And pc=(p1c+p2c)/2 is the pooled marginal, so κF is exactly Scott's pi. It inherits the pooled chance model, and with it the prevalence paradox.
Krippendorff's alpha starts from a different idea. Forget which rater gave which value, and look only at pairs of values within one item (Krippendorff calls an item a unit). Unit u with nu≥2 ratings has nu(nu−1) ordered pairs of values from different raters. Give each pair the weight 1/(nu−1), so that each of the nu values carries total weight 1. Units with a single rating have no pairs and are dropped.
In plain words,Do is how often two values from the same item disagree. De is how often two values drawn at random from the whole pool, without replacement, would disagree. For unordered categories De=(N2−∑cnc2)/(N(N−1)). Alpha is 1 for perfect agreement, and 0 when values within an item are no more alike than random values.
When no rating is missing, alpha is Fleiss' kappa up to a small-sample factor.
∂ Proof that alpha is Fleiss' kappa up to the factor (N - 1)/N
Every unit has nu=R, so unit u adds nuc(nuk−1[c=k])/(R−1) to ock. Its off-diagonal mass is (R2−∑cnuc2)/(R−1)=R(1−Pu), so Do=N1∑uR(1−Pu)=1−Pˉ. The pairable counts are nc=Npc, so De=(N2−∑cnc2)/(N(N−1))=(1−Pˉe)N/(N−1). Then αK=1−NN−1⋅1−Pˉe1−Pˉ, and 1−Pˉe1−Pˉ=1−κF. ∎
For the four-item example with all twelve ratings, N=12 and αK=1−32⋅1211=187≈0.389, slightly above κF=31. The factor (N−1)/N goes to 1 as the data grow. Alpha also inherits the paradox, since it too corrects for chance with pooled marginals. Krippendorff (2011) works through the computation for every type of scale.
Warm-up
Fleiss' kappa, and how it meets Scott and Krippendorff
Implement fleiss_kappa(counts). The array counts has shape (n_items, C), and counts[u, c] is the number of ratings of item u in category c. Every row must sum to the same R≥2. Raise ValueError otherwise. Return κF, or 1.0 when Pˉe=1 (every rating in one category).
import numpy as np
def fleiss_kappa(counts):
raise NotImplementedError
Tests, hints, verified solutions, and AI help, with Pro at $7.99 a month.
Core
Krippendorff's alpha with missing ratings
Implement krippendorff_alpha_nominal(R) for unordered categories. R is a raters by units array of numeric labels, with np.nan for a missing rating. Build the coincidence matrix with the 1/(nu−1) weighting, drop units with fewer than two ratings, and return αK.
import numpy as np
def krippendorff_alpha_nominal(R):
raise NotImplementedError
Tests, hints, verified solutions, and AI help, with Pro at $7.99 a month.
The table collects the statistics of this part.
statistic
raters
missing ratings
scale
chance model
watch out for
percent agreement po
2
no
any
none
inflated by a common class
Cohen's κ
2
no
unordered
each rater's own marginals
prevalence paradox, rewards unequal marginals
Scott's π, Fleiss' κF
2, or a fixed R per item
no
unordered
pooled marginals
prevalence paradox
weighted κw
2
no
ordered
own marginals
choice of weights changes the number
Krippendorff's αK
any
yes
unordered, ordered, numeric
pooled values
prevalence paradox, needs enough pairable values
Gwet's AC1, PABAK
2 (AC1 extends to more)
AC1 extends
unordered
chosen to stay high at extreme prevalence
close to raw agreement at extreme prevalence
per-class agreement, sensitivity and specificity
judge against reference
no
binary per criterion
none
needs the reference to be right
Item-level and system-level agreement
A judge can agree with humans on single answers, which is item-level agreement. Or it can agree with them on which system is better overall, which is system-level agreement. These are different properties, and a judge can have one without the other.
Here is the puzzle that shows it. Thakur et al. (2024) tested 13 judge models on questions where humans agree with each other well. Only the largest judges aligned reasonably with humans on single answers. Even those gave overall scores up to 5 points away from the human scores. Yet when the task was to rank nine "exam-taker" models, smaller judges did reasonably well. So did a plain string check that asks whether the answer contains the reference.
At the other end is Arena-Hard-Auto (Li et al. 2024). It grades 500 hard prompts with a judge against a fixed baseline. Its reference is Chatbot Arena, a public site where people compare two anonymous models' answers and vote (§22.7 builds its ranking). Against the arena's human ranking with the effect of answer style removed, Arena-Hard-Auto's ranking has a Spearman correlation of 98.6% when it removes style the same way, and 94.9% without that adjustment. MT-Bench reaches 90.7% and length-controlled AlpacaEval 88.1%. Arena-Hard-Auto also separates 87.4% of model pairs with non-overlapping confidence intervals, against 22.6% for MT-Bench, at about 20 US dollars a run.
How can a judge be mediocre on items and excellent on systems? Because averages forgive noise and do not forgive bias. Here is a tiny example. Two systems differ in true mean score by 0.2. The judge's error on one item has a standard deviation of 1, five times that gap, so single verdicts are unreliable. Average 500 items and the error of each system's mean shrinks to 1/500≈0.045, small next to 0.2. Now give the worse system a constant bonus of 0.2. Averaging never shrinks it, and the two systems now look tied however many items you grade.
To state this precisely we need a measure of how well two rankings agree. Kendall's tau looks at every pair of systems and asks whether the two rankings order the pair the same way. It is the share of pairs ordered the same way minus the share ordered oppositely. So it is 1 for identical rankings, −1 for reversed ones, and near 0 for unrelated ones.
∂ Proof of the attenuation formulas
Average over the n items of system s, writing bars for means, hˉs=μs+vˉs and jˉs=hˉs+bs+ηˉs. The mean of n independent terms of variance σ2 has variance σ2/n, so Var(hˉs)=σμ2+σv2/n. Since bs and ηˉs are independent of hˉs,
Therefore Corr(jˉs,hˉs)=Var(hˉs)/Var(hˉs)Var(jˉs)=Var(hˉs)/Var(jˉs), which is ρsys(n). The item-level formula is the same computation with n=1, the correlation over all system-item cells pooled. As n→∞ the terms with 1/n vanish and ρsys2→σμ2/(σμ2+σbias2).
The last claim needs two more facts. First, for a pair of random variables (X,Y) the population Kendall tau is τ=P(concordant)−P(discordant) for two independent draws (X1,Y1) and (X2,Y2), where concordant means (X1−X2)(Y1−Y2)>0. For continuous variables ties have probability zero, so τ=2P(concordant)−1. The sample tau over m systems averages the sign of (xs−xt)(ys−yt) over all (2m) pairs. Each term has expectation τ when the systems are independent draws, so the average does too.
Second, the differences DX=X1−X2 and DY=Y1−Y2 are jointly normal with mean zero, variances 2VarX and 2VarY, and covariance 2Cov(X,Y), so their correlation is the same ρ. The orthant formula of Sheppard (1899), also used in §16.1, says that for such a pair P(DX>0,DY>0)=41+2π1arcsinρ. To see it, standardize and write DX=Z1 and DY=ρZ1+1−ρ2Z2, with Z1,Z2 independent standard normals. The vector (Z1,Z2) points in a uniformly random direction. The event DX>0 is a half-plane with normal (1,0), and DY>0 is a half-plane with normal (ρ,1−ρ2), at angle arccosρ from the first. Two half-planes whose normals differ by an angle ϕ intersect in a wedge of angle π−ϕ. So the probability is (π−arccosρ)/(2π)=41+2π1arcsinρ, using arccosρ=2π−arcsinρ. By symmetry both differences are negative with the same probability, so P(concordant)=21+π1arcsinρ and τ=π2arcsinρ. Applied to the system means, with ρ=ρsys, this is the theorem's last claim.
In plain words, averaging over n items divides the judge's item noise by n, so the noise disappears from system rankings. A bias that attaches to a whole system does not average away at all. Self-preference for one family, or a taste for one system's style, caps the agreement you can reach however many items you grade.
Let's check the formulas. Systems differ by σμ=0.2 and items vary by σv=1 within a system, so systems differ by a fifth of the item spread, a realistic ratio. The judge's item noise is as large as the item variation, ση=1. The cell simulates 2,000 leaderboards of 20 systems. It draws each system's average directly from its exact distribution, since a mean of n independent normals with variance σ2 is normal with variance σ2/n.
Python · cell 6
So the two kinds of agreement answer different questions. If the judge ranks systems or picks checkpoints, check its system-level agreement with humans, and hunt for biases that attach to systems, such as self-preference and style. If the judge decides about single responses (filtering training data, gating a response, acting as a reward), check item-level agreement, because no averaging rescues a bad single verdict. Arena-Hard-Auto's 98.6% is a statement of the first kind and says little about the second. An interviewer who asks "is this judge good?" wants you to ask back "good for what?".
In the widget, eight systems have true means with a spread of about 0.2, and as in the cell the judge's noise on one answer is as large as the item spread, ση=σv=1. Under the picture, the average Kendall tau and the share with the same top system come from 200 fresh leaderboards. Press Play to grade more items per system and watch the lines between the two rankings straighten. Then give one system a bonus and play again.
Can a judge that is noisy on single answers still rank models correctly?
Eight systems, S1 truly best. Lines join each system's rank by humans and by a noisy judge.
Loading interactive figure…
Leaderboards are rankings, and coarse scores produce ties. So the natural statistic for system-level agreement is a rank correlation that handles ties.
Without ties this equals the plain τa=(ncon−ndis)/(2m). With ties, τa is pulled toward zero, so even two identical rankings that contain a tie score below 1, while τb gives them exactly 1. The uncertainty comes from the prompts, which are the sample. So a bootstrap interval resamples prompts and recomputes every system's mean. The systems are the fixed objects of interest and are never resampled. Spearman's rank correlation is the other common choice and behaves similarly.
Core
Does the judge rank systems like humans?
J and H are arrays of shape (n_prompts, n_systems), holding the judge's and the humans' scores of every system on every prompt. First, implement kendall_tau_b(x, y) from scratch, handling ties. Then implement system_agreement(J, H, n_boot, rng, level=0.95). It returns a dict with three entries.
"tau_b", the tau-b between the per-system mean scores.
"ci", a percentile bootstrap interval over prompts, with replicates drawn as idx = rng.integers(0, n_prompts, size=(n_boot, n_prompts)).
"item_spearman", the Spearman correlation over all prompt-system cells. You may use scipy.stats.spearmanr.
Tests, hints, verified solutions, and AI help, with Pro at $7.99 a month.
Where judges fail at the frontier
Everything so far assumes the judge measures the right thing, with some noise and bias. On the hardest problems that assumption breaks in four ways.
Judges cannot grade what they cannot solve. JudgeBench (Tan et al. 2024) took hard problems whose answers can be checked, in knowledge, reasoning, math, and coding. It turned them into 350 pairs, each with one correct and one incorrect response. Both responses came from GPT-4o, so the wrong answers look plausible. Each pair is judged in both orders, and it counts as correct only if the two verdicts pick the right answer, or one picks it and the other calls a tie. A guess made once per pair would score 50%, which the authors take as chance. GPT-4o as a judge scored 50.9% with a plain prompt, and 56.6% with the Arena-Hard judge prompt. All but two of the judge models fine-tuned for grading scored below 50%. The pairs are hardest for GPT-4o itself, since it wrote both responses, and the authors note that bias. In the updated paper, reasoning models did much better, 75.4% for o1-preview and 80.9% for o3-mini at high effort. Each model's accuracy as a judge closely tracked its own accuracy at solving the problems.
Benchmarks of judges built from human preferences miss this, because crowd raters cannot check these answers either. The remedies are a reference answer, a program that checks the answer where one exists (§18.3), and a stronger or reasoning judge. When the models being graded exceed every available judge, the remaining option is the research program of scalable oversight, which studies how weaker graders can supervise stronger models.
Judges can be attacked. The fixed text from the opening worked in two steps. First, a structured response imitated the judge's own template and rewrote the comparison it was asked to make. That alone reached a 76.8% length-controlled win rate on AlpacaEval 2.0. Then a short prefix found by random search against GPT-4 raised it to 86.5%. The prefix was tuned on instructions from a public dataset, UltraFeedback, not on the benchmark's own (Zheng et al. 2024). So the attack needs no access to the benchmark's questions. It exploits the fact that the response being graded is text the judge reads, the same weakness as prompt injection against agents (§19.3).
The defenses are the ones a security engineer would expect. Delimit and clean the response. Test the judge with adversarial and constant responses before trusting a leaderboard. Flag responses whose content does not depend on the prompt. Use several judges from different families, keep the judge's instructions private, and keep humans in the loop for anything high-stakes.
Judges drift. A judge is a model version plus a prompt, and changing either moves every number. Verga et al. (2024) found GPT-4 a relatively weak judge in some settings, with high variance under small changes to the prompt. Pin the judge model and the prompt, version them with the eval, and rerun the validation set whenever either changes.
Judges can be contaminated.§22.3 was about a model that saw the test before it was graded. A judge has its own version of the problem, which Li et al. (2025) call preference leakage. Much post-training data is now written by strong models, and the same strong models are the usual judges. A judge then grades students trained on its own writing, and it likes what it recognizes.
Li et al. had GPT-4o, Gemini-1.5-flash, and Llama-3.3-70B each answer the same 30,000 prompts. They fine-tuned small models (Mistral-7B and Qwen-2.5-14B) on each set of answers, giving one "student" per teacher. Then the same three models judged the students against each other on Arena-Hard and AlpacaEval 2.0. In most pairs, each judge favored the student trained on its own outputs. Their preference leakage score measures by how much, relative to what the two judges say on average.
An excess of about a fifth in relative win rate is large. It also survives, at a smaller size, when the judge is only a sibling of the teacher, as the summary of Li et al.'s findings shows.
Preference leakage hides from the judge's own verdicts for the same reason self-preference does. The bias attaches to a whole system, so in the biased-judge model it only shifts that system's rating. From judge data alone, a favored student looks exactly like a better one. It is also harder to audit. The thing to record is no longer the student's model family but where its training data came from. You may know that for your own models, and you rarely know it for anyone else's. And like every bias that attaches to a system, it does not average away however many items you grade, as the theorem on system-level agreement showed.
Two mitigations recur across all four failures. The first is a jury, which replaces one large judge with several smaller ones from different families and takes a vote. Verga et al.'s panel of three models from different families (Command R, Claude 3 Haiku, and GPT-3.5) reached a higher Cohen's kappa with human judgments than GPT-4 alone on three question-answering sets. On Natural Questions it was 0.763 against 0.627. The panel also showed less bias toward any one family, and it cost over seven times less. A vote of independent judges improves like the majority of several annotators in §16.2, but only to the extent that their errors are independent. That is why the families should differ.
The second is calibration with humans, which turns a biased judge into an unbiased estimate. Label a random slice of a few hundred items with people. Then correct the judge's mean in one of two ways. Prediction-powered inference adds the judge's average error on the labeled slice to its average on everything, and it needs no model of the judge's errors (§14.7, from Angelopoulos et al. 2023). Or estimate the judge's sensitivity and specificity and invert them (§19.4). Either way, the human slice is what makes the number defensible.
Open evaluator models give you control over all of this. Prometheus 2 (Kim et al. 2024) is an open model trained to grade against criteria you write, in both pointwise and pairwise formats. It is the kind of judge you can pin forever and audit fully.
A checklist for validating a judge
Before a judge's numbers drive a decision, collect a random sample of 200 to 500 items. Stratify it by the failure modes you care about, and have at least two humans label each item with the rubric fixed in advance. Then measure these six things, in order.
Agreement between the humans, with an interval. It is the ceiling a judge can be compared with.
The judge's agreement with the humans on the same items, on items not used to tune the judge prompt. Report kappa with an interval and agreement on each class, or sensitivity and specificity for each criterion.
The calibration of the judge's probabilities, if you will use them for expected scores or thresholds. Report a reliability table and an ECE against the human labels, with a temperature or Platt repair fitted on one split and checked on another.
The bias audit. Measure position from both orders, length from a fitted slope, and self-preference against the human labels. Record whether the judge's family wrote any of the compared systems' training data.
System-level agreement, if the judge will rank systems.
Adversarial behavior, with constant, empty, very long, and judge-addressing responses.
Then use the judge with a human-labeled slice on every run and a prediction-powered correction. MT-Bench's original validation is the template. Its GPT-4 pairwise judge agreed with expert humans on 85% of the votes that were not ties, while the experts agreed with each other on 81% (Zheng et al. 2023). That comparison is what justifies calling a judge "as good as a human".
The rest of the chapter builds on this. §22.5 meets judges that read an agent's whole trajectory, including judges that are themselves agents (Zhuge et al. 2024). §22.6 writes one judge per failure mode for your own product and validates each with its sensitivity and specificity. And §22.7 applies the agreement statistics to human raters.
Read more
Zheng et al. (2023). Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena. The paper that made judges standard, with the position-consistency tables, the repeated-list test, reference-guided grading, and the judge-human agreement numbers.
Krippendorff (2011). Computing Krippendorff's Alpha-Reliability. The coincidence-matrix computation with worked examples, for any number of raters, missing data, and scale types.
Watch next
🎬 Cohen's Kappa : Data Science Basics · ritvikmathA clear walk through observed versus chance agreement and why kappa corrects raw agreement, the starting point for the section's agreement statistics.🎬 LLM Evals: Common Mistakes · Hamel HusainA practitioner's view of the mistakes teams make with LLM evals and judges. Worth watching next to the section's checklist for validating a judge.