Attention encoder-decoder ASR: learning alignment between audio and tokens
An attention-based encoder-decoder represents acoustic frames, then generates tokens using both the encoded audio and previous outputs. Using Listen, Attend and Spell (LAS), this guide explains learned alignment, beam search, language-model rescoring, and why long utterances need separate evaluation.
Attention encoder-decoder ASR: learning alignment between audio and tokens
Attention-based encoder-decoder speech recognition turns acoustic input into hidden representations, then generates text tokens one by one using those representations and prior outputs. Attention can learn how output tokens align with input frames without frame-level alignments specified in advance. Learned alignment, however, does not guarantee stable behavior for every utterance length or condition.
What the encoder, attention, and decoder do
Listen, Attend and Spell (LAS) is a representative example:
**Encoder (listener):** maps spectral feature frames to higher-level representations. The original paper used a pyramidal recurrent encoder to reduce time resolution for long input.
**Attention:** at each output step, weights relevant encoder positions and forms a context vector. The decoder can draw on the encoded sequence instead of relying on one fixed summary.
**Decoder (speller):** predicts the next character conditioned on previous characters and the attention context. Character outputs can spell words absent from a fixed pronunciation lexicon, but behavior still depends on tokenization and training data.
This differs from traditional systems that separate components with HMM states and a pronunciation lexicon. It also differs from CTC, which makes a simplifying conditional-independence assumption about output labels.
Training and decoding
The probability of a reference token sequence (y) is commonly factorized as (P(y|x)=prod_i P(y_i|x,y_{<i})). During training, the decoder often receives the correct previous token. At inference it receives its own previous output, so an early mistake can affect later predictions. Beam search keeps multiple likely partial strings and compares their scores. Some systems rescore candidates with an external language model or combine its score during decoding. Poor score balance can make text frequency outweigh acoustic evidence.
Benefits and limits to check
Attention models learn an alignment without requiring frame labels and let the decoder use linguistic context from prior tokens. But attending over long audio and generating tokens autoregressively can add computation and latency. A bidirectional encoder may need future audio, so it is not automatically suitable for online recognition. Chunking or monotonic-attention designs trade latency against accuracy.
Evaluate long utterances separately. Early attention research reported that a model could generalize poorly to utterances much longer than its training examples and proposed location-aware attention. The LAS paper also analyzed errors by utterance length. These are findings about particular models and data, not fixed limits for all attention-based ASR.
When comparing systems, break down WER/CER by utterance length, noise, speaker, and language. Measure latency, memory, and beam size under deployment conditions, and report results with and without an external language model. A plausible attention plot or lower training loss alone does not establish transcription quality.
References
[Chan et al., Listen, Attend and Spell (2015)](https://arxiv.org/abs/1508.01211)
[Google Research, Listen, Attend and Spell](https://research.google/pubs/listen-attend-and-spell/)
[Chorowski et al., Attention-Based Models for Speech Recognition (NeurIPS 2015)](https://proceedings.neurips.cc/paper/2015/hash/1068c6e4c8051cfd4e9ea8072e3189e2-Abstract.html)