📋 KEY INSIGHTS
- Machine learning for audio and speech has undergone a paradigm shift identical to NLP: task-specific models trained on labelled data (HMMs for speech recognition, GMMs for speaker verification) have been replaced by self-supervised foundation models pre-trained on massive unlabelled audio corpora, then fine-tuned for downstream tasks. The enabling insight is the same as in NLP: raw audio contains rich latent structure (phonemes, speaker identity, prosody, musical notes, environmental sounds) that can be learned from the signal itself without annotations, using objectives like masked prediction or contrastive learning. The result is that wav2vec 2.0 and HuBERT pre-trained on 960 hours of LibriSpeech and fine-tuned on 10 minutes of labelled speech match the performance of supervised models trained on 100× more labelled data — a dramatic reduction in the annotation bottleneck that democratises speech technology for low-resource languages.
- wav2vec 2.0 (Baevski et al., NeurIPS 2020) is the foundational self-supervised speech model: a convolutional feature encoder maps raw waveform to a sequence of latent representations, a Transformer contextualises the sequence, and during pre-training a contrastive loss trains the model to identify the correct quantised speech unit (from a codebook learned via product quantisation) for masked positions from a set of distractors. The quantisation step is essential: it converts the continuous latent representations to discrete units that can be treated as a “speech vocabulary”, enabling a masked prediction objective analogous to BERT’s masked token prediction. Fine-tuning wav2vec 2.0 for ASR requires only a linear classification head (mapping contextualised representations to characters or phonemes) trained with CTC (Connectionist Temporal Classification) loss on labelled speech. The connection to our self-supervised learning guide is direct: wav2vec 2.0’s pre-training objective (contrastive learning over discrete speech units) is the audio-domain application of the contrastive self-supervised framework described there — the positive pair is the masked position and its true quantised unit, the negatives are other quantised units sampled from the same utterance, and the NT-Xent-style loss maximises similarity between the contextualised representation and the correct unit.
- Whisper (Radford et al., OpenAI 2022) takes a fundamentally different approach from wav2vec: instead of self-supervised pre-training followed by fine-tuning, Whisper trains end-to-end on 680,000 hours of weakly supervised internet audio-transcript pairs using a standard encoder-decoder Transformer with cross-entropy loss. The massive and diverse training data (99 languages, diverse acoustic conditions, varied speaking styles) produces a highly robust model that generalises to out-of-distribution audio without any fine-tuning — Whisper large-v3 achieves <5% WER on most English benchmarks and is competitive with supervised models for low-resource languages. The connection to our Transformers guide is direct: Whisper uses the standard encoder-decoder Transformer architecture described there — the encoder processes 80-channel log-Mel spectrogram patches (analogous to image patches in ViT), the decoder generates transcript tokens autoregressively, and the cross-attention mechanism aligns encoder acoustic features with decoder token positions, performing learned alignment that supersedes the explicit alignment required by older HMM-based ASR systems.
- Neural audio codecs (EnCodec, DAC, SoundStream) are neural audio compression systems that encode audio into discrete token sequences at very low bit rates, enabling audio generation with language model architectures. EnCodec (Défossez et al., Meta 2022) uses a convolutional encoder-decoder with residual vector quantisation (RVQ): multiple VQ codebooks are applied sequentially, each quantising the residual of the previous stage, achieving high-fidelity reconstruction at 1.5–24 kbps. The discrete token sequences produced by EnCodec can be treated as audio “text” — an autoregressive language model trained on EnCodec tokens can generate audio by sampling from the token distribution, then decoding with the EnCodec decoder. AudioLM (Borsos et al., Google 2023) demonstrates this: it uses a hierarchical language model over both coarse semantic tokens (from HuBERT) and fine acoustic tokens (from SoundStream) to generate coherent long-form speech and music with realistic prosody and acoustic quality. The connection to our sparse representation guide is direct: residual vector quantisation is a hierarchical sparse coding method — each codebook quantises the residual of the previous stage, and the total representation is the sum of multiple codebook entries, analogous to hierarchical dictionary learning where each layer of the dictionary captures increasingly fine-grained residual structure.
- MusicGen (Copet et al., Meta 2023) generates high-quality music from text descriptions (“upbeat jazz with piano and drums”) or audio continuation using a single-stage autoregressive Transformer over EnCodec tokens. The key innovation over prior music generation (Jukebox, MuseNet): a novel codebook interleaving pattern that enables single-stage generation over multi-codebook RVQ tokens without the cascade of separate models required by earlier approaches. MusicGen fine-tuned on 20,000 hours of licensed music achieves state-of-the-art on the MusicCaps evaluation benchmark (FAD, KL divergence, CLAP score), and the base model is openly available for commercial use. The connection to our diffusion models guide is direct: music and audio generation has two dominant paradigms — autoregressive token generation (MusicGen, AudioLM) and diffusion-based generation (AudioLDM, Stable Audio) — analogous to the LLM vs. diffusion split in image generation. Diffusion models for audio generate directly in the latent space of a variational autoencoder (AudioLDM2 uses a latent diffusion model conditioned on CLAP text embeddings), offering better diversity and controllability but slower inference than autoregressive models.
- Speaker diarisation (the “who spoke when” problem) segments an audio recording by speaker identity without knowing the number of speakers in advance. The modern pipeline: speech activity detection (VAD) with a WebRTC VAD or Silero VAD model, speaker embedding extraction (d-vectors from ECAPA-TDNN or WavLM-based speaker encoders that map each speech segment to a fixed-dimensional embedding), and clustering (agglomerative hierarchical clustering with cosine distance to group segments by speaker identity). End-to-end neural diarisation (EEND, Fujita et al., 2019) replaces the pipeline with a single Transformer that jointly solves VAD and speaker assignment, trained with permutation-invariant training (PIT) loss to handle the arbitrary speaker order. Pyannote.audio is the leading open-source diarisation toolkit, integrating segmentation, embedding, and clustering with a speaker change detection model fine-tuned from wav2vec 2.0. The connection to our clustering guide is direct: speaker diarisation’s clustering step uses spectral clustering or agglomerative hierarchical clustering with cosine similarity between d-vector embeddings — the same algorithms described in that guide, applied to the speaker embedding space rather than to tabular features or image embeddings.
Audio and speech ML has benefited more than almost any other domain from the self-supervised pre-training revolution: labelled speech data is expensive to collect (transcribers must listen in real time, at 10× the audio duration), but unlabelled audio is essentially unlimited (every podcast, meeting recording, YouTube video, and phone call is potential training data). Self-supervised models like wav2vec 2.0 and HuBERT exploit this abundance, learning rich speech representations that transfer to ASR, speaker verification, emotion recognition, and language identification with minimal labelled data. Meanwhile, neural audio codecs (EnCodec, DAC) enable audio generation with language model architectures, producing the audio generation equivalents of GPT and Stable Diffusion. This guide covers the full audio ML landscape: wav2vec 2.0 and contrastive speech pre-training, HuBERT and masked speech prediction, Whisper end-to-end ASR, neural audio codecs and autoregressive audio generation, MusicGen, speaker diarisation, and audio diffusion models.
Self-Supervised Speech Models, wav2vec 2.0, HuBERT and Whisper
The speech waveform is a 1D time series sampled at 16kHz–44kHz — a raw signal that contains phonemic, prosodic, speaker, and channel information all entangled. The first step in almost all speech models is feature extraction: converting the raw waveform to a time-frequency representation. The traditional approach is the log-Mel spectrogram: apply short-time Fourier transform (STFT) with a 25ms window and 10ms stride, map to 80 Mel-frequency bins, take the log. This produces an 80×T matrix (80 frequency channels × T time frames) that is treated analogously to an image for downstream processing. wav2vec 2.0’s convolutional feature encoder learns this feature extraction end-to-end from raw waveform, outperforming hand-crafted MFCC/log-Mel features by learning audio features specifically suited for the downstream pre-training objective. The product quantisation step in wav2vec 2.0 partitions the feature encoder’s output space into G groups, each with V codebook entries: a vector from each group is selected by nearest-neighbour lookup, and the G selected vectors are concatenated to form the quantised speech unit. Training the codebook jointly with the contrastive loss via Gumbel-Softmax (the same technique from our neural architecture guide‘s discussion of discrete bottleneck learning) enables end-to-end learning of the speech vocabulary. HuBERT (Hidden-Unit BERT, Hsu et al., 2021) replaces wav2vec 2.0’s contrastive loss with a masked prediction loss (BERT-style), using offline cluster assignments from k-means on MFCC features as the prediction targets — an iterative procedure that alternates between k-means clustering and masked prediction pre-training. HuBERT generalises better than wav2vec 2.0 to tasks requiring semantic understanding (spoken language understanding, emotion recognition) because its masked prediction objective encourages learning the semantic content of speech frames rather than just discriminating between nearby frames. The connection to our Transformers guide is direct: HuBERT is precisely BERT applied to audio — the architecture (bidirectional Transformer, [MASK] tokens, masked prediction loss), the pre-training procedure (mask 80% of time steps, predict cluster assignments from context), and the fine-tuning approach (add a CTC head, fine-tune on labelled speech) are all direct analogues of BERT’s text pre-training described there, with audio frames as tokens and cluster IDs as the vocabulary. Whisper’s training data curation is a key reason for its robustness: the 680k hours are sourced from the internet with heuristic quality filtering (remove audio where the transcript appears to be machine-generated, remove non-speech audio, remove transcripts in languages that do not match the audio language). This diverse, real-world data covers accents, recording conditions, background noise, and speaking styles that laboratory-collected datasets miss — the same distribution coverage principle that makes Common Crawl-trained LLMs more robust than models trained on curated corpora. The connection to our data quality guide is direct: Whisper’s training data curation implements the data validation and quality filtering principles described there at massive scale — the heuristic filters (language detection, sentence length distribution, transcript-audio alignment score) are automated data quality rules applied to 680k hours of training data.
| Model | Approach | Pre-training Objective | Key Task | Labelled Data for Fine-tune |
|---|---|---|---|---|
| wav2vec 2.0 | Self-supervised (contrastive) | Contrastive over VQ units | ASR, phoneme cls | 10 min → <5% WER (en) |
| HuBERT | Self-supervised (masked pred) | Masked cluster prediction | ASR, SLU, emotion | 1h → competitive with 100h sup |
| WavLM | Self-supervised + denoising | Masked pred + noise robustness | ASR, speaker, diar | SUPERB benchmark SOTA |
| Whisper | Weakly supervised (680k hrs) | Encoder-decoder ASR (CTC-free) | ASR, translation, VAD | Zero-shot (no fine-tuning needed) |
| EnCodec | Neural codec (RVQ) | Reconstruction (no self-sup) | Audio compression; LM tokens | N/A (codec, not classifier) |
Neural Audio Codecs, MusicGen and Audio Generation
The neural audio codec paradigm treats audio generation as a language modelling problem: encode audio into discrete tokens, train an autoregressive language model on the tokens, generate audio by sampling tokens and decoding. This requires a codec that (1) produces a compact token sequence (low bit rate), (2) enables high-fidelity reconstruction from tokens, and (3) has a token vocabulary small enough for language model training. EnCodec achieves all three with RVQ: the first codebook captures coarse structure (prosody, speaker identity), subsequent codebooks capture increasingly fine acoustic details, and training with an adversarial discriminator (a GAN loss) on the reconstructed waveform ensures perceptual quality. The number of codebook levels (typically 4–8) and codebook size (typically 1024 entries) determine the compression rate and reconstruction quality tradeoff. The connection to our diffusion models guide is direct: the latent diffusion paradigm (encode to latent space, run diffusion in latent space, decode to data space) applies to audio exactly as to images — AudioLDM2 uses a VAE encoder/decoder analogous to Stable Diffusion’s VAE, with the diffusion process operating in the compressed latent audio space rather than the raw waveform. AudioLDM2 is conditioned on CLAP (Contrastive Language-Audio Pretraining) text embeddings, which are the audio-domain equivalent of CLIP embeddings described in our multimodal AI guide — CLAP aligns audio and text embeddings using contrastive learning, enabling text-to-audio generation conditioned on CLAP embeddings. Voice cloning and text-to-speech (TTS) with neural models represents the intersection of audio generation and voice synthesis: VALL-E (Wang et al., Microsoft 2023) is a neural codec language model for TTS that conditions on a 3-second reference utterance of the target speaker and generates EnCodec tokens for the target text, achieving zero-shot voice cloning without speaker-specific fine-tuning. The model learns to associate speaker identity (extracted from the reference utterance by the first codebook’s tokens, which primarily capture prosody and speaker characteristics) with acoustic realisation (subsequent codebooks), enabling voice conversion and style transfer. The connection to our foundation models guide is direct: VALL-E is a foundation model for speech — a single model pre-trained on 60,000 hours of speech (LibriLight) that can generate in any voice with 3 seconds of reference audio, the speech equivalent of GPT-4’s few-shot learning capability described there. Real-time streaming ASR for production deployment requires additional engineering beyond the offline Whisper model: chunked processing (sliding window over the audio stream with overlap to handle speech spanning chunk boundaries), voice activity detection (to avoid processing silence), partial results (emit hypothesis transcripts before the utterance is complete), and latency budgeting (the model must produce a transcript faster than the audio arrives). Faster-Whisper (using CTranslate2 INT8 quantisation) and WhisperX (forced alignment for word-level timestamps) are the standard production deployment wrappers. The connection to our LLM distillation guide is direct: Whisper model distillation (Distil-Whisper, Gandalf et al., 2023) produces a 6-layer Whisper student from the 32-layer large-v2 teacher using sequence-level KD, achieving 50% fewer parameters with <1% WER degradation on the OpenASR leaderboard — the same word-level distillation framework described in that guide for LLMs applies directly to encoder-decoder speech models.
✦ SUMMARIZE THIS ARTICLE WITH AI
Self-supervised learning (wav2vec 2.0 contrastive pre-training; HuBERT masked prediction as audio BERT) is in our Self-Supervised Learning guide. Transformers (encoder-decoder for Whisper; bidirectional Transformer for HuBERT) are in our Transformers guide. Diffusion models (AudioLDM2 latent audio diffusion; audio generation paradigm comparison) are in our Diffusion Models guide. Multimodal AI (CLAP audio-text alignment; audio-visual models) is in our Multimodal AI guide. LLM distillation (Distil-Whisper sequence-level KD for ASR) is in our LLM Distillation guide. Clustering (speaker diarisation clustering in d-vector space) is in our Clustering guide. Data quality (Whisper training data curation at scale) is in our Data Quality guide. Foundation models (VALL-E as speech foundation model for zero-shot voice cloning) are in our Foundation Models guide.



