Understanding Cohen's Kappa

The Paradox of High Agreement
Your LLM judge and a human reviewer label the same 100 responses as Pass or Fail. They agree on 90. A 90% match rate sounds like the validation can end early.
The catch: 85 of those responses were obviously fine, and both raters passed them. They're agreeing on the easy cases. On the 15 borderline responses, they only agreed on 5.
Raw agreement conflates skill with task difficulty. If 95% of your data falls into one category, two raters who match that base rate while guessing will "agree" about 90% of the time by accident.
Enter Cohen's Kappa
Jacob Cohen's insight (1960) was to ask: how much better is our agreement than random chance?
Symbol guide:
- κ (kappa): the agreement coefficient we're computing (range: -1 to 1)
- p_o: observed agreement, the actual proportion of items where both raters agreed
- p_e: expected agreement, the agreement we'd expect by pure chance
- 1 - p_e: the maximum possible improvement over chance
Think of it as measuring the "improvement over guessing":
- : Perfect agreement. The raters always agree.
- : Agreement equals chance. No better than random.
- : Worse than chance, which means systematic disagreement.
The 2×2 Contingency Table
Kappa is computed from a simple table counting agreements and disagreements:
| Rater B: Yes | Rater B: No | |
|---|---|---|
| Rater A: Yes | (both yes) | (A yes, B no) |
| Rater A: No | (A no, B yes) | (both no) |
Observed agreement:
Expected agreement: If raters were independent:
This accounts for the marginal distributions. If Rater A says "Yes" 80% of the time and Rater B says "Yes" 70% of the time, we'd expect them to both say "Yes" about 56% of the time by chance.
A Worked Example
You're validating an LLM judge against a human reviewer. Both label the same 50 responses as Pass or Fail:
| Judge: Pass | Judge: Fail | |
|---|---|---|
| Human: Pass | 18 | 4 |
| Human: Fail | 6 | 22 |
Step 1: observed agreement. They agree on responses: .
Step 2: the marginals. The human says Pass times; the judge, times.
Step 3: expected agreement.
Two raters with these base rates would agree half the time with zero skill.
Step 4: kappa.
The 80% headline becomes "moderate, brushing substantial." The judge captured about 60% of the headroom that chance left available: useful, but not the near-perfect proxy the raw number implied.
Try It Yourself
Drag the raters to see how their positions affect Kappa. Notice how the class imbalance (controlled by the "Base rate" slider) changes what counts as "chance agreement."
| B: Yes | B: No | |
|---|---|---|
| A: Yes | 53 | 0 |
| A: No | 0 | 47 |
Experiments to try:
- Set base rate to 50% (balanced classes). Even modest agreement yields decent Kappa.
- Set base rate to 90%. Now watch Kappa plummet even with high raw agreement, because the raters are mostly agreeing on obvious cases.
- Make both raters biased in the same direction. High agreement, but is it meaningful?
Your Turn
Fresh counts each time, same four moves as the worked example: agreements, marginals, the chance floor, then κ. The hints, if you need them, come in three sizes.
Practice problem
Moderation Queue
| Trainee moderator: Approve | Trainee moderator: Remove | |
|---|---|---|
| Senior moderator: Approve | 21 | 7 |
| Senior moderator: Remove | 5 | 17 |
n = 50 posts
Why Kappa Can Be Misleading
The Prevalence Problem
When one category dominates, Kappa can be counterintuitively low despite high agreement. With 95% base rate:
- Raw agreement might be 94%
- But chance agreement is ~90%
- So , which Landis and Koch would file under merely "fair."
Kappa is doing its job here: most of the "agreement" was coming from the easy majority class, and the low score says so.
The Bias Problem
If both raters have the same bias (e.g., both tend to say "Yes"), Kappa will be higher than if they have opposite biases, even when their accuracy is identical.
Interpretation Guidelines
Landis & Koch (1977) proposed these benchmarks:
| Interpretation | |
|---|---|
| < 0.00 | Poor (worse than chance) |
| 0.00–0.20 | Slight |
| 0.21–0.40 | Fair |
| 0.41–0.60 | Moderate |
| 0.61–0.80 | Substantial |
| 0.81–1.00 | Almost perfect |
Treat the benchmarks as folklore rather than law. A Kappa of 0.60 might be fine for a subjective task like rating "creativity" and disqualifying for a safety-critical classifier.
Kappa vs Krippendorff's Alpha
| Feature | Cohen's Kappa | Krippendorff's Alpha |
|---|---|---|
| Number of raters | 2 only | Any number |
| Missing data | Not allowed | Handles gracefully |
| Data types | Nominal (extensions exist) | Nominal, ordinal, interval, ratio |
| Use case | Simple pairwise agreement | Complex annotation projects |
Rule of thumb: Use Kappa for quick two-rater sanity checks. Use Alpha for serious annotation quality measurement.
Code
from sklearn.metrics import cohen_kappa_score
rater_a = [1, 1, 0, 1, 0, 0, 1, 1, 0, 1]
rater_b = [1, 0, 0, 1, 0, 1, 1, 1, 0, 1]
kappa = cohen_kappa_score(rater_a, rater_b)
print(f"Cohen's Kappa: {kappa:.3f}")library(irr)
kappa2(data.frame(rater_a, rater_b))Further Reading
- Cohen, J. (1960). "A coefficient of agreement for nominal scales." Educational and Psychological Measurement
- Landis & Koch (1977). "The measurement of observer agreement for categorical data"
- Wikipedia: Cohen's kappa -- good worked examples