Bradley–Terry and Elo
\(\Pr(i \text{ beats } j) = \dfrac{1}{1+10^{(R_j-R_i)/400}}\)
Takeaway
A rating gap of points means the stronger prompt wins only 58.5% of head-to-head judgments. Telling them apart reliably takes about 269 head-to-head comparisons.
Change the blue number. Every figure on this page updates with it.
Why care
"Which output is better, A or B?" is the easiest question to ask a human or an LLM judge, and the hardest to turn into a ranking.
Absolute scores drift: graders disagree on what a 7 out of 10 means, and an LLM judge's scale shifts with the prompt. Pairwise preferences are more stable, which is why model leaderboards and many internal evals use them. But a pile of "A beat B" judgments is not yet a ranking. Bradley–Terry turns the pile into ratings with error bars and a win probability for any pair. Elo, the chess system, approximates the same thing one game at a time, and that shortcut has a cost worth knowing.
The intuition
Give every contestant a hidden strength. When two meet, each wins in proportion to its strength: a contestant twice as strong as another wins two times in three. Ratings are just strengths on a log scale, set so that every 400 points multiplies the odds of winning by ten.
Bradley–Terry looks at all the results at once and finds the strengths that best explain them. Elo nudges two ratings after every single game, so it can follow a contestant that changes over time, but its final answer depends on the order the games arrived in.
The math
Bradley–Terry gives each contestant a strength \(s_i > 0\), or a rating \(R_i = 400\log_{10} s_i\):
Fit it to all the judgments by maximum likelihood. A simple, reliable algorithm repeats this update until it settles:
Elo instead updates after each game, with a step size \(K\):
- \(s_i,\ R_i\)
- strength and rating of contestant \(i\) (a prompt, model or agent version)
- \(W_i\)
- total wins of contestant \(i\)
- \(n_{ij}\)
- number of comparisons between \(i\) and \(j\)
- \(S_i,\ E_i\)
- result of one game for \(i\) (1 win, 0 loss, 0.5 tie) and its expected score
- \(K\)
- Elo step size: how far one game moves a rating
- Only differences matter: adding the same number to every rating changes nothing, so ratings are anchored, here at an average of 1000.
- Error bars come from the bootstrap: resample the judgments, refit, and read the spread of each rating.
- Close contestants need many judgments: to detect a win rate \(p\) against 50% with 80% power takes roughly \(n \approx \big((1.96+0.84)/(p-0.5)\big)^2/4\) direct comparisons: about 270 for a 58.5–41.5 matchup, a 60-point gap.
Where each of these comes from is worked through in Derivations at the end of the page.
Interactive calculator
Four prompts with known true ratings play a round-robin judged at random by their true win probabilities. Bradley–Terry fits all the results; Elo replays the same results in 60 random orders.
Worked example: four prompt variants
A team compared four system prompts for a sales-email agent. For 100 customer briefs per pair, an LLM judge saw two drafts side by side and picked the better one, with each pair shown in both orders to cancel the judge's preference for whichever draft comes first. That gave 600 judgments:
| Wins (row beat column) | A | B | C | D |
|---|---|---|---|---|
| Prompt A | – | 58 | 64 | 81 |
| Prompt B | 42 | – | 55 | 74 |
| Prompt C | 36 | 45 | – | 69 |
| Prompt D | 19 | 26 | 31 | – |
Bradley–Terry, with bootstrap 95% intervals, rated them A 1101 (1072–1134), B 1040 (1012–1073), C 1001 (969–1029) and D 857 (824–891). A beats B by 61 points with an interval of 11 to 110: probably better, predicted to win 58.7% of head-to-heads, and worth confirming with more judgments before a big rollout.
The team's dashboard used Elo with \(K = 32\), processing judgments as they streamed in. Replaying the same 600 judgments in 200 random orders, A's final Elo rating ranged from 944 to 1204, and B finished above A in 26% of orders. Lowering \(K\) to 16 cut that to 12%; at \(K = 4\) it disappeared, but then ratings barely moved from 1000 until hundreds of games had passed. For a fixed batch of judgments, Bradley–Terry gives one answer with honest error bars; Elo is for streams where contestants change.
Assumptions and where it breaks
- Judges have position bias. LLM judges often favor the first or the longer response. Show every pair in both orders and control for length, or the ratings measure the bias.
- Preferences may not be transitive. If A beats B, B beats C and C beats A, no single rating explains it. Check how well the fitted probabilities match observed win rates per pair.
- One number per contestant hides task mix. A prompt can win on short emails and lose on long ones. Fit separate ratings per task category when categories matter.
- Ties need handling. Count a tie as half a win each, or use the Davidson extension of Bradley–Terry, rather than dropping ties, which inflates differences.
- Sparse comparisons give shaky ratings. Contestants compared only a few times, or only against much weaker ones, get wide intervals. Spread comparisons across close pairs.
How to apply it
- Collect pairwise judgments on the same inputs. Both candidates answer the same brief, so the judgment compares outputs, not tasks.
- Randomize and swap positions. Present each pair in both orders and log which was shown first.
- Fit Bradley–Terry on the whole batch. Use Elo only for live leaderboards over changing systems.
- Bootstrap the intervals. Resample judgments 500 times, refit, and report each rating's 2.5th–97.5th percentile.
- Add judgments where intervals overlap. Spend the next comparisons on the closest pairs, not on settled ones.
How to explain it to a stakeholder
"We held a tournament between the prompts and let a judge pick the winner of each match. The ratings say how often each prompt would beat the others, with a range for how sure we are. A is ahead of B, and we'll run a few hundred more matches before we bet the launch on it."
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: bradley-terry-elo
number: M07
name: Bradley-Terry ratings and Elo
family: evaluation
answers: "How do pairwise judgments become a ranking with error bars?"
formula:
win_probability: "1 / (1 + 10**((R_j - R_i)/400))"
bt_mm_update: "s_i = W_i / sum_j(n_ij / (s_i + s_j))"
rating: "R_i = 400 * log10(s_i), centered to mean 1000"
elo_update: "R_i += K * (S_i - E_i)"
intervals: "bootstrap: resample judgments, refit, take percentiles"
inputs:
wins: {type: matrix, meaning: "wins[i][j] = times i beat j"}
K: {type: float, meaning: Elo step size, only for streaming updates}
assumptions:
- one strength per contestant explains all matchups
- judgments independent; position bias removed by swapping order
- preferences transitive
use_when:
- ranking prompts, models or agent versions from pairwise preferences
- building leaderboards from human or LLM-judge votes
related_patterns: [llm-as-judge, debate, learning-loop]import numpy as np
def bradley_terry(wins, iters=1000):
"""wins[i][j] = times i beat j. Returns ratings centered at 1000."""
W = np.asarray(wins, float)
n = len(W)
s = np.ones(n)
for _ in range(iters):
total = W + W.T
denom = np.array([sum(total[i, j] / (s[i] + s[j]) for j in range(n) if j != i)
for i in range(n)])
s = W.sum(axis=1) / denom
s /= np.exp(np.log(s).mean())
r = 400 * np.log10(s)
return r - r.mean() + 1000
def bootstrap(wins, reps=500, seed=0):
rng = np.random.default_rng(seed)
W = np.asarray(wins, float)
out = []
for _ in range(reps):
Wb = np.zeros_like(W)
for i in range(len(W)):
for j in range(i + 1, len(W)):
t = int(W[i, j] + W[j, i])
Wb[i, j] = rng.binomial(t, W[i, j] / t)
Wb[j, i] = t - Wb[i, j]
out.append(bradley_terry(Wb, iters=300))
return np.percentile(out, [2.5, 97.5], axis=0)
if __name__ == "__main__":
wins = [[0, 58, 64, 81], [42, 0, 55, 74], [36, 45, 0, 69], [19, 26, 31, 0]]
print(bradley_terry(wins).round()) # [1101. 1040. 1001. 857.]
print(bootstrap(wins).round()) # roughly A 1072-1134, B 1012-1073, ...Derivations
For the math-curious: where each result in The math comes from. Nothing above depends on reading this.
From strengths to the 400-point scale
Write \(s_i = 10^{R_i/400}\). Then \(\frac{s_i}{s_i+s_j} = \frac{1}{1+s_j/s_i} = \frac{1}{1+10^{(R_j-R_i)/400}}\). The odds of \(i\) winning are \(s_i/s_j = 10^{(R_i-R_j)/400}\), so every 400 points multiplies the odds by ten. In natural-log units, Bradley–Terry is logistic regression on the rating difference: \(\Pr(i\text{ beats }j) = \sigma\big((R_i-R_j)\ln 10/400\big)\).
The fitting update
The log-likelihood of all judgments is \(\ell(s) = \sum_{i\ne j} w_{ij}\big(\ln s_i - \ln(s_i+s_j)\big)\). Setting \(\partial\ell/\partial s_i = 0\) gives \(W_i/s_i = \sum_{j} n_{ij}/(s_i+s_j)\): at the best fit, each contestant's expected wins equal its actual wins. Solving that condition for \(s_i\) while holding the others fixed gives the update shown. Hunter (2004) showed it is a minorize-maximize algorithm, so each step increases the likelihood and the iteration converges whenever every contestant has at least one win and one loss against the connected group.
Elo is Bradley–Terry learned one game at a time
Take the log-likelihood of a single game in rating units. Its derivative with respect to \(R_i\) is \(\frac{\ln 10}{400}(S_i - E_i)\). A gradient-ascent step with learning rate \(\eta\) moves \(R_i\) by \(\eta\frac{\ln 10}{400}(S_i-E_i)\), which is the Elo update with \(K = \eta\ln 10/400\). So Elo is stochastic gradient ascent on the Bradley–Terry likelihood with a constant step size. A constant step never settles: it keeps weighting recent games more than old ones, which is why the final ratings depend on game order and keep fluctuating, more so the larger \(K\) is, unless the step shrinks over time.
How many judgments to separate two contestants
If A beats B with probability \(p\), the observed win share over \(n\) head-to-head judgments has standard error \(\sqrt{p(1-p)/n} \approx 0.5/\sqrt n\). To be 95% sure A is ahead, the margin \(p - 0.5\) must exceed \(1.96 \times 0.5/\sqrt n\), so \(n \approx \big(1.96/(p-0.5)\big)^2/4\). At \(p = 0.585\) (a 60-point gap) that is about 130 direct comparisons; at 80% power it is about 270. Comparisons with other contestants help too, which is the advantage of fitting everything together.
References
- Bradley, R. A. and Terry, M. E. (1952). Rank analysis of incomplete block designs: I. The method of paired comparisons. Biometrika 39(3/4), 324–345.
- Hunter, D. R. (2004). MM algorithms for generalized Bradley–Terry models. The Annals of Statistics 32(1), 384–406.
- Chiang, W.-L. et al. (2024). Chatbot Arena: An Open Platform for Evaluating LLMs by Human Preference. Explains the move from online Elo to Bradley–Terry with bootstrap intervals for LLM leaderboards.