Learning speech before reading transcripts
wav2vec 2.0 is a speech encoder that learns from raw audio alone and is then taught to transcribe with a little labelled speech. Baevski et al. pretrain the network to identify masked stretches of its own input, then add one linear layer and fine-tune it with connectionist temporal classification (CTC), a loss that needs only the text, not where each letter is said. With an hour of labels and 53,000 hours of unlabelled audio their large model already beat the previous best on LibriSpeech's 100-hour subset, the paper reports.
The page records facebook/wav2vec2-base-960h, the base model (94.4 M parameters) pretrained on LibriSpeech's 960 hours without transcripts and fine-tuned on the same hours with them, on LibriSpeech dev-clean utterance 1272-128104-0010 (5.60 s): “near the fire and the ornaments fred brought home from india on the mantel board”. The pretrained · quantizer view switches to facebook/wav2vec2-base, the same network before fine-tuning, whose convolutions fine-tuning left untouched: their weights are identical.
Seven convolutions: 20 ms frames
The model reads the waveform itself, 16,000 samples a second, scaled to mean 0 and variance 1. Seven 1-D convolutions with 512 channels and GELU activations (the first normalised per channel over the clip) shrink it: kernel 10 and stride 5, then kernel 3 and stride 2 four times, then kernel 2 and stride 2 twice. Each keeps
positions, so the strides multiply to samples between frames and the kernels give each frame a receptive field of 400 samples: 25 ms of audio every 20 ms. The Audio → 20 ms frames column draws the 89,600 samples becoming 17,919 → 8,959 → 4,479 → 2,239 → 1,119 → 559 → 279 positions; the outlined spans are what the selected frame reads on every row. The clip ends as 279 frames of 512 numbers, the first row of Frame t.
Context from a transformer
A layer norm and a linear map take each frame to 768 dimensions. There is no table of positions: a grouped convolution over 128 neighbouring frames (2.56 s, 16 groups) adds a sense of place, followed by 12 post-norm transformer blocks with 12 heads each. Every frame attends to every other frame of the clip, before and after it, so the output at a frame (the context row) can depend on the whole utterance.
The Transformer context head card shows one head's attention with rows and columns grouped into 0.4 s bins: a row is the mean over the bin's frames, a column sums the bin's keys. The grid under it gives every head's mean distance between a frame and what it attends to, averaged over frames: on this clip it ranges from 191 ms to 1988 ms, and the click selects that layer and head.
Quantized targets and the contrastive task
Pretraining needs targets that the network cannot simply copy. A product quantizer maps each frame's convolutional features to one entry in each of 2 codebooks of 320 learned vectors; the two entries, concatenated and projected, are that frame's target (the Quantized targets stack shows both entries per frame). During training the choice is a Gumbel softmax, so gradients flow; at evaluation it is the argmax. Then about half the frames are replaced by one learned vector before the transformer: spans of 10 frames starting at a random 6.5 % of positions. For a masked frame the transformer's output must pick out its true target among distractors taken from other masked frames of the same clip:
A diversity term pushes the codebooks to be used evenly. On this clip, with the seeded mask, 156 of 279 frames are masked and the pretrained model ranks the true target first for 73 of them; the Contrastive task panel shows one frame's candidates.
CTC: one symbol per frame
Fine-tuning adds a linear head that gives every frame a distribution over 32 symbols: 26 letters, the apostrophe, the word boundary |, a blank and three specials the transcripts never use. A transcript is far shorter than the frame sequence, so CTC sums over every alignment , one symbol per frame, that collapses to the text when repeats are merged and blanks dropped, a map written :
A forward recursion over the frames computes the sum exactly. The blank lets the model say nothing between letters and separates a real double letter (L, blank, L) from one long L. The CTC output grid shows the 279 × 32 probabilities: 160 frames put the blank first, and the letters appear as short spikes. Blank collapse follows the best path through both steps of .
Greedy and beam decoding
Greedy decoding takes the likeliest symbol at every frame and collapses that one path. Here it writes “near the fire and the ornaments fred brought home from india on the mantelboard”. But the likeliest path is not the likeliest text: a text's probability adds up all its paths. A prefix beam search keeps the 8 likeliest prefixes frame by frame, each with two sums, over paths ending in a blank and paths ending in its last letter, so that an extra letter is added only after a blank or a different letter. The strip at the bottom steps through it; it writes “near the fire and the ornaments fred brought home from india on the mantel board”, the reference text, which has log-probability −0.97 against −1.41 for greedy's, summed over every alignment; greedy's single best path has −7.62. Between the L at frame 231 and the B at frame 235, the blank is the likeliest symbol at every frame, so the best path has no word boundary; but | has p = 0.42 and 0.33 at frames 233 and 234, and the paths that pass through it add up to more than the ones that do not. From frame 235 on, the beam's best prefix ends in “mantel b”.
No language model is used here; in practice one usually scores the beam's words too, with an n-gram or neural language model.
Where it came from
Graves et al. introduced CTC in 2006 for unsegmented sequence labelling with recurrent networks; Hannun et al. made the prefix beam search with a language model the decoder of end-to-end recognisers. wav2vec (2019) first pretrained a convolutional network on raw audio with a contrastive loss over future frames, vq-wav2vec added a quantizer to make discrete units, and wav2vec 2.0 masked the input and learned both together in one model. HuBERT then replaced the online quantizer with offline clustering targets. The Whisper tab takes the other route: no self-supervised pretraining, but an encoder–decoder trained on 680,000 hours of weakly labelled audio that writes text token by token.
Papers
- wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations The model this tab records: convolutional features, masked transformer context, product-quantized targets and the contrastive loss, then CTC fine-tuning.
- Connectionist temporal classification Labelling unsegmented sequence data with recurrent networks. CTC: the blank, the collapse map, the sum over alignments and its forward recursion, the loss and output layer of the fine-tuned model.
- First-Pass Large Vocabulary Continuous Speech Recognition using Bi-Directional Recurrent DNNs The CTC prefix beam search with separate blank and non-blank scores, which the strip steps through (here without a language model).
- vq-wav2vec: Self-Supervised Learning of Discrete Speech Representations Gumbel-softmax quantization of speech features into codebook entries, the forerunner of wav2vec 2.0's product quantizer.
- wav2vec: Unsupervised Pre-training for Speech Recognition The first wav2vec: a convolutional encoder on raw audio pretrained to tell true future frames from distractors.
- Categorical Reparameterization with Gumbel-Softmax The differentiable relaxation of a discrete choice that trains the quantizer's codebook selection.
- HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units A follow-up that predicts offline cluster labels of masked frames instead of contrasting against quantized targets.
- Librispeech: An ASR corpus based on public domain audio books The read-speech corpus the model was pretrained and fine-tuned on, and the source of the clip (dev-clean, 1272-128104-0010).