intermediate nlp-evaluation 35 min read

Overlap Metrics: BLEU and ROUGE

A candidate and a reference make a grid of matches. Clipping is a matching on it and ROUGE-L is the longest chain through it, so a one-word edit moves either by a few n-grams at most: overlap cannot tell a paraphrase from a reversed fact. Read as a decision rule, BLEU's brevity penalty is why minimum Bayes risk beats the mode.

Overview & Motivation

The decoding topic ended with strings that were shorter and blander than the text the model learned from, and it measured that only by length and predictability. The usual way to say whether a generated sentence is good is to compare it with one written by a person, a reference, and count what the two share. BLEU counts shared n-grams from the candidate’s side, ROUGE from the reference’s side, and between them they have scored a large share of machine translation and summarization research.

This page asks what such a count can and cannot see. Everything starts from one picture. Write the candidate’s words down the side of a grid and the reference’s words across the top, and mark each cell where the two words are equal. Unigram matches are the marks; bigram matches are pairs of marks on a diagonal; BLEU’s clipping is a matching on the marks; ROUGE-L’s longest common subsequence is the longest chain of marks rising in both directions.

  1. Clipping and BLEU. We prove clipping is a maximum matching, bound BLEU by an envelope that depends on length alone, and work through three ways BLEU’s arithmetic surprises: corpus scores are not averages of sentence scores, one missing 4-gram zeroes a sentence, and a new reference can lower the score.
  2. ROUGE and the longest chain. The dynamic program for the longest common subsequence is a longest-path computation on the grid.
  3. What overlap cannot see. A one-word edit moves every overlap score by a bounded amount. So a reversed fact, which is a one-word edit, barely registers, and word embeddings make it worse.
  4. The metric as a decision rule. If BLEU is what we want, the best output is not the most probable one. Minimum Bayes risk makes that precise, and the brevity penalty is the reason the decoding topic’s mode loses.
  5. Metrics and judgments. Averaging over many documents cancels a metric’s noise but not its bias.

The finance case study supplies what human ratings never do: an exact answer key. The shared corpus’s generator records every fact a filing states, so we can write references from those facts and grade every candidate by how many it gets right.


The match grid and clipping

Fix a candidate y=(y1,…,yc)y = (y_1, \dots, y_c) and a set of references R={r1,…,rK}R = \lbrace r_1, \dots, r_K \rbrace, each a sequence of tokens. An n-gram is a run of nn consecutive tokens, and cx(g)c_x(g) counts the occurrences of the n-gram gg in xx.

Before the definition, the example that motivated it. The candidate “the the the the the the the” contains seven unigrams, and every one of them occurs in the reference “the cat sat on the mat.” Counting matched words naively gives a precision of 7/77/7. The reference holds “the” only twice, so a fair count gives the candidate credit for two of its seven words.

Definition 1 (Clipped counts and modified precision).

The clipped count of order nn is

mn(y,R)=∑gmin⁡(cy(g), max⁡kcrk(g)),m_n(y, R) = \sum_g \min\Big(c_y(g),\ \max_k c_{r_k}(g)\Big),

and the modified precision is pn=mn/tnp_n = m_n / t_n, where tn=max⁡(c−n+1,0)t_n = \max(c - n + 1, 0) is the number of n-grams in yy.

For the seven “the”s, m1=2m_1 = 2 and p1=2/7p_1 = 2/7. The cap max⁡kcrk(g)\max_k c_{r_k}(g) is the most times gg occurs in any single reference (Papineni et al. 2002, §2.1 and footnote 2). In the grid the marks of row ii are the reference positions holding yiy_i, and clipping says how many rows may claim a mark.

Proposition 1 (Clipping is a maximum matching).

Give each n-gram gg a set of M(g)=max⁡kcrk(g)M(g) = \max_k c_{r_k}(g) reference slots, and join each occurrence of gg in yy to every slot of gg. The largest matching in this bipartite graph has exactly mn(y,R)m_n(y, R) edges.

Proof.

An edge joins two copies of the same n-gram, so the graph is a disjoint union, over the n-grams gg, of complete bipartite graphs with cy(g)c_y(g) vertices on one side and M(g)M(g) on the other. A matching in a disjoint union is a union of matchings in its parts, and the largest matching in a complete bipartite graph pairs off the smaller side, min⁡(cy(g),M(g))\min(c_y(g), M(g)) edges. Summing over gg gives Definition 1.

∎

So a candidate gains nothing by repeating a matched word: each extra copy finds no free slot. The harness checks Proposition 1 against SciPy’s Hopcroft–Karp matching on 300 random instances. The lab’s Match grid tab draws the marks for one filing’s summary, with one maximum matching of unigrams and of bigrams and the longest chain on top.


BLEU

Definition 2 (BLEU).

Score a corpus of candidates y1,…,ySy_1, \dots, y_S with reference sets R1,…,RSR_1, \dots, R_S. Pool the counts,

Pn=∑imn(yi,Ri)∑itn(yi),c=∑i∣yi∣,r=∑iri,P_n = \frac{\sum_i m_n(y_i, R_i)}{\sum_i t_n(y_i)}, \qquad c = \sum_i |y_i|, \qquad r = \sum_i r_i,

where rir_i is the length of the reference in RiR_i closest to ∣yi∣|y_i| (the shorter one on a tie). The brevity penalty is BP=1\mathrm{BP} = 1 if c>rc \gt r and e1−r/ce^{1 - r/c} otherwise, and

BLEU=BP⋅exp⁡(1N∑n=1Nlog⁡Pn),\mathrm{BLEU} = \mathrm{BP} \cdot \exp\left(\frac{1}{N} \sum_{n=1}^{N} \log P_n\right),

with N=4N = 4. BLEU is 00 if any PnP_n is 00. Sentence BLEU is the same formula with S=1S = 1.

These are Papineni et al.’s choices (2002, §2.2.2 and §2.3): uniform weights, N=4N = 4, and the reference length taken as the “best match length.” The paper computes the brevity penalty over the whole corpus, because penalizing each short sentence on its own punishes it harshly. Our implementation equals sacreBLEU’s (Post 2018) to 10−1210^{-12}, at the corpus and sentence level, under three smoothing rules.

Precision alone rewards saying little: a one-word candidate that matches has precision 11. Clipping and the brevity penalty together close both doors, short and long, and the result depends on the length ratio alone.

Theorem 1 (The length envelope).

Write x=c/rx = c/r.

(a) For one segment with one reference, BLEU≤g(x)\mathrm{BLEU} \le g(x), where g(x)=e1−1/xg(x) = e^{1 - 1/x} for x≤1x \le 1 and g(x)=1/xg(x) = 1/x for x≥1x \ge 1.

(b) For a corpus with one reference per segment, BLEU≤e1−1/x\mathrm{BLEU} \le e^{1 - 1/x} for x≤1x \le 1 and BLEU≤x−1/N\mathrm{BLEU} \le x^{-1/N} for x≥1x \ge 1.

(c) With several references, BLEU≤BP⋅min⁡(1,ρ/c)1/N\mathrm{BLEU} \le \mathrm{BP} \cdot \min(1, \rho/c)^{1/N}, where ρ=∑i∑gmax⁡kcrik(g)\rho = \sum_i \sum_g \max_k c_{r_{ik}}(g) counts the references’ unigram union.

Both envelopes equal 11 at x=1x = 1 and are smaller at every other xx. A candidate made of a reference’s first words lies exactly on the left branch.

Proof.

Every Pn≤1P_n \le 1, so their geometric mean is at most 11 and BLEU≤BP\mathrm{BLEU} \le \mathrm{BP}, which is e1−1/xe^{1 - 1/x} when x≤1x \le 1. That is the left branch in all three parts.

For x>1x \gt 1, BP=1\mathrm{BP} = 1. In (a), the clipped count of order nn is at most the number of n-grams in the reference, r−n+1r - n + 1, so

pn≤r−n+1c−n+1≤rc,p_n \le \frac{r - n + 1}{c - n + 1} \le \frac{r}{c},

where the second inequality is c(r−n+1)≤r(c−n+1)c(r - n + 1) \le r(c - n + 1), which holds because c≥rc \ge r. A geometric mean of numbers at most 1/x1/x is at most 1/x1/x. In (b) we bound only the unigram precision: each segment matches at most rir_i unigrams, so P1≤r/c=1/xP_1 \le r/c = 1/x, while Pn≤1P_n \le 1 for n≥2n \ge 2, and the geometric mean is at most (1/x)1/N(1/x)^{1/N}. In (c) each segment matches at most ∑gmax⁡kcrik(g)\sum_g \max_k c_{r_{ik}}(g) unigrams, which gives P1≤ρ/cP_1 \le \rho/c in the same way.

The left branch increases to 11 at x=1x = 1, and both right branches decrease from 11, so x=1x = 1 is the only maximum. A prefix of a reference matches every one of its n-grams, so every Pn=1P_n = 1 and BLEU=BP\mathrm{BLEU} = \mathrm{BP} exactly.

∎

The arithmetic–geometric mean inequality (formalStatistics, Expectation and Moments, Example 7) says the geometric mean in BLEU is at most the average precision, so one weak order pulls BLEU down harder than an average would. In the lab’s Length envelope tab, prefixes of each prompt’s first reference trace the left branch: at x=0.249x = 0.249 the corpus scores 0.0490.049, on the envelope. Appending unmatched words traces a curve below the right branch, and at x=2x = 2 it scores 0.4350.435, under the corpus bound 0.8410.841 and the segment bound 0.5000.500. The decoding systems of Theorem 4 sit under the curve too. The exact mode, at x=0.329x = 0.329, scores 0.0870.087.

The pooled precisions in Definition 2 also explain why a corpus score is not an average of sentence scores.

Proposition 2 (Corpus BLEU is not the mean of sentence BLEU).

(a) Each pooled precision is a weighted average of the segments’ precisions, with weights tn(yi)/∑jtn(yj)t_n(y_i)/\sum_j t_n(y_j), so it lies between the smallest and the largest.

(b) One system can score higher than another on every sentence and lower on the corpus.

Proof.

(a) ∑imn(i)/∑jtn(j)=∑itn(i)∑jtn(j)⋅mn(i)tn(i)\sum_i m_n(i) \big/ \sum_j t_n(j) = \sum_i \frac{t_n(i)}{\sum_j t_n(j)} \cdot \frac{m_n(i)}{t_n(i)}, a convex combination over the segments with tn(i)>0t_n(i) \gt 0.

(b) Take two references of ten words each. System AA copies both, with one middle word replaced. System BB copies the first and appends five unmatched words, and stops halfway through the second. Sentence BLEU gives AA the score 0.6580.658 on both sentences and BB the scores 0.6260.626 and 0.3680.368: AA wins both. Pooled, BB has c=r=20c = r = 20, so its two length errors cancel in the brevity penalty, and its corpus BLEU is 0.6990.699, above the 0.6580.658 of AA.

∎

So the two common ways of reporting BLEU, the corpus score and the mean of sentence scores, can rank systems differently. On the finance systems below they disagree on two pairs of the weak extractive baselines.

Sentence BLEU has a second problem: the zero-frequency catastrophe of the n-gram topic, in a new place. Take the candidate “costs fell and revenue rose” against the reference “revenue rose and costs fell.” All five words match, but no 4-gram does, so p4=0p_4 = 0 and sentence BLEU is 00.

Proposition 3 (Zero frequency, and smoothing as shrinkage).

(a) If mN=0m_N = 0, unsmoothed BLEU is 00, whatever the lower orders.

(b) Add-kk smoothing replaces pnp_n by (mn+k)/(tn+k)(m_n + k)/(t_n + k) for n≥2n \ge 2. With λ=tn/(tn+k)\lambda = t_n/(t_n + k),

mn+ktn+k=λ mntn+(1−λ)⋅1,\frac{m_n + k}{t_n + k} = \lambda\, \frac{m_n}{t_n} + (1 - \lambda) \cdot 1,

an interpolation between the observed precision and perfect precision, with weight on the prior that grows as the candidate shrinks. Smoothed BLEU is positive whenever some unigram matches.

Proof.

(a) log⁡0=−∞\log 0 = -\infty in Definition 2. (b) Multiply out: λmn/tn+(1−λ)=(mn+tn+k−tn)/(tn+k)\lambda m_n/t_n + (1 - \lambda) = (m_n + t_n + k - t_n)/(t_n + k). Every smoothed precision is then positive, and p1>0p_1 \gt 0 when a unigram matches.

∎

Part (b) is the n-gram topic’s Proposition 3, shrinkage as interpolation, with a prior that puts all its mass on a perfect match. Lin and Och (2004, §4) add one to the hit and total counts for n>1n \gt 1, which is k=1k = 1; Chen and Cherry (2014, §2.2) call it Smoothing 2 and compare it with the NIST rule (their Smoothing 3), which gives the jj-th order with no match a count of 1/2j1/2^j. Without smoothing the finance summaries are often zeroed: 0.2440.244 of the reference-style summaries have no matched 4-gram, and 0.9330.933 of the copied document sentences do not.

More references should make a metric more forgiving. For the counts they do.

Proposition 4 (More references).

(a) Adding a reference never lowers any clipped count mnm_n.

(b) Adding a reference can lower BLEU.

Proof.

(a) max⁡kcrk(g)\max_k c_{r_k}(g) can only grow when the set grows. (b) Take a candidate of eight words whose only reference is its own first six. Then r=6<cr = 6 \lt c, BP=1\mathrm{BP} = 1, and BLEU is 0.6800.680. Add a reference of nine words, none of them in the candidate. No clipped count changes, but the new reference is closer in length (∣9−8∣<∣6−8∣|9 - 8| \lt |6 - 8|), so rr becomes 9>c9 \gt c, the brevity penalty drops to e1−9/8e^{1 - 9/8}, and BLEU falls to 0.6000.600.

∎

ROUGE and the longest chain

Definition 3 (ROUGE-N and ROUGE-L).

Against one reference rr, ROUGE-N has precision mn(y,{r})/tn(y)m_n(y, \lbrace r \rbrace)/t_n(y), recall mn(y,{r})/tn(r)m_n(y, \lbrace r \rbrace)/t_n(r), and their harmonic mean as F. ROUGE-L replaces the clipped count by the length LCS(y,r)\mathrm{LCS}(y, r) of a longest common subsequence: precision LCS/∣y∣\mathrm{LCS}/|y|, recall LCS/∣r∣\mathrm{LCS}/|r|, and F. With several references we report the best F among them.

Lin (2004) defines ROUGE-N as recall (Eq. 1), ROUGE-L by its Eqs. 2–4 with a weight β\beta between precision and recall, and scores several references by the best pairwise score, jackknifed over the reference set (§2.1). We use the balanced F of the rouge-score package, which our implementation equals to 10−1210^{-12}. A common subsequence need not be contiguous: “revenue rose and costs fell” and “costs fell and revenue rose” share “costs fell,” and also “and,” but not both, since they come in opposite orders.

Theorem 2 (The longest common subsequence is a longest path).

(a) Common subsequences of yy and rr are exactly the chains of marked cells (i1,j1),…,(ik,jk)(i_1, j_1), \dots, (i_k, j_k) with i1<⋯<iki_1 \lt \dots \lt i_k and j1<⋯<jkj_1 \lt \dots \lt j_k. So LCS(y,r)\mathrm{LCS}(y, r) is the number of cells on a longest path in the directed acyclic graph whose edges go from each marked cell to every marked cell above and to the right of it, and the table

L[i,j]={L[i−1,j−1]+1if yi=rj,max⁡(L[i−1,j], L[i,j−1])otherwise,L[i, j] = \begin{cases} L[i-1, j-1] + 1 & \text{if } y_i = r_j, \\ \max\big(L[i-1, j],\ L[i, j-1]\big) & \text{otherwise}, \end{cases}

with L[0,⋅]=L[⋅,0]=0L[0, \cdot] = L[\cdot, 0] = 0, gives L[i,j]=LCS(y1..i,r1..j)L[i, j] = \mathrm{LCS}(y_{1..i}, r_{1..j}).

(b) LCS(y,r)≤m1(y,{r})\mathrm{LCS}(y, r) \le m_1(y, \lbrace r \rbrace), so ROUGE-L’s precision, recall, and F are each at most ROUGE-1’s.

Proof.

(a) A common subsequence picks increasing positions in yy and increasing positions in rr that hold the same tokens, which is a chain of marked cells, and a chain read off in order is a common subsequence. A path in the graph visits cells rising in both coordinates, so paths and chains are the same thing.

For the recursion, take a longest chain in the grid of the prefixes y1..iy_{1..i} and r1..jr_{1..j}. Its last cell has the largest row and the largest column in the chain, so the chain can use row ii or column jj only at its last cell.

Suppose yi=rjy_i = r_j. If the last cell lies in row ii or column jj, replace it with (i,j)(i, j), which is marked and still lies above and to the right of the cell before it. If it lies in neither, append (i,j)(i, j), which would give a longer chain, a contradiction. Either way, some longest chain ends at (i,j)(i, j), and removing that cell leaves a longest chain of y1..i−1y_{1..i-1} and r1..j−1r_{1..j-1}.

Suppose yi≠rjy_i \ne r_j. Then (i,j)(i, j) is unmarked, so the chain’s last cell misses row ii or misses column jj, and the whole chain lies in one of the two smaller grids. Induction on i+ji + j finishes the proof.

(b) A chain uses each position of yy and each position of rr at most once, and pairs equal tokens, so it is a matching between unigram occurrences. Proposition 1 with n=1n = 1 and R={r}R = \lbrace r \rbrace bounds every such matching by m1m_1. Dividing by ∣y∣|y| or ∣r∣|r| preserves the inequality, and F is increasing in both.

∎

The harness checks the table against brute-force enumeration of subsequences on 300 random pairs, and checks that the backtracked path is a valid chain of the stated length.


What overlap cannot see

Every score so far is a function of the grid’s marks, and editing one word changes one row of marks. That gives a Lipschitz bound.

Theorem 3 (Overlap is Lipschitz in substitutions).

Let zz differ from yy in kk positions, with ∣z∣=∣y∣|z| = |y|. Then for every reference set RR, every order nn, and every reference rr,

∣mn(z,R)−mn(y,R)∣≤nk,∣LCS(z,r)−LCS(y,r)∣≤k.\big|m_n(z, R) - m_n(y, R)\big| \le nk, \qquad \big|\mathrm{LCS}(z, r) - \mathrm{LCS}(y, r)\big| \le k.

So each modified precision moves by at most nk/tnnk/t_n, ROUGE-N recall by at most nk/(∣r∣−n+1)nk/(|r| - n + 1), and ROUGE-L recall by at most k/∣r∣k/|r|.

Proof.

Substitute one position at a time. A position lies in at most nn of the candidate’s n-gram windows, so one substitution changes at most nn windows. Changing one window from gg to g′g' lowers cy(g)c_y(g) by one and raises cy(g′)c_y(g') by one, and each term min⁡(cy(⋅),M(⋅))\min(c_y(\cdot), M(\cdot)) moves by at most one in the direction of its count, so the sum moves by at most one. That bounds one substitution by nn, and kk substitutions by nknk.

For the subsequence, delete the kk substituted positions from a longest chain of yy. What remains is a chain for zz, since the other tokens are unchanged, so LCS(z,r)≥LCS(y,r)−k\mathrm{LCS}(z, r) \ge \mathrm{LCS}(y, r) - k. Exchange yy and zz for the other direction.

∎

BLEU itself has no such bound near Pn=0P_n = 0, because of its logarithms, which is one more reason to state the bound for the precisions. Now apply it to a summary of facts.

Corollary 1 (Reversing every fact).

Suppose a summary states mm facts, each through one word (a direction verb or a polarity adjective), and zz reverses every fact by swapping each such word for its opposite. Then ROUGE-N recall against any reference drops by at most nm/(∣r∣−n+1)nm/(|r| - n + 1), while the share of the summary’s facts that are true drops from 11 to 00.

Proof.

Reversing mm facts is mm substitutions, so Theorem 3 bounds the change in recall. Every fact zz states is the reverse of a true one, so none is true.

∎

On the finance summaries, a summary of 3.63.6 facts against a reference of 1616 words can lose at most about a quarter of its ROUGE-1 recall when every fact is reversed, and the harness checks the bound on all 360360 summary–reference pairs. The lab’s Flip vs. paraphrase tab moves the share of reversed facts from 00 to 11: fact F1 falls from 1.0001.000 to 0.0000.000 while ROUGE-1 moves from 0.6670.667 to 0.6380.638.

Order is the other thing overlap reads weakly. Callison-Burch, Osborne, and Koehn (2006, §3.1) observed that the pieces of a candidate between bigram mismatches can be shuffled without losing a match.

Proposition 5 (Permuting at bigram mismatches).

Cut yy between yiy_i and yi+1y_{i+1} wherever the bigram (yi,yi+1)(y_i, y_{i+1}) occurs in no reference, and let π(y)\pi(y) be any reordering of the pieces. Then:

(a) no clipped count decreases: mn(π(y),R)≥mn(y,R)m_n(\pi(y), R) \ge m_n(y, R) for every nn;

(b) BLEU(π(y))≥BLEU(y)\mathrm{BLEU}(\pi(y)) \ge \mathrm{BLEU}(y), with equality unless a new junction creates a matched n-gram;

(c) the subsequence, and with it ROUGE-L, can change either way.

Proof.

(a) Unigrams are unchanged. For n≥2n \ge 2, every n-gram of yy that crosses a cut contains the bigram at that cut, so no reference contains it and its cap M(g)M(g) is 00. Every n-gram with M(g)>0M(g) \gt 0 therefore lies inside a piece, and the pieces survive the reordering, so cπ(y)(g)≥cy(g)c_{\pi(y)}(g) \ge c_y(g) for each such gg. Each term min⁡(c(g),M(g))\min(c(g), M(g)) is then at least as large.

(b) The length is unchanged, so tnt_n and the brevity penalty are too, and BLEU is increasing in each mnm_n. The counts can grow only through n-grams that cross a new junction.

(c) The lab’s grid shows a reordering moving the longest chain.

∎

Callison-Burch et al. make (a) and (b) in prose and count at least (k−b)!(k - b)! reorderings (their Eq. 1), noting that one may raise the score (their footnote 2). On the finance summaries the cuts fall often, since four writers phrase each fact differently: a summary splits into 7.37.3 pieces on average, about 15,00015{,}000 orderings. Of 200200 random orderings per summary, 0.7850.785 keep every clipped count exactly, none lowers one, and for 0.9890.989 of the summaries ROUGE-L takes more than one value.


Character and soft matching

Two refinements loosen exact matching. One matches pieces of words, the other matches words by meaning.

Definition 4 (chrF).

Remove spaces, and compute the precision and recall of character n-grams for each n=1,…,6n = 1, \dots, 6 that both strings reach. Average the precisions and the recalls separately over those orders, to chrP\mathrm{chrP} and chrR\mathrm{chrR}, and set

chrFβ=(1+β2) chrP⋅chrRβ2 chrP+chrR,β=2.\mathrm{chrF}_\beta = \frac{(1 + \beta^2)\, \mathrm{chrP} \cdot \mathrm{chrR}}{\beta^2\, \mathrm{chrP} + \mathrm{chrR}}, \qquad \beta = 2.

Popović (2015, Eq. 1) introduced chrF with β=3\beta = 3 as a preliminary value, and Popović (2016, §3) found β=2\beta = 2 best, which is sacreBLEU’s default; ours equals sacreBLEU’s to 10−1210^{-12}. chrF credits “liabilities” against “liability,” but its character n-grams are still marks in a grid, and Theorem 3’s argument goes through with characters for words.

Definition 5 (Greedy soft matching).

Give each word a unit vector uw\mathbf{u}_w. The similarity of positions ii and jj is Sij=uyi⊤urjS_{ij} = \mathbf{u}_{y_i}^\top \mathbf{u}_{r_j}, the cosine, and the soft scores are

Psoft=1∣y∣∑imax⁡jSij,Rsoft=1∣r∣∑jmax⁡iSij,P_{\mathrm{soft}} = \frac{1}{|y|} \sum_i \max_j S_{ij}, \qquad R_{\mathrm{soft}} = \frac{1}{|r|} \sum_j \max_i S_{ij},

with F their harmonic mean. A word without a vector matches only itself.

This is BERTScore’s form (Zhang et al. 2020, §3), with the trained skip-gram vectors of the word2vec topic in place of contextual states, and without BERTScore’s idf weights or rescaling. Each row of the grid now carries a shade instead of a mark, and the scores read the darkest shade in each row or column.

Proposition 6 (Soft matching moves less).

If zz replaces one word uu of yy by u′u', both with vectors, then

∣Psoft(z)−Psoft(y)∣≤∥u−u′∥∣y∣,∣Rsoft(z)−Rsoft(y)∣≤∥u−u′∥.\big|P_{\mathrm{soft}}(z) - P_{\mathrm{soft}}(y)\big| \le \frac{\Vert \mathbf{u} - \mathbf{u}' \Vert}{|y|}, \qquad \big|R_{\mathrm{soft}}(z) - R_{\mathrm{soft}}(y)\big| \le \Vert \mathbf{u} - \mathbf{u}' \Vert.
Proof.

Only one row of SS changes, and in that row each entry moves by ∣(u−u′)⊤v∣≤∥u−u′∥|(\mathbf{u} - \mathbf{u}')^\top \mathbf{v}| \le \Vert \mathbf{u} - \mathbf{u}' \Vert for a unit vector v\mathbf{v}, by Cauchy–Schwarz. The row’s maximum moves by at most as much, which bounds the change in the precision sum, and each column’s maximum moves by at most as much, which bounds the change in the recall average.

∎

For exact matching the analogous distance is 11 between any two different words. The skip-gram vectors put antonyms close, because antonyms occur in the same contexts (“costs rose,” “costs fell”): cos⁡(rose,fell)=0.995\cos(\text{rose}, \text{fell}) = 0.995, “fell” is the nearest neighbor of “rose,” and ∥urose−ufell∥=0.104\Vert \mathbf{u}_{\text{rose}} - \mathbf{u}_{\text{fell}} \Vert = 0.104. Reversing every fact moves the corpus soft F from 0.9340.934 to 0.9330.933. A metric built to forgive paraphrase forgives contradiction too.


The metric as a decision rule

A metric says which outputs are good, so it also says what a decoder should output. Suppose the model’s distribution pp is the truth about which references a person might write. The decision that maximizes the expected metric is then a Bayes decision.

Theorem 4 (Minimum Bayes risk).

Let pp be a distribution over outputs, HH a finite set of hypotheses, and U(h,y)∈[0,1]U(h, y) \in [0, 1] a utility. The hypothesis maximizing expected utility, equivalently minimizing the risk EY∼p[1−U(h,Y)]\mathbb{E}_{Y \sim p}[1 - U(h, Y)], is

h⋆=arg⁡max⁡h∈H ∑yp(y) U(h,y).h^\star = \arg\max_{h \in H}\ \sum_y p(y)\, U(h, y).

(a) With exact match, U(h,y)=1[h=y]U(h, y) = \mathbf{1}[h = y], h⋆h^\star is the most probable hypothesis: over all strings, the mode.

(b) With UU = sentence BLEU, h⋆h^\star need not be the mode.

(c) Estimate each expected utility by the average over SS independent samples from pp, and let Δ\Delta be the gap between the largest expected utility and the second largest. If

S≥2log⁡(2∣H∣/δ)Δ2,S \ge \frac{2 \log(2|H|/\delta)}{\Delta^2},

the estimated maximizer is h⋆h^\star with probability at least 1−δ1 - \delta.

Proof.

The expected utility of hh is ∑yp(y)U(h,y)\sum_y p(y) U(h, y), and maximizing it is the definition of h⋆h^\star.

(a) Under exact match the sum is p(h)p(h).

(b) Take an output distribution that gives “margins held” probability 0.20.2 and eight variants of a seven-word sentence 0.10.1 each: seven with one word replaced, and the first six words alone. The two-word string is the mode, but it shares nothing with the variants, so its expected BLEU+1 is 0.2440.244, while the six-word variant shares most of its n-grams with all the others and reaches 0.5500.550.

(c) For each hh, the estimate is an average of SS independent values in [0,1][0, 1]. Hoeffding’s inequality bounds the chance that it misses its mean by Δ/2\Delta/2 or more by 2e−2S(Δ/2)2=2e−SΔ2/22e^{-2S(\Delta/2)^2} = 2e^{-S\Delta^2/2}. A union bound over HH (formalCalculus, Probability and the Union Bound, Theorem 8) bounds the chance that any estimate misses by 2∣H∣e−SΔ2/22|H| e^{-S\Delta^2/2}, which is at most δ\delta under the stated SS. If no estimate misses, the estimate for h⋆h^\star is above its mean minus Δ/2\Delta/2, and every other estimate is below its own mean plus Δ/2\Delta/2, which is at most the mean of h⋆h^\star minus Δ/2\Delta/2.

∎

Part (c) is a sufficient condition, and a loose one. In the toy the two best hypotheses differ by Δ=0.011\Delta = 0.011, so the bound asks for S=95,180S = 95{,}180 samples, at which Monte Carlo picks h⋆h^\star in all 400400 trials. Kumar and Byrne (2004, Eq. 3) introduced the rule for machine translation with the loss 1−BLEU1 - \mathrm{BLEU}, and note that 0/1 loss gives the MAP decision (their Eqs. 5–6). Eikema and Aziz (2020, §7.4) estimate it from ancestral samples, as we do. Ancestral sampling is exact (Theorem 1 of the sampling topic), so each average is unbiased.

On the decoding topic’s 188188 prompts, each opening a held-out MD&A sentence, the references are the continuations of every held-out sentence the prompt opens, 2.362.36 per prompt and 7.2987.298 words long on average. We take 6464 samples per prompt from the Kneser–Ney trigram, add the decoding topic’s three outputs to the hypotheses, and pick the one with the highest average BLEU+1 against the samples:

systemBLEUlengthemptyBP
exact mode0.1100.1102.3672.3670.1970.1970.1470.147
beam, k=16k = 160.1180.1182.4472.4470.1860.1860.1620.162
normalized beam0.2130.2135.1285.1280.1060.1060.6690.669
one sample0.1490.1497.7667.7660.0050.0051.0001.000
BLEU-MBR0.2540.2544.7074.7070.0000.0000.6090.609

The mode is short, as the decoding topic’s Theorem 4 predicts (once the end mark is the likeliest next token, stopping wins), and a fifth of the modes are empty strings. The brevity penalty multiplies its score by 0.1470.147. A single sample has the right length but poor precision. Minimum Bayes risk trades between them and wins. By part (a), the most frequent of the 6464 samples is the Monte Carlo estimate of the mode, and it equals the exact mode on 0.5430.543 of the prompts. The lab’s MBR vs. mode tab shows five prompts whose mode is empty.


Metrics and judgments

A metric is useful if it ranks outputs the way a judge would. Ranking agreement is measured by Kendall’s τ: over all pairs of items, the share ranked the same way by both scores minus the share ranked the opposite way, with the tie correction of τb\tau_b. Its discordant-pair count is the Kendall distance between the two rankings (formalRAG, Rank Fusion, Definition 2). Agreement is usually reported at two levels: per segment, ranking systems on each document, and per system, ranking systems by their corpus scores. The second is usually higher. Here is why, and where it stops.

Proposition 7 (Averaging removes noise, not bias).

Let system jj have quality qijq_{ij} on segment ii, with mean qˉj\bar q_j, and let its metric score be

sij=b qij+βj+εij,s_{ij} = b\, q_{ij} + \beta_j + \varepsilon_{ij},

with b>0b \gt 0, a bias βj\beta_j that depends on the system only, and independent noise of mean zero and finite variance. Write μj=bqˉj+βj\mu_j = b \bar q_j + \beta_j, and suppose the μj\mu_j are distinct. As the number of segments nn grows, the system means converge almost surely to the μj\mu_j, and system-level Kendall’s τ between metric and quality converges to τ(μ,qˉ)\tau(\mu, \bar q). That limit equals 11 if and only if

b (qˉk−qˉj)>βj−βkfor every pair with qˉj<qˉk.b\,(\bar q_k - \bar q_j) \gt \beta_j - \beta_k \quad \text{for every pair with } \bar q_j \lt \bar q_k.
Proof.

The mean of nn segment scores is bb times the mean quality, plus βj\beta_j, plus the mean of nn noise terms, which tends to zero almost surely by the strong law of large numbers. Kendall’s τ depends only on the signs of the pairwise differences, and with distinct limits every sign eventually equals the sign of μj−μk\mu_j - \mu_k. τ is 11 exactly when every pair is ordered alike, which is the displayed condition.

∎

So averaging can lift τ only to the ranking of the biases. In a model with five systems of quality 0,14,12,34,10, \tfrac14, \tfrac12, \tfrac34, 1 and a bias of 0.60.6 on the middle one, the limit is τ=0.6\tau = 0.6, and the harness watches simulated means rise toward it. The finance systems below have a bias of exactly this kind. Writers who phrase facts like the references share surface form with them, and extractors who copy the document do not.

metricper documentper systemflips only
BLEU0.3950.3950.5230.5231.0001.000
ROUGE-10.3790.3790.5680.5681.0001.000
ROUGE-20.3600.3600.5230.5231.0001.000
ROUGE-L0.3830.3830.5680.5681.0001.000
chrF0.3430.3430.5230.5231.0001.000
soft F0.3860.3860.5680.5681.0001.000

The first column averages τ over the 9090 documents and the second ranks the ten systems by their corpus scores. The third ranks only the five systems that share one surface and differ by how many facts they reverse, and there every metric is perfect. Scored on random subsets of nn documents, system-level τ for BLEU rises from 0.3750.375 at n=1n = 1 to 0.5230.523 at n=90n = 90, which is the plateau Proposition 7 describes. The lab’s Correlation tab draws the curve for each metric. Every metric puts the all-reversed summary above the extract, and BLEU reverses ten pairs of systems in all.


Finance case study

One summary of Marrow Freight (synth-0017) against one reference: rows are the summary, columns the reference
summary
layer
formarrowfreightrevenuewasweakerliquidityroseandleaseliabilitieswereunfavorablemarrowfreightreportedthatrevenuewasstrongfreecashflowfellandpensionliabilitiesdeclined
BLEU+1
0.145
ROUGE-1 F
0.429
ROUGE-2 F
0.154
ROUGE-L F
0.429
chrF
0.452
soft F
0.872
fact F1
0.000

Gold facts: revenue −, liquidity +, liabilities −. Scores are against the one reference drawn; the page's tables use all four. A clipped matching pairs each summary n-gram with at most one reference n-gram (Proposition 1); the longest chain rises in both directions and never has more cells than the clipped unigrams (Theorem 2).


Where this sits

An overlap metric reads the grid of matches between a candidate and its references. Clipping is a maximum matching on it (Proposition 1), and the longest common subsequence is the longest chain through it (Theorem 2). With one reference, BLEU is bounded by an envelope of the length ratio that peaks at the reference length (Theorem 1). Its corpus score is not the mean of its sentence scores (Proposition 2), one missing 4-gram zeroes a sentence (Proposition 3), and a new reference can lower it (Proposition 4). The central fact is Theorem 3: a few edited words move every overlap score by a few n-grams’ worth, so a reversed fact barely registers (Corollary 1), reordering at mismatches never costs BLEU anything (Proposition 5), and embeddings soften the edit further (Proposition 6). Read as a decision rule, BLEU prefers a different output from the mode (Theorem 4), and averaged over documents it converges to its bias, not to the truth (Proposition 7).

Smoothing from the n-gram topic reappears in sentence BLEU, and the short modes of the decoding topic are what the brevity penalty punishes. Every number on this page is a point estimate. Whether a gap between two systems is larger than its noise is a question for paired tests and intervals, the subject of the next topic, on significance testing.


Honest caveats


Implementation

The companion notebook (notebookPath) imports the topic’s Python module, which owns every number on this page. It imports the decoding topic’s module for the prompts, the trigram, its exact modes, and beam search; the collocations topic’s module for PageRank; the word2vec topic’s module for the skip-gram vectors; and through them the n-gram module and the finance corpus. Minimum Bayes risk computes the utility of every hypothesis against every sample at once, from n-gram count matrices. Its harness checks:

  • Proposition 1 against SciPy’s Hopcroft–Karp matching, and Definitions 2–4 against sacreBLEU and rouge-score;
  • Theorems 1–3 and Propositions 2–5 on random instances;
  • Corollary 1, Proposition 5, and Proposition 6 on every finance summary;
  • Theorem 4 on the toy distribution and the 188188 prompts, and Proposition 7 in its model and on the finance systems;
  • every finance number this page states.

The laboratory reads its data from a JSON file that one of the harness’s tests requires to equal the module’s viz_payload() exactly, so the figure cannot drift from the code.

Connections

  • Its Theorem 4, the pull of the end mark, is why the exact mode is short; Theorem 1 here shows the brevity penalty punishing exactly that, and Theorem 4 here replaces the mode by the decision BLEU itself prefers. beam-search-decoding
  • Its Theorem 1, that ancestral sampling draws exactly from the model, is what makes sample-based minimum Bayes risk an unbiased estimate of each hypothesis's expected BLEU. sampling-temperature-nucleus
  • Its trained skip-gram vectors are the soft match's embeddings; Proposition 6 shows that their distributional geometry puts antonyms such as rose and fell almost on top of each other. word2vec-implicit-factorization
  • Its PageRank, proved unique and geometrically convergent there, ranks sentences here for the TextRank extractive baseline in the finance case study. collocations-keyword-extraction

References & Further Reading

  • paper Bleu: A Method for Automatic Evaluation of Machine Translation — Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu (2002) Proceedings of ACL 2002, 311–18. No numbered equations. Section 2.1 and footnote 2: modified n-gram precision, clipped at the largest count in any single reference (the 'the the the' example); Section 2.2.2: the best match length, and the brevity penalty computed over the corpus because sentence-level penalties punish short sentences harshly; Section 2.3: BP and N = 4 with uniform weights; Section 5, Figures 5–6: correlations with human judges over five systems
  • paper ROUGE: A Package for Automatic Evaluation of Summaries — Chin-Yew Lin (2004) Text Summarization Branches Out (ACL 2004 workshop), 74–81. Equation 1: ROUGE-N; Section 2.1: several references scored by the best pairwise score, then jackknifed; Section 3.1, Equations 2–4: ROUGE-L from the longest common subsequence; Section 5: ROUGE-S
  • paper ORANGE: A Method for Evaluating Automatic Evaluation Metrics for Machine Translation — Chin-Yew Lin and Franz Josef Och (2004) Proceedings of COLING 2004, 501–7. Section 4: smoothed BLEU adds one to the n-gram hit and total counts for n > 1
  • paper Re-evaluating the Role of Bleu in Machine Translation Research — Chris Callison-Burch, Miles Osborne, and Philipp Koehn (2006) Proceedings of EACL 2006, 249–56. Section 3.1 and Equation 1: phrases between bigram mismatches can be permuted without reducing the matched n-grams, at least (k − b)! variants; footnote 2: a permutation can raise the score; Section 4, Figures 2–4: systems BLEU ranks against human judgment
  • paper A Systematic Comparison of Smoothing Techniques for Sentence-Level BLEU — Boxing Chen and Colin Cherry (2014) Proceedings of the Ninth Workshop on Statistical Machine Translation, 362–67. Section 2.2: Smoothing 2 is Lin and Och's add-one (Equations 6–7); Smoothing 3 is the NIST rule, giving the k-th order with no match a count of 1/2^k
  • paper chrF: Character n-gram F-score for Automatic MT Evaluation — Maja Popović (2015) Proceedings of the Tenth Workshop on Statistical Machine Translation, 392–95. Equation 1: chrF_β from precision and recall averaged over n-gram orders; Section 3.1: n = 6, spaces ignored, β = 3 as a preliminary value
  • paper chrF Deconstructed: Beta Parameters and n-gram Weights — Maja Popović (2016) Proceedings of the First Conference on Machine Translation, 499–504. Section 3: β = 2 and uniform n-gram weights work best, the defaults sacreBLEU adopts
  • paper BERTScore: Evaluating Text Generation with BERT — Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi (2020) ICLR 2020. Section 3 (no numbered equations): greedy-matching recall, precision, and F over contextual embeddings; importance weighting by idf; baseline rescaling
  • paper A Call for Clarity in Reporting BLEU Scores — Matt Post (2018) Proceedings of the Third Conference on Machine Translation, 186–91. Section 2.2 and Table 1: reference preprocessing moves BLEU by up to 1.8 points; the sacreBLEU reference implementation
  • paper Minimum Bayes-Risk Decoding for Statistical Machine Translation — Shankar Kumar and William Byrne (2004) Proceedings of HLT-NAACL 2004, 169–76. Equation 3: the minimum Bayes-risk decision rule; Equations 5–6: 0/1 loss gives the MAP decision; Section 2.1: the loss 1 − BLEU, sentence-level and unsmoothed
  • paper Is MAP Decoding All You Need? The Inadequacy of the Mode in Neural Machine Translation — Bryan Eikema and Wilker Aziz (2020) Proceedings of COLING 2020, 4506–20. Section 7.4, Equation 1: minimum Bayes risk over ancestral samples, with METEOR as the utility; footnote 9 avoids smoothed sentence BLEU
  • paper High Quality Rather than High Model Probability: Minimum Bayes Risk Decoding with Neural Metrics — Markus Freitag, David Grangier, Qijun Tan, and Bowen Liang (2022) Transactions of the Association for Computational Linguistics 10: 811–25
  • paper A Structured Review of the Validity of BLEU — Ehud Reiter (2018) Computational Linguistics 44 (3): 393–401. 284 correlations from 34 papers: BLEU is supported for system-level diagnostic evaluation of machine translation, not for other tasks or individual texts (Section 3, Figures 4–5; Section 5)
  • paper TextRank: Bringing Order into Texts — Rada Mihalcea and Paul Tarau (2004) Proceedings of EMNLP 2004, 404–11. Section 4.1: sentence similarity as shared words over log |S_i| + log |S_j| (unnumbered)