Skip to content
CodeKruPro

Cohen's kappa and the human ceiling

50/99

Module · Judges and guardrails as classifiers

intermediate

about 30 min

What this lesson teaches

The idea

If most replies pass, two raters who guess at random still agree most of the time. Raw agreement flatters them.

Why a tester cares

Cohen's kappa removes agreement that happens by chance. A judge should be compared with what two people reach using the same rubric, not with perfection.

Words you will meet

Cohen's kappa:
agreement corrected for chance: 0 is no better than guessing, 1 is perfect.
Human ceiling:
how well two people agree; a judge cannot be expected to beat it.

What you will do

  1. 1Implement kappa
  2. 2Compare judge and humans
  3. 3Choose what to fix
  4. 4Submit
Jump to practice

Raw agreement flatters raters: if 70% of replies pass, two raters who guess at random will agree more than half the time. Cohen's kappa corrects for that:

kappa = (observed agreement − chance agreement) / (1 − chance agreement)
chance agreement = P(A says pass)·P(B says pass) + P(A says fail)·P(B says fail)

0 means no better than chance, 1 means perfect. The useful comparison is not "is the judge's kappa high?" but "is it close to what two humans reach with the same rubric?". Humans set the ceiling. A judge cannot be held to agreement the rubric does not allow.

Your task

Implement kappa, compute it for two humans and for the judge against one human, and decide what to improve first.

Sign in to practise

The lesson is free to read. A free account lets you talk to the practice bots, run your code and save your score. You will come back to this lesson.

1

Your code

on both files

How this is checked: When you submit, your script runs and the server compares what it prints with the right values.

2

Question

The judge reaches kappa 0.609 with a human; two humans reach 0.696. What do you improve first?

How this is checked: One answer is right. This is a harder check: it earns the second 50 points once the core checks pass.

Core checks earn 50 points and the harder checks the other 50. You can submit as many times as you like.

About this lesson

Cohen kappa for LLM judge agreement, and the human ceiling it should be compared with

AI Testing for QA EngineersIntermediateJudges and guardrails as classifiers

How it works

Raw agreement flatters raters. If most replies pass, two raters guessing at random still agree often. Cohen's kappa corrects for agreement expected by chance: zero means no better than chance, one means perfect.

The useful comparison is not whether a judge's kappa is high, but whether it is close to what two humans reach with the same rubric. Humans set the ceiling, and a judge cannot be held to agreement the rubric itself does not allow.

About the assignment

Implement kappa, compute it for two humans and for the judge against one of them, and choose what to fix.

What you will do

  1. Compute observed agreement and each rater's pass share.
  2. Compute chance agreement and then kappa, as the page defines.
  3. Compare the judge with the human pair before deciding what to fix.

Common mistakes

  • Blaming the judge for a weak rubric

    If humans disagree too, fix the rubric first.

  • Dividing by zero

    When chance agreement is one, kappa is undefined. Handle it.

In a real test suite

Teams report a judge's kappa next to the human pair's. When the two are close, the judge is as good as the rubric allows, and more prompt work on the judge will not help.

Kappa is sensitive to how common passes are, so compare values only on the same set of replies. A judge measured on an easy week and humans measured on a hard one will give numbers that cannot be compared fairly.