Translation Evaluation Beyond BLEU › Do the Differences Matter? Paired Bootstrap
Language AI HandbookAll chapters In this constructed A/B comparison, A copies the references and B emits the paired paraphrases. Both sets receive the same assigned quality scores. Paired resampling shows how consistently corpus BLEU separates them on this sample.
PythonIn [29]Expand
sys_a = df[df["kind"] == "good"].sort_values("seg_id")
sys_b = df[df["kind"] == "paraphrase"].sort_values("seg_id")
refs = sys_a["reference"].tolist()
hyps_a = sys_a["hyp"].tolist()
hyps_b = sys_b["hyp"].tolist()
obs_a = corpus_bleu_metric.corpus_score(hyps_a, [refs]).score
obs_b = corpus_bleu_metric.corpus_score(hyps_b, [refs]).score
print(f"System A corpus BLEU: {obs_a:.2f}")
print(f"System B corpus BLEU: {obs_b:.2f}")
print(f"Observed difference : {obs_a - obs_b:.2f}")ConsoleOut [30]Expand
System A corpus BLEU: 100.00 System B corpus BLEU: 75.57 Observed difference : 24.43 System A mean toy MQM: 100.00 System B mean toy MQM: 100.00
Corpus BLEU favors the reference copies by 24.43 points. The toy MQM-style scores are both 100 by construction. The next cell recomputes the BLEU gap on paired resamples of the same eight source segments.
PythonIn [31]Expand
def corpus_bleu(hyps, refs):
return corpus_bleu_metric.corpus_score(hyps, [refs]).score
rng = np.random.default_rng(0)
n = len(refs)
n_boot = 2000
deltas = np.empty(n_boot)
for b in range(n_boot):
idx = rng.integers(0, n, n)
sample_refs = [refs[i] for i in idx]
s_a = corpus_bleu([hyps_a[i] for i in idx], sample_refs)
s_b = corpus_bleu([hyps_b[i] for i in idx], sample_refs)
deltas[b] = s_a - s_b
nonpositive = int(np.count_nonzero(deltas <= 0))
ci_lo, ci_hi = np.percentile(deltas, [2.5, 97.5])ConsoleOut [32]Expand
Bootstrap resamples : 2000 Observed BLEU difference : 24.43 95% percentile interval : [20.05, 28.19] Nonpositive resamples : 0 of 2000
All 2,000 resamples in this seeded run put A ahead on BLEU, and the percentile interval is about 20.05–28.19 points. The resamples are drawn around the observed comparison, so the nonpositive count describes the bootstrap distribution. A population-level claim would need a sampling design beyond these eight constructed segments.
VisualizationOut [33]Expand

The gap is stable under resampling these pairs. The toy protocol assigns reference copies and designed paraphrases the same quality score because neither receives a penalty. BLEU rewards their different degrees of reference overlap. Check sampling uncertainty and metric validity separately.
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!