Cohen’s kappa
\(\kappa = \dfrac{p_o - p_e}{1 - p_e}\): agreement beyond chance
Takeaway
A judge that catches % of real failures agrees with your experts 90% of the time when % of outputs fail. Its kappa is only 0.49.
Change the blue numbers. Every figure on this page updates with them.
Why care
Every eval that uses an LLM judge is only as good as the judge.
The usual check is to have experts label a sample and report how often the judge agrees. When most outputs are good, a judge that passes almost everything agrees most of the time without judging anything. Cohen's kappa subtracts the agreement you would get by chance from the raters' own pass rates, and asks how much of the remaining room the judge actually covers. It is the validation step most teams skip, and the one that tells you whether your eval numbers mean anything.
The intuition
Imagine a judge that never reads the output and stamps "pass" on everything. If 87% of outputs are genuinely good, it agrees with your experts 87% of the time. That number sounds respectable and means nothing.
Kappa puts chance at zero and perfect agreement at one. The weak judge's 90% looks only three points better than the stamp, and kappa shows that it covers about half of the distance from chance to perfect.
The math
Lay out expert and judge verdicts on the same \(N\) items as a 2×2 table: \(a\) both pass, \(b\) expert passes and judge fails, \(c\) expert fails and judge passes, \(d\) both fail.
- \(p_o\)
- observed agreement: share of items where expert and judge give the same verdict
- \(p_H,\ p_J\)
- pass rates of the expert, \((a+b)/N\), and the judge, \((a+c)/N\)
- \(p_e\)
- agreement expected by chance if the two rated independently at those pass rates
- \(\kappa\)
- share of the possible improvement over chance that the judge achieves
For an eval judge, two more numbers explain the kappa: how many real failures it catches, and how much good work it wrongly fails. With \(\pi\) the share of outputs that truly fail:
- Read kappa on a scale: a common rule of thumb is below 0.4 poor to fair, 0.4–0.6 moderate, 0.6–0.8 substantial, above 0.8 almost perfect. For an eval judge, aim for 0.7 or better.
- Rare failures pull kappa down: when only a few outputs fail, chance agreement is already high, so the judge has to be very good at spotting failures to earn a high kappa. This is the prevalence effect, and it is the point, not a flaw: catching rare failures is the judge's job.
- Interval: an approximate standard error is \(\sqrt{p_o(1-p_o)/N}\,/\,(1-p_e)\). With 200 labeled items, expect intervals around ±0.1 to ±0.2.
Where each of these comes from is worked through in Derivations at the end of the page.
Interactive calculator
Describe the judge by how many real failures it catches and how often it fails good work, and set how common failures are. The table, agreement and kappa follow.
Worked example: validating a support-quality judge
A team built an LLM judge to grade customer-support transcripts as pass or fail, and asked two senior agents to label 200 transcripts independently of the judge.
| Judge v1 | Judge v2 | |
|---|---|---|
| Both pass / expert pass, judge fail | 168 / 6 | 170 / 4 |
| Expert fail, judge pass / both fail | 14 / 12 | 4 / 22 |
| Agreement | 90.0% | 96.0% |
| Chance agreement | 80.3% | 77.4% |
| Kappa (approx. 95% interval) | 0.49 (0.28–0.70) | 0.82 (0.70–0.94) |
| Real failures caught | 12 of 26 (46%) | 22 of 26 (85%) |
Judge v1's 90% agreement looked fine in the status update. Its kappa of 0.49 showed the problem, and the table showed where: it missed more than half of the transcripts the experts failed, mostly polite replies that gave the wrong refund policy. The team added the policy to the judge's rubric with three failing examples. Judge v2 reached 96% agreement and kappa 0.82, and the eval's reported pass rate dropped from 91% to 87%, which matched the experts. The earlier eval had been overstating quality by four points.
Assumptions and where it breaks
- The experts are not ground truth. Two humans also disagree. Measure human–human kappa on the same items; no judge can be expected to beat that ceiling.
- Kappa alone hides the direction of errors. A judge that misses failures and one that fails good work can have the same kappa. Always read the table, especially the catch rate on real failures.
- Prevalence changes kappa. The same judge scores differently on a sample with 5% failures than on one with 30%. Label a sample whose failure rate matches production, or oversample failures and report the catch rate separately.
- Beyond pass or fail. For 1–5 scores, use weighted kappa, which gives partial credit for near misses. For more than two raters, use Fleiss' kappa or Krippendorff's alpha.
- Judges drift. A model update or a rubric edit can change behavior. Re-run the check on a fixed labeled set whenever the judge changes.
How to apply it
- Label 200 or more items with experts, blind to the judge's verdicts, sampled like production traffic.
- Build the 2×2 table and compute kappa with its interval, plus the judge's catch rate on real failures.
- Read the disagreements. The \(b\) and \(c\) cells show which rubric items the judge misreads.
- Fix the rubric with failing examples, then re-check on a fresh labeled sample, not the one you tuned on.
- Gate on a threshold. Use the judge for decisions only once kappa clears your bar, such as 0.7, and its catch rate covers the failures that matter.
How to explain it to a stakeholder
"A judge that said 'pass' to everything would agree with our experts 87% of the time, because most work is good. So 90% agreement isn't impressive. Kappa measures how much better than that the judge does, and we need it above 0.7 before we trust its scores."
Related models and patterns
For coding agents
A machine-readable summary and a reference implementation. The same spec is embedded in this page as <script type="application/json" id="model-spec">, and the whole series is listed in models.json.
id: cohens-kappa
number: M08
name: Cohen's kappa for judge validation
family: evaluation
answers: "Does an LLM judge agree with human experts beyond chance?"
formula:
observed_agreement: "po = (a + d) / N"
chance_agreement: "pe = pH*pJ + (1 - pH)*(1 - pJ)"
kappa: "(po - pe) / (1 - pe)"
kappa_se_approx: "sqrt(po*(1 - po)/N) / (1 - pe)"
catch_rate: "d / (c + d)"
false_fail_rate: "b / (a + b)"
inputs:
a: {type: int, meaning: both pass}
b: {type: int, meaning: expert pass, judge fail}
c: {type: int, meaning: expert fail, judge pass}
d: {type: int, meaning: both fail}
assumptions:
- expert labels treated as reference, not ground truth
- binary verdicts (weighted kappa for ordinal scores)
- labeled sample matches production failure rate
use_when:
- validating an LLM judge or classifier guardrail before relying on it
- re-checking a judge after a model or rubric change
related_patterns: [llm-as-judge, human-in-the-loop, guardrails]import math
def kappa(a, b, c, d):
"""a both pass, b expert pass/judge fail, c expert fail/judge pass, d both fail."""
n = a + b + c + d
po = (a + d) / n
p_h, p_j = (a + b) / n, (a + c) / n
pe = p_h * p_j + (1 - p_h) * (1 - p_j)
k = (po - pe) / (1 - pe)
se = math.sqrt(po * (1 - po) / n) / (1 - pe)
return {"agreement": po, "chance": pe, "kappa": k,
"ci": (k - 1.96 * se, k + 1.96 * se),
"catch_rate": d / (c + d) if c + d else None}
if __name__ == "__main__":
print(kappa(168, 6, 14, 12)) # agreement 0.90, chance 0.803, kappa 0.49, catch 0.46
print(kappa(170, 4, 4, 22)) # agreement 0.96, chance 0.774, kappa 0.82, catch 0.85
print(kappa(174, 0, 26, 0)) # always-pass judge: agreement 0.87, kappa 0.0Derivations
For the math-curious: where each result in The math comes from. Nothing above depends on reading this.
Chance agreement
Suppose the expert passes items at rate \(p_H\) and the judge at rate \(p_J\), but they decide independently, as if the judge never looked at the expert's reasoning. They agree on "pass" with probability \(p_Hp_J\) and on "fail" with \((1-p_H)(1-p_J)\). The sum is \(p_e\). With \(p_H = 0.87\) and \(p_J = 0.91\), \(p_e = 0.792 + 0.012 = 0.803\).
Why kappa rescales between chance and perfect
Agreement can range from \(p_e\) (no better than chance) to 1 (perfect). Kappa measures where the observed agreement sits on that range: \(\kappa = (p_o - p_e)/(1 - p_e)\). It is 0 at chance, 1 at perfect, and negative when the raters agree less than chance would predict, which usually means a label is flipped.
Kappa from the judge's catch rate and false-fail rate
Let a share \(\pi\) of outputs truly fail, let the judge catch a share \(s\) of them, and let it wrongly fail a share \(f\) of good ones. As shares of all items, the four cells are \(a = (1-\pi)(1-f)\), \(b = (1-\pi)f\), \(c = \pi(1-s)\), \(d = \pi s\). A standard identity gives \(p_o - p_e = 2(ad - bc)\) and \(1 - p_e = p_H(1-p_J) + (1-p_H)p_J\). Here \(ad - bc = \pi(1-\pi)(s-f)\) and \(p_H = 1-\pi\), so
$$\kappa = \frac{2\,\pi(1-\pi)\,(s - f)}{(1-\pi)(1-p_J) + \pi\,p_J}.$$The numerator shows that kappa grows with how much better than chance the judge separates failures (\(s - f\)), weighted by \(\pi(1-\pi)\), which is small when failures are rare. That is the prevalence effect: when \(\pi\) is small, only a judge with \(s\) close to 1 and \(f\) close to 0 reaches a high kappa.
The approximate interval
Treat \(p_e\) as fixed. Then \(\kappa\) is a linear function of \(p_o\), whose standard error as a proportion is \(\sqrt{p_o(1-p_o)/N}\). Dividing by \(1-p_e\) gives Cohen's original approximation. It is good enough for planning; for reporting, a bootstrap over the labeled items accounts for the uncertainty in \(p_e\) as well.
References
- Cohen, J. (1960). A coefficient of agreement for nominal scales. Educational and Psychological Measurement 20(1), 37–46.
- Landis, J. R. and Koch, G. G. (1977). The measurement of observer agreement for categorical data. Biometrics 33(1), 159–174. Source of the commonly used interpretation scale.
- Feinstein, A. R. and Cicchetti, D. V. (1990). High agreement but low kappa: I. The problems of two paradoxes. Journal of Clinical Epidemiology 43(6), 543–549.
- Zheng, L. et al. (2023). Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena. Measures LLM-judge agreement with humans, and judge biases.