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.
300 tickets, one dot each (the judge is the taster)
The new version's win rate
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.
1 · How many decisive comparisons does an edge need?
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
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.
| version | strength (95%) | Elo | P(best) | rank range |
|---|---|---|---|---|
| v5 bigger model + tone guide | +0.19 (+0.10 to +0.29) | 1033 | 53% | 1–3 |
| v4 bigger model | +0.17 (+0.08 to +0.26) | 1030 | 26% | 1–3 |
| v3 few-shot examples (the new one) | +0.15 (+0.06 to +0.24) | 1026 | 21% | 1–3 |
| v2 shorter prompt | −0.17 (−0.26 to −0.08) | 970 | 0% | 4 |
| v1 baseline prompt (the old one) | −0.34 (−0.44 to −0.25) | 941 | 0% | 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.
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
- Judge every pair in both orders. A split verdict is a tie. It costs twice the judge calls.
- Report the win rate with ties as half, plus the number of ties. Don't headline the decisive rate.
- Check whether the edge is real: is the Wilson interval of the decisive win rate clear of 50%?
- 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.
- Report "can't tell" when the check can't tell. Don't crown the one that happens to be ahead.
- 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.
- 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
- Was every pair judged in both orders? If not, part of the result is the order.
- How many ties, and were they reported next to the win rate?
- Which win rate is the headline: ties as half, or decisive only?
- Is the decisive win rate's interval clear of 50%?
- Were there enough comparisons for the edge that matters, and is "can't tell" an allowed answer?
- Does the ranking show how sure it is: intervals, how often each version is best, rank ranges?
- 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.
Quiz
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.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.Both orders gave 92 wins, 46 losses and 162 ties. Which win rate do you report?
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.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.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.