San York or New Francisco?

A Visual Explanation of Text Diffusion

hi, i’m susie

2nd year CS PhD @ Tufts

susiesyli.com

Context & motivation


Text AR & Image Diffusion

Language models write one token at a time, left to right. Image models start from noise and sharpen the whole picture at once.

Text, left to right: one more token per pass

Image diffusion: every pixel refined each step


Text diffusion does it with words

You can blur a pixel, but not a word. Here the noise is random tokens: each pass keeps what the model is sure of and redraws the rest.

DiffusionGemma, recorded pass by pass. Dashed: random tokens it reads and then redraws.

Many tokens per pass

The same function on one clock, where a step is one pass. Left to right needs a pass per token; DiffusionGemma needed far fewer.


      
Left to rightone token per pass

      
Diffusionall positions per pass

Reported speeds: Gemini Diffusion 1,479 tokens/s (Google, excluding overhead) and Mercury Coder Mini 1,109 tokens/s on one H100 (Artificial Analysis). A pass reads the whole canvas, so it is not free; the gain is needing far fewer of them.


Contextwhat each word can see
Refinementwhen each word is decided
Coordinationwhether words written together agree

Context

Bidirectional context

👀

Causal attention permits connections to earlier positions and itself. Bidirectional attention permits connections on both sides.

Rows: the word looking, columns: what it can see

Causal mask

Bidirectional within the active canvas

Connections show permitted attention; canvas positions may contain provisional tokens.

A blank in the middle sees both sides

What should fill the blank depends on a word that comes after it.

Fixed ending:too big.
Fixed ending:too small.

Infilling example · surrounding text fixed · probabilities illustrative.

GainsFill in the middle, and edit with text fixed on both sides.
CostsEvery pass re-reads the whole canvas, so the usual left-to-right cache does not apply.
Used forCode infilling, rewriting a span in place, constraints at both ends.

Refinement

Flexible order and progressive refinement

Words settle in any order

DiffusionGemma, recorded pass by pass. Coloured words are kept; grey words are guesses it throws away and re-draws.

wordopen guess kept on passfirst → last
GainsStructure first: the length was fixed on pass 1. These 23 tokens took 6 passes; left to right takes 23.
CostsEach pass processes all 256 positions; with too few passes, drafts stutter.
Used forDrafting and editing, structured output like code and JSON.

Coordination

Parallel prediction, dependent choices

Parallel guesses can disagree

Each blank is predicted on its own. Both guesses are reasonable; together they may not be.

DiffusionGemma does this too. Its best guess after pass 1:

drifted laz across the the blue blue, a a against the the the

None of the repeats were kept: each pass keeps only the positions the model is sure of.


GainsMany words per pass when they do not depend on each other, so fewer passes.
CostsWords that depend on each other need separate passes; the sampler must hold back.
Used forFast generation: Gemini Diffusion, Mercury, DiffusionGemma.
QR code for susiesyli.com/text-diffusion-explainer

Interactive article & demos:

susiesyli.com/text-diffusion-explainer