Lesson 16 / Unit 5: Recognition Evaluation
Word Errors
Calculate edit distance with an explicit tokenisation policy, and distinguish digit error rate from WER.
Error rate depends on what counts as a token. This lab treats each digit as one token. It therefore reports digit error rate: the minimum number of insertions, deletions and substitutions divided by the number of reference digits.
For natural-language WER, tokenize words under a declared policy instead. Do not label a character-level score as WER simply because the same edit-distance algorithm computes both.
Try Scoring
Leading zeros stay intact. This is digit edit rate, not word error rate.
The interactive example is constructed. It is separate from the measured training results and allows empty hypotheses so deletion behaviour remains visible.
Aggregate Correctly
errors = sum(edits(r['reference'], r['hypothesis']) for r in predictions)reference_digits = sum(len(r['reference']) for r in predictions)digit_error_rate = errors / reference_digitsThis weights every reference digit equally. Averaging individual sequence error rates would give a one-digit example the same weight as a three-digit example and can produce a different number. Keep the numerator and denominator in the report.
Our saved evaluation contains 69 edits across 256 reference digits: 26.953125%. The model can insert extra digits, so edit rates are not mathematically capped at 100%.
Empty References
A zero-length reference needs a separate policy because division by zero is undefined. The generated training task contains no empty targets. To evaluate silence hallucinations, add explicitly labelled silence clips and report their false emissions separately.
The normalisation case study shows another way scores can mislead. Pair this metric with Entity Accuracy, and retain raw strings in the Evaluation Harness.
We do this work for teams shipping voice agents: Self-Hosted Voice Agent .
Edit this lesson on GitHub ↗Discussion
Questions, corrections and war stories welcome. Sign in with GitHub to comment.