How chrF Scores Translation: Character n-grams and Recall
Learn how chrF combines character n-gram precision and recall, calculate a small chrF2 example, and run reproducible chrF/chrF++ comparisons with SacreBLEU.
chrF evaluates machine translation by comparing overlapping character n-grams in a candidate and a reference, then combining precision and recall in an F-score. It can capture partial spelling and ending matches without morphological tokenization, but it does not directly judge meaning. Common chrF2 weights recall more; chrF++ adds word n-grams.
Character n-grams and the score
An n-gram is a run of n consecutive units. The character trigrams in cats are cat and ats. chrF counts character n-grams of several lengths in the candidate and reference. Precision (P) is the share of candidate n-grams that match; recall (R) is the share of reference n-grams recovered by the candidate. Shared fragments can earn credit even when word forms or endings differ.
Fβ = (1 + β²) × P × R / (β² × P + R)
At β=1, precision and recall have equal weight. β=2 gives recall more weight, so missing reference fragments lowers the score more than an equivalent amount of extra candidate material. Implementations generally average precision and recall across character n-gram orders before computing Fβ. Lowercasing, whitespace and smoothing settings may also differ.
Worked toy example
Use character 2-grams only, no spaces or case conversion; this is an illustration, not tool output. Reference cats has ca, at, ts; candidate cat has ca, at. Both candidate n-grams match, so P=2/2=1 and R=2/3. With β=2, F₂=5×1×(2/3)/(4×1+2/3)=5/7≈0.714, or about 71.4 on a 0–100 scale. The missing final s leaves one reference n-gram unrecovered.
chrF, chrF2 and chrF++
| Variant | Units | Interpretation |
|---|---|---|
| chrF | Character n-grams | The 2015 paper tested 6-gram F1 and F3; its results are specific to WMT12–14 data and conditions. |
| chrF2 | Character n-grams, β=2 | A 2016 study found β=2 and uniform n-gram weights promising in its tested WMT14/15 settings. Current SacreBLEU defaults to character order 6, β=2 and word order 0. |
| chrF++ | Character and word n-grams | The later variant adds word unigrams and bigrams. In SacreBLEU, word order 2 selects chrF++. |
Names do not guarantee identical settings across tools. Implementations may differ in smoothing and handling low n-gram orders. Record the tool and version, β, character and word orders, casing and whitespace choices alongside the score.
Run chrF2 with SacreBLEU
Put one detokenized reference sentence per line in ref.txt and the aligned candidate sentence on the same line in hyp.txt. Install SacreBLEU in the Python environment and specify the settings:
python -m pip install sacrebleu
sacrebleu ref.txt -i hyp.txt -m chrf --chrf-char-order 6 --chrf-word-order 0 --chrf-beta 2The command prints a corpus score and a configuration signature. Current SacreBLEU is case-sensitive by default and excludes whitespace from character n-grams. Use --chrf-lowercase to ignore case or --chrf-whitespace to include whitespace; set word order to 2 for chrF++. Keep settings fixed and retain the signature when comparing runs.
Uses and limits
chrF works without a tokenizer and can reflect partial matches across inflected forms. Character overlap is not semantic understanding: negation, agents, numbers or word order can change while many fragments still overlap; a valid paraphrase may score lower because its surface form differs. Use chrF to compare systems on the same data with fixed settings, and inspect important errors directly rather than treating it as a sole quality verdict.
For a token-overlap metric, see BLEU scoring; for a learned metric trained with human ratings, see COMET scoring and model choice.
References
[Popović (2015), chrF: character n-gram F-score for automatic MT evaluation](https://aclanthology.org/W15-3049/)
[Popović (2016), chrF deconstructed: beta parameters and n-gram weights](https://aclanthology.org/W16-2341/)
[SacreBLEU official repository: chrF usage and settings](https://github.com/mjpost/sacrebleu)
[Popović (2017), chrF++: words helping character n-grams](https://aclanthology.org/W17-4770/)