Masked prediction for speech: HuBERT, WavLM, data2vec and BEST-RQ
Hide stretches of speech and predict what was there: cluster labels (HuBERT), cluster labels through noise and overlap (WavLM), a teacher's vectors (data2vec), or codes from a random projection (BEST-RQ).
What runs in CodeSplash
- AUD008HuBERT Explained here
- AUD009WavLM Explained here
- AUD010data2vec for speech Explained here
- AUD016BEST-RQ Explained here
You will be able to
- Explain masked prediction with offline cluster targets and why the loss uses only masked frames
- Describe how WavLM's corrupted inputs help speaker and overlap tasks
- Describe data2vec's moving-average teacher and continuous targets
- Explain what BEST-RQ shows by using a random, fixed tokenizer
Fill in the blanks
ReadThe second family of speech pretraining works like a fill-in-the-blanks test. Mask stretches of the input frames, run a Transformer over what's left, and predict a target for each masked frame:
with the masked frames, the masked input and the target. Only masked frames count: predicting visible frames would teach the model to copy. The methods below differ in where comes from.
HuBERT: cluster, predict, repeat
ReadHuBERT makes its targets offline. Round one runs k-means on MFCC frames; each frame's cluster number is its target. The model learns to predict those numbers at masked frames. Round two clusters the trained model's own middle-layer features, which are better, and trains again. These cluster targetsCluster targets (HuBERT)Targets made by clustering features, such as k-means on MFCCs or on an earlier model's layers. They are pseudo-labels, not phonemes. are pseudo-labels: clusters of sound, not phonemes anyone wrote down.
In the reference's example, masking the first and last of three frames and scoring only those gives a loss of 0.434.
Reference · AUD008 · Explained hereHuBERTHidden-unit BERT learns speech representations by predicting offline cluster assignments at masked time positions. Clustering and representation learning can be iterated.WavLM: predict through the noise
ReadWavLM keeps HuBERT-style targets but corrupts the input: it adds noise or overlaps a second utterance, while the targets still describe the main speaker's clean speech. To succeed, the model must pick out one voice from a mix. That makes its features strong for speaker verification, diarization and overlapped speech, not only for content.
WavLM's output is a set of features, not a cleaned waveform: it isn't a denoiser. In the reference's example, predictions from corrupted input scored against clean targets give a loss of 0.459.
Reference · AUD009 · Explained hereWavLMA self-supervised speech representation framework combining masked prediction with denoising-style training, including mixtures of utterances. It targets both content and speaker-related downstream tasks.data2vec: regress a teacher
Readdata2vec drops discrete targets. A teacher, a slow moving average of the student's own weights (a momentum encoderMomentum encoderA copy of the encoder whose weights trail the trained one as a slow moving average; it gives stable targets or keys.), reads the unmasked audio. Its averaged top-layer vectors are the targets. The student reads the masked audio and regresses those vectors at masked frames; gradients don't flow into the teacher.
In the reference's example, the regression loss is 0.0133, and one teacher update with moves the teacher only 1% of the way toward the student. The same recipe works for images and text, which is why the entry counts it once.
Reference · AUD010 · Explained heredata2vec for speechA self-supervised teacher–student framework whose speech configuration regresses contextual latent targets. Unlike discrete-unit prediction, targets are continuous representations from an exponential-moving-average…BEST-RQ: a tokenizer nobody trained
ReadBEST-RQ asks how good the targets must be. It builds them with a random-projection quantizerRandom-projection quantizerTargets from a fixed random projection and a fixed random codebook (BEST-RQ). Nothing about the tokenizer is learned.: multiply each feature frame by a fixed random matrix, normalize, and take the nearest of a fixed random set of codebook vectors. Nothing in the tokenizer is learned. In the reference's example three frames get codes 0, 1 and 0 (counting from 0; R counts from 1).
That it still trains strong encoders suggests what matters most: targets that are consistent for similar sounds, and a hard masked-prediction task.
Reference · AUD016 · Explained hereBEST-RQA self-supervised speech pretraining method using fixed random projections and a random codebook to produce prediction targets.Which layer, which task?
ReadThese encoders aren't used whole. Downstream models read one layer, or a weighted mix of layers, and different layers suit different tasks: in speech encoders the middle layers tend to carry content, while speaker identity is easier to read lower down. Report which layer you used, whether the encoder was frozen or fine-tuned, and how the task data was split, because the same checkpoint can look strong or weak depending on those choices.
Where it stands in CodeSplash
Read| Entry | In CodeSplash |
|---|---|
| HuBERT (AUD008) | Explained here |
| WavLM (AUD009) | Explained here |
| data2vec (AUD010) | Explained here |
| BEST-RQ (AUD016) | Explained here |
Speaker embeddings in CodeSplash come from ECAPA-TDNN, general audio embeddings from AST. The reference programs are component checks, verified in Python and R; for BEST-RQ R counts codes from 1.
Check: masked prediction
CheckpointCheck yourself
Where do HuBERT's training targets come from?
Show the answer
Answer: b
They are pseudo-labels from k-means. Each round's better features give better clusters for the next round.
Check yourself
Why does HuBERT's loss use only the masked frames?
Show the answer
Answer: a
The task must be impossible to solve by looking at the frame itself; only then does the model learn the context.
Check yourself
WavLM overlaps a second utterance onto the input but keeps targets from the main speaker. What does that buy?
Show the answer
Answer: b
Predicting the main speaker's targets through interference teaches the encoder to separate voices. Its output is still features, not audio.
Check yourself
A team wants to clean up noisy call recordings and plans to "run WavLM on them." What's the problem?
Show the answer
Answer: b
Denoising-style pretraining shapes the features. Producing clean audio is a different task with a different model.
Check yourself
In data2vec, what produces the student's targets?
Show the answer
Answer: c
The teacher sees everything, the student sees the masked input and regresses the teacher's averaged layer vectors.
Check yourself
How do data2vec's targets differ from HuBERT's?
Show the answer
Answer: a
HuBERT classifies masked frames into clusters; data2vec regresses a teacher's representations.
Check yourself
What is learned in BEST-RQ's tokenizer?
Show the answer
Answer: d
Only the encoder is trained. Fixed random targets still give consistent codes for similar frames.
Check yourself
What does BEST-RQ's success suggest about masked speech pretraining?
Show the answer
Answer: b
The result doesn't make tokenizers useless; it shows how much of the learning comes from the masked-prediction task itself.
Recap
Recap- Masked prediction scores only hidden frames; methods differ in their targets.
- HuBERT predicts cluster numbers and re-clusters; WavLM predicts them through noise and overlap.
- data2vec regresses a moving-average teacher's vectors; BEST-RQ uses a random, fixed tokenizer.
- Report the layer, frozen or fine-tuned, and the split; all four are explained here.
Concepts in this lesson