Evaluation Harnesses and Reproducibility › Comparing Two Models on the Same Tasks

Michael BrenndoerferDecember 1, 20265 min read
Language AI HandbookAll chapters
Part 57 of 67Dynamic, Interactive, and Agentic Evaluation
Chapter 436Evaluation Harnesses and Reproducibility › Comparing Two Models on the Same Tasks
Reading section 10 of 18 · Comparing Two Models on the Same Tasks · 5 minSection 10 of 18 · 5 min

Section 10 of 18 · 5 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Comparing model A and model B is usually framed as "is B's score higher than A's?" That framing invites computing two independent intervals and eyeballing overlap, which is both under-powered and misleading. The models were evaluated on the same tasks. That pairing is information: if a task is hard, both models tend to miss it; if it is easy, both tend to hit it. A paired analysis exploits this by looking at per-task differences, which cancels the shared task difficulty.

The discordant outcomes determine the observed difference, but the estimate still divides by the total number of matched tasks. Pairs where both systems succeed or both fail contribute a zero difference.

The statistic of interest is the mean per-task difference

d^=1n∑i=1n(siB−siA),\hat{d} = \frac{1}{n}\sum_{i=1}^{n}\left(s_i^{B} - s_i^{A}\right),

where:

  • siM∈{0,1}s_i^{M} \in \{0,1\}: model MM's score on task ii (1 if correct, 0 otherwise)
  • nn: the number of graded tasks shared by both models
  • d^\hat{d}: the estimated mean per-task accuracy difference between models B and A

With pairing, d^\hat d is the average of the per-task differences di=siB−siAd_i = s_i^{B} - s_i^{A}, which have mean d^\hat d and sample variance Var^(sB−sA)\hat{\mathrm{Var}}(s^{B}-s^{A}); the standard error of d^\hat d is therefore the standard deviation of those differences divided by n\sqrt{n}:

SE^(d^)=Var^(sB−sA)n,\widehat{\mathrm{SE}}(\hat d) = \sqrt{\frac{\widehat{\mathrm{Var}}(s^{B}-s^{A})}{n}},

not Var(sB)/n+Var(sA)/n\sqrt{\mathrm{Var}(s^B)/n + \mathrm{Var}(s^A)/n}. Positive covariance lowers the variance of the paired difference relative to ignoring covariance. Negative covariance raises it. The classic McNemar view makes the same point: only the discordant items (where one model is right and the other wrong) carry information about which model is better. Let (b) be the count of items where B is right and A is wrong, and (c) the count of items where A is right and B is wrong.

where:

  • bb: the number of discordant tasks on which model B is correct and model A is incorrect
  • cc: the number of discordant tasks on which model A is correct and model B is incorrect
  • nn: the number of graded tasks shared by both models
  • (b−c)/n(b - c)/n: the mean per-task difference, since the bb tasks contribute +1+1, the cc tasks contribute −1-1, and the remaining concordant tasks contribute 00

The paired difference is therefore (\hat d = (b - c)/n).

For uncertainty, a bootstrap over tasks is the most flexible and the least assumption-laden: resample task indices with replacement, compute d^\hat d on each resample, and take percentiles. We will also compute the analytic paired z-test as a cross-check.

Let's run the paired analysis on our fixture. Recall the true gap is 0.80 - 0.72 = 0.08.

PythonIn [32]
CollapseExpand
diffs = scores_b - scores_a
n = len(diffs)
d_hat = float(diffs.mean())

# Discordant counts (symmetric difference)
b = int(((scores_b == 1) & (scores_a == 0)).sum())  # B right, A wrong
c = int(((scores_b == 0) & (scores_a == 1)).sum())  # A right, B wrong

# Paired standard error
var_d = float(np.var(diffs, ddof=1))
se_paired = math.sqrt(var_d / n)
z = 1.959963984540054
paired_ci = (d_hat - z * se_paired, d_hat + z * se_paired)

# Unpaired SE for comparison (wrong for this design)
p_a, p_b = scores_a.mean(), scores_b.mean()
se_unpaired = math.sqrt(p_a * (1 - p_a) / n + p_b * (1 - p_b) / n)
unpaired_ci = (d_hat - z * se_unpaired, d_hat + z * se_unpaired)

# Bootstrap over tasks
rng = np.random.default_rng(7)
B = 5000
boot_d = np.empty(B)
for bidx in range(B):
    idx = rng.integers(0, n, size=n)
    boot_d[bidx] = diffs[idx].mean()
boot_ci = (float(np.quantile(boot_d, 0.025)), float(np.quantile(boot_d, 0.975)))
ConsoleOut [33]
CollapseExpand
n=7, observed mean difference=+0.143
Discordant: B-only-right b=1, A-only-right c=0
Paired   SE=0.1429  95% CI=(-0.137, +0.423)
Bootstrap      95% CI=(+0.000, +0.429)
Unpaired SE=0.2160  95% CI=(-0.280, +0.566)

Compare the paired estimate, discordant counts and interval bounds directly. This fixture has only seven graded tasks, so a handful of discordances can dominate the estimate. An interval including zero leaves both signs compatible with the uncertainty in that procedure.

Pairing changes variance through the covariance between scores. Positive covariance can narrow the interval compared with an independence calculation; negative covariance can widen it. The small fixture is a demonstration of the computation, so avoid treating either normal or percentile-bootstrap bounds as a release decision.

Coverage of the Paired Interval

In a separate synthetic experiment, draw 100 independent tasks per run. Use the same uniform draw for both binary outcomes on a task, creating positive dependence. Compare the observed coverage of the true 0.08 difference when the estimated covariance is used and when it is ignored.

PythonIn [34]
CollapseExpand
def simulate_paired(n_runs=3000, n_tasks=100, base_seed=3000):
    draws = np.random.default_rng(base_seed).random((n_runs, n_tasks))
    a, b = (draws < 0.72).astype(float), (draws < 0.80).astype(float)
    d = b - a
    dhat = d.mean(axis=1)
    z = NormalDist().inv_cdf(0.975)
    paired_se = np.sqrt(d.var(axis=1, ddof=1) / n_tasks)
    naive_se = np.sqrt(
        (a.var(axis=1, ddof=1) + b.var(axis=1, ddof=1)) / n_tasks
    )
    gap = 0.80 - 0.72
    return float(np.mean(np.abs(dhat - gap) <= z * paired_se)), float(
        np.mean(np.abs(dhat - gap) <= z * naive_se)
    )


cov_paired, cov_unpaired = simulate_paired()
ConsoleOut [35]
CollapseExpand
Observed coverage of the 0.08 gap, paired: 0.907
Observed coverage if covariance is ignored: 1.000

The output reports observed coverage for this construction. It does not establish nominal coverage for the same interval in a seven-item benchmark. Use a paired estimate on a matched design and report the assumptions behind the uncertainty calculation.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy