ealeng

Episode 10 of 15 · Can you trust the grader?

Shown first, it wins: pairwise comparisons, ties and honest rankings

A simulated AI judge compared a new summarizer version with the old one on 300 tickets. Shown first, the new one won 70.0%; shown second, 45.3%, as if the old one were better; a person would prefer it 60.7% of the time. How judging both orders turns the judge's pull toward the first answer into ties, which win rate to report (ties as half: 57.7%), how many comparisons a win needs (85 for a 65% edge, 783 for 55%), why a Bradley–Terry ranking of five versions can't separate the top three, and how an overall draw can hide a clear loss on angry customers.

Lab 11 · Pairwise Comparisons and Rankings17 min read
Video transcript7:25

0:00Cold open

0:01

Our support AI writes a short summary of each customer ticket. I built a new version, and wanted to know if it’s better than the old one.

0:10

So for three hundred tickets, an AI judge read both summaries, and picked the better one.

0:16

With my new version shown first, it won seventy percent of the time.

0:22

Then I swapped the order. Same kind of tickets, same judge. Now it won just forty-five percent, as if the old one were better.

0:31

This is a simulation, so I know the truth: a person would prefer my new version about sixty-one percent of the time.

0:39

So which number do you trust? And how do you compare two versions, when the judge cares about the order?

0:46Intro

0:48

Hands-on AI evals: can you trust the grader? Part three: comparing versions side by side, and ranking them.

0:57Meet Maya

0:58

I’m Maya, an ML engineer. Our summarizer has five versions.

1:03

Version one is the old one. The others try a shorter prompt, example summaries, a bigger model, and a bigger model with a tone guide. Version three is my new one.

1:14

Scoring each summary from one to five is hard to do consistently. Picking the better of two is easier. That’s a pairwise comparison.

1:23

Here the judge is another AI. It sees one ticket and two summaries, and answers: A, or B.

1:30

One thing to know: all of this is simulated. I chose how good each version really is.

1:36

And I built the judge to favour whichever summary it reads first: sixty-two percent of the time, when both are equally good. Part two of this series tested a judge for exactly this.

1:4901 · Judge both orders

1:50

It’s like a taste test, where people tend to prefer whichever cup they sip first. The fair fix: everyone tastes in both orders.

1:59

So each ticket gets judged twice: once with my new version first, and once with the old one first.

2:06

If the judge picks my new version both times, that’s a win. If it picks the old one both times, a loss.

2:13

If its pick changes when the order changes, the judge didn’t really prefer either one. That’s a tie.

2:20

Out of three hundred tickets: ninety-two wins, forty-six losses, and a hundred and sixty-two ties.

2:28

More than half the tickets were ties: on these two versions, this judge often can’t make up its mind, and the order tips it.

2:37

Ties aren’t all bias: an unsure judge flips too. Even with no bias at all, a version against itself would tie half the time. This judge ties fifty-two percent.

2:4902 · Which win rate?

2:51

So what’s my new version’s win rate? There are two ways to count.

2:55

Count each tie as half a win, and it’s fifty-eight percent. Close to the true sixty-one.

3:02

Or drop the ties, and keep only the decisive comparisons, where the judge picked the same version both times. That gives sixty-seven percent.

3:12

That’s too high. A decisive result needs the same pick twice, so a small edge gets counted twice.

3:19

So I report the win rate with ties as half, and the number of ties next to it.

3:2503 · How many comparisons?

3:27

Is fifty-eight percent a real win, or luck? That depends on how many comparisons you have.

3:33

The standard check: is the likely range clear of fifty percent? For this check, only decisive comparisons count: if the two versions were equal, those would split fifty-fifty.

3:45

If the better version wins sixty-five percent of them, you need about eighty-five to spot it.

3:51

So how many for fifty-five percent? Take a guess.

3:57

Seven hundred and eighty-three. A small edge needs far more comparisons.

4:03

And my fifty-eight percent, from three hundred tickets? Real: the range stays above fifty.

4:10

With only a hundred tickets, the check would still spot my new version eighty-six percent of the time.

4:16

Now take the bigger model, with and without a tone guide. In my simulation, a person would prefer one of them just fifty-one percent of the time.

4:26

With a hundred tickets, the check spots a difference less than one time in ten. Two identical versions would do about as well.

4:35

So “can’t tell” is a result. I report it, instead of crowning the one that happens to be ahead.

4:4204 · Five versions, one ranking

4:43

Now all five versions. I compared every pair on a hundred and fifty tickets, both orders. That’s fifteen hundred comparisons.

4:52

To turn them into one ranking, I fit a model called Bradley–Terry. It gives each version one strength.

4:59

The gap between two strengths sets how often one beats the other. Equal strengths: fifty-fifty. A bigger gap: the stronger one wins more often.

5:09

Here’s the ranking: version five on top, then four, then three.

5:14

But in my simulation, I set version four as the strongest.

5:19

So is the ranking wrong? To see how sure it is, I refit it four hundred times, each time on a reshuffled copy of the same comparisons: drawn at random, some twice, some not at all.

5:32

Version five came out on top in just over half of them. And each of the top three landed anywhere from first to third.

5:40

The bottom two are settled: version two fourth, version one last.

5:45

So the honest report: we can’t tell the top three apart. A table that numbers them one, two, three is showing noise.

5:5405 · A draw that hides a loss

5:55

Back to that close pair: the bigger model, and the bigger model with a tone guide. Over all tickets, we can’t tell them apart.

6:03

But our tickets come in three kinds: simple ones, ones with several requests, and angry customers.

6:10

So I compared the two on four hundred tickets of each kind.

6:14

On simple tickets, and on multi-request ones: can’t tell.

6:19

With angry customers, the tone guide clearly wins. The bigger model alone wins only about one in four of the decisive comparisons, far below half.

6:30

I built that into the simulation: without the guide, the bigger model is blunt with angry customers. Splitting by kind of ticket found it. The overall number hid it.

6:41

So which one should I ship? If angry customers matter most, the tone guide. That’s a product decision, not a statistics one.

6:5006 · What I do now

6:51

So here’s how I compare versions now. Every pair judged in both orders, and the win rate reported with its ties.

6:59

Enough comparisons for the edge I care about, and a breakdown by kind of ticket.

7:05

And a ranking that shows how sure it is.

7:08

That wraps up this series on whether you can trust the grader.Maya: Ask both ways. Count the ties.

7:12Summary

7:14

A judge that favours one position can still give a fair comparison, if you ask it both ways round, and count a split verdict as half a win.Maya: Thanks for watching!

Key takeaways

  • ✓A pairwise comparison shows a judge two answers to the same input and asks which is better. An AI judge that favours whichever answer it reads first makes one fixed order unreliable: the same new version won 70.0% of 300 simulated comparisons when shown first and 45.3% when shown second, against a true 60.7%.
  • ✓Judge every pair in both orders. The same pick both times is a win or a loss; a different pick in each order is a tie. The new version against the old one: 92 wins, 46 losses, 162 ties. Most ties come from an unsure judge, not the bias: with no bias at all, a version against itself would tie 50% of the time; this judge ties 52%.
  • ✓Report the win rate with ties counted as half a win (57.7%, close to the true 60.7%), with the number of ties next to it. The decisive win rate, ties dropped, reads too high (66.7%): a decisive result needs the same pick twice, so a small edge counts twice.
  • ✓Whether an edge is real depends on how many decisive comparisons you have: about 85 for a version that wins 65% of them, 783 for 55%. Two versions a person would prefer 50.9% against 49.1% were told apart only 2% of the time with 100 tickets and 8% with 400, no better than two identical versions. "Can't tell" is a result to report.
  • ✓Bradley–Terry turns all comparisons into one strength per version. With five versions and 1,500 comparisons, the fitted top three came out in a different order from the truth, and in 400 refits on resampled comparisons each of them landed anywhere from 1st to 3rd; the leader was 1st in only 53%. Show ranks as ranges, not 1, 2, 3.
  • ✓An overall draw can hide a clear loss. The bigger model and the bigger model with a tone guide tied over all tickets (50.6%), but with angry customers the version without the guide won only 25% of decisive comparisons (95% range 20–32%). Break results down by kind of input; which to ship is a product decision.

Our support AI writes a short summary of each customer ticket. A new version is ready, and we want to know whether it's better than the old one. So for 300 tickets an AI judge reads both summaries and picks the better one. With the new version shown first, it wins 70.0% of the time. Swap the order, same kind of tickets, same judge, and it wins 45.3%, as if the old one were better. Because this is a simulation, we know the truth: a person would prefer the new version 60.7% of the time. This chapter is about comparing versions side by side when the judge cares about the order: how to get a fair verdict, which win rate to report, how many comparisons a win needs, and how to rank several versions without claiming more than the data shows. It's the third of three chapters on whether you can trust the grader, after Chapter 8 (metrics without a reference answer) and Chapter 9 (the judge as a measuring instrument).

The examples come from Lab 11 (Pairwise Comparisons and Rankings) of the eval labs: 01_win_rates.py (one order against both, ties, how many comparisons), 02_bradley_terry.py (from comparisons to a ranking, and how firm it is) and 03_strata_and_cycles.py (when one ranking misleads), with the math in the lab's evalkit/pairwise.py. The video skips two parts of those scripts, online Elo and cycles; they get a short section near the end. The lab's last script, 04_live_pairwise.py, runs a real judge through a paid API; it isn't covered here. Everything here is simulated (the lab's common.py): five versions of the summarizer, each with a true strength set in the lab, tickets of three kinds, and a judge built to favour whichever summary it reads first. The true strengths and the bias are inputs, not findings; only the counts, rates and rankings are measured. Every number below is from the lab's scripts with their own random seeds, so rerunning them prints the same results.

The five versions

Version What changed In the simulation
v1 the baseline prompt: the old version weakest
v2 a shorter prompt
v3 few-shot examples (example summaries in the prompt): the new version
v4 a bigger model strongest overall, but blunt with angry customers
v5 the bigger model plus a tone guide nearly as strong overall, best with angry customers

The names v1 to v5 are just the order the versions were built in. Tickets come in three kinds: simple ones (50% of traffic), ones with several requests (30%) and angry customers (20%).

Scoring a summary from one to five is hard to do consistently. Picking the better of two is easier, for people and for AI judges. That's a pairwise comparison: show the judge one input and two outputs, and ask "A or B?". A version's win rate is the share of comparisons it wins. Here the judge is another AI model, and the lab built it to pick the summary it reads first 62% of the time when both are equally good. That pull is position bias, the bias Chapter 9 tested a judge for.

Judge both orders

It's like a taste test, where people tend to prefer whichever cup they sip first. If the new recipe is always sipped first, it gets credit for going first. The fair fix: everyone tastes in both orders. So each ticket is judged twice, once with the new version first and once with the old one first:

  • the judge picks the new version both times: a win;
  • it picks the old one both times: a loss;
  • its pick changes when the order changes: a tie. The judge didn't really prefer either one.

Below, each dot is one of the 300 tickets, the judge is the taster, and the cups show the order. Switch between the three designs.

Try it · A taste test with 300 tastersLab 11 · 01_win_rates.py · simulated judge, seed 0
sip 1stv3 · newsip 2ndv1 · oldone taste per ticket, always this order

300 tickets, one dot each (the judge is the taster)

● picked the new one● picked the old one

The new version's win rate

50%truth 60.7%0%100%
Wins
210
Losses
90
Ties
0
Win rate
70.0%

The new version is always sipped first, and the judge leans toward the first cup. It wins 210 of 300: 70.0%, well above the true 60.7%.

Simulated: the judge is built to pick the first summary 62% of the time when both are equally good, and the true 60.7% is set in the lab, not measured. Each design draws its own 300 tickets from the same mix (seed 0), so they're the exact verdicts the script prints. Tie shares: 42.0% first-both-times, 12.0% second-both-times.

Design Wins Losses Ties Win rate
New version always shown first 210 90 0 70.0%
Old version always shown first 136 164 0 45.3% (95% range 40–51%)
Both orders, a split verdict is a tie 92 46 162 57.7% with ties as half

With one fixed order, the answer depends on which version you happened to put first: a big win, or something that looks like a loss. (The 45.3% doesn't prove the old version is better: its range, 40–51%, still touches 50%. But a one-order eval would never have shown the new version's real edge.)

More than half the tickets were ties. That isn't all position bias. Each judge call is like a weighted coin, so an unsure judge flips its pick from one call to the next even without any bias. A version compared with itself would tie 50% of the time with no bias at all (heads-tails or tails-heads); with this judge's bias the expected rate is 53.0%, and the lab measured 52.2% over 500 tickets. For the new version against the old one, the expected tie rate is 47.7% without the bias and 50.7% with it; the run gave 54.0% (162 of 300). The order adds about three points of ties. And not every tie followed the order: in 126 of the 162 the judge picked whichever summary came first both times, in 36 whichever came second. So ties mostly measure how unsure the judge is on these two versions, with the order tipping it. The bias itself shows in the 70.0% against 45.3%.

Judging both orders costs twice the judge calls, and it's what makes the comparison fair.

Which win rate?

Two ways to turn 92 wins, 46 losses and 162 ties into one number:

  • Ties as half a win: (92 + 162 ÷ 2) ÷ 300 = 173 ÷ 300 = 57.7%, close to the true 60.7%.
  • Decisive only: drop the ties and keep the decisive comparisons, where the judge picked the same version both times: 92 ÷ 138 = 66.7%.

The decisive rate is too high as a win rate. A decisive result needs the same pick twice, so a small edge gets counted twice. A plain example (an illustration, not the lab's judge): a judge that picks the better version 60% of the time on each call gives a win 0.6 × 0.6 = 36% of the time and a loss 0.4 × 0.4 = 16%; among those decisive results, the better version wins 36 ÷ 52 = 69%.

So report the win rate with ties as half, and the number of ties next to it. "55% wins, 30% ties" and "55% wins, no ties" are different results: the ties say how often the judge couldn't separate the versions. The decisive rate still has a job, in the next section.

How many comparisons?

Is 57.7% a real win, or luck? The standard check: is the likely range clear of 50%? For this check only decisive comparisons count, because if the two versions were equally good, those would split 50/50 (a sign test). The range is the 95% Wilson interval from Chapter 1, a confidence interval that behaves well for rates.

How many decisive comparisons you need depends on the edge. To spot it 80% of the time (80% power, the share of the time a check notices a real difference, as in Chapter 2), with a 5% chance of a false alarm:

The better version wins this share of decisive comparisons Decisive comparisons needed
75% 29
65% 85
60% 194
55% 783

A small edge needs far more comparisons: half the edge, about four times the comparisons. Ties don't count, so with a judge that splits about half its verdicts you need about twice as many tickets.

Try it · Is the range clear of 50%?Lab 11 · 01_win_rates.py, 03_strata_and_cycles.py · simulated

1 · How many decisive comparisons does an edge need?

Decisive comparisons needed
85
Tickets, at about half ties
~170

To notice the edge 80% of the time (80% power) with a 5% false-alarm rate. The lab prints this row. Halving the edge roughly quadruples the comparisons: 65% needs 85, 55% needs 783. Ties don't count, so with this judge you need about twice as many tickets.

2 · The check on recorded results

v3 (few-shot examples) vs v1 (the old prompt), 300 tickets, Script 1

0%25%50%75%100%66.7% (58–74%)
Wins / losses
92 / 46
Ties
162
Win rate, ties ½
57.7%
Verdict
new version better

The bar is the 95% Wilson interval of the decisive win rate (92 of 138). It sits above 50%: the new version's edge is real, even with 162 ties.

Simulated versions and judge. Comparisons needed from the lab's comparisons_needed (exact, not simulated); intervals from its wilson_ci on the recorded counts. The v4 vs v5 rows use 400 tickets of each kind (Script 3, seed 0); “all tickets” mixes them in the production shares (50 / 30 / 20%).

The new version's 92 of 138 decisive comparisons give a range of 58–74%, clear of 50%: real. To see how often the check spots a difference at all, the lab repeated the whole comparison 300 times at each size:

Pair A person prefers the first 100 tickets 400 tickets
New vs old (v3 vs v1) 60.7% spotted 86% of the time 299 of 300 (the lab prints 100%)
Bigger model vs bigger model + tone guide (v4 vs v5) 50.9% 2% 8%
Two identical versions (v1 vs v1) 50% 6% 4%

The last row isn't in the lab: the video's exporter ran the same check on a version against itself, with the lab's code and its own seed, to see what chance alone looks like. For the two bigger-model versions the check does no better than for identical versions. So "can't tell" is a result: report it instead of crowning the one that happens to be ahead, and size the comparison for the edge you care about.

Five versions, one ranking

Now all five versions. The lab compared every pair (ten pairs) on 150 tickets each, both orders: 1,500 comparisons. To turn them into one ranking it fits a Bradley–Terry model: each version gets one strength, and the gap between two strengths sets how often one beats the other. Equal strengths: 50/50. A gap of 0.4 (the strengths are on the log-odds scale): the stronger one wins about 60%. The model is fitted to all comparisons at once, so even pairs compared rarely get an estimate from the others. Elo ratings, as in chess, are the same scale stretched so 400 points means 10 times the odds.

Version Strength (95% interval) Elo True strength (set in the simulation) Best in Rank range
v5 bigger model + tone guide +0.19 (+0.10 to +0.29) 1033 +0.21 53% 1–3
v4 bigger model +0.17 (+0.08 to +0.26) 1030 +0.24 26% 1–3
v3 few-shot examples +0.15 (+0.06 to +0.24) 1026 +0.10 21% 1–3
v2 shorter prompt −0.17 (−0.26 to −0.08) 970 −0.22 0% 4
v1 baseline prompt −0.34 (−0.44 to −0.25) 941 −0.34 0% 5

The fit says v5, v4, v3. The simulation set v4 as the strongest. Is the ranking wrong? To see how sure it is, the lab refits it 400 times, each on a reshuffled copy of the same comparisons: 1,500 drawn at random, some twice, some not at all (a bootstrap). "Best in" is the share of refits where the version came first; the rank range covers the middle 95% of its ranks.

Try it · Five versions, one rankingLab 11 · 02_bradley_terry.py · 1,500 simulated comparisons
−0.4−0.20.0+0.21. v52. v43. v34. v25. v1
versionstrength (95%)EloP(best)rank range
v5 +0.19 (+0.10 to +0.29)103353%1–3
v4 +0.17 (+0.08 to +0.26)103026%1–3
v3 +0.15 (+0.06 to +0.24)102621%1–3
v2 −0.17 (−0.26 to −0.08)9700%4
v1 −0.34 (−0.44 to −0.25)9410%5

One strength per version, fitted from all 1,500 comparisons at once (dots; bars are 95% intervals from 400 refits). The table numbers them 1 to 5, but the top three intervals overlap almost entirely.

v5 above v4 in 62% of refits · not separatedv4 above v3 in 60% of refits · not separatedv3 above v2 in 100% of refits · separatedv2 above v1 in 98% of refits · separated

Simulated versions and judge; “true” strengths are set in the lab's common.py (centred to average 0), never known in real life. Strength is on the log-odds scale: a gap of 0.4 means the stronger one wins about 60%. Elo is the same scale × 400 / ln 10, centred on 1,000. Separation shares come from a second set of 400 refits (seed 1); the lab calls a pair separated at 97.5% or more.

v5 came out on top in just over half the refits, and each of the top three landed anywhere from 1st to 3rd. Checked pair by pair, v5 sat above v4 in 62% of a second set of 400 refits and v4 above v3 in 60%; the lab calls a pair separated only at 97.5% or more. The bottom two are settled: v3 above v2 in 100%, v2 above v1 in 98%. The fit isn't broken: the true strengths sit inside the intervals. The gaps at the top are just smaller than the noise. So the honest report is "we can't tell the top three apart". That doesn't mean they're equal (v3's true strength is well below the other two); it means 1,500 comparisons can't order them. A table that numbers them 1, 2, 3 is showing noise; show ranks as ranges, or group the versions into tiers.

A draw that hides a loss

Back to the close pair: the bigger model (v4) and the bigger model with a tone guide (v5). Over all tickets, can't tell. But the tickets come in three kinds, so the lab compared the two on 400 tickets of each kind, both orders. This is stratified sampling from Chapter 3: each kind of ticket is a stratum, measured on its own.

Kind of ticket Share of traffic A person prefers v4 (set) v4 win rate, ties as half v4 decisive (95% range) Verdict
Simple 50% 56.2% 53.2% 56.0% (49–62%) can't tell
Multi-request 30% 53.7% 53.1% 56.3% (49–63%) can't tell
Angry customer 20% 33.2% 37.9% 25.4% (20–32%) v5 better
All tickets (production mix, 800) 100% 50.6% 51.1% (46–56%) can't tell

With angry customers the tone guide clearly wins: the bigger model alone wins only about one in four of the decisive comparisons, far below half. The lab built that in (without the guide, the bigger model is blunt with angry customers), and splitting by kind of ticket found it. The overall number hid it, because the bigger model's small edge on the other 80% of tickets cancels the loss on the 20%. Which one to ship? If angry customers matter most, the tone guide. That's a product decision, not a statistics one; the report's job is to show it rather than average it away.

Two things the video skips

Both are in the lab's scripts and printouts.

Online Elo depends on the order of games. Classic Elo, as used in chess, updates both ratings after every game, so recent games count more. Fed the same 1,500 comparisons in 50 random orders (Script 2, Exercise 3), v5's rating ranged from 957 to 1114, and each of the top three came out first in some orders (v5 38%, v3 34%, v4 28%). Bradley–Terry uses all comparisons at once and gives one answer: for fixed versions, fit Bradley–Terry. Online Elo is for settings where players keep arriving and changing.

Cycles. Three prompt styles that differ in two ways, length and tone (Script 3, Exercise 2; drawn directly at a set 68%, with no judge and no ties): concise beats detailed (68.7%, 63–74%), friendly beats concise (concise wins only 30.7%, 26–36%), detailed beats friendly (63.0%, 57–68%). Every pair has a clear winner, yet there's no best style, like rock, paper, scissors. Bradley–Terry, which assumes one strength per version, reports them as nearly equal (friendly +0.08, concise −0.01, detailed −0.08) and hides the structure. Before publishing a ranking, check each triple of versions in the pairwise table for a cycle; when there is one, report the separate qualities (the rubric criteria of Chapter 7), not one number.

What to do

  1. Judge every pair in both orders. A split verdict is a tie. It costs twice the judge calls.
  2. Report the win rate with ties as half, plus the number of ties. Don't headline the decisive rate.
  3. Check whether the edge is real: is the Wilson interval of the decisive win rate clear of 50%?
  4. Size the comparison for the edge you care about: about 85 decisive comparisons for 65%, 783 for 55%, about twice that in tickets when half are ties.
  5. Report "can't tell" when the check can't tell. Don't crown the one that happens to be ahead.
  6. Rank with Bradley–Terry and a bootstrap: strengths with intervals, how often each is best, and rank ranges. Group versions that the refits can't separate.
  7. Break every comparison down by kind of input, and check triples for cycles before publishing a ranking.

Caveats

  • Everything is simulated. The versions' strengths, the three kinds of ticket and the judge's 62% pull toward the first answer are set in common.py; the "true" preferences are known only because of that. A real judge's bias and indecision have to be measured, which is what the lab's Script 4 (paid API, not run here) does.
  • This judge's calls are independent coins. Each call is a fresh weighted coin, so ties come out near 50% even with no bias. A real judge may be more consistent on clear pairs, and give fewer ties.
  • No summaries exist. The lab simulates verdicts, not text; there's no summary to read.
  • One draw of each experiment. Other seeds give other counts. The 45.3% one-order result, for instance, is one run whose range still touches 50%.
  • The identical-versions row (6% / 4%) and the expected tie rates are not in the lab. They come from the video's exporter, using the lab's code; the 6% / 4% (17 and 12 of 300) were rerun for this chapter on a copy of the lab.
  • Rounded in the lab's printout. The lab prints 783 / 194 / 85 / 29 exactly, but rounds the 400-ticket detection of the new version (299 of 300) to 100% and v2 above v1 (97.75%) to 98%.

The checklist

  1. Was every pair judged in both orders? If not, part of the result is the order.
  2. How many ties, and were they reported next to the win rate?
  3. Which win rate is the headline: ties as half, or decisive only?
  4. Is the decisive win rate's interval clear of 50%?
  5. Were there enough comparisons for the edge that matters, and is "can't tell" an allowed answer?
  6. Does the ranking show how sure it is: intervals, how often each version is best, rank ranges?
  7. Was the result broken down by kind of input, and checked for cycles?

Practice: judge both orders and fit a ranking

Write the lab's pairwise math: turn the verdicts from each order into a win, loss or tie, summarise a comparison both ways, check whether the decisive win rate is clear of 50% with a Wilson interval, size a comparison, compute the expected tie rate of a judge like the lab's, and fit Bradley–Terry strengths. The tests use the lab's recorded verdicts: the 300 tickets of each design (210 / 90, 136 / 164, and 92 / 46 / 162), the four kinds of ticket for the bigger-model pair, and the 1,500-comparison round robin, where your fit should match the lab's strengths (+0.19 down to −0.34) and its Elo ratings.

Try it · Practice in PythonRuns in your browser · ⌘/Ctrl + Enter to run
pairwise_practice.py80 lines

Quiz

Try it · Check your understanding0 of 6 answered
  1. 1.An AI judge compares your new version with the old one, always showing the new one first. It wins 70% of 300 comparisons. What's the problem?

  2. 2.Each ticket is judged twice, once in each order. The judge picks the new version when it's shown first, and the old one when that's shown first. How do you score that ticket?

  3. 3.Both orders gave 92 wins, 46 losses and 162 ties. Which win rate do you report?

  4. 4.Two versions are close: a person would prefer one of them 50.9% of the time. With 100 tickets, the check spotted a difference 2% of the time; with 400, 8%. What do you report?

  5. 5.A Bradley–Terry ranking of five versions puts them in order 1 to 5. Refit on 400 resampled copies of the comparisons, each of the top three lands anywhere from 1st to 3rd, and the leader is 1st in 53%. How do you present it?

  6. 6.Over all tickets, two versions tie. Split by kind of ticket, one wins only 25% of the decisive comparisons on angry customers. What does this tell you?

Check your understanding

Try each question before opening its answer.

Why does one fixed order give an unreliable pairwise result?

AI judges tend to favour the answer in one position, usually the first. With the new version always shown first, its win rate includes that pull: 70.0% of 300 simulated comparisons. With the order swapped, 45.3%. The truth, set in the simulation, was 60.7%. Judging both orders cancels the pull.

How do you score a ticket judged in both orders?

The same pick both times is a win (or a loss). A different pick in each order is a tie: the judge didn't really prefer either one. The new version against the old one gave 92 wins, 46 losses and 162 ties.

Are the ties a measure of position bias?

Mostly not. Each judge call is like a weighted coin, so even a judge with no bias would split its verdict on a version against itself half the time. With the lab's bias the expected rate is 53.0%, and it measured 52.2%. The order adds about three points; the bias shows in the 70.0% against 45.3% of a single fixed order. Ties mostly say the judge is unsure on that pair.

Why report the win rate with ties as half, rather than the decisive rate?

Ties as half (57.7%) lands near how often a person would prefer the version (60.7%). The decisive rate (66.7%) needs the same pick twice, so a small edge counts twice and reads too high. Report ties as half with the number of ties; use the decisive comparisons for the check of whether the edge is real, where a 50/50 split is what equal versions give.

How many comparisons does it take to show one version is better?

It depends on the edge: about 85 decisive comparisons when the better version wins 65% of them, 194 for 60%, 783 for 55%, for an 80% chance of spotting it. Ties don't count, so you need more tickets. Two versions a person would prefer 50.9% against 49.1% were spotted only 2% of the time with 100 tickets and 8% with 400, about as often as two identical versions (6% and 4%).

What does a Bradley–Terry ranking give you, and how do you know how firm it is?

One strength per version, fitted from all comparisons at once, so the gap between two strengths sets how often one beats the other. To see how firm it is, refit it on many resampled copies of the comparisons and report how often each version is best and its range of ranks. In the lab, the top three of five landed anywhere from 1st to 3rd and the leader was best in only 53% of refits, so they can't be told apart.

Two versions tie overall. Why still break the result down by kind of input?

A tie can hide a loss. The bigger model and the bigger model with a tone guide tied over all tickets (50.6%), but with angry customers the version without the guide won only 25% of decisive comparisons (95% range 20–32%). Its small edge on the other tickets cancelled the loss in the overall number. Which to ship then depends on how much those tickets matter.

Why can't one ranking describe three versions where each beats one of the others?

In a cycle (concise beats detailed, detailed beats friendly, friendly beats concise, each clearly) there is no best version, and Bradley–Terry, which assumes one strength per version, reports them as nearly equal (+0.08, −0.01, −0.08). The versions differ in more than one way, here length and tone, so the useful report is the separate qualities.

Next up: Chapter 11, is your synthetic data realistic? Every chapter so far assumed the test inputs looked like real traffic. The next one checks that assumption for generated test data: can you tell synthetic tickets from real ones, how varied they are, and does the system score higher on them than on the real thing.

Learning something useful?

New labs, articles, and videos on evaluating and testing AI systems come out regularly. Follow along so you don't miss the next one.