Beyond CTC: transducers, attention decoders and the Conformer
Three answers to CTC's limits: the RNN transducer adds a network over the labels so far and can stream, Listen, Attend and Spell writes text with an attention decoder, and the Conformer encoder mixes attention with convolution.
What runs in CodeSplash
- AUD002Recurrent neural network transducer (RNN-T) Explained here
- AUD003Listen, Attend and Spell (LAS) Explained here
- AUD005Conformer Explained here
You will be able to
- Describe the RNN transducer's encoder, prediction network, joint network and lattice
- Explain how an attention encoder–decoder writes a transcript, and what teacher forcing is
- Describe a Conformer block and why it pairs attention with convolution
- Choose between CTC, a transducer and an attention decoder for streaming and long audio
The transducer
ReadCTC can't see its own earlier outputs. The RNN transducerRNN transducerA recognizer that joins an audio encoder with a network over the labels emitted so far. It can stream and needs no frame labels. (RNN-T) adds a prediction network that reads the labels emitted so far, like a small language model. A joint network combines its state with the audio encoder's state and gives a distribution over the labels plus a blank.
Decoding walks a lattice of (frame, label) positions: emitting a label moves one step in the transcript, emitting blank moves to the next frame. As with CTC, training sums over every walk that produces the transcript:
Reference · AUD002 · Explained hereRecurrent neural network transducer (RNN-T)A supervised sequence transducer combining an acoustic encoder, prediction network over prior labels, and joint network.Two walks through a lattice
ReadThe reference's example keeps only two legal walks through a tiny lattice, with step probabilities multiplied along each walk. The loss over those two walks is 1.938. A full transducer sums every walk with a dynamic program, much like the CTC table, now over frames × labels.
Because the encoder can be causal and each step needs only the past, a transducer can stream: words appear while the person is still talking. That is why phone keyboards and live captions use transducers. The cost is a three-dimensional joint output, frames × labels × vocabulary, which makes training memory-hungry.
Listen, attend and spell
ReadAn attention encoder–decoderAttention encoder–decoderA decoder writes output tokens one by one while attending to the encoded input, as in LAS, Whisper and translation models. drops alignment paths entirely. Listen, Attend and Spell (LAS) has a listener, recurrent layers that halve the frame rate at each level, and a speller that writes one character at a time. Before each character, attention weights over the encoder states form a context vector:
In the reference's example, weights over three encoder states give the context 0.5, 0.8.
Reference · AUD003 · Explained hereListen, Attend and Spell (LAS)A supervised attention-based encoder–decoder that directly generates a transcript. The pyramidal listener reduces acoustic sequence length; the speller predicts symbols while attending to encoder states.Attention weights, masks and heads on a handful of tokens.
DExplorable · Attention: scores, masks and heads
Where does each word look, and what do the scaling and the masks change?
With this mask, how much of each word's attention lands on <pad>?
How many of the positions are <pad>.
Width d
Heads
Mask
Without masks or positions the output rows shuffle the same way.
- Little weight
- Most weight
- Masked: score set to −∞
Commit your prediction above to see the result
Make your prediction to see the result.
Teacher forcing and its price
ReadLAS trains with teacher forcingTeacher forcingTraining a decoder on the correct previous tokens instead of its own predictions; at use time it must feed on its own outputs.: the speller sees the true previous characters. At inference it sees its own guesses, so one early mistake can derail the rest. And because attention looks at the whole utterance, the model must hear all of it first: no streaming.
Attention also has no built-in left-to-right constraint. On long or silent stretches an attention decoder can repeat itself or write fluent text that wasn't said. LAS's descendants, Whisper among them, inherit both the strengths and this risk.
The Conformer block
ReadSpeech has short patterns (a burst, a formant shift) and long ones (who is speaking, what was said earlier). The ConformerConformerA speech encoder block that pairs self-attention for long context with a convolution for local detail, between two half feed-forwards. block handles both: a half-step feed-forward layer, self-attentionSelf-attentionEach token builds its next value as a weighted mix of all tokens, with weights from how well their keys match its query. for long context, a depthwise convolution for local detail, another half-step feed-forward, then normalization. The half steps are the "macaron" arrangement.
In the reference's example, one half-step update scales each state entry by 1.1. A Conformer is an encoder only: it can be trained with CTC, a transducer or an attention decoder. The architecture doesn't decide the training objective.
Reference · AUD005 · Explained hereConformerA convolution-augmented Transformer encoder for speech. Attention models broad context while depthwise convolution captures local acoustic patterns.Which one when?
PredictPredict first
You need live captions that appear while a person speaks, and the model should use the words it has already written. Which design fits?
Reveal
A transducer with a causal encoder: it emits as audio arrives and its prediction network reads the labels so far. CTC with a bidirectional encoder must wait for the whole utterance and can't read its own outputs; an attention decoder must hear everything before writing.
Where it stands in CodeSplash
Read| Entry | In CodeSplash |
|---|---|
| RNN transducer (AUD002) | Explained here |
| Listen, Attend and Spell (AUD003) | Explained here; its descendant Whisper runs as Speech to text (Whisper) |
| Conformer (AUD005) | Explained here |
The reference programs are component checks, verified in Python and R: two lattice walks, one attention context, one half-step update.
Check: transducers and attention
CheckpointCheck yourself
What does the RNN transducer's prediction network read?
Show the answer
Answer: b
It plays the part of a small language model over earlier outputs, which removes CTC's frame-independence assumption.
Check yourself
What makes a transducer suitable for streaming recognition?
Show the answer
Answer: a
Emitting blank advances time, emitting a label advances the transcript, and nothing requires future audio when the encoder is causal.
Check yourself
LAS trains with teacher forcing. What goes wrong more easily at inference?
Show the answer
Answer: b
Training always saw the true history; inference sees its own. That mismatch (exposure bias) lets errors snowball.
Check yourself
In LAS, what is the context vector the speller uses for its next character?
Show the answer
Answer: b
: attention picks where in the audio to listen for the next character.
Check yourself
Why does a Conformer block put a convolution next to self-attention?
Show the answer
Answer: b
Speech carries both kinds of structure. The pairing, between two half-step feed-forward layers, is the Conformer's idea.
Check yourself
A paper says it used "a Conformer". What do you still need to know before comparing its results?
Show the answer
Answer: a
The Conformer is an encoder. The same block can sit under CTC, a transducer or an attention decoder, and those behave differently.
Check yourself
Which statement about the three recognizer designs is right?
Show the answer
Answer: c
Alignment-summing objectives keep output order tied to time. Attention decoders gain flexibility and lose that guarantee.
Recap
Recap- The RNN transducer adds a prediction network over earlier labels and can stream with a causal encoder.
- LAS writes text with attention; teacher forcing trains it, and it must hear the whole utterance.
- A Conformer encoder pairs attention with convolution; any objective can sit on top.
- All three are explained here; CodeSplash transcribes with Whisper.
Concepts in this lesson