Automatic Speech Recognition
Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16
35 cards in “16.3 Encoder-decoder ASR” · whole deck
16.3 Encoder-decoder ASR
- What is AED / LAS?Attention-based encoder-decoder, also called Listen Attend and Spell after the papers first applying it to speech (Chorowski et al. 2014; Chan et al. 2016). The same encoder-decoder architecture used for MT.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What are the input and output of an ASR encoder-decoder?Input: a sequence of t acoustic feature vectors X = x₁…x_t, one per 10 ms frame (often log mel features, or a raw wavefile). Output: letters or tokens (BPE or SentencePiece), Y = (⟨SOS⟩, y₁, …, y_m, ⟨EOS⟩).
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Example English character output set for an encoder-decoder?{a…z, 0…9, ⟨space⟩, ⟨comma⟩, ⟨period⟩, ⟨apostrophe⟩, ⟨unk⟩}
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Order the stages of the encoder-decoder ASR pipeline (Fig. 16.5).Waveform → feature computation (e.g. 80-dim log mel per frame) → subsampling → shorter sequence X → encoder → decoder (via H) → output letters.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What is released and not released for OpenAI's Whisper?Released: models and inference code. Not released: training code and training data.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Whisper's transcription format tokens?Start of Transcript (SOT), a language tag, then an instruction token for whether to transcribe or translate (followed by timestamps/text). Whisper is multitask.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Besides transcription, what other tasks does Whisper do?Speech translation and voice activity detection (and language identification).
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Why is the encoder-decoder architecture well suited to speech?Input and output sequences differ starkly in length: long acoustic feature sequences map to much shorter letter/word sequences.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- How much longer is a 10 ms-frame speech signal than its text?About 5× (vs letters) to 19× (vs BPE tokens). Words average 5 letters or 1.3 BPE tokens and last about 250 ms (25 frames) in conversation: 25/5 = 5, 25/1.3 ≈ 19.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What is the low frame rate subsampling method?At time i, concatenate feature vector fᵢ with fᵢ₋₁ and fᵢ₋₂ into one vector 3× longer, then delete fᵢ₋₁ and fᵢ₋₂. E.g. a 40-dim vector every 10 ms becomes 120-dim every 30 ms; length n = t/3 (Pundak & Sainath, 2016).
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What is the most common way to shorten the input sequence?Convolutional layers with stride > 1.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Whisper front end: context window and input features?30-second audio context window; 128-channel log mel features per frame with 25 ms window and 10 ms stride, normalized to zero mean and range −1 to 1. That gives 3000 input frames.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Whisper's two convolutional layers?Each followed by GELU. Conv 1: 128 input channels → model dimensionality, stride 1 (length stays 3000). Conv 2: model dim → model dim, stride 2, halving length to 1500 — one audio token every 20 ms.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What is GELU?Gaussian Error Linear Unit: a smoother version of ReLU, used by Whisper and HuBERT.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What is added to Whisper's audio encodings before the transformer encoder?Sinusoidal position embeddings. (The decoder uses learned positional encodings.)
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- HuBERT's front end: how does it differ from Whisper's?Its conv layers completely replace spectrum computation: raw 16 kHz audio goes through seven 512-channel conv layers that learn to extract spectral info and shorten the sequence.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- HuBERT conv strides and kernel widths, and the total downsampling?Strides [5,2,2,2,2,2,2], kernel widths [10,3,3,3,3,2,2]. Total 320× shorter: from 16 kHz (one sample per 0.0625 ms) to a 20 ms frame rate.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What is applied after HuBERT's conv layers before the transformer?Positional encodings are added, then GELU and layer norm.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What are the two transformers in an encoder-decoder, and what's special about the decoder?An encoder (a basic transformer) mapping X to H^enc = h₁…h_n, and a decoder that adds one new layer: cross-attention.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What is the decoder, conceptually?A conditional language model that attends to the encoder representation and generates letters/tokens one by one, conditioning on the audio and previously generated text.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What is cross-attention?Multi-head attention where queries come from the previous decoder layer, but keys and values come from the encoder's final output H^enc.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Write the cross-attention Q, K, V computations.\(Q = H^{dec[\ell-1]}W^Q;\ K = H^{enc}W^K;\ V = H^{enc}W^V\)
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Write the cross-attention formula.\(\mathrm{CrossAttention}(Q,K,V) = \mathrm{softmax}\left(\frac{QK^\top}{\sqrt{d_k}}\right)V\)
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Which attention is masked in encoder-decoders: encoder or decoder?The decoder's self-attention is causal (left-to-right, masked). The encoder's attention can look at the entire source audio, so it is not masked.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- How is the output string probability decomposed?\(p(y_1,\ldots,y_n) = \prod_{i=1}^{n} p(y_i \mid y_1,\ldots,y_{i-1}, X)\)
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What is greedy decoding in an ASR encoder-decoder?Pick the most probable character at each step: \(\hat{y}_i = \mathrm{argmax}_{\text{char}\in\text{Alphabet}} P(\text{char}\mid y_1\ldots y_{i-1}, X)\). Whisper/OWSM can also use beam search.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Why add an external language model to an encoder-decoder?It already learns an implicit LM, but speech paired with transcripts has far less text than pure text corpora, so a very large LM can usually improve results at least slightly.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What is an n-best list and rescoring?The final beam of hypothesized sentences from beam search is an n-best list. Rescoring re-ranks each hypothesis by interpolating an LM score with the encoder-decoder score, weight λ tuned on held-out data.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Why add a length factor in ASR scoring?Most models prefer shorter sentences; normalizing by the number of characters |Y|_c counters this.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Listen, Attend and Spell scoring function?\(\mathrm{score}(Y|X) = \frac{1}{|Y|_c}\log P(Y|X) + \lambda \log P_{LM}(Y)\)
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- How are ASR encoder-decoders trained? Give the per-step loss.With cross-entropy loss backpropagated end to end: \(L_{CE} = -\log p(y_i \mid y_1,\ldots,y_{i-1}, X)\), summed over i = 1…m for the sentence.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- What is teacher forcing, and what variant is possible?Forcing the decoder history to be the gold yᵢ rather than the predicted ŷᵢ. Variant: mix, e.g. gold 90% of the time and the decoder's own output with probability 0.1.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- Whisper-v2 training data size?680,000 hours of speech, mostly English, including 118,000 hours from 96 other languages.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- How do web-scraping ASR systems keep data quality high?They remove ASR-generated transcripts from training data, e.g. by filtering text that is all uppercase or all lowercase.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
- OWSM training data?180k hours of mainly hand-transcribed public data: LibriSpeech, Multilingual LibriSpeech, Common Voice, FLEURS, Switchboard, AMI, and others.
- Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft, ch. 16, §16.3
Source
- Daniel Jurafsky and James H. Martin. Speech and Language Processing. 3rd edition (draft). https://web.stanford.edu/~jurafsky/slp3/