Language model rescoring: rerank ASR hypotheses
Language model rescoring reevaluates transcript candidates from a first-pass speech recognizer with a stronger language model. Learn how N-best lists and lattices differ, how scores are combined, and how to validate gains and failure cases.
Language model rescoring: rerank ASR hypotheses
Language model rescoring is a second-pass step that re-evaluates transcript candidates from an automatic speech recognition (ASR) decoder with a stronger language model (LM). It combines the new LM score with preserved acoustic evidence and other costs to rerank candidates. If the correct transcript is absent from the first-pass candidate space, rescoring alone cannot create it.
What does rescoring recompute?
First-pass decoding searches possible word sequences using an acoustic model, pronunciation lexicon, and LM. It can save the result as an N-best list of the top N sentences or as a lattice, a compact graph of alternative paths. An N-best list is simple to handle, but contains only a fixed set of candidates. A lattice can preserve a broader set of alternatives by sharing common paths, at the cost of more computation and memory.
Conceptually, a candidate’s new score can be viewed as the acoustic score + α × the new LM score + a length/insertion adjustment.
Implementations differ in score signs and scales. A first-pass graph score may combine the old LM with pronunciation and transition costs, so simply adding a new LM score can double-count components. Kaldi’s lattice-rescoring documentation describes removing the old LM cost before adding the new one. Check the decoder’s score definitions and tool procedure before applying rescoring.
Candidate formats and trade-offs
| Input | Strength | Caveat |
|---|---|---|
| N-best list | Relatively simple to implement and score with a neural LM. | Cannot recover transcripts absent from the list; a small or redundant list can omit useful alternatives. |
| Lattice | Retains a broader alternative space for applying a new LM. | May require more memory and latency; pruning and score management matter. |
| Context-augmented rescoring | Can use reliable context such as video descriptions or domain terms. | Stale or biased context may over-favor plausible but incorrect words. |
Research on LSTM lattice decoding reported more potential improvement than a 1,000-best list in its specific experiments. A Japanese lecture ASR study of neural error-corrective LMs used ASR hypotheses and confidence scores as context for reranking. These are results for particular models, datasets, and conditions, not general guarantees.
Apply and validate rescoring safely
**Set the constraint.** Decide whether processing is offline or real time and define latency and memory limits.
**Check candidate coverage.** On development data, measure oracle WER or how often the reference appears among candidates. If many references are missing, first improve search width, vocabulary, or acoustic modeling.
**Check score composition.** Confirm whether old LM scores must be removed before adding new scores and how acoustic, pronunciation, and transition costs are preserved.
**Tune on development data.** Choose the LM weight and insertion or length adjustment on a validation set; do not tune on the final test set.
**Compare under the same conditions.** Measure WER/CER, latency, and memory for the original 1-best output and rescored N-best list or lattice. Inspect names, numbers, domain terms, noise, and accent groups separately.
**Keep a fallback.** If the rescoring step times out or fails, use the first-pass result. If context causes bias, restrict the context source or lower its weight.
The benefit depends on candidate coverage, correct score separation and combination, and whether the extra cost fits deployment constraints. Overall WER can improve while names or some accents get worse, so examine subgroup errors and latency too.
References
[Kaldi, Lattices in Kaldi](https://kaldi-asr.org/doc/lattices.html)
[Sundermeyer et al., Lattice decoding and rescoring with long-Span neural network language models (Interspeech 2014)](https://www.isca-archive.org/interspeech_2014/sundermeyer14_interspeech.html)
[Tanaka et al., Neural Error Corrective Language Models for Automatic Speech Recognition (Interspeech 2018)](https://www.isca-archive.org/interspeech_2018/tanaka18_interspeech.html)