The interview problem

Practice prompt

Explain how CTC maps frame-level paths to a shorter label sequence and why greedy decoding need not maximize sequence probability.

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Assume monotonic alignment between frames and target labels, with a special blank symbol. Collapse adjacent repeated labels first, then remove blanks. Training sums probabilities of all valid paths for the target, typically using dynamic programming in log space. The most probable single path can differ from the most probable collapsed sequence because several paths may support the same output.

2. Trace the design or derivation

Compute frame probabilities
  → enumerate valid alignments
  → sum target probability
  → decode sequence

For a two-frame alphabet containing a and blank, several paths collapse to a: (a,a), (a,blank) and (blank,a). Their probabilities contribute together. This small enumeration explains why a sequence with no individually dominant path can still outrank another sequence after summing its supporting alignments.

3. Calculate the example

Path (a,a,blank,a) first becomes (a,blank,a), then (a,a). Path (a,a,a) becomes only (a). Thus a blank can separate two repeated target labels; removing blanks before collapsing would incorrectly erase that distinction.

4. Failure cases and trade-offs

Targets too long for available frames have no valid alignment; repeated labels can require additional frames. CTC's conditional structure may underrepresent linguistic dependencies, motivating a separate decoder or language model. Beam search costs more than greedy decoding but approximates sequence-level aggregation better.

5. Validation, follow-ups and self-review

Enumerate short paths and verify their collapsed outputs. Follow-up: how would a language model affect decoding without changing acoustic evidence? Self-review: get collapse order right and distinguish path probability from sequence probability.

Sources and related practice

Technical reference: www.cs.toronto.edu — CTC alignment paths, blanks and sequence probabilities.

Source publication/update: 2006. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with Distinguish sequence likelihood from the best hidden path; Align supplied subtitles to speech.

Continue your preparation

Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.