How to calculate and interpret word error rate (WER)
WER counts substitutions, deletions, and insertions after aligning an ASR transcript with a reference. See an example, calculate it in Python, and understand scores above 100% and multilingual normalization.
Word error rate (WER) measures how an automatic speech recognition (ASR) transcript differs from a reference at the word level. Align both sequences, then divide substitutions (S), deletions (D), and insertions (I) by the number of words in the reference (N). Lower is better, but WER is not simply the percentage of words recognized correctly. Hugging Face WER metric
Formula
WER = (S + D + I) / N × 100%
N = words in reference. S = substitutions, D = deletions, I = insertions. A substitution replaces a reference word, a deletion omits one, and an insertion adds a word absent from the reference.
Compute it in Python
Reference: “we turn left at next street” (6 words). Prediction: “we turned left next street now”. “turn”→“turned” is 1 substitution, “at” is 1 deletion, and “now” is 1 insertion. WER = (1+1+1)/6 × 100 = 50%.
Interpret scores and compare fairly
Use a human-checked reference and the model output as paired inputs. The library returns a ratio such as 0.5, which can be formatted as a percentage. For a dataset, pair each reference and prediction by utterance. Corpus WER divides total errors by total reference words, so it can differ from the plain average of per-sentence WER. An empty reference has a zero denominator. Metric usage
pip install --upgrade evaluate jiwerfrom evaluate import load
metric = load("wer")
score = metric.compute(
references=["we turn left at next street"],
predictions=["we turned left next street now"],
)
print(f"{score:.1%}") # 50.0%Formula — interpretation
Insertions are not bounded by reference length, so WER can exceed 100%; this is not a calculation bug. WER gives each word error equal cost and does not directly measure meaning loss. Inspect S/D/I counts too. Compare systems using the same audio, references, segmentation, tokenization, and normalization. Case, punctuation, number formats, contractions, and fillers can change results. Apply the same documented rules to both texts. Normalization must respect language conventions; research shows unsuitable normalization can distort multilingual ASR scores. For languages without natural whitespace word boundaries, specify the tokenizer or consider a character-level metric such as CER. NIST scoring · Normalization study · WER and CER