BLEU

Algorithm for evaluating the quality of machine-translated text

This article is about the evaluation metric for machine translation. For other uses, see Bleu (disambiguation).

BLEU (bilingual evaluation understudy) is an algorithm for evaluating the quality of text which has been machine-translated from one natural language to another. Quality is considered to be the correspondence between a machine's output and that of a human: "the closer a machine translation is to a professional human translation, the better it is" – this is the central idea behind BLEU.[1] Invented at IBM in 2001, BLEU was one of the first metrics to claim a high correlation with human judgements of quality,[2][3] and remains one of the most popular automated and inexpensive metrics.

Scores are calculated for individual translated segments—generally sentences—by comparing them with a set of good quality reference translations. Those scores are then averaged over the whole corpus to reach an estimate of the translation's overall quality. Intelligibility or grammatical correctness are not taken into account.[4]

BLEU's output is always a number between 0 and 1. This value indicates how similar the candidate text is to the reference texts, with values closer to 1 representing more similar texts. Few human translations will attain a score of 1, since this would indicate that the candidate is identical to one of the reference translations. For this reason, it is not necessary to attain a score of 1. Because there are more opportunities to match, adding additional reference translations will increase the BLEU score.[5]

## Mathematical definition

[edit]

### Basic setup

[edit]

A basic, first attempt at defining the BLEU score would take two arguments: a candidate string  y ^ {\displaystyle {\hat {y}}} and a list of reference strings  ( y ( 1 ) , . . . , y ( N ) ) {\displaystyle (y^{(1)},...,y^{(N)})} . The idea is that  B L E U ( y ^ ; y ( 1 ) , . . . , y ( N ) ) {\displaystyle BLEU({\hat {y}};y^{(1)},...,y^{(N)})} should be close to 1 when  y ^ {\displaystyle {\hat {y}}} is similar to  y ( 1 ) , . . . , y ( N ) {\displaystyle y^{(1)},...,y^{(N)}} , and close to 0 if not.

As an analogy, the BLEU score is like a language teacher trying to score the quality of a student translation  y ^ {\displaystyle {\hat {y}}} by checking how closely it follows the reference answers  y ( 1 ) , . . . , y ( N ) {\displaystyle y^{(1)},...,y^{(N)}} .

Since in natural language processing, one should evaluate a large set of candidate strings, one must generalize the BLEU score to the case where one has a list of M candidate strings (called a "corpus")  ( y ^ ( 1 ) , ⋯ , y ^ ( M ) ) {\displaystyle ({\hat {y}}^{(1)},\cdots ,{\hat {y}}^{(M)})} , and for each candidate string  y ^ ( i ) {\displaystyle {\hat {y}}^{(i)}} , a list of reference candidate strings  S i := ( y ( i , 1 ) , . . . , y ( i , N i ) ) {\displaystyle S_{i}:=(y^{(i,1)},...,y^{(i,N_{i})})} .

Given any string  y = y 1 y 2 ⋯ y K {\displaystyle y=y_{1}y_{2}\cdots y_{K}} , and any integer  n ≥ 1 {\displaystyle n\geq 1} , we define the set of its n-grams to be  G n ( y ) = { y 1 ⋯ y n , y 2 ⋯ y n + 1 , ⋯ , y K − n + 1 ⋯ y K } {\displaystyle G_{n}(y)=\\{y_{1}\cdots y_{n},y_{2}\cdots y_{n+1},\cdots ,y_{K-n+1}\cdots y_{K}\\}} Note that it is a set of unique elements, not a multiset allowing redundant elements, so that, for example,  G 2 ( a b a b ) = { a b , b a } {\displaystyle G_{2}(abab)=\\{ab,ba\\}} .

Given any two strings  s , y {\displaystyle s,y} , define the substring count  C ( s , y ) {\displaystyle C(s,y)} to be the number of appearances of  s {\displaystyle s} as a substring of  y {\displaystyle y} . For example,  C ( a b , a b c b a b ) = 2 {\displaystyle C(ab,abcbab)=2} .

Now, fix a candidate corpus  S ^ := ( y ^ ( 1 ) , ⋯ , y ^ ( M ) ) {\displaystyle {\hat {S}}:=({\hat {y}}^{(1)},\cdots ,{\hat {y}}^{(M)})} , and reference candidate corpus  S = ( S 1 , ⋯ , S M ) {\displaystyle S=(S_{1},\cdots ,S_{M})} , where each  S i := ( y ( i , 1 ) , . . . , y ( i , N i ) ) {\displaystyle S_{i}:=(y^{(i,1)},...,y^{(i,N_{i})})} .

### Modified n-gram precision

[edit]

Define the modified n-gram precision function to be  p n ( S ^ ; S ) := ∑ i = 1 M ∑ s ∈ G n ( y ^ ( i ) ) min ( C ( s , y ^ ( i ) ) , max y ∈ S i C ( s , y ) ) ∑ i = 1 M ∑ s ∈ G n ( y ^ ( i ) ) C ( s , y ^ ( i ) ) {\displaystyle p_{n}({\hat {S}};S):={\frac {\sum _{i=1}^{M}\sum _{s\in G_{n}({\hat {y}}^{(i)})}\min(C(s,{\hat {y}}^{(i)}),\max _{y\in S_{i}}C(s,y))}{\sum _{i=1}^{M}\sum _{s\in G_{n}({\hat {y}}^{(i)})}C(s,{\hat {y}}^{(i)})}}} The modified n-gram, which looks complicated, is merely a straightforward generalization of the prototypical case: one candidate sentence and one reference sentence. In this case, it is  p n ( { y ^ } ; { y } ) = ∑ s ∈ G n ( y ^ ) min ( C ( s , y ^ ) , C ( s , y ) ) ∑ s ∈ G n ( y ^ ) C ( s , y ^ ) {\displaystyle p_{n}(\\{{\hat {y}}\\};\\{y\\})={\frac {\sum _{s\in G_{n}({\hat {y}})}\min(C(s,{\hat {y}}),C(s,y))}{\sum _{s\in G_{n}({\hat {y}})}C(s,{\hat {y}})}}} To work up to this expression, we start with the most obvious n-gram count summation: ∑ s ∈ G n ( y ^ ) C ( s , y ) = number of n-substrings in  y ^  that appear in  y {\displaystyle \sum _{s\in G_{n}({\hat {y}})}C(s,y)={\text{number of n-substrings in }}{\hat {y}}{\text{ that appear in }}y} This quantity measures how many n-grams in the reference sentence are reproduced by the candidate sentence. Note that we count the n-substrings, not n-grams. For example, when  y ^ = a b a , y = a b a b a b a , n = 2 {\displaystyle {\hat {y}}=aba,y=abababa,n=2} , all the 2-substrings in  y ^ {\displaystyle {\hat {y}}} (ab and ba) appear in  y {\displaystyle y} 3 times each, so the count is 6, not 2.

In the above situation, however, the candidate string is too short. Instead of 3 appearances of  a b {\displaystyle ab} it contains only one, so we add a minimum function to correct for that:  ∑ s ∈ G n ( y ^ ) min ( C ( s , y ^ ) , C ( s , y ) ) {\displaystyle {\sum _{s\in G_{n}({\hat {y}})}\min(C(s,{\hat {y}}),C(s,y))}} This count summation cannot be used to compare between sentences, since it is not normalized. If both the reference and the candidate sentences are long, the count could be big, even if the candidate is of very poor quality. So we normalize it  ∑ s ∈ G n ( y ^ ) min ( C ( s , y ^ ) , C ( s , y ) ) ∑ s ∈ G n ( y ^ ) C ( s , y ^ ) {\displaystyle {\frac {\sum _{s\in G_{n}({\hat {y}})}\min(C(s,{\hat {y}}),C(s,y))}{\sum _{s\in G_{n}({\hat {y}})}C(s,{\hat {y}})}}} The normalization is such that it is always a number in  [ 0 , 1 ] {\displaystyle [0,1]} , allowing meaningful comparisons between corpuses. It is zero if none of the n-substrings in candidate is in reference. It is one if every n-gram in the candidate appears in reference, for at least as many times as in candidate. In particular, if the candidate is a substring of the reference, then it is one.

### Brevity penalty

[edit]

The modified n-gram precision unduly gives a high score for candidate strings that are "telegraphic", that is, containing all the n-grams of the reference strings, but for as few times as possible.

In order to punish candidate strings that are too short, define the brevity penalty to be  B P ( S ^ ; S ) := e − ( r / c − 1 ) + {\displaystyle BP({\hat {S}};S):=e^{-(r/c-1)^{+}}} where  ( r / c − 1 ) + = max ( 0 , r / c − 1 ) {\displaystyle (r/c-1)^{+}=\max(0,r/c-1)} is the positive part of  r / c − 1 {\displaystyle r/c-1} .

* When  r ≤ c {\displaystyle r\leq c} , the brevity penalty  B P = 1 {\displaystyle BP=1} , meaning that we don't punish long candidates, and only punish short candidates.
* When  r > c {\displaystyle r>c} , the brevity penalty  B P = e 1 − r / c {\displaystyle BP=e^{1-r/c}}

c {\displaystyle c} is the length of the candidate corpus, that is, c := ∑ i = 1 M | y ^ ( i ) | {\displaystyle c:=\sum _{i=1}^{M}|{\hat {y}}^{(i)}|} where  | y | {\displaystyle |y|} is the length of  y {\displaystyle y} .

r {\displaystyle r} is the effective reference corpus length, that is,  r := ∑ i = 1 M | y ( i , j ) | {\displaystyle r:=\sum _{i=1}^{M}|y^{(i,j)}|} where  y ( i , j ) = arg ⁡ min y ∈ S i | | y | − | y ^ ( i ) | | {\displaystyle y^{(i,j)}=\arg \min _{y\in S_{i}}||y|-|{\hat {y}}^{(i)}||} , that is, the sentence from  S i {\displaystyle S_{i}} whose length is as close to  | y ^ ( i ) | {\displaystyle |{\hat {y}}^{(i)}|} as possible.

### Final formula

[edit]

There is not a single definition of BLEU, but a whole family of them, parametrized by the weighting vector  w := ( w 1 , w 2 , ⋯ ) {\displaystyle w:=(w_{1},w_{2},\cdots )} . It is a probability distribution on  { 1 , 2 , 3 , ⋯ } {\displaystyle \\{1,2,3,\cdots \\}} , that is,  ∑ i = 1 ∞ w i = 1 {\displaystyle \sum _{i=1}^{\infty }w_{i}=1} , and  ∀ i ∈ { 1 , 2 , 3 , ⋯ } , w i ∈ [ 0 , 1 ] {\displaystyle \forall i\in \\{1,2,3,\cdots \\},w_{i}\in [0,1]} .

With a choice of  w {\displaystyle w} , the BLEU score is B L E U w ( S ^ ; S ) := B P ( S ^ ; S ) ⋅ exp ⁡ ( ∑ n = 1 ∞ w n ln ⁡ p n ( S ^ ; S ) ) {\displaystyle BLEU_{w}({\hat {S}};S):=BP({\hat {S}};S)\cdot \exp \left(\sum _{n=1}^{\infty }w_{n}\ln p_{n}({\hat {S}};S)\right)} In words, it is a weighted geometric mean of all the modified n-gram precisions, multiplied by the brevity penalty. We use the weighted geometric mean, rather than the weighted arithmetic mean, to strongly favor candidate corpuses that are simultaneously good according to multiple n-gram precisions.

The most typical choice, the one recommended in the original paper, is  w 1 = ⋯ = w 4 = 1 4 {\displaystyle w_{1}=\cdots =w_{4}={\frac {1}{4}}} .[1]

## Algorithm

[edit]

This is illustrated in the following example from Papineni et al. (2002):

Example of poor machine translation output with high precision  Candidate  | the | the | the | the | the | the | the

|
|
|
|
|
|
|

Reference 1  | the | cat | is | on | the | mat |
Reference 2  | there | is | a | cat | on | the | mat

Of the seven words in the candidate translation, all of them appear in the reference translations. Thus the candidate text is given a unigram precision of,

P = m w t = 7 7 = 1 {\displaystyle P={\frac {m}{w_{t}}}={\frac {7}{7}}=1}

where    m {\displaystyle ~m} is number of words from the candidate that are found in the reference, and    w t {\displaystyle ~w_{t}} is the total number of words in the candidate. This is a perfect score, despite the fact that the candidate translation above retains little of the content of either of the references.

The modification that BLEU makes is fairly straightforward. For each word in the candidate translation, the algorithm takes its maximum total count,    m m a x {\displaystyle ~m_{max}} , in any of the reference translations. In the example above, the word "the" appears twice in reference 1, and once in reference 2. Thus    m m a x = 2 {\displaystyle ~m_{max}=2} .

For the candidate translation, the count  m w {\displaystyle m_{w}} of each word is clipped to a maximum of  m m a x {\displaystyle m_{max}} for that word. In this case, "the" has    m w = 7 {\displaystyle ~m_{w}=7} and    m m a x = 2 {\displaystyle ~m_{max}=2} , thus    m w {\displaystyle ~m_{w}} is clipped to 2. These clipped counts    m w {\displaystyle ~m_{w}} are then summed over all distinct words in the candidate. This sum is then divided by the total number of unigrams in the candidate translation. In the above example, the modified unigram precision score would be:

P = 2 7 {\displaystyle P={\frac {2}{7}}}

In practice, however, using individual words as the unit of comparison is not optimal. Instead, BLEU computes the same modified precision metric using n-grams. The length which has the "highest correlation with monolingual human judgements"[6] was found to be four. The unigram scores are found to account for the adequacy of the translation, how much information is retained. The longer n-gram scores account for the fluency of the translation, or to what extent it reads like "good English".

Comparing metrics for candidate "the the cat"  Model | Set of grams | Score

|
|

Unigram | "the", "the", "cat" |  1 + 1 + 1 3 = 1 {\displaystyle {\frac {1+1+1}{3}}=1}
Grouped Unigram | "the"*2, "cat"*1 |  1 + 1 2 + 1 = 2 3 {\displaystyle {\frac {1+1}{2+1}}={\frac {2}{3}}}
Bigram | "the the", "the cat" |  0 + 1 2 = 1 2 {\displaystyle {\frac {0+1}{2}}={\frac {1}{2}}}

An example of a candidate translation for the same references as above might be:

the cat

In this example, the modified unigram precision would be,

P = 1 2 + 1 2 = 2 2 {\displaystyle P={\frac {1}{2}}+{\frac {1}{2}}={\frac {2}{2}}}

as the word 'the' and the word 'cat' appear once each in the candidate, and the total number of words is two. The modified bigram precision would be  1 / 1 {\displaystyle 1/1} as the bigram, "the cat" appears once in the candidate. It has been pointed out that precision is usually twinned with recall to overcome this problem [7], as the unigram recall of this example would be  3 / 6 {\displaystyle 3/6} or  2 / 7 {\displaystyle 2/7} . The problem being that as there are multiple reference translations, a bad translation could easily have an inflated recall, such as a translation which consisted of all the words in each of the references.[8]

To produce a score for the whole corpus, the modified precision scores for the segments are combined using the geometric mean multiplied by a brevity penalty to prevent very short candidates from receiving too high a score. Let r be the total length of the reference corpus, and c the total length of the translation corpus. If  c ≤ r {\displaystyle c\leq r} , the brevity penalty applies, defined to be  e ( 1 − r / c ) {\displaystyle e^{(1-r/c)}} . (In the case of multiple reference sentences, r is taken to be the sum of the lengths of the sentences whose lengths are closest to the lengths of the candidate sentences. However, in the version of the metric used by NIST evaluations prior to 2009, the shortest reference sentence had been used instead.)

iBLEU is an interactive version of BLEU that allows a user to visually examine the BLEU scores obtained by the candidate translations. It also allows comparing two different systems in a visual and interactive manner which is useful for system development.[9]

## Performance

[edit]

BLEU has frequently been reported as correlating well with human judgement,[10][11][12] and remains a benchmark for the assessment of any new evaluation metric. There are however a number of criticisms that have been voiced. It has been noted that, although in principle capable of evaluating translations of any language, BLEU cannot, in its present form, deal with languages lacking word boundaries.[13] Designed to be used for several reference translation, in practice it's used with only the single one.[2] BLEU is infamously dependent on the tokenization technique, and scores achieved with different ones are incomparable (which is often overlooked); in order to improve reproducibility and comparability, SacreBLEU variant was designed.[2]

It has been argued that although BLEU has significant advantages, there is no guarantee that an increase in BLEU score is an indicator of improved translation quality.[14]

## See also

[edit]

* F-Measure
* NIST (metric)
* METEOR
* ROUGE (metric)
* Word Error Rate (WER)
* LEPOR

## Notes

[edit]

1. ^ Papineni, K., et al. (2002)
2. ^ Papineni, K., et al. (2002)
3. ^ Coughlin, D. (2003)
4. ^ Papineni, K., et al. (2002)
5. ^ Papineni, K., et al. (2002)
6. ^ Papineni, K., et al. (2002)
7. ^ Coughlin, D. (2003)
8. ^ Doddington, G. (2002)
9. ^ Denoual, E. and Lepage, Y. (2005)
10. ^ Callison-Burch, C., Osborne, M. and Koehn, P. (2006)
11. ^ Lee, A. and Przybocki, M. (2005)
12. ^ Callison-Burch, C., Osborne, M. and Koehn, P. (2006)
13. ^ Lin, C. and Och, F. (2004)
14. ^ Callison-Burch, C., Osborne, M. and Koehn, P. (2006)
15. ^ Madnani, N. (2011)

## References

[edit]

1. ^ Papineni, Kishore; Roukos, Salim; Ward, Todd; Zhu, Wei-Jing (2001). "BLEU". Proceedings of the 40th Annual Meeting on Association for Computational Linguistics - ACL '02. Morristown, NJ, USA: Association for Computational Linguistics: 311. doi:10.3115/1073083.1073135. S2CID 11080756.
2. ^ a b Marie, Benjamin (5 November 2022). "BLEU: A Misunderstood Metric from Another Age". Towards Data Science.

## Bibliography

[edit]

* Papineni, K.; Roukos, S.; Ward, T.; Zhu, W. J. (2002). BLEU: a method for automatic evaluation of machine translation (PDF). ACL-2002: 40th Annual meeting of the Association for Computational Linguistics. pp. 311–318\. CiteSeerX 10.1.1.19.9416.
* Papineni, K., Roukos, S., Ward, T., Henderson, J and Reeder, F. (2002). "Corpus-based Comprehensive and Diagnostic MT Evaluation: Initial Arabic, Chinese, French, and Spanish Results Archived 2016-03-04 at the Wayback Machine" in Proceedings of Human Language Technology 2002, San Diego, pp. 132–137
* Callison-Burch, C., Osborne, M. and Koehn, P. (2006) "Re-evaluating the Role of BLEU in Machine Translation Research Archived 2008-12-04 at the Wayback Machine" in 11th Conference of the European Chapter of the Association for Computational Linguistics: EACL 2006 pp. 249–256
* Doddington, G. (2002) "Automatic evaluation of machine translation quality using n-gram cooccurrence statistics Archived 2013-10-12 at the Wayback Machine" in Proceedings of the Human Language Technology Conference (HLT), San Diego, CA pp. 128–132
* Coughlin, D. (2003) "Correlating Automated and Human Assessments of Machine Translation Quality Archived 2008-09-06 at the Wayback Machine" in MT Summit IX, New Orleans, USA pp. 23–27
* Denoual, E. and Lepage, Y. (2005) "BLEU in characters: towards automatic MT evaluation in languages without word delimiters Archived 2011-07-18 at the Wayback Machine" in Companion Volume to the Proceedings of the Second International Joint Conference on Natural Language Processing pp. 81–86
* Lee, A. and Przybocki, M. (2005) NIST 2005 machine translation evaluation official results
* Lin, C. and Och, F. (2004) "Automatic Evaluation of Machine Translation Quality Using Longest Common Subsequence and Skip-Bigram Statistics Archived 2008-07-05 at the Wayback Machine" in Proceedings of the 42nd Annual Meeting of the Association of Computational Linguistics.
* Madnani, N. (2011). "iBLEU: Interactively Scoring and Debugging Statistical Machine Translation Systems" in "Proceedings of the Fifth IEEE International Conference on Semantic Computing (Demos), Palo Alto, CA" pp. 213–214

## External links

[edit]

* BLEU – Bilingual Evaluation Understudy lecture of Machine Translation course by Karlsruhe Institute for Technology, Coursera

* v
* t
* e

Machine learning evaluation metrics

Regression|

* MSE
* MAE
* sMAPE
* MAPE
* MASE
* MSPE
* RMS
* RMSE/RMSD
* R2
* MDA
* MAD

Classification|

* F-score
* P4
* Accuracy
* Precision
* Recall
* Kappa
* MCC
* AUC
* ROC
* Sensitivity and specificity
* Logarithmic loss

Clustering|

* Silhouette
* Calinski–Harabasz index
* Davies–Bouldin index
* Dunn index
* Hopkins statistic
* Jaccard index
* Rand index
* Similarity measure
* SMC
* DBCV index

Ranking|

* MRR
* NDCG
* AP

Computer vision|

* PSNR
* SSIM
* IoU

NLP|

* Perplexity
* BLEU

Deep learning|

* Inception score
* FID

Recommender system|

* Coverage
* Intra-list similarity

Similarity|

* Cosine similarity
* Euclidean distance
* Pearson correlation coefficient

* Confusion matrix

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template