← Concept library

Vision & Multimodal

wav2vec 2.0 and Self-Supervised Audio

wav2vec 2.0 learns speech representations from raw audio without transcripts by masking latent features and solving a contrastive task over learned discrete units, then fine-tunes on as little as ten minutes of labelled speech to reach competitive word error rates.

intermediate · 8 min read

Ten minutes of labelled speech. That is all wav2vec 2.0 needed in 2020 to achieve 4.8% / 8.2% word error rate (WER) on LibriSpeech clean/other test sets, where competitive supervised systems at the time required hundreds of hours of transcripts. The number is striking because it inverts the usual assumption: that ASR is fundamentally a supervised problem requiring expensive human annotation.

This concept explains the mechanism behind that result, what makes it work, and where it breaks.

The core problem self-supervision solves

Labelling speech is expensive. A trained human transcriber produces roughly one hour of verified transcript for every six to ten hours of work. That bottleneck concentrates high-quality ASR in a handful of resource-rich languages. Unlabelled audio, by contrast, is nearly free: broadcast recordings, podcasts, and voice-search logs accumulate continuously.

The self-supervised strategy is to design a pretext task that forces the model to learn something useful about speech structure from unlabelled audio alone, then use those representations as a head start for supervised fine-tuning. The challenge is choosing the right pretext task. Predicting raw waveform samples is too easy (nearby samples are highly correlated). Predicting mel-filterbank features works but the model can cheat by exploiting short-range spectral smoothness. wav2vec 2.0 solves this by operating in a learned discrete latent space, then masking and predicting within it.

Architecture: from waveform to quantised targets

The model has three components working in sequence.

1. Feature encoder. A stack of seven 1-D convolutional layers maps raw 16 kHz waveform directly to a sequence of dense feature vectors at roughly 50 frames per second (20 ms stride). No MFCC or filterbank preprocessing. The encoder learns its own front-end.

2. Quantisation module. The same encoded features are passed to a product quantiser with G codebook groups and V entries per group. During pre-training, each frame gets a discrete code (the quantised representation q). This is learned jointly via a straight-through estimator; a Gumbel-softmax relaxation makes the discrete choice differentiable. The key insight is that these codes become the prediction targets, not the raw features. The model therefore cannot trivially "look up" the answer from nearby frames.

3. Transformer encoder. Before the transformer sees the features, a proportion p of consecutive time-step spans are masked (typically 10 frames per masked region, ~65% of all frames are masked on average). The transformer contextualises the unmasked and masked positions, producing context representations c.

The pre-training loss is contrastive. For each masked position t, the model must identify the correct quantised target q_t among a set of K distractors sampled from other time-steps in the same sequence:

L_m = -log [ exp(sim(c_t, q_t) / κ) / Σ_{q̃} exp(sim(c_t, q̃) / κ) ]

where sim is cosine similarity and κ is a temperature. A diversity loss is added to prevent codebook collapse (all frames mapping to the same code).

The full training objective is L = L_m + α * L_d, where L_d penalises low entropy in the codebook usage distribution.

Masking + contrastive objective at a glance
-------------------------------------------
raw waveform  →  [conv encoder]  →  latent z_1 ... z_T
                                         │
                               [quantiser] → targets q_t
                                         │
                           mask ~65% of positions
                                         │
                           [transformer] → context c_t
                                         │
                    contrastive loss: c_t vs {q_t, distractors}

Fine-tuning and the labelled-data regime

After pre-training on unlabelled audio, a linear projection head followed by a CTC loss is placed on top of the transformer. Only a handful of gradient steps on labelled data are needed because the transformer already encodes rich phonetic structure.

A typical setup trains on 53,000 hours of unlabelled LibriVox audio first. Fine-tuning on 10 minutes of transcribed speech, with a language model for decoding, yields 4.8% / 8.2% WER. Fine-tuning on 960 hours reaches 1.8% / 3.3%, setting a new benchmark at the time.

Labelled data WER clean WER other
10 min 4.8% 8.2%
1 hour 2.7% 5.8%
10 hours 2.1% 4.8%
960 hours 1.8% 3.3%

Results from Baevski et al. (2020) with an external 4-gram LM on LibriSpeech.

The model scales predictably: the BASE variant (12 transformer layers, 95M parameters) and LARGE (24 layers, 317M parameters) both follow the pattern. LARGE with 53k unlabelled hours is where the 10-minute fine-tuning result comes from.

What the model actually learns

Probing studies show that the lower transformer layers capture acoustic-phonetic features (voicing, place of articulation), while higher layers encode progressively more abstract structure approaching phoneme identity. The quantised codes cluster into units that correspond roughly to phones, even though the model was never told what phones are. This emergent structure is what makes fine-tuning data-efficient: the model does not need many labelled examples to map its internal phone-like units to grapheme or word targets.

HuBERT (Hsu et al., 2021) extends this line of work by replacing online quantisation with offline k-means cluster assignments over MFCC features (or a previous model's representations) as targets. This removes the tricky joint quantiser training and often produces cleaner pseudo-labels at the cost of an iterative pre-training pipeline.

When it falls down

Domain mismatch. Pre-training on LibriVox (read, clean audiobook speech) then fine-tuning on telephone or child speech transfers poorly. The learned codebook reflects the acoustic distribution of pre-training data. If the fine-tuning domain is spectrally very different, WER can degrade sharply relative to a model pre-trained on in-domain unlabelled audio.

Low-resource languages with no unlabelled data. wav2vec 2.0's advantage evaporates if no large unlabelled corpus exists for the target language. The model is not a cross-lingual transfer system by default; multilingual variants (XLSR-53) train on many languages jointly to address this, but the unlabelled data requirement remains.

Streaming and latency. The transformer encoder is non-causal: it attends over the entire utterance. The 65% masking rate during pre-training produces a model that looks forward freely. Deploying it for real-time transcription requires either a causal replacement (which tends to degrade quality) or a chunked streaming strategy with look-ahead, both of which add engineering complexity.

Quantisation collapse. If the codebook diversity loss weight α is poorly tuned, the product quantiser degenerates: many codes go unused and a few dominate. When this happens the contrastive task becomes trivially easy (the distractors are all the same code), the loss stops providing useful gradient signal, and representations do not improve past a certain point.

Transcription of overlapping speakers. wav2vec 2.0 produces a single-channel sequence of frame representations. It has no built-in mechanism to handle two simultaneous speakers. Multi-speaker scenarios require a separate diarisation or separation stage before recognition.

Fine-tuning with CTC. CTC assumes conditional independence between output tokens given the acoustic representation, which loses some sequential context. For tasks requiring strong language-model-like sequence modelling (e.g., morphologically rich languages), the combination of CTC and a shallow n-gram LM under-performs attention-based seq2seq decoders fine-tuned from the same backbone.

Further reading

Sign in to save and react.
Share Copied