Search

Search papers and lessons

BLEU Score

Level 3 · 14 min read

BLEU scores a machine-generated text by how many of its word sequences also appear in a human reference, with a penalty for being too short.

On this page

  • Colour = topic mix
  • Discrete math
  • Probability
  • Learning basics
  • Post-training
  • Sign in to see your progress

TL;DR

BLEU is a score from 0 to 1 that measures how close a machine-generated text is to one or more human reference texts. It counts the short word sequences (1 to 4 words long) in the output that also appear in a reference, then combines those overlap rates and multiplies by a penalty if the output is too short.

It was built to score machine translation quickly and repeatedly, without a human reading every output. It is still the default number people quote for translation and many text generation tasks, even though it measures surface overlap rather than meaning.

Where you'll see it: in machine translation papers and leaderboards, in evaluating summarisation and image-caption systems, and as a quick regression check while tuning a text generator.

Intuition

Counting shared phrases

Suppose a translator writes a sentence, and a human also writes a reference translation of the same source. A good machine output should use many of the same words in the same order. The simplest test is to count matching single words. That fails quickly: a sentence made of the words "the" and "of" would score well. So BLEU looks at short phrases (the idea behind an N-gram Language Model) as well: pairs of adjacent words, triples, and quadruples.

Matching phrases, not single words, is the key move. If the output says "the cat sat on the mat" and the reference says "the cat sat on the mat", the four-word sequence "cat sat on the" matches. A random jumble of the same words would share single words but almost no phrases, so it scores low. Word order is rewarded without requiring an exact copy.

Why does this matter? A human judge takes minutes per sentence and disagrees with other judges. A metric that takes milliseconds and gives the same answer every time lets researchers try thousands of model settings. BLEU was designed for that trade: it is not a perfect measure of quality, but it moves in the same direction as human judgement when averaged over a whole test set.

0.20.30.40.50.60.70.80.9100.20.40.60.81candidate length divided by reference lengthpenalty multiplier
  • brevity penalty
When the output is shorter than the reference, BLEU multiplies the score by this penalty. At equal length it is 1, and it drops sharply for short outputs.

The math

Setup

Let a candidate be the machine output and let R1,…,RmR_1, \ldots, R_m be one or more human references. For each nn from 1 to 4, an nn-gram is a run of nn consecutive words. Let cc be the total length of the candidate in words and let rr be the length of the reference closest to cc. The "closest" choice matters only when there are several references.

Clipped n-gram precision

For each nn, count how many times each distinct candidate nn-gram gg appears in the candidate, and how many times it appears in the most generous single reference. Clip the candidate count at that reference count. This is a modified form of precision:

pn=∑g∈candidate n-gramsmin⁡(Countcand(g), max⁡iCountRi(g))∑g∈candidate n-gramsCountcand(g).p_n = \frac{\sum_{g \in \text{candidate } n\text{-grams}} \min\big(\text{Count}_{\text{cand}}(g),\ \max_i \text{Count}_{R_i}(g)\big)}{\sum_{g \in \text{candidate } n\text{-grams}} \text{Count}_{\text{cand}}(g)}.

Clipping stops a degenerate output from gaming the metric. A candidate that says "the the the the the the" against the reference "the cat sat on the mat" has a unigram precision of 2/62/6, not 6/66/6, because "the" appears only twice in the reference.

Combining the orders

BLEU averages the log precisions with equal weights, up to N=4N = 4:

BLEU=BP⋅exp⁡ ⁣(∑n=1414 log⁡pn).\text{BLEU} = \text{BP} \cdot \exp\!\left(\sum_{n=1}^{4} \frac{1}{4}\,\log p_n\right).

The sum of logs is the logarithm of a geometric mean. A geometric mean punishes a single very low precision much more than an arithmetic mean would. If p4p_4 is zero, the whole score is zero, which is why BLEU is unforgiving on short sentences (see the worked examples). The inner exponential undoes the logs, so BLEU is the geometric mean of the four precisions.

Brevity penalty

Precision alone rewards outputs that are short and safe: a single word like "the" might match well. The brevity penalty corrects this:

BP={1if c>r,exp⁡ ⁣(1−rc)if c≤r.\text{BP} = \begin{cases} 1 & \text{if } c \gt r, \\ \exp\!\left(1 - \dfrac{r}{c}\right) & \text{if } c \le r. \end{cases}

If the candidate is as long as the reference or longer, there is no penalty. If it is shorter, the score is scaled down by an amount that grows as cc shrinks relative to rr. The plot above shows the curve exp⁡(1−1/x)\exp(1 - 1/x) for x=c/rx = c/r.

Corpus-level score

The original definition is computed over a whole test set. Clipped counts are summed across all sentences before the precisions are formed, cc is the total candidate length, and rr is the sum over sentences of the closest reference length. Summing before dividing means a long sentence with good overlap counts for more than a short one, which is the behaviour you want. Sentence-level BLEU is also used, but it is noisier and needs smoothing when a sentence has no 4-gram matches.

Worked examples

Example
A short sentence, step by step

Candidate: "the cat is on the mat". Reference: "the cat sat on the mat". Both have six words, so c=r=6c = r = 6 and BP=1\text{BP} = 1.

  1. Unigrams. Candidate counts: the 2, cat 1, is 1, on 1, mat 1, total 6. Reference counts: the 2, cat 1, sat 1, on 1, mat 1. Clipped matches: the 2, cat 1, on 1, mat 1. "is" does not match. So p1=5/6≈0.833p_1 = 5/6 \approx 0.833.
  2. Bigrams. Candidate has 5: the cat, cat is, is on, on the, the mat. Matches with the reference: the cat, on the, the mat. So p2=3/5=0.6p_2 = 3/5 = 0.6.
  3. Trigrams. Candidate has 4: the cat is, cat is on, is on the, on the mat. Only "on the mat" matches. So p3=1/4=0.25p_3 = 1/4 = 0.25.
  4. Four-grams. Candidate has 3: the cat is on, cat is on the, is on the mat. None appear in the reference, so p4=0p_4 = 0.
  5. Combine. The geometric mean includes log⁡0\log 0, which is minus infinity, so the unsmoothed BLEU is exactly 0.

Interpretation: the sentence means nearly the same thing, yet unsmoothed sentence-level BLEU scores it zero. The fourth-order precision is the problem. Corpus-level BLEU avoids this by pooling counts across many sentences, and sentence-level implementations add smoothing, such as adding one to each count, to keep the score informative.

Example
A realistic translation batch

Suppose a test set has a total candidate length c=1400c = 1400 words, against a summed closest-reference length r=1600r = 1600. Pooled precisions are p1=0.85p_1 = 0.85, p2=0.62p_2 = 0.62, p3=0.45p_3 = 0.45, p4=0.30p_4 = 0.30.

  1. Brevity penalty: BP=exp⁡(1−1600/1400)=exp⁡(−0.1429)≈0.8669\text{BP} = \exp(1 - 1600/1400) = \exp(-0.1429) \approx 0.8669.
  2. Log precisions: log⁡0.85≈−0.1625\log 0.85 \approx -0.1625, log⁡0.62≈−0.4780\log 0.62 \approx -0.4780, log⁡0.45≈−0.7985\log 0.45 \approx -0.7985, log⁡0.30≈−1.2040\log 0.30 \approx -1.2040.
  3. Average them with weight 1/41/4: (−0.1625−0.4780−0.7985−1.2040)/4≈−0.6608(-0.1625 - 0.4780 - 0.7985 - 1.2040)/4 \approx -0.6608.
  4. Exponentiate: exp⁡(−0.6608)≈0.5165\exp(-0.6608) \approx 0.5165.
  5. Multiply by the penalty: BLEU=0.8669⋅0.5165≈0.448\text{BLEU} = 0.8669 \cdot 0.5165 \approx 0.448.

Interpretation: the score is 0.448, usually reported as 44.8 on a 0 to 100 scale. Setting the penalty aside, the geometric mean is 0.517. Lengthening the output to 1600 words, with the same precisions, would remove the penalty and lift the score to about 0.52, which shows how much the brevity term can matter for systems that drop content.

Tradeoffs and failure modes

BLEU is cheap, deterministic and comparable across papers that use the same tokenisation and references. It is weak at the sentence level and blind to meaning, so it should be read as a rough signal, not a verdict.

SituationWhat goes wrongBetter choice
Judging one sentenceShort sentences give zero 4-gram matches; scores are noisyCorpus-level BLEU, or a learned metric
Paraphrase is correctA synonym or reordering is penalised as an errorMetrics with synonyms (METEOR) or embeddings (COMET, BERTScore)
Comparing systems with different tokenisersScores not comparable; punctuation changes the resultReport a standard tokeniser, or use sacreBLEU
Open-ended generation such as chatMany valid answers; overlap says little about qualityHuman or model-based evaluation
Only one referenceCommon phrases match by chance; ceiling is lowMultiple references, when affordable

Several known pitfalls deserve a mention. Scores depend heavily on tokenisation, so two papers reporting "BLEU 30" may not mean the same thing. Small test sets give high variance. The brevity penalty can be gamed by padding with words that happen to match, though clipping limits how much. Finally, a system tuned to maximise BLEU can drift toward safe, generic phrasing, which is why several studies have questioned how well BLEU tracks human preference at the level of individual systems.

History

BLEU was introduced in 2002 by Kishore Papineni, Salim Roukos, Todd Ward and Wei-Jing Zhu, working at IBM Research, in a paper at the Association for Computational Linguistics conference. Machine translation research at the time relied on slow human judgements, and each new system needed fresh evaluation. The authors proposed an automatic score that correlated with human ratings over a corpus, so that research cycles could be shorter.

It caught on quickly because it made shared tasks and leaderboards possible. Once many groups used the same metric, progress became measurable, and BLEU became the standard reported number in translation papers for more than a decade. In 2006, Chris Callison-Burch and colleagues examined where BLEU's correlation with human judgement breaks down, and the field has since added complementary metrics. The details of which variant and tokeniser a paper used matter, which is why tools that standardise them are now common.

Check yourself

QuestionWhy does BLEU clip the count of each candidate n-gram at its maximum count in the reference?Show answer

Without clipping, a candidate that repeats a common word would score high even if the word appears only once in the reference. For example, "the the the the the the" against "the cat sat on the mat" would get a unigram precision of 6/6. Clipping limits each matched n-gram to the number of times it appears in the reference, so the output gets credit only for as many occurrences as a human would have written. Here it scores 2/62/6 instead.

QuestionA candidate has length c=8c = 8 and the closest reference has length r=10r = 10. What is the brevity penalty? Give the number to three decimal places.Show answer

Since c≤rc \le r, BP=exp⁡(1−r/c)=exp⁡(1−10/8)=exp⁡(−0.25)≈0.779\text{BP} = \exp(1 - r/c) = \exp(1 - 10/8) = \exp(-0.25) \approx 0.779. Interpretation: the score is multiplied by about 0.78, a 22 percent cut, purely for being two words short. The penalty stops a system from raising precision by just outputting its most confident words.

QuestionWhy is the BLEU combination a geometric mean of the precisions rather than an arithmetic mean? What does this imply for short sentences?Show answer

A geometric mean is the exponential of the average of logs. Because the log of a small number is very negative, one low precision pulls the whole average down strongly. An arithmetic mean would let high precisions compensate for a low one. The consequence is that a sentence with no 4-gram matches gets a score of exactly zero without smoothing, so sentence-level BLEU is unreliable on short texts, and corpus-level pooling is preferred.

QuestionA translation system outputs fluent, correct sentences that use synonyms the single reference does not contain. Why might its BLEU score be low, and what would you do before concluding the system is poor?Show answer

BLEU counts exact word sequences, so each synonym breaks every n-gram that contains it, lowering all four precisions even though the meaning is right. Before concluding the system is poor, add references if possible, check tokenisation and length, look at the brevity penalty, and run a complementary metric or a human evaluation on a sample. The low score is evidence about the metric's blind spot as much as about the system.

Sources