Speech and audio
CTC and Monotonic Alignment
Explain CTC blanks, collapse rules, conditional independence, forward–backward training, decoding, and limitations.
By the end you can
- Define ctc and monotonic alignment as an operational problem with explicit inputs, outputs, and boundaries
- Distinguish frame classification, ctc, and autoregressive decoder without treating them as interchangeable
- Trace the workflow from encode the acoustic sequence through marginalize and decode
- Evaluate ctc and monotonic alignment using sequence error and alignment diagnostics and evidence from difficult deployment slices
Example
A timestamp was inferred from a training objective that never promised exact boundaries
A transcript can be exactly right and its timestamps quietly wrong. That gap has been published, measured and given units.
The 2024 paper that measured it separates the behavior from the defect in two sentences: “Connectionist temporal classification (CTC) models are known to have peaky output distributions. Such behavior is not a problem for automatic speech recognition (ASR), but it can cause inaccurate forced alignments (FA), especially at finer granularity, e.g., phoneme level.”
Read that twice. Only the second sentence describes something broken. The transcripts are right. The model is not sick. What is wrong is a reading — frame-by-frame posteriors taken as the moments labels begin and end. The size of that wrongness is a number nobody in a transcription pipeline is collecting.
Huang and colleagues collected it. Their fix was label priors, and it “outperforms the standard CTC model and a heuristics-based approach for obtaining CTC's token offset timestamps by 12-40% in phoneme and word boundary errors (PBE and WBE) measured on the Buckeye and TIMIT data.”
So between 12% and 40% of the boundary error in a standard CTC aligner was removable. Two named corpora, one target: peakiness. Every one of those systems would have reported the same sequence error before and after. And the story does not end in triumph. With the peakiness reduced, the method still falls behind the Montreal Forced Aligner on TIMIT.
- One setting is not what is at stake. The whole apparatus is: blanks, the collapse rule, the conditional independence between frames, forward–backward training, decoding. Each of those puts a limit on what a CTC model can honestly be asked.
- The failure is a single reading, repeated everywhere a product touches time: posterior spikes taken as exact acoustic boundaries. The label-prior paper names the result as inaccurate forced alignments “especially at finer granularity, e.g., phoneme level.”
- The evidence normally in hand is sequence error and alignment diagnostics. Both are real measurements. Both are silent on phoneme and word boundary error, the quantities in which the 12–40% gap is expressed.
- The cheapest response is to push repeated and non-repeated labels through the model and watch what the collapse rule does with each. That is where the behavior of the peaks stops being mysterious.
Analogy
Reading a ticker with pauses and repeated displays
Start with what a peak is a peak of. A ticker sign spelling out a word can hold the same letter on screen for several frames. It also has to drop a blank separator between two identical letters in a row, or the repeat reads as one letter. So a great many different display histories spell the same word once you read them off.
The sign shows one history at a time. CTC holds all of them at once, scores each in context, and sums exponentially many paths during training. It never has to pick one. Not picking is the whole trick.
CTC learns sequence order without requiring one fixed frame alignment.
Sum over every alignment that collapses correctly
Not picking is what the objective is built to do. Connectionist Temporal Classification defines a distribution over frame-level paths containing labels and blanks. It then sums the probabilities of every path that collapses to the target sequence.
The collapse rule is not folklore. The 2006 paper states it as a one-line operation: “We do this by simply removing all blanks and repeated labels from the paths (e.g. B(a − ab−) = B(−aa − −abb) = aab)”. Nobody has to mark where each label starts. Monotonic order survives because the paths themselves only run forward, and the sum handles the rest. Repeated labels are the one place the rule is strict. Two identical labels in a row need a blank between them, or the collapse merges them into one. The same example shows exactly that.
Two consequences follow, and both come due later in this lesson. The first is written into the definition itself. Graves and his co-authors state it plainly: “Implicit in (2) is the assumption that the network outputs at different times are conditionally independent, given the internal state of the network.” Each frame is scored as though the others were not there.
The second is that the alignments are latent explanations under the model, not guaranteed phonetic boundaries. The paper's own figure caption says what the output looks like: “The CTC network predicts only the sequence of phonemes (typically as a series of spikes, separated by ‘blanks’, or null predictions), while the framewise network attempts to align them with the manual segmentation (vertical lines).” Spikes is the authors' own word. And note which of the two networks was ever asked about the manual segmentation. Model size settles little here either. A bigger encoder buys better sequences, not more honest boundaries.
Drop the hand alignment and you inherit a model whose own paper calls its outputs at different times “conditionally independent, given the internal state of the network” — and downstream timing claims carry that assumption whether or not anyone states it.
Case
CTC in 2006: sixty-two output units and a blank
CTC was introduced to train a recurrent network on unsegmented data. That was the point: nobody had to cut the audio up first. Graves and Fernández published it with two co-authors in 2006. The network they ran on TIMIT had an input layer of size 26 and, in the words of the paper, “the softmax output layer size 62 (61 phoneme categories plus the blank label)”. The whole thing carried 114,662 weights.
That count is the argument in miniature. Blank is not a leftover, a mask, or a threshold laid over the other categories. It is the sixty-second category. It competes in the same softmax layer, for the same frame, against the 61 phonemes. A frame given to blank is a frame the model chose not to give to a phone. It chose on the arithmetic of path cost, not on anything happening in the mouth.
The numbers made the case. Table 1 reports six label error rates on TIMIT: context-independent HMM 38.85%, context-dependent HMM 35.21%, BLSTM/HMM 33.84±0.06%, weighted-error BLSTM/HMM 31.57±0.06%, CTC (best path) 31.47±0.21% and CTC (prefix search) 30.51±0.19%. Prefix-search CTC beat the context-dependent HMM by 4.70 points. The hand alignment was gone and an entire pipeline stage with it, at a comparable size: the hybrid network had 114,461 weights plus 183 HMM parameters. All differences were significant (p<0.01) except the one between weighted-error BLSTM/HMM and CTC (best path).
The objective did not stay a 2006 result. The Open ASR Leaderboard, first posted in October 2025 and revised since, compares 86 open-source and proprietary ASR systems across 12 datasets under standardized WER and inverse real-time factor (RTFx). Its abstract states the trade-off directly: “We observe that Conformer-based encoders paired with transformer-based decoders achieve the best average WER, while connectionist temporal classification (CTC) and token-and-duration transducer (TDT) decoders offer superior RTFx, making them better suited for long-form and batched processing.” The first version benchmarked a smaller field — 60+ systems across 11 datasets — and put the same split another way: “Conformer encoders paired with LLM decoders achieve the best average WER but are slower, while CTC and TDT decoders deliver much better RTFx”. Best accuracy has moved elsewhere. Best throughput has not. Which is why the objective is still everywhere, and why one misreading of its peaks travels so far.
Example
Blank is a symbol, not silence
That sixty-second unit is where most of the confusion starts. It carries an ordinary English name and an unordinary meaning. Blank is a token in CTC, not a period of silence. A model can spend blank frames on loud audio and label frames on something nearly inaudible. Nothing in the 2006 definition ties it to the acoustics. It is one of the 62 categories in the softmax layer, and the collapse rule removes it along with repeated labels.
A path is not a route through a graph either. It is one frame-level sequence, one of the ticker's display histories. The collapse function and forward–backward are what connect the two.
Get either word wrong and a diagnostic changes what it has to prove — and changes who is entitled to act on the result.
- A blank token is a CTC symbol that appears inside paths and is removed during collapse. It never reaches the output. In the 2006 network it was one of 62 competing softmax units, not a threshold over the other 61.
- A path is a frame-level sequence of labels and blanks — one complete account of what was said at every single frame.
- The collapse function is the rule the paper states as “removing all blanks and repeated labels from the paths”, turning a path into an output sequence.
- Forward–backward is the dynamic programming that sums probabilities over all the valid alignments at once. That is what makes the training objective tractable at all.
Visual
Where the blanks get removed
Collapsing is the last thing that ever happens to a blank, and by then every interesting decision has already been made. There are three stages: encode the acoustic sequence, predict labels and blank at every frame, then marginalize and decode. Blanks exist only in the middle stage. They are produced there and cleared at the end. Nothing further down the chain sees one.
That middle stage is also the last point at which the first stage can be questioned. What the encoder kept, and what it quietly dropped — a frame rate too coarse for a short sound, say — arrives at marginalization as settled fact. The sum is faithful to the paths it was handed. It has no opinion about the ones it never received.
1. Encode the acoustic sequence
Transform frames into contextual representations.
2. Predict labels and blank
Produce a distribution at each encoded time step.
3. Collapse paths
Remove repeated adjacent labels and blanks to obtain a transcript.
4. Marginalize and decode
Train by summing valid paths; search prefixes or combine external language evidence at inference.
Decoding treats the encoded acoustic sequence as given, so an encoder that lost something never hears about it from the marginalization.
Example
One objective, four jobs
The 2006 network did a single job: phoneme label sequences on unsegmented speech, 61 categories and a blank. The same objective now does at least four. They do not all want the same evidence.
Forced alignment is the one that touches the label-prior result head-on. It can use posterior structure, but it only survives doing so if the calibration is done separately, as its own piece of work. That is exactly what label priors are for. Keyword spotting searches an open vocabulary through CTC prefixes. Streaming transcription and low-resource ASR take the objective somewhere else again.
The low-resource case has a named shape. The wav2vec 2.0 paper describes its recipe: “Pre-trained models are fine-tuned for speech recognition by adding a randomly initialized linear projection on top of the context network into C classes representing the vocabulary of the task... Models are optimized by minimizing a CTC loss”. For Librispeech that vocabulary is 29 character tokens plus a word-boundary token. Thirty units and a CTC loss on top of a pretrained encoder.
What it buys is in the abstract: “Using just ten minutes of labeled data and pre-training on 53k hours of unlabeled data still achieves 4.8/8.2 WER.” With all the labels, the same system reaches 1.8/3.3 WER on Librispeech test-clean/test-other. None of those four jobs is discharged by the sequence error and alignment diagnostics that were supposed to discharge the case above.
- Streaming transcription is possible because CTC supports monotonic prefix processing. The prefix only ever grows forward, so output can be committed while audio is still arriving, and the Open ASR Leaderboard finds CTC decoders “better suited for long-form and batched processing.”
- Forced alignment can use posterior structure to place labels in time, on the condition that the calibration is carried out separately. The 12–40% PBE/WBE improvement from label priors is what that separate work is worth.
- Keyword spotting can search an open vocabulary through CTC prefixes, rather than being confined to a fixed word list.
- Low-resource ASR puts a simple output head on a self-supervised encoder and fine-tunes it. In wav2vec 2.0 that head is a randomly initialized linear projection over 29 character tokens plus a word-boundary token, trained with a CTC loss, reaching 4.8/8.2 WER from ten minutes of labels.
Steps
Enumerate a tiny CTC example
Sixty-one phoneme categories cannot be enumerated by hand. Two labels over four frames can, and that is the exercise. Write out every path of labels and blanks. Collapse each one with the paper's own rule — remove blanks and repeated labels — and see which survive to the target. Use the 2006 worked example as your check: B(a − ab−) and B(−aa − −abb) both give aab. A tiny CTC example enumerated by hand is the fastest way to see where the peaks actually fall, and why they fall there rather than on a boundary.
Then write down three things. What encoding the acoustic sequence assumes. One counterexample to that assumption. What marginalizing and decoding then does with the counterexample once it is on the table.
1. Choose a two-symbol target
Use repeated and non-repeated labels to expose collapse behavior.
2. List valid paths
Include blanks and repeated frames that map to the target.
3. Compare path probabilities
Show why training sums rather than selects one alignment.
4. Test a failure
Reduce the input length until no valid alignment remains.
Shrinking the input by hand until no valid alignment survives makes the length constraint concrete, and an empty output on a short clip stops looking like a bug.
Example
Check the timestamps against an independent aligner
Do the exercise and the timing problem stops being arguable. It becomes measurable. The instrument is an independent aligner, and there is a published one with error bars.
The Montreal Forced Aligner, published in 2017, reports absolute differences from hand annotation on Buckeye. Word boundaries: 24.1 ms mean, 15.8 ms median. Phone boundaries: 17.0 ms mean, 11.2 ms median. The comparisons in the same table are FAVE at 24.7/16.6 and 19.3/12.0, and PLA-LS at 30.5/15.6 and 24.0/13.9.
Those averages are the trap, and the authors say so themselves: “While phone and word-level alignment is comparable to human annotators on average, the force-aligned boundaries do contain more medium-to-large alignment errors (>25 msec).” The distribution behind the 24.1 ms is right-skewed. 68% of word-boundary differences fall under 25 ms and about 90% under 50 ms, while 2–5% of tokens differ by at least 100 ms. A tenth of a second is visible in a caption.
So an evaluation reports the tail, not the mean. And it reports it next to sequence error, not instead of it. The two will sometimes conflict. The conflict is the point.
The portfolio also has to name where the reading of the peaks stops holding, and say what the decoder does when it arrives there: abstain, or fall back.
- Core task evidence is sequence error and alignment diagnostics — what the model was trained to get right, reported as such and no further. The label-prior authors are explicit that peakiness is “not a problem for automatic speech recognition (ASR)”.
- System behavior means the awkward cases: rare repeated tokens, and what happens over long-form audio.
- The robustness slice is streaming latency and prefix stability — whether a prefix that was committed stays committed.
- Lifecycle evidence is timestamp error against independently aligned references, reported in phoneme and word boundary error and with the tail shown: the 2–5% of tokens at or beyond 100 ms, not the 24.1 ms mean that hides them.
Report sequence error and alignment diagnostics together with phoneme and word boundary error against an independent aligner, tail included.
Key idea
The spike is not the boundary
Four readings of a CTC model all look like reasonable readings. They are listed here in order of damage.
The first is the timestamp mistake, and it now has a proof behind it. In 2021 Zeyer and two co-authors asked why CTC results in peaky behavior, and answered with a proof. They give formal definitions of peaky alignment, Viterbi alignment and peaky behavior. Then, in the abstract, “we prove that a feed-forward neural network trained with CTC from uniform initialization converges towards peaky behavior with a 100% error rate” — on an example that should be trivial to learn. Peakiness is therefore a property of the training criterion, not of the model's capacity or of the audio. No amount of extra data removes it. The same authors name the exact circumstance in which it becomes a defect: “Peaky behavior can be problematic in certain cases, e.g. when an application requires to not use the blank label, e.g. to get meaningful time accurate alignments of phonemes to a transcription.” A spike marks where the path was cheapest to place, not where a phone began or ended.
The second is ignoring CTC sequence-length constraints, which the hand enumeration exposes in about a minute. The third is letting an external language model overwhelm rare acoustic evidence. That is not bad luck. It follows directly from the conditional independence quoted earlier: frame predictions that do not condition on one another put up very little resistance to a model that does. The fourth is assuming blank means physical silence — the sixty-second output unit of the 2006 softmax layer mistaken for a gap in the audio. The same authors note, in the other direction, that CTC only works well together with the blank label at all.
Each of the four has a home earlier in this lesson. Not one of them appears in sequence error.
Posterior spikes mark where the model committed to a label, not where the sound started or stopped — peaky behavior is a proven consequence of the criterion, and any timestamp product built on it carries an error no one measured.
Key takeaways
- CTC scores frame-level paths of labels and blanks and sums every path that collapses to the target. The 2006 rule is to remove “all blanks and repeated labels from the paths”. The alignment it appears to hand you was never the quantity being optimized.
- Frame predictions are assumed “conditionally independent, given the internal state of the network”. That assumption is what lets an external language model walk over thin acoustic evidence.
- Blank is the sixty-second unit of a 62-way softmax — 61 phoneme categories plus the blank label in the 2006 TIMIT network. It competes for each frame against the phonemes rather than marking silence in the audio.
- Frame classification, CTC and an autoregressive decoder answer related but different questions. CTC (prefix search) reached 30.51% label error on TIMIT against 35.21% for a context-dependent HMM — sequence accuracy bought without buying boundaries.
- Peaky behavior is a proven property of the criterion: a 2021 proof shows CTC converging to peaky behavior with a 100% error rate from uniform initialization. Label priors then recovered 12–40% of phoneme and word boundary error. Sequence error registered nothing.
- Put sequence error next to boundary error against an independent aligner and read the tail. The Montreal Forced Aligner averages 24.1 ms on Buckeye word boundaries while 2–5% of tokens differ by at least 100 ms.