AI Logic

Evaluation Metrics

chrF

Updated:

Computation of chrF. The top shows the reference "Kit saw a dove" and the candidate "It saw a bird". The bottom left shows whether each character 1- to 6-gram of the candidate appears in the reference, with precision and recall for each n (0.70 and 0.64 for 1-grams, 0 and 0 for 6-grams). The bottom right shows chrF (β = 1) 0.310 and chrF2 (β = 2) 0.300, computed from the mean precision 0.329 and mean recall 0.294 over the six values

Background and Overview

chrF is an evaluation metric that counts how many character sequences (character n-grams) a machine translation output (the candidate) shares with a human translation (the reference), and combines precision and recall into an F-score. It ranges from 0 to 1 (often written on a 0–100 scale), and higher values mean the translation is closer to the reference.

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

chrP\mathrm{chrP} is the fraction of the candidate's character n-grams that also appear in the reference (precision), and chrR\mathrm{chrR} is the fraction of the reference's character n-grams that also appear in the candidate (recall); both are averaged over n=1n = 1 to 66. β\beta sets how many times more weight recall gets than precision.

chrF was proposed by Maja Popović at WMT (the Workshop on Machine Translation) in 2015. Character n-grams had already been used as components of more complex metrics, and their usefulness was known. The paper tested whether the F-score of character n-grams alone works as a standalone metric, and showed that it correlates with human judgments as well as or better than widely used metrics such as BLEU. It needs no extra tools or dictionaries, and it is independent of language and tokenization (how text is split into words).

Definition and Computation

chrF is computed as follows.

  1. Remove spaces from the candidate and the reference to get character sequences. In the paper, counting a space as a character did not improve correlation with human judgments, so spaces are not counted.
  2. For each of n=1,2,…,6n = 1, 2, \dots, 6, extract the character n-grams of the candidate and the reference. The paper compared maximum lengths of 4, 6, and 10 characters, as well as a length set per sentence from the average word length; up to 6 characters correlated best with human judgments.
  3. For each n-gram, add the smaller of its counts in the candidate and the reference to the number of matches.
  4. For each nn, divide the number of matches by the number of candidate n-grams to get precision, and by the number of reference n-grams to get recall.
  5. Take the arithmetic mean of the six precisions and of the six recalls to get chrP\mathrm{chrP} and chrR\mathrm{chrR}.
  6. Combine them into an F-score with the formula above.

With β=1\beta = 1, this is the harmonic mean of precision and recall (the paper's standard chrF); with β=3\beta = 3, it is chrF3, which weights recall three times as much as precision. In a follow-up study the next year (2016), Popović examined β\beta from 1/6 to 6 and reported chrF2 (β=2\beta = 2) as the most promising. The default in the widely used sacreBLEU is also β=2\beta = 2.

The example in the figure at the top compares the reference "Kit saw a dove" with the candidate "It saw a bird". For single characters, 7 of 10 match, giving precision 0.70. Longer n-grams match less, and no 6-character sequence matches at all. Averaging the six values gives chrP=0.329\mathrm{chrP} = 0.329 and chrR=0.294\mathrm{chrR} = 0.294, so chrF (β=1\beta = 1) is 0.310 and chrF2 is 0.300.

When only the ending differs, as in "watched" and "watching", word-level BLEU treats them as different words and counts the whole word as a mismatch. In chrF, character n-grams such as "w", "wa", "wat", "watc", and "watch" match, so the translation gets partial credit. This is why chrF is used for morphologically rich languages and for languages like Japanese, where word boundaries are ambiguous.

What It Measures and Its Limitations

chrF measures how much the candidate and the reference overlap as character sequences, from the viewpoints of both precision (whether nothing superfluous is output) and recall (whether everything needed is output). According to the paper, like morpheme-based F-scores, character n-grams also capture some grammatical phenomena, such as inflection and word order.

It has the following limitations.

  • It cannot measure closeness in meaning: it only looks at character matches, so other ways of saying the same thing (synonyms and paraphrases) are not credited unless the characters overlap.
  • It depends on the quality and number of references: the closer to the reference, the higher the score, so translations that differ from the reference but are correct are underrated.
  • It can be lenient toward reordering: short character n-grams count as matches wherever they appear, so even a scrambled word order earns points from 1- and 2-character matches.
  • The original paper's validation was mainly on European languages: the paper itself notes that, outside Europe, it was tested only on Hindi, and that validation on languages with different writing systems, such as Arabic and Chinese, is left for future work.

Even under the name "chrF", the score changes with the value of β\beta (1, 2, or 3) and with whether word n-grams are added. The sacreBLEU default is β=2\beta = 2 (displayed as chrF2), and the default of torchmetrics' CHRFScore is chrF++ with β=2\beta = 2 plus word 1- to 2-grams. When comparing with prior work, report the sacreBLEU signature (for example, nrefs:1|case:mixed|eff:yes|nc:6|nw:0|space:no|version:2.x) and match the settings.

Validation in the Original Paper

The paper computed chrF for all translation outputs submitted to the WMT12–WMT14 evaluation tasks and compared its correlation with human rankings against the word 4-gram F-score (wordF), BLEU, TER, and METEOR. The languages were English, Spanish, French, German, Czech, Russian, and Hindi.

Average system-level correlations (rankings of translation systems) are shown below. WMT14 uses the Pearson correlation coefficient and WMT13 and WMT12 the Spearman rank correlation coefficient; chrF3 was tested only on WMT14.

YearwordFchrFchrF3BLEUTERMETEOR
WMT140.8100.8050.8570.8450.8140.822
WMT130.8740.873—0.8350.7910.876
WMT120.6590.696—0.6710.6820.690

At the segment level (whether it predicts human judgments of which of two translations is better), the paper compared Kendall rank correlation coefficients on WMT14. For translation from English into other languages, chrF3's average of 0.331 was the highest, above BEER (0.319), the best metric in the evaluation task, and METEOR (0.306). For translation from other languages into English, chrF (0.338) and chrF3 (0.343) fell slightly short of the top-ranked DiscoTK-party (0.386), BEER (0.362), and METEOR (0.354).

Comparing per translation output, chrF correlated better than BLEU and TER on 67.9% of outputs and better than METEOR on 50.0%. chrF3 outperformed every metric on 70–80% of outputs.

Where It Is Used

chrF is mainly used in the following settings.

  • Machine translation evaluation: on benchmarks such as WMT, it is often reported alongside BLEU, especially for translation into morphologically rich languages such as German, Czech, and Russian.
  • Languages with ambiguous word boundaries: since it compares character sequences, it can be computed for Japanese and Chinese without word segmentation tools (such as morphological analyzers).
  • Evaluating subword-based models: models that split words into small pieces with BPE or SentencePiece produce more outputs in which only part of a word matches. chrF can credit such partial matches.

Comparison with Similar Metrics

The table compares chrF with other metrics used to evaluate text generation from the same perspectives.

MetricUnit comparedPrecision / recallRobustness to paraphraseExtra tools
chrFCharacter n-grams (1–6)Both (F-score)Moderate (robust to inflection)None
BLEUWord n-grams (1–4)Precision + brevity penaltyWeak (surface match only)Tokenization
METEORWord alignmentBoth (recall weighted)Fairly strong (stems and synonyms match)Stemmer and synonym dictionary
ROUGEWord n-grams, longest common subsequenceMainly recallWeakTokenization
BERTScoreEmbedding similarityBoth (F-score)Strong (compares meaning)Pretrained language model
Word error rate (WER)Word edit distance—WeakTokenization

Guidelines for choosing:

  • Comparing with prior work on translation benchmarks: in addition to BLEU, compute chrF with sacreBLEU and include the signature.
  • Morphologically rich languages, Japanese, and Chinese: use chrF as the main metric, since it does not depend on word segmentation.
  • Crediting synonyms and paraphrases: also use METEOR or BERTScore.
  • Light, fast computation: chrF needs neither a language model nor a dictionary, so it is easy to use for things like validation during training.

PyTorch example

Show code
python
from collections import Counter


def char_ngrams(text, n):
  s = "".join(text.split())  # spaces are not counted
  return Counter(s[i:i + n] for i in range(len(s) - n + 1))


def chrf(hyp, ref, max_n=6, beta=1.0):
  """chrF-beta of Popović (2015). Averages precision and recall over n = 1..max_n, then computes the F-score.
  beta=1 is the original paper's standard chrF; beta=2 is the sacreBLEU default (chrF2). Returns 0-1."""
  precs, recs = [], []
  for n in range(1, max_n + 1):
    h, r = char_ngrams(hyp, n), char_ngrams(ref, n)
    if not h or not r:
      continue  # if the sentence is too short to have n-grams, leave this n out of the average (as sacreBLEU does)
    match = sum(min(k, r[g]) for g, k in h.items())  # the smaller count is the number of matches
    precs.append(match / sum(h.values()))
    recs.append(match / sum(r.values()))
  if not precs:
    return 0.0
  p, r = sum(precs) / len(precs), sum(recs) / len(recs)
  if p + r == 0:
    return 0.0
  return (1 + beta ** 2) * p * r / (beta ** 2 * p + r)


print(round(chrf("It saw a bird", "Kit saw a dove"), 3))          # 0.31 (beta = 1)
print(round(chrf("It saw a bird", "Kit saw a dove", beta=2), 3))  # 0.3 (beta = 2)

# Scores compared across papers are computed with sacreBLEU (returns 0-100)
import sacrebleu

metric = sacrebleu.metrics.CHRF()  # defaults: char_order=6, word_order=0, beta=2 (chrF2). word_order=2 gives chrF++
result = metric.corpus_score(["It saw a bird"], [["Kit saw a dove"]])
print(result.score, metric.get_signature())

# torchmetrics: defaults are n_word_order=2 (chrF++), beta=2.0. For chrF, specify n_word_order=0
from torchmetrics.text import CHRFScore

chrf2 = CHRFScore(n_char_order=6, n_word_order=0, beta=2.0)
print(chrf2(["It saw a bird"], [["Kit saw a dove"]]))

FAQ

Q. What is the difference between chrF, chrF2, chrF3, and chrF++?
A.

The number is the value of β\beta, which says how many times more weight recall gets than precision. The original paper's standard chrF uses β=1\beta = 1, chrF3 uses β=3\beta = 3, and sacreBLEU's default chrF2 uses β=2\beta = 2. chrF++ is a variant that counts word 1- to 2-grams in addition to character n-grams. Their scores are not comparable with each other, so always state which one was used.

Q. Can chrF be used as is for Japanese translation?
A.

Yes. chrF compares character sequences, so no word segmentation preprocessing is needed. Unlike BLEU, there is no need to choose a Japanese tokenizer (morphological analyzer), which reduces the risk of scores changing with preprocessing. However, the original paper's validation was mainly on European languages, so correlation with human judgments for Japanese needs to be confirmed by other studies.

Q. What chrF score counts as a good translation?
A.

There is no fixed threshold, because the score varies greatly with the language pair, test data, references, and the value of β\beta. Judge by comparing with existing systems computed with the same settings (the same sacreBLEU signature).

References

  1. Popović, M. (2015). chrF: character n-gram F-score for automatic MT evaluation. Proceedings of the Tenth Workshop on Statistical Machine Translation (WMT), 392–395.
  2. Popović, M. (2016). chrF deconstructed: β parameters and n-gram weights. Proceedings of the First Conference on Machine Translation (WMT), 499–504.
  3. sacreBLEU (GitHub repository).
  4. Lightning AI. torchmetrics.text.CHRFScore (API reference).