Bradley–Terry Model
The Bradley–Terry model turns pairwise outcomes, such as "response A was preferred to response B", into one strength score per item. Each item \(i\) gets a number \(\theta_i\), and the probability that \(i\) beats \(j\) depends only on the difference of their scores. It is the model behind many ranking tables built from head-to-head human preference votes, and it is the batch counterpart of the Elo rating.
The model
Give item \(i\) a positive strength \(p_i=e^{\theta_i}\). The probability that \(i\) beats \(j\) is
\[ P(i\succ j)=\frac{p_i}{p_i+p_j}=\frac{1}{1+e^{-(\theta_i-\theta_j)}}=\sigma(\theta_i-\theta_j). \]
The right-hand form is the logistic function of the score gap. Equal scores give 0.5. A gap of 0.4 gives 0.599, a gap of 1 gives 0.731 and a gap of 2 gives 0.881, so a gap of 0.4 is a clear but modest preference. Scores are on the log-odds scale: adding 1 to \(\theta_i\) multiplies the odds of beating anyone by \(e\).
Only differences are identified, because adding a constant to every \(\theta\) changes nothing, so scores are reported relative to a reference or centered to mean 0.
Fitting
Let \(w_{ij}\) be the number of times \(i\) beat \(j\). The log-likelihood is
\[ \ell(\theta)=\sum_{i\ne j} w_{ij}\log\sigma(\theta_i-\theta_j), \]
which is concave in \(\theta\), so any finite local maximum is global. Adding the same constant to every score still leaves the likelihood unchanged; fix a reference score or center the scores to remove that freedom. A unique finite maximum also requires the directed win graph to be strongly connected: every division of the items into two nonempty groups must have observed wins crossing in both directions. Without that condition, scores can diverge, as in the zero-wins example below. It is a logistic regression in which each comparison has a feature vector with +1 for the winner, −1 for the loser and no intercept. A classical alternative is the minorize-maximize update of Hunter, which repeats \(p_i\leftarrow W_i\big/\sum_{j}\tfrac{n_{ij}}{p_i+p_j}\) for every item and then rescales, where \(W_i\) is the total number of wins of \(i\) and \(n_{ij}=w_{ij}+w_{ji}\).
The program below simulates four items with true scores 0, 0.4, 0.9 and 1.6 and 50 comparisons for each of the 6 pairs, fits the model with the update above, and puts bootstrap intervals around the scores. Its second part is used in the discussion of failure cases below.
import numpy as np
rng = np.random.default_rng(3)
theta = np.array([0.0, 0.4, 0.9, 1.6]) # true strengths of items A..D
sigma = lambda z: 1 / (1 + np.exp(-z))
def simulate(n_per_pair):
W = np.zeros((4, 4)) # W[i, j] = times i beat j
for i in range(4):
for j in range(i + 1, 4):
k = rng.binomial(n_per_pair, sigma(theta[i] - theta[j]))
W[i, j], W[j, i] = k, n_per_pair - k
return W
def fit(W, iters=500): # Hunter's MM update
p, n = np.ones(len(W)), W + W.T
for _ in range(iters):
for i in range(len(W)):
p[i] = W[i].sum() / sum(n[i, j] / (p[i] + p[j]) for j in range(len(W)) if j != i)
p /= np.exp(np.log(p).mean()) # fix the free constant: mean score 0
return np.log(p)
def bootstrap(W, B=200):
pairs = [(i, j, W[i, j], W[j, i]) for i in range(4) for j in range(i + 1, 4)]
out = []
for _ in range(B):
M = np.zeros((4, 4))
for i, j, a, b in pairs:
k = rng.binomial(int(a + b), a / (a + b)); M[i, j], M[j, i] = k, a + b - k
out.append(fit(M, 300))
return np.array(out)
W = simulate(50); th = fit(W); lo, hi = np.percentile(bootstrap(W), [2.5, 97.5], axis=0)
print("true (centered):", np.round(theta - theta.mean(), 2))
for name, t, l, h in zip("ABCD", th, lo, hi): print(f"{name}: {t:+.2f} 95% bootstrap [{l:+.2f}, {h:+.2f}]")
print("P(D beats A): fitted %.3f, observed %.3f" % (sigma(th[3] - th[0]), W[3, 0] / (W[3, 0] + W[0, 3])))
# an item with zero wins: log-likelihood keeps rising as its score goes to -infinity
W0 = np.array([[0, 0, 0], [5, 0, 3], [5, 2, 0.]]) # item 0 lost all 10 comparisons
def ll(tA):
t = np.array([tA, 0.0, 0.0])
return sum(W0[i, j] * np.log(sigma(t[i] - t[j])) for i in range(3) for j in range(3) if i != j and W0[i, j] > 0)
for g in (0, 3, 6, 10): print(f"theta_A = {-g:3d}: log-likelihood {ll(-g):.3f}")
true (centered): [-0.73 -0.33 0.17 0.88]
A: -0.86 95% bootstrap [-1.16, -0.58]
B: -0.27 95% bootstrap [-0.48, -0.06]
C: +0.20 95% bootstrap [-0.04, +0.43]
D: +0.93 95% bootstrap [+0.68, +1.29]
P(D beats A): fitted 0.856, observed 0.780
theta_A = 0: log-likelihood -10.397
theta_A = -3: log-likelihood -3.952
theta_A = -6: log-likelihood -3.490
theta_A = -10: log-likelihood -3.466
The fitted scores are near the true ones and each interval is about ±0.3 wide with 300 comparisons in total, so neighboring items such as B and C can be hard to tell apart (the intervals for B and C come within 0.02 of touching) even though the ranking is correct. The fitted probability that D beats A (0.856) differs from the observed 39 wins out of 50 (0.780) because the model pools all comparisons: it explains the D-versus-A result through D's and A's results against B and C as well, which is how it can rank items that were never compared directly.
Using it for preference evaluation
A common protocol shows a rater two outputs for the same prompt, records which is better, and fits Bradley–Terry scores for the systems. The scores give a ranking, and the probability formula translates a score gap into an expected win rate. Intervals should come from resampling prompts or raters, not only individual votes, because votes on the same prompt are not independent. Ask a separate question for each criterion, since one overall "better" mixes them.
When it fails
- Zero wins. If an item loses every comparison, the likelihood keeps rising as its score goes to \(-\infty\). In a three-item example where A loses all 10 comparisons, with the other two scores fixed at 0, the log-likelihood is −10.397 at \(\theta_A=0\), −3.952 at −3, −3.490 at −6 and −3.466 at −10: there is no finite maximum. Sparse data therefore needs a prior or a penalty that keeps scores finite.
- Non-transitive preferences. The model assumes one scale. A finite sample can show A beating B, B beating C and C beating A by chance, and the model allows that. What no set of scores can reproduce is a systematic cycle, where the underlying win probabilities of A over B, B over C and C over A are all above 0.5, as can happen when raters judge different qualities. The fit then hides the cycle. Comparing the observed win-rate matrix with the fitted one shows it, with the sampling uncertainty of each pair kept in view.
- Ties. Plain Bradley–Terry has no tie outcome; extensions such as Rao–Kupper and Davidson add one, and a common shortcut counts a tie as half a win to each side.
- Context. Strength is assumed fixed across prompts. A system that is better at code and worse at poetry gets one average score, so slicing by category matters.
- Connectivity. If the comparison graph splits into groups with no cross comparison, scores in different groups cannot be compared.
Neighbors
Elo updates scores after each match with a step size, so it follows drifting strength but depends on the order of games; Bradley–Terry fits all data at once and treats order as irrelevant. The Thurstone model uses a Gaussian instead of logistic link, with similar conclusions in practice. In reinforcement learning from human feedback, the reward model for preferences is trained with this same loss, \(-\log\sigma(r_w-r_l)\), for a preferred response \(w\) and a rejected one \(l\).
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
