VerifiedarXiv:2209.0314322 min
Generative models · Audio

AudioLM: a Language Modeling Approach to Audio Generation

Turn audio into two token streams, one for what is said and one for how it sounds, and predict them in that order to continue a recording.

AudioLM converts audio into semantic tokens from a self-supervised speech model and acoustic tokens from a neural codec, then models them with three decoder-only Transformers. Trained on 60,000 hours of untranscribed English speech, it continues a 3-second prompt in the speaker's voice, and in a listening test people told its continuations from real speech 51.2% of the time, close to the 50% of guessing.

Explaining the paperAudioLM: a Language Modeling Approach to Audio GenerationBorsos, Marinier, Vincent, Kharitonov, Pietquin, Sharifi, Roblek, Teboul, Grangier, Tagliasacchi, Zeghidour · Google Research · IEEE/ACM TASLP 2023 · arXiv 2022 · arXiv:2209.03143 ↗

The page builds both tokenizers (a residual quantizer you can step through, and k-means over a speech model's hidden layer), counts the sequence lengths that force the design into three stages, shows what each stage conditions on, and reads the listening test with its p-value worked out.

Why raw audio is a hard sequence to model

A language model like GPT-3 generates text one token at a time, each token sampled from a distribution conditioned on everything before it. Audio at 16 kHz has 16,000 samples per second, so a 10-second clip is a sequence of 160,000 numbers. Self-attention compares every position with every other, and its cost grows with the square of the length: 160,000 positions means 2.6 × 1010 pairs per layer, against about 106 for the 1,000-token sequences the paper calls comfortable for a standard Transformer.

Earlier work reached the problem from two sides. WaveNet (2016) models raw samples autoregressively and sounds natural over short spans, but without text or other conditioning it produces babbling: speech-like sounds with no words. GSLM (Lakhotia et al., 2021) clusters the features of a self-supervised speech model into a few hundred discrete units, removes repeated units, and trains a Transformer on them; its output contains real words and sentences, but its unit-to-speech synthesizer was trained on one speaker, so every output has that voice. AudioLM's goal is both properties at once: long-range structure (words, syntax, melody) and the acoustic detail of any speaker or recording.

Tokenize, model, detokenize

AudioLM has three parts. A tokenizer maps a mono waveform x∈RTx \in \mathbb{R}^{T} to a sequence h=(h1,…,hT′)h = (h_1, \dots, h_{T'}) of discrete tokens from a finite vocabulary, with T′≪TT' \ll T. A decoder-only Transformer, the same architecture as GPT, is trained to maximize the likelihood of those token sequences:

p(h)=∏t=1T′p(ht∣h<t)p(h) = \prod_{t=1}^{T'} p(h_t \mid h_{<t})
(1)

At inference the Transformer samples tokens one by one, and a detokenizer maps the sampled tokens back to a waveform x^\hat{x}. The tokenizer and detokenizer are trained first and then frozen; the language model never backpropagates into them. The paper gives a simpler training setup as the reason: the tokenizers are fixed functions, and the language model's inputs and targets are plain integers.

AudioLM uses two tokenizers whose tokens hold different information: acoustic tokens from a neural codec and semantic tokens from a self-supervised speech model, described in the next two sections.

Acoustic tokens: SoundStream and residual vector quantization

SoundStream is a neural audio codec from the same group (Zeghidour et al., 2021): an encoder network compresses audio into discrete codes and a decoder network reconstructs the audio from them, trained with reconstruction and adversarial losses so the output sounds like the input. Its convolutional encoder has four downsampling blocks with strides 2, 4, 5 and 8, so it outputs one embedding vector per 2⋅4⋅5⋅8=3202 \cdot 4 \cdot 5 \cdot 8 = 320 input samples. At 16 kHz that is 50 vectors per second, one per 20 ms frame.

Each 20 ms vector has to become discrete. The simplest option is a single codebook: a learned table of vectors, with the frame replaced by the index of its nearest entry. AudioLM's codec spends 120 bits per frame (6,000 bits per second at 50 frames per second), and a single codebook with 120 bits of index would need 21202^{120} entries. Residual vector quantization (RVQ) gets the same bit budget from a stack of small codebooks. The first codebook quantizes the frame; the second quantizes the error the first one left; each later level quantizes the error left by all the levels before it:

r0=y,ci=Qi(ri−1),ri=ri−1−ci,y^=∑i=1Qcir_0 = y, \qquad c_i = Q_i(r_{i-1}), \qquad r_i = r_{i-1} - c_i, \qquad \hat{y} = \sum_{i=1}^{Q} c_ir0=y,ci=Qi(ri−1),ri=ri−1−ci,y^=∑i=1Qci\begin{gathered} r_0 = y, \qquad c_i = Q_i(r_{i-1}), \\ r_i = r_{i-1} - c_i, \qquad \hat{y} = \sum_{i=1}^{Q} c_i \end{gathered}
(2)

In (2), yy is the encoder output for one frame, QiQ_i returns the entry of codebook ii nearest to its input, and the token for level ii is that entry's index. AudioLM uses Q=12Q = 12 levels of N=1024N = 1024 entries each, so every frame becomes 12 integers of 10 bits, and the codec stores 12×1024=12,28812 \times 1024 = 12{,}288 vectors instead of 21202^{120}. Making change with coins works the same way: the largest coin gets close, smaller coins fix the remainder. The analogy breaks in two places: codebook entries are learned vectors, not fixed denominations, and greedy nearest-entry choice at each level is not guaranteed to find the best combination.

Figure 1 · residual vector quantization of one frame

tokens for this frame: 1, 1, 3 · error 0.059 · 9 bits
one flat codebook with 9 bits needs 512 entries; these 3 codebooks store 24

A two-dimensional stand-in for one encoder frame y. Each level has 8 codewords (the circles, drawn around the current approximation); the level picks the one nearest to what is left, and teal arrows add them up into y^\hat{y}. The bars show the remaining error on a log scale. Move the slider from 0 to 8 levels and click inside the square to move the frame.

In the figure the error drops by roughly half per level, because each toy codebook has half the radius of the one before. The tokens are ordered by importance: level 1 alone fixes the coarse position, and level 8 moves the reconstruction by under 0.01. SoundStream's learned codebooks behave the same way, and the paper uses that ordering. The first few levels recover what the paper calls coarse acoustic properties (speaker identity, recording conditions); the later levels add fine detail. Table I of the paper puts numbers on it: SoundStream at 4 levels (2,000 bps) reconstructs speech with a ViSQOL score of 3.3, and at 12 levels (6,000 bps) with 3.9. ViSQOL is an automatic estimate of how similar a reconstruction sounds to the reference, on a scale of 1 to 5.

A 10-second clip becomes a matrix YY of 500×12500 \times 12 tokens. To feed it to a Transformer, AudioLM flattens it row by row, frame 1 levels 1 to 12, then frame 2 levels 1 to 12, and so on, into 6,000 tokens. Index 517 means different things at level 1 and level 3, so each token gets an offset by level, giving every level its own range of ids:

oi=((i−1) mod Q)⋅No_i = \big((i - 1) \bmod Q\big) \cdot N
(3)

where ii is the position in the flattened sequence. A level-3 token with index 517 becomes 517+2⋅1024=2565517 + 2 \cdot 1024 = 2565, and the model's vocabulary for 12 levels has 12,288 ids.

Semantic tokens: k-means on w2v-BERT

The second tokenizer starts from w2v-BERT (Chung et al., 2021), a self-supervised speech model. Like wav2vec 2.0 it learns from untranscribed audio by hiding parts of the input and predicting them, and like BERT it adds a masked-prediction loss over discrete targets; the training never sees text. The XL version AudioLM uses has 0.6B parameters: a convolutional front end that reduces the frame rate 4-fold, 12 Conformer blocks trained with the contrastive loss, and 12 more trained with the masked-prediction loss. A Conformer block is a Transformer layer with an added convolution module, which helps it model local patterns in the audio. Its hidden vectors come out at 25 per second, one per 40 ms, each 1,024-dimensional.

AudioLM takes the vectors from the 7th layer of the masked-prediction module (the 19th of the 24 blocks), standardizes each dimension to zero mean and unit variance, and runs k-means with K=1024K = 1024 clusters: k-means places 1,024 centroid vectors so that every training vector lies close to one of them. A semantic token is the index of the nearest centroid. One second of speech becomes 25 tokens of 10 bits, 250 bits per second. The standardization step, which the paper reports “significantly improves” how well the tokens separate phonemes, keeps a few high-variance dimensions from dominating the k-means distances.

The layer and KK were chosen by measuring several candidates. Phonetic discriminability is scored with ABX: take three recordings A, B and X, where A and X are the same three-phoneme word (say “bit”) and B differs in the middle phoneme (“bet”), and count how often X is closer to B than to A in the representation. Within-speaker ABX takes all three from one speaker; across-speaker takes X from a different speaker than A and B. The paper also used two language-modeling probes described in the results section, plus listening to a few continuations. Layer 7 with 1,024 clusters came out best.

Why one tokenizer is not enough

The two token types fail in opposite directions. Table I of the paper compares them on ABX error (lower means the tokens separate phonemes better) and on ViSQOL after training a SoundStream decoder to reconstruct audio from each:

tokensbitrateABX within / across speaker (↓)ViSQOL (↑)
semantic (w2v-BERT)250 bps6.7 / 7.61.1
semantic (w2v-BERT)6000 bps5.6 / 6.21.4
acoustic (SoundStream)2000 bps22.4 / 28.73.3
acoustic (SoundStream)6000 bps17.8 / 26.63.9

Semantic tokens at 250 bps make fewer than half as many ABX errors as acoustic tokens at 6,000 bps, and reconstruct speech so badly (ViSQOL 1.1, the bottom of the scale) that more bits barely help: the 6,000 bps version still scores 1.4. The w2v-BERT objective rewards predicting masked content, so the features keep what identifies phonemes and words and are not trained to keep detail such as the exact voice and room, which the decoder then cannot recover. SoundStream is trained to reproduce the waveform, and none of its losses depends on phoneme identity, so nothing in training makes phonemes easy to read off the tokens, which the ABX errors of 17.8 to 28.7 reflect.

The paper then trains a Transformer on acoustic tokens alone and prompts it with 4 seconds of speech. The continuations keep the speaker and the recording conditions and lose the language: the words are inconsistent and often babbling, like WaveNet's. A score and a recording of the same piece divide the information in a similar way. The score fixes the notes and timing and leaves out the instrument and the hall; the recording has everything but makes the notes hard to read off. The analogy overstates the separation: semantic tokens also carry much of the rhythm and intonation of speech, as the results section shows, and they are learned clusters, not symbols someone designed.

How AudioLM works: semantic first, then coarse, then fine

AudioLM models both token types, semantic first. It assumes the next semantic token depends on past semantic tokens and not on past acoustic ones:

p(zt∣z<t, y<t)≈p(zt∣z<t)p(z_t \mid z_{<t},\, y_{<t}) \approx p(z_t \mid z_{<t})
(4)

where zz are the semantic tokens and yy the acoustic tokens. Under (4), the semantic sequence can be generated for the entire clip without looking at acoustics, and the acoustic tokens can then be generated conditioned on it. The alternative, one model over an interleaved sequence of both token types, would have to process every token in a single context, and Figure 2 counts what that costs.

Figure 2 · how many tokens each model reads

attention pairs (n²): one model over semantic + 12 levels 3.9e7 · three stages summed 1.5e7 (ratio 2.6×) · raw samples 2.6e10

Token counts on a log scale for one clip, at the rates AudioLM uses (25 semantic tokens per second; 50 SoundStream frames per second with 12 levels, 4 of them coarse). Stage 3 reads chunks of at most 3 seconds (1,800 tokens), however long the clip. The dashed line marks 1,000 tokens. Drag the clip length from 1 to 60 seconds; the readout compares the summed attention cost (length squared) of the three stages with one model over all tokens.

At the default 10 seconds, raw samples would be 160,000 positions, and one model over semantic plus all 12 acoustic levels would read 6,250. AudioLM's three stages read 250 semantic tokens (stage 1); those 250 as a prefix plus 2,000 coarse tokens (stage 2, 2,250 in all); and four chunks of at most 1,800 coarse-plus-fine tokens (stage 3). Their summed attention cost is about 40% of the attention cost of one model over all 6,250 tokens. The saving grows with clip length (the readout's multiplier rises), because stage 3's chunks stay the same size. Below about 4 seconds the three stages cost slightly more than one model, since a single chunk then holds every acoustic token of the clip. The paper trains on crops of 30 seconds for stage 1 (750 semantic tokens), 10 seconds for stage 2 and 3 seconds for stage 3.

Each stage is a separate decoder-only Transformer, trained with next-token cross-entropy on the true tokens of its own sequence (teacher forcing). Stage 1 models semantic tokens alone:

p(zt∣z<t)p(z_t \mid z_{<t})
(5)

Stage 2 predicts the acoustic tokens of the first Q′=4Q' = 4 levels, the coarse ones, conditioned on the semantic tokens of the whole clip:

p(ytq∣z,  y<t≤Q′,  yt<q),q≤Q′p\big(y_t^q \mid z,\; y_{<t}^{\le Q'},\; y_t^{<q}\big), \qquad q \le Q'
(6)

Its input sequence is all the semantic tokens first, then the coarse tokens flattened frame by frame: (z1,…,zTS,y11,…,y14,y21,… )(z_1, \dots, z_{T_S}, y_1^1, \dots, y_1^{4}, y_2^1, \dots). The loss covers only the acoustic positions; the paper names y11y_1^1 as the first token predicted in training. Because the whole semantic sequence comes first, a coarse token at time tt sees semantic tokens from later in the clip, while the causal mask (each position attends only to positions before it) still hides later acoustic tokens. In the second stage, two acoustic frames correspond to each semantic token (50 Hz against 25 Hz), so there are 2Q′=82Q' = 8 coarse tokens per semantic token before repeats are removed.

Stage 3 predicts the 8 fine levels from the coarse ones, without semantic tokens:

p(ytq∣y≤Q′,  y<t>Q′,  yt<q),q>Q′p\big(y_t^q \mid y^{\le Q'},\; y_{<t}^{> Q'},\; y_t^{<q}\big), \qquad q > Q'
(7)

It conditions on all the coarse tokens of its chunk, the fine tokens of earlier frames, and the lower levels of the current frame. Dropping the semantic tokens rests on a second assumption, that fine detail is conditionally independent of content once the coarse acoustics are known. A further assumption, that fine detail is determined locally, lets stage 3 run on non-overlapping 3-second chunks, so its sequence length stays at 1,800 tokens whatever the length of the clip.

Figure 3 · what each stage conditions on

stage 2 predicts frame 4, level 3 from all 3 semantic tokens, 12 coarse tokens of earlier frames and 2 lower levels of frame 4: 17 context tokens

A toy clip of 6 frames (120 ms) with the real 12 levels, 4 of them coarse (above the gap), and 3 semantic tokens. The amber token is being predicted; teal tokens are its context; outlined tokens come later in the same sequence and are masked; faint tokens are not in this stage at all. The strip at the bottom is the stage's actual input, in order. Click any token, or pick a stage.

Click a coarse token at frame 1 and stage 2 conditions on all three semantic tokens, including those for frames 3 to 6. Click a fine token and the semantic row goes faint, while all 24 coarse tokens of the chunk turn teal, including those of frames after the target. The strip shows the same sets as positions: each stage is an ordinary causal language model, and its conditioning set in (5), (6) or (7) is whatever the sequence places before the target.

All three Transformers have the same shape: 12 layers, 16 attention heads, width 1,024, feed-forward width 4,096, dropout 0.1, and the relative position embeddings of T5, which add a learned bias to each attention score based on the distance between the two positions. Each stage trains on 16 TPUv4 chips with batch size 256 for 1M steps. The paper states 0.3B parameters per stage; the stated shape works out to about half that, a discrepancy discussed in the provenance notes below.

Training and sampling in code

One training example for stage 2, with tensor shapes for a 10-second crop. The paper says only that tokens are offset “properly”; putting semantic ids at 0 to 1,023 and the four coarse levels after them is one consistent choice, giving a vocabulary of 5,120.

# One stage-2 training example (speech model). Everything except
# stage2 is pretrained and frozen: w2v-BERT XL, the k-means, SoundStream.
x = random_crop(librilight_audio, seconds=10)   # (160000,) at 16 kHz
e = w2v_bert_xl(x, mlm_layer=7)                 # (250, 1024), 25 frames/s
z = kmeans_1024.nearest(standardize(e))         # (250,) ids in [0, 1024)
z = drop_consecutive_repeats(z)                 # e.g. 7 7 7 3 3 9 -> 7 3 9
Y = soundstream.encode(x)                       # (500, 12) ids in [0, 1024)
y = (Y[:, :4] + 1024 * arange(4)).reshape(-1)   # (2000,) row-major, offsets
seq = concat(z, 1024 + y)                       # id layout is ours (see text)
logits = stage2(seq[:-1])                       # causal; 12 layers, d = 1024
loss = cross_entropy(logits[len(z) - 1:], seq[len(z):])  # acoustic targets only
loss.backward()                                 # updates stage2 only

Stages 1 and 3 have the same structure. Stage 1 trains on 30-second crops of semantic tokens, with the loss on every position. Stage 3 trains on 3-second crops: 150 frames, the 600 coarse tokens as a prefix, and the 1,200 fine tokens as targets. The removal of repeated semantic tokens, borrowed from GSLM, applies in stages 1 and 2; a run like 7 7 7 3 3 9 becomes 7 3 9, which shortens the sequence. Durations then come from stage 2, whose acoustic frames keep the original timing.

Sampling uses temperature: the model's unnormalized scores (logits) ℓi\ell_i become probabilities

pi=exp⁡(ℓi/τ)∑jexp⁡(ℓj/τ)p_i = \frac{\exp(\ell_i / \tau)}{\sum_j \exp(\ell_j / \tau)}
(8)

and lower τ\tau concentrates the probability on the top candidates. For logits (2, 1, 0) the probabilities are (0.665, 0.245, 0.090) at τ=1\tau = 1, (0.731, 0.209, 0.060) at 0.8, and (0.817, 0.154, 0.029) at 0.6. AudioLM uses 0.6 for stage 1, 0.8 for stage 2 and 0.6 for stage 3, chosen by the authors as a trade-off between diversity and semantic consistency. Continuation then runs the three models in order:

# Continue a 3 s prompt by 7 s (temperatures from Sec. IV-B).
z_p = drop_consecutive_repeats(semantic(prompt))     # <= 75 ids
Y_p = soundstream.encode(prompt)                     # (150, 12)
z = sample(stage1, prefix=z_p, temperature=0.6)      # semantic, up to 10 s
c = sample(stage2, prefix=concat(z, flat(Y_p[:, :4])),
           n_new=7 * 50 * 4, temperature=0.8)        # 1400 coarse ids
Y_c = concat(Y_p[:, :4], unflat(c, levels=4))        # (500, 4)
new = Y_c[150:]                                      # the 350 new frames
fine = [sample(stage3, prefix=flat(ch), n_new=len(ch) * 8, temperature=0.6)
        for ch in split(new, frames=150)]            # chunks: 150, 150, 50
audio = soundstream.decode(concat(Y_p, stack_levels(new, fine)))  # (160000,)

Continuing a 3-second prompt

To continue a prompt, AudioLM tokenizes it with both tokenizers. A 3-second prompt gives up to 75 semantic tokens and a 150×12150 \times 12 matrix of acoustic tokens. Stage 1 extends the semantic sequence. Stage 2 reads the full semantic sequence, prompt plus continuation, followed by the prompt's coarse tokens, and samples coarse tokens for the new frames. Stage 3 fills in the fine levels, and the SoundStream decoder converts all 12 levels, prompt and continuation, into a waveform.

Figure 4 · the three stages producing a 7-second continuation
0%

stage 1 · semantic · 0 / 175 tokens · temperature 0.6

Each tick is a token on a 10-second time axis: amber tokens come from tokenizing the prompt, teal ones are sampled. Stage 3's dashed boxes are its 3-second chunks, drawn at 3-second boundaries here because the paper does not say where they fall at inference. Press Play, or drag the slider to stop at any point.

The prompt's coarse acoustic tokens carry the voice into the continuation. Without them stage 2 would see only content and would pick a voice at random; with them, its context holds 600 coarse tokens of one speaker in one room immediately before the first token it samples, and the sampled tokens continue that voice. The paper also runs AudioLM without any prompt, sampling the semantic tokens from scratch, which produces speech with varying speakers and content, and in an “acoustic generation” mode, which takes the true semantic tokens of a test utterance and samples only the acoustics.

What the semantic and acoustic tokens carry

All speech components (SoundStream, w2v-BERT, the k-means, the three Transformers) are trained on unlab-60k, the 60,000-hour unlabeled part of Libri-Light, which is English audiobook speech with mixed recording quality. Earlier textless models used its 6,000-hour clean subset. Evaluation uses LibriSpeech test-clean, whose speakers are excluded from Libri-Light.

Content is in the semantic tokens. In acoustic generation, stages 2 and 3 resynthesize test utterances of 4 to 10 seconds from their true semantic tokens, three times each, and an automatic speech recognition (ASR) system, a Conformer Transducer-L, transcribes the result. Word error rate is 6.0% (character error rate 3.4%), against 2.5% (0.8%) for the original audio and 2.6% (0.9%) for the audio passed through SoundStream. Since the codec alone adds almost nothing, most of the extra errors come from mapping semantic to acoustic tokens; the paper names proper nouns as the main source, followed by sentences ending at the wrong place and generated background noise. GSLM's resynthesis of the same utterances gets 6.6% WER, always in the same single voice.

Speaker identity is in the acoustic tokens. A convolutional speaker classifier trained on 291 LibriSpeech speakers identifies 100% of SoundStream reconstructions. On acoustic generations from the true semantic tokens it names the original speaker 3.2% of the time, above the 0.34% of guessing at random. On 7-second continuations of 3-second prompts (classifier run on the continuation only) it names the prompt's speaker 92.6% of the time. By listening, the authors report that rhythm and intonation vary only slightly between acoustic generations from the same semantic tokens, so prosody sits mostly in the semantic tokens.

Stage 1 learns words and some grammar. Two zero-shot probes from the ZeroResource Challenge 2021 compare the probability a model assigns to two utterances, normalized by length. sWUGGY pairs a word with a similar non-word (“brick” and “blick”); sBLIMP pairs a grammatical sentence with an ungrammatical one (“the dogs sleep” and “the dog sleep”). A model scores a point when it prefers the real word or the grammatical sentence, so 50 is chance.

modelsWUGGY allin-vocabsBLIMP
phone topline (text)97.9–66.8
forced-alignment topline92.2–63.7
HuBERT-only (non-causal)70.979.859.5
CPC-BERT (non-causal)–80.059.9
GSLM (causal)–68.757.1
van Niekerk et al. (causal)64.372.354.0
AudioLM (causal)71.583.764.7

AudioLM has the highest score of the models without text supervision on all three columns, including the non-causal ones that see the full utterance in both directions. Its sBLIMP of 64.7 is 8% higher, relative, than CPC-BERT's 59.9, and above the forced-alignment topline trained on phonetic transcriptions. Without length normalization the sBLIMP score is 67.5, above the phone topline as well; the paper reports the normalized number because ungrammatical sBLIMP sentences are on average longer, and an unnormalized likelihood favors shorter sequences.

Can people tell? The listening test and the detector

Ten raters screened for English proficiency rated 100 clips of exactly 10 seconds, 1,000 ratings in all. Half were real LibriSpeech utterances passed through SoundStream, so codec artifacts could not give the answer away; half were a real 3-second prompt followed by a 7-second AudioLM continuation. Raters knew the first 3 seconds were always real and labeled each clip as original or synthetic. Of the 1,000 labels, 51.2% were correct, and the paper reports that this is not significantly different from guessing, with p=0.23p = 0.23.

Figure 5 · the listening test as a binomial test

512 of 1000 correct · one-sided p = 0.234 · not distinguishable from guessing at the 5% level

Bars are the chance of each accuracy if every label were a coin flip; teal bars are results at least as extreme as the observed one, and their total is the p-value. The dashed line is where p reaches 0.05. Drag the accuracy, switch on the two-sided test, or treat the 100 clips instead of the 1,000 labels as the independent units.

With 1,000 independent coin flips, the probability of 512 or more heads is 0.234, so the reported p-value is a one-sided test; the two-sided value is 0.467. A one-sided test needs 527 correct labels (52.7%) to reach p = 0.05. The labels are also not independent: each clip was rated by 10 people, and if raters tend to agree on a clip, the effective sample size is closer to 100 than to 1,000. The “100 independent clips” setting shows that extreme, where chance accuracy spreads over roughly 40% to 60% and the 5% line moves out to 59% (61% two-sided). Under every variant, 51.2% stays well inside the range of guessing, as the paper concludes. The test also covers only 7-second continuations, read speech, and one dataset.

A classifier separates AudioLM continuations from real speech easily. The authors trained the same convolutional architecture as the speaker classifier, on 1-second crops from LibriSpeech train-clean-100, to separate AudioLM continuations from SoundStream-compressed real speech. On a balanced test set it is right 98.6% of the time. The real side of the training set is compressed too because, against raw speech, the task is trivial (the paper reports quick convergence to 100%) and codec artifacts would confound what the classifier learns.

Piano

The same framework, retrained on 40,000 hours of internal piano recordings from beginner to expert level, continues piano music. Here the codec uses 3 quantizer levels with codebooks of 214=16,3842^{14} = 16{,}384 entries, enough for high reconstruction quality, so stage 2 predicts all three levels and stage 3 is dropped. Prompts are 4 seconds from the MAESTRO dataset. In a test with 10 raters and 15 pairs of 20-second continuations from the same prompt, one from AudioLM and one from a model trained only on acoustic tokens, raters preferred AudioLM in 83.3% of pairs. The authors describe both as equally high in audio quality and only AudioLM's as keeping consistent melody and rhythm. There is no symbolic music (MIDI or notes) anywhere in training; the semantic tokens are k-means clusters of a w2v-BERT model trained on the piano audio.

Limitations

Generation is sequential. Every token costs one forward pass, and a 7-second continuation samples about 4,400 tokens, of which the stage-3 chunks can run in parallel; the paper gives no timing. The detector is trained against AudioLM itself, so its 98.6% says nothing about other generators.

The w2v-BERT layer and KK were chosen partly by listening to continuations, and the paper gives no measurement behind the three sampling temperatures. The speech model is trained on English audiobooks, and the paper notes that continuations may not keep the accent or dialect of speakers underrepresented in that data. The piano data is internal, so the piano result cannot be reproduced. The paper links audio samples; no official code or weights were released.

The paper lists the misuse risk directly: continuing 3 seconds of someone's voice can be used to spoof voice-based authentication or impersonate a speaker, and the detector is offered as a partial mitigation.

Provenance Verified against primary literatureHow we verify
Zeghidour et al. (2021), SoundStream, Sec. III and Algorithm 1Residual vector quantization: y_hat = 0, residual = y; for i = 1..Nq: y_hat += Q_i(residual), residual -= Q_i(residual). Encoder strides (2, 4, 5, 8) give one embedding every 2 x 4 x 5 x 8 = 320 samples. Codebooks are trained with exponential moving averages, initialized by k-means on the first batch, and unused entries are replaced; quantizer dropout trains one model for several bitrates. The SoundStream paper uses 24 kHz; AudioLM retrains it at 16 kHz, 12 levels of 1024 entries.
Chung et al. (2021), w2v-BERT, Sec. 3 and Table 1w2v-BERT XL has 0.6B parameters: a convolutional feature encoder (two 2-D convolutions with stride 2, a 4x reduction of the input frame rate), 12 Conformer blocks in the contrastive module and 12 in the masked-prediction module, model dimension 1024. AudioLM's "7th layer of the MLM module" is therefore the 19th of 24 Conformer blocks.
Lakhotia et al. (2021), GSLM, Sec. 3Units come from k-means (50, 100 or 200 clusters) on CPC, wav2vec 2.0 or HuBERT features, consecutive repeated units are removed before language modeling, and the unit-to-speech model is a Tacotron 2 trained on LJ Speech, a single-speaker dataset. AudioLM's comparison in Table II uses the 200-unit HuBERT version from textless-lib.
Kahn et al. (2020), Libri-Light, Sec. 2The unlabeled training set removed speakers who appear in the LibriSpeech dev and test sets, so AudioLM's test-clean prompts come from speakers the speech model never heard. The speaker classifier in Sec. IV-D is a different model, trained on train-clean-100 plus test-clean so that it can name those 291 speakers.
AudioLM Sec. III-B, Table IBitrates follow from rates and codebook sizes: 50 frames/s x 4 levels x 10 bits = 2000 bps; 50 x 12 x 10 = 6000 bps (600 tokens/s); 25 x 10 = 250 bps for semantic tokens. The 6000 bps semantic row is described only as residual-quantized w2v-BERT embeddings; at 25 Hz with 1024-entry codebooks that is 24 levels, a number the paper does not state.
AudioLM Sec. IV-G, our arithmeticFor 512 correct out of 1000 under a fair coin, P(X >= 512) = 0.2335 exactly, which matches the reported p = 0.23 as a one-sided test; the two-sided value is 0.467. A one-sided test needs at least 527 correct (52.7%) for p <= 0.05.
Agostinelli et al. (2023), MusicLM, Sec. 4.1MusicLM reuses AudioLM's stages with "24 layers, 16 attention heads, an embedding dimension of 1024, feed-forward layers of dimensionality 4096 ... resulting in 430M parameters per stage". Cited here only for the parameter-count comparison in the flag.
CodeGoogle did not release AudioLM's code or weights. The mechanisms on this page come from the paper's Sec. III and IV; where the paper leaves a detail open (the id layout of semantic tokens in stage 2, how many semantic tokens are sampled after repeats are removed, where stage-3 chunk boundaries fall at inference) the page says so instead of filling it in from an unofficial reimplementation.
correctionThree numbers in the paper do not hold as stated. (1) Sec. III-A says the token count is "typically 2-3 orders of magnitude smaller" than the sample count. That holds for semantic tokens (16,000 samples/s vs 25 tokens/s, 640x, 2.8 orders) and for SoundStream frames (320x), but the acoustic sequence the language models actually read is flattened across levels: 600 tokens/s for all 12 levels (27x, 1.4 orders) and 200 tokens/s for the 4 coarse levels (80x, 1.9 orders). (2) Sec. IV-B gives 12 layers, model width 1024 and feed-forward width 4096, "resulting in a model parameter size of 0.3B per stage". The standard count is 12 x (4 x 1024^2 + 2 x 1024 x 4096) = 151M, plus at most about 25M for embeddings and output layer at these vocabulary sizes; 24 layers would give 302M. Either the layer count or the parameter count is off by about 2x. (3) Sec. IV-G reports p = 0.23 for 51.2% of 1000 ratings without saying the test is one-sided; it is, and it also treats 1000 ratings of 100 clips by 10 raters as independent. Neither changes the conclusion that raters were near chance.

Questions you might still have

?

How is AudioLM different from GSLM?
GSLM (Lakhotia et al., 2021) also trains a Transformer on discrete speech units with no text, and its speech is meaningful, but its units feed a Tacotron 2 synthesizer trained on one speaker, so every output has that one voice in a clean room. AudioLM keeps GSLM-style units for content (k-means ids, repeats removed) and adds SoundStream tokens, which carry speaker, recording conditions and fine detail. On transcription error after resynthesis the two are close (WER 6.0 for AudioLM vs 6.6 for GSLM), but AudioLM's output can be any voice, and in continuation it keeps the prompt's voice.

?

Why not train one Transformer on the SoundStream tokens alone?
The paper tried it on speech: a decoder-only model on flattened acoustic tokens, prompted with 4 seconds, kept the voice and the recording conditions and produced babbling instead of words. With 600 tokens per second, the model's context covers little time, and most of its capacity goes to predicting fine acoustic detail. Perceiver AR made the same choice for piano and got high audio quality with weaker long-range structure; in the paper's piano test, raters preferred AudioLM over an acoustic-only model in 83.3% of pairs.

?

Does AudioLM know English words?
It assigns higher probability to real words than to similar-sounding non-words 71.5% of the time over all sWUGGY pairs (83.7% on words that occur in LibriSpeech), and to grammatical over ungrammatical sentences 64.7% of the time on sBLIMP, the best of the models without text supervision in the comparison. It never saw text. The judgments come from stage 1 alone, which scores sequences of semantic tokens; its 64.7 sBLIMP is between a forced-alignment phone topline (63.7) and the phone topline (66.8).

?

Why does the continuation keep the speaker, when generating from semantic tokens does not?
Speaker identity is carried mostly by the acoustic tokens. In acoustic generation, stage 2 sees only semantic tokens, so it samples a new voice each time and a speaker classifier names the original speaker 3.2% of the time. In continuation, stage 2 also gets the prompt's coarse acoustic tokens as its prefix, and a causal model that has just read 3 seconds of one voice continues in that voice: the classifier then names the right speaker 92.6% of the time.

?

How fast is generation?
The paper reports no timing. Each token costs one forward pass of a 12-layer model, and a 7-second continuation samples about 175 semantic tokens, 1,400 coarse tokens and 2,800 fine tokens. The stage-3 chunks are independent given the coarse tokens, so they can be sampled as one batch, which leaves roughly 175 + 1,400 + 1,200 = 2,775 sequential steps.

?

Can AudioLM do text-to-speech?
Not as published. It is trained on audio only, and its conditioning signals are a prompt or nothing. The conclusion names text-to-speech and speech-to-speech translation as future work, by putting AudioLM inside an encoder-decoder model whose encoder reads the text or the source speech.

?

Is the detector a general deepfake detector?
No. It is trained to separate AudioLM continuations from real LibriSpeech speech that was passed through SoundStream, and it reaches 98.6% accuracy on a balanced test set of the same kind. The paper does not test it on other generators, other codecs, or audio that was edited after generation.

Footnotes & further reading

  1. The paper: Borsos, Marinier, Vincent, Kharitonov, Pietquin, Sharifi, Roblek, Teboul, Grangier, Tagliasacchi, Zeghidour, AudioLM: a Language Modeling Approach to Audio Generation (2022), and the audio samples, including the “generation without semantic tokens” examples.
  2. The codec: Zeghidour, Luebs, Omran, Skoglund, Tagliasacchi, SoundStream: An End-to-End Neural Audio Codec (2021), Algorithm 1 for residual vector quantization.
  3. The semantic model: Chung, Zhang, Han, Chiu, Qin, Pang, Wu, W2v-BERT: Combining Contrastive Learning and Masked Language Modeling for Self-Supervised Speech Pre-Training (2021), Table 1 for the XL configuration. Its contrastive half descends from Baevski et al., wav2vec 2.0, covered in the wav2vec 2.0 explainer; the masked-prediction half follows BERT.
  4. Textless speech language modeling: Lakhotia et al., Generative Spoken Language Modeling from Raw Audio (GSLM, 2021).
  5. Training data: Kahn et al., Libri-Light: A Benchmark for ASR with Limited or No Supervision (2020).
  6. The decoder-only Transformer: Vaswani et al. (2017), in the Attention Is All You Need explainer; relative position biases from Raffel et al. (2020), in the T5 explainer.
  7. A later system built on AudioLM's stages: Agostinelli et al., MusicLM: Generating Music From Text (2023).