Diffusion language models

Every model so far writes the same way: one token at a time, strictly left to right. But that's a choice, not a law. Image generators don't paint pixel by pixel — they start from noise and refine the whole canvas at once, over a handful of steps. Diffusion language models ask whether text can be written the same way: all positions in parallel, sharpened step by step from a blank, fully-masked sequence.

1 The left-to-right habit

Autoregression — predict the next token, append, repeat — has been the only game in this course, and for good reason: it's simple, it trains on an exact likelihood, and it matches the way text seems to unfold. But it bakes in two constraints. Generation is strictly sequential, one token per forward pass, so a thousand-token output takes a thousand passes. And it only ever looks left — a token, once written, can never be revised in light of what comes after.

all noiseclean text iterative denoising — refine the whole sequence in parallel
Diffusion language models generate differently from left-to-right transformers: they start from pure noise over the whole sequence and denoise it in a handful of parallel steps, sharpening every position at once. It trades the autoregressive token-by-token loop for a small number of full-sequence refinement passes.

Other domains long ago abandoned this. Diffusion models — the technology behind modern image, audio, and video generators — don't produce their output in order at all. They start from pure noise and run a small, fixed number of refinement steps, each one improving the entire output simultaneously. The question this chapter asks is whether the same recipe works for language.

Autoregression is a default, not a requirement. Sequential, left-to-right generation is one way to turn a model into text — the one that won — but diffusion shows there's a fundamentally different shape the same goal can take.

2 What "noise" means for discrete text

Image diffusion has it easy: pixels are continuous, so you can add a little Gaussian noise, then a little more, until the picture dissolves into static — and train a model to reverse each step. Text is discrete. There's no "slightly noisy" version of the word cat. So discrete diffusion uses a different corruption: masking.

The forward process progressively replaces tokens with a special [MASK] symbol — a few at first, then more, until the whole sequence is masked. The model is trained to run that backwards: given a partly-masked sequence, predict what the masked tokens should be. Generation then starts from an all-masked sequence and unmasks its way to text.

For text, the noise is the mask. Corrupting toward a fully-masked sequence and learning to reverse it is the discrete analogue of dissolving an image into static and denoising it back. You met this exact masking objective in Chapter 8 — diffusion turns it into a multi-step generator.

3 Refine the whole sequence in parallel

Here's the part that makes it interesting. Each denoising step looks at the entire sequence at once — every position, masked or not — and predicts all the masked tokens together. It then commits the predictions it's most confident about, leaves the uncertain positions masked, and moves to the next step. Over a handful of steps, the sequence sharpens from all-mask to finished text.

Two things fall out of this. The number of steps is fixed and small — a few dozen, not one per token — so a long sequence doesn't cost proportionally more steps. And every step has bidirectional context: a token can be filled in based on words to its right that don't exist yet under autoregression. The model can lay down anchor words first and fill the gaps around them, in any order it likes.

Steps decouple from length, and context goes both ways. Diffusion trades "one pass per token, left to right" for "a few passes over everything, in any order." That parallelism and the ability to revise are its whole appeal.

4 Diffusion vs autoregressive

Line them up and the trade is clear. Autoregression takes N sequential steps for N tokens, sees only the left context, can't revise, but trains on an exact likelihood and is, today, the strongest approach for text. Diffusion takes a fixed T steps regardless of length, sees the whole sequence, can revise earlier tokens as later ones firm up — but each of those T steps is a full forward pass over the entire sequence, and its training objective is a looser bound, not the exact likelihood.

So "fewer steps" doesn't automatically mean "faster" — a diffusion step costs more than an autoregressive one, and you need enough steps for quality. The honest framing is that they occupy different points on the speed/quality/flexibility surface, and which wins depends on the sequence length, the hardware, and how much revision the task rewards.

5 Why autoregression still rules text

Despite the appeal, the frontier of language modelling is still overwhelmingly autoregressive, and there are real reasons. Left-to-right factorization matches the causal grain of language and gives an exact, easy-to-optimize training loss; the KV cache makes AR generation cheap per step; and decades of tooling and scaling know-how are built around it. Diffusion's looser objective and full-sequence steps have, so far, left it a step behind on raw quality.

But it's an active, fast-moving frontier — recent diffusion and masked-generation language models have closed much of the gap, and the parallelism is genuinely attractive for long outputs and controllable, infilling-style generation. Diffusion already owns image, audio, and video; whether it takes a real share of text is one of the open questions of the field.

Don't mistake "less common" for "settled." Autoregression leads text today on the strength of likelihood, caching, and momentum — not because diffusion can't work. This is one of the places the architecture story is still being written.

6 Reading the playground

The two columns illustrate the generation processes on the same target sentence: autoregressive fills left to right, one token per step; diffusion starts fully masked and unmasks confident tokens across the whole sequence over a few steps. It shows the mechanism and the step counts, not a trained model's samples.

Step or play both generators side by side: autoregressive marches left to right; diffusion lays down anchor words anywhere and fills the gaps.

Set the number of diffusion steps and re-run — fewer steps, coarser passes; more steps, a gentler reveal.

The steps-versus-length comparison — autoregressive grows with the sequence, diffusion stays flat — and the full trade-off table.

The reading is the setup. The playground is the point.

Two ways to write a sentence same target, two generation processes
Diffusion steps: 6

Autoregressive

one token per step, strictly left → right

Diffusion

all positions at once, masked → unmasked over a few steps

Steps, length & the trade-off generation steps vs sequence length

Generation steps vs length

Autoregressive needs one step per token (linear). Diffusion uses a fixed step budget regardless of length (flat) — though each step is a heavier pass.

Side by side

orderleft → rightany order
stepsN (one per token)fixed T
contextleft onlybidirectional
revise?neveryes, until committed
per-step costcheap (KV cache)full pass
training lossexact likelihoodlooser bound
text quality todayleadscatching up