Skip to content
mlmentorship

Automatic speech recognition (ASR)

Connect audio timing to transcript alignment, compare CTC/RNN-T/attention context, and evaluate text errors separately from delivery delay.

Published · 8 min read ·Specialist ·Advanced
Reading depth

Summary

Audio frames arrive on a clock; transcript labels lack supplied frame alignment. Choose alignment, output history and available audio context separately.

Problem

One second contains 16,000 samples. Use uncentered 400-sample windows, a 160-sample hop and no padding. How many complete frames exist?

Separately, a reference says “turn left” while a hypothesis says “please turn right now”. Compute word error rate, then choose an architecture for captions that must appear before speech ends.

Calculate the Feature Clock

At this sample rate, the window is 25 milliseconds and the hop is ten. The exact full-window count is:

The last frame starts at sample 15,520 and ends before sample 15,920 under half-open indexing. The approximate 100-hops/second rate is not this clip’s frame count. Record padding, centering, normalization and encoder subsampling before interpreting output lengths.

Picture: What Advances When a Label Is Emitted?

Learning objective

RNN-T can emit another token without advancing the audio frame

One audio frame can emit more than one transducer tokenA transducer token edge advances output position without advancing time. A blank advances the audio frame; these are different transitions.Token edges move output; blank edgesmove timeHorizontal: emit token, keep audiotimeVertical: emit blank, advance audiotime
Derivation
Comparison of CTC, RNN-T, and attention alignment paths Three illustrative panels produce CAT. CTC uses six frames, one label-or-blank decision per frame and collapse without explicit emitted-label conditioning. The RNN-T schematic shows five blank time moves and three token moves with prefix conditioning. Offline attention uses prior tokens and weighted context over six available encoded frames. These paths are schematic, not outputs of a trained model on the worked waveform. CTC · ONE DECISION PER FRAME encoded frames 1 2 3 4 5 6 frame path blank C blank A T blank collapse → CAT no output history RNN-T · MOVE THROUGH TIME OR OUTPUT audio time t → output position u → blank C blank A T blank token step: u + 1 blank step: t + 1 prefix seen: C, then CA OFFLINE ATTENTION · CHOOSE CONTEXT PER TOKEN all encoded frames available C A T prior tokens + attended audio
compare frame, time/token and attention moves. CTC lacks explicit emitted-label conditioning; RNN-T and autoregressive attention use a prefix. Streaming still depends on available encoder context.
Check: Which decoder can advance its output position without advancing audio time?
Read it this way: A transducer token edge advances output position without advancing time. A blank advances the audio frame; these are different transitions.
Which edge changes audio time rather than output position?
FamilyAlignment and output historyStreaming condition
CTCFrame-label/blank paths summed; no explicit autoregressive label prefixStreaming-compatible features and encoder
RNN-TBlank advances time; token advances output with prediction-network prefixBounded-context encoder, state and decoding
Attention encoder-decoderPrefix plus attended audio; ordinary offline version sees encoded utteranceChanged context/chunk policy and measured delivery

CTC’s factorization does not prevent its encoder learning linguistic regularities. An output-history network is also not proof of complete language knowledge.

Evaluation

Align the worked text under a fixed normalization/reference policy:

ReferenceHypothesisEdit
-pleaseInsertion
turnturnMatch
leftrightSubstitution
-nowInsertion

Word error rate divides edits by reference words:

Here , , and , giving . Insertions allow WER above 100%. Specify empty-reference handling; ordinary WER has a zero denominator there. Use CER when character units fit, and report critical entities alongside aggregate errors.

Change 1: Captions Must Arrive During Speech

New task. Deliver stable text before the utterance ends.

Picture and change. Bound future context, preserve streaming state and measure token/finalization delay from named audio events.

Check. CTC or RNN-T loss alone cannot make a full-utterance encoder stream. Chunking an offline model changes quality and boundary behavior.

Use when. Live delivery is required.

Change 2: Rare Names Drive Failures

New task. Domain entities matter more than average WER.

Picture and change. Check acoustic/token coverage and contextual bias/fusion with held-out terms and false-insertion tests.

Check. A stronger LM can prefer plausible words unsupported by audio.

Use when. Domain terms determine usefulness.

Failure: Fluent Text Is Called Acoustically Verified

A better language score can mask wrong words. Report audio grounding, text error, stability, delay and resources separately.

Transfer Check

Can rescoring a fixed n-best list recover a transcript absent from that list?

Reasoned Answer

No. Candidate generation or the search must change; rescoring only reorders existing candidates.

The pipeline

waveform -> features -> encoder -> decoder/LM -> transcript

1. Audio features

Log-mel features apply short-time Fourier analysis, mel filtering and logarithms. MFCCs add a discrete cosine transform to log-mel energies. Learned waveform front ends are another option; specify sample rate, feature shape and time stride rather than assume universality. SpecAugment masks time/frequency, optionally warps time; noise mixing and speed perturbation require task-valid labels. Self-supervised wav2vec/HuBERT-style pretraining offers another data path, not guaranteed gains.

2. Acoustic / sequence model

Transformer/Conformer encoders can have different future-context policies. LAS/Whisper exemplify attention-based decoding; inspect the particular model’s context and deployment wrapper. Link CTC and RNN-T for objective derivations. Declare vocabulary, blank/EOS conventions and true post-subsampling lengths.

3. Language model fusion

RouteWhat changes
Shallow fusionAdd during beam search under a specified score convention
Deep/cold fusionIntegrate LM hidden state into decoding
RescoringReorder an existing n-best list/lattice; missing candidates stay missing

External LMs are optional; compare entity gains, false insertions, costs and acoustic support.

Historical Decomposition

Hybrid systems combine lexicon/pronunciation, HMM state transitions, GMM/DNN acoustic estimates and language scores, often using alignment training. End-to-end objectives reduce some component boundaries, not every lexicon/LM or decoder choice. Neither family wins every data, resource, customization and latency setting.

Delivery Checklist

  1. State waveform, feature and subsampling units.
  2. Trace alignment, label history and audio context.
  3. Specify fusion/search and missing-candidate limits.
  4. Fix reference normalization, slices, WER/CER and entity checks.
  5. Measure onset/word-end/utterance-end delay, revision stability, resources and fallback.

Common confusions

Loss factorization, encoder context, linguistic evidence and runtime delivery are distinct contracts.


Related: Connectionist Temporal Classification (CTC), RNN-Transducer (RNN-T), Transformer architecture, Tokenization.