Diffusion Language Models

A diffusion model writes every word of a sentence at once, then sharpens all of them together. Diffusion-LM used this to meet a target parse tree 86.0% of the time, where a left-to-right method managed 17.9%. LLaDA then trained the idea from scratch at 8 billion parameters.

Pick a writer and press Play. Both must write the middle line of a three-line story. Watch which one can read the last line while it writes. Then we build, piece by piece, noise on word vectors, rounding, gradient steering, masking, the likelihood bound and the sampler.

You need a little Python and what a probability is. We build the rest from zero.

Session 18 of Georgia Tech CS 8803, LLM seminar. It rests on two papers: Li, Thickstun, Gulrajani, Liang and Hashimoto, Diffusion-LM Improves Controllable Text Generation (2022), and Nie, Zhu, You, Zhang, Ou, Hu, Zhou, Lin, Wen and Li, Large Language Diffusion Models (NeurIPS 2025). Every idea is re-taught here in our own words and devices.

Write the middle line

3

Toy: both writers are scripted, not trained. The story and the diffusion middle line are the infilling example in Table 1 of Diffusion-LM. The left-to-right line is ours. The paper's real result (Table 2): syntax-tree control 86.0% for Diffusion-LM and 17.9% for FUDGE.

Chapter 0

Left to Right Is a Choice

See why a model that writes in order cannot aim at a rule that lives at the end

You must write the middle line of a story. The first line is "My dog loved tennis balls." The last line is "My dog had stolen every one and put it under there." Your line has to set up "under there" without breaking either side.

A standard language model is autoregressive: it writes one token at a time, left to right. Each token depends only on the tokens before it. Call the words of a sentence w1 to wn, and the words before position i w<i.

Say it aloud

p of w equals the product over i of p of w-i given w-before-i.

p(w)
p of w the probability the model gives the whole sentence w.
∏i
the product over i multiply one term for each position, from 1 to n.
wi
w-i the word at position i.
w<i
w-before-i every word before position i: the only context that term can see.
In plain words

Take each word w-i in turn. Ask how likely it is, given only the words before it. Multiply the answers to get p of w.

With numbers

With made-up numbers for "the dog ran": p(the) = 0.2, p(dog | the) = 0.1, p(ran | the dog) = 0.3. So p(w) = 0.2 × 0.1 × 0.3 = 0.006. No term looks at a later word.

When word 6 is chosen, word 12 does not exist yet. So a rule that lives at the end, such as "end with under there" or "parse into this tree", cannot shape word 6 directly. The usual fix for infilling moves the future into the past: train on (left, right, middle) order.

See what each word can read

Row i is the word being predicted; a filled cell is a word it can condition on. Pick a model, then drag to a word.

3

Toy sentence. The left-to-right grid is the chain rule above; the diffusion grid is a Transformer with no causal mask, as in LLaDA.

A diffusion model drops the order. It starts with a rough guess at every position and refines all of them together over many steps. Any position can depend on any other. Image models already worked this way. Two papers asked the same question of text:

Diffusion-LM (2022)LLaDA (2025)
Size80M parameters8B parameters
CorruptionGaussian noise on word vectorsa mask token on words
DataE2E (50K reviews), ROCStories (98K stories)2.3 trillion tokens
Goalsteer text toward a controlmatch an autoregressive LLM

Failure. An infilled line contradicts the ending. Measure: score the line against references and with people (Diffusion-LM reports BLEU-4, ROUGE-L and a human rating). Fix: give the writer the right context, by reordering the training data or with a model that sees all positions.

  1. Noise for words: map words to vectors, then add Gaussian noise on a schedule.
  2. The rounding problem: why denoised vectors sit between words, and two fixes.
  3. Steering the latent: push the vectors toward a control by gradient.
  4. Diffusion-LM's report card: five control tasks, read row by row.
  5. LLaDA: masks, not noise: the masked loss and its 1/t weight.
  6. A bound you can measure: the likelihood bound and a lower-variance estimate.
  7. Unmask step by step: the sampler. The hero's second button.
  8. LLaDA's report card: benchmarks, the reversal test and compute.
  9. What diffusion costs: no KV cache, and where it still wins.
  10. Field guide: numbers, code, links and the credit.
Why can a left-to-right model not condition word 3 directly on a rule that only settles at word 8?

Chapter 1

Noise for Words

Turn each word into a vector so that Gaussian noise has something to act on

Image diffusion adds Gaussian noise to pixels, which are numbers. You cannot add 0.3 units of noise to the word "Cambridge".

An embedding maps a word to a vector of d numbers. A sentence of n words becomes n × d numbers. Diffusion-LM learns this table with the rest of the model; fixed embeddings did worse in its early tests.

The forward process adds noise over T = 2,000 steps and has no trainable weights. Call the clean vectors x0 and the noisy vectors at step t xt. Call a fresh draw of standard Gaussian noise ε, and the share of signal left at step t ᾱt.

Say it aloud

x-t equals the square root of alpha-bar-t times x-0, plus the square root of one minus alpha-bar-t, times epsilon.

xt
x-t the noisy vectors at step t, from 0 to T = 2,000.
√ᾱt
the square root of alpha-bar-t how much of the clean signal survives at step t.
x0
x-0 the clean vectors: each word's embedding plus a little noise.
√(1 − ᾱt)
the square root of one minus alpha-bar-t the noise scale at step t.
ε
epsilon a fresh draw from a standard Gaussian, one number per coordinate.
In plain words

Shrink the clean vector x-0 by the root of alpha-bar-t. Draw noise epsilon and scale it by the root of one minus alpha-bar-t. Add the two. This jumps to any step t in one move.

With numbers

With a made-up coordinate x-0 = 1.0 and epsilon = 0.5, at step t = 1,000 where alpha-bar = 0.293: x-t = 0.541 × 1.0 + 0.841 × 0.5 = 0.962. Half of what you see there is noise.

The noise schedule sets ᾱt for every step. Diffusion-LM found that image schedules waste steps on text. A small push rarely changes which word is nearest, so the early steps are too easy. Its sqrt schedule uses the total step count T and a small start constant s.

Say it aloud

alpha-bar-t equals one minus the square root of t over T, plus s.

ᾱt
alpha-bar-t the share of signal left at step t: 0.99 at the start, about 0 at the end.
t
t the current step.
T
T the number of steps: 2,000 in Diffusion-LM.
s
s a small constant, 0.0001, that sets the starting noise.
In plain words

Divide the step t by the total T. Add s. Take the square root and subtract it from one.

With numbers

At t = 0: 1 − √0.0001 = 0.99, so the noise is √(1 − 0.99) = 0.1, the paper's starting value. At t = 50: alpha-bar = 0.842 and the noise is 0.40. At t = 2,000: 1 − √1.0001, about 0: pure noise.

Noise a word until it is lost

Left: noise scale against step for two schedules. Right: 160 noisy copies of "tennis" among other word vectors; a copy is teal if "tennis" is still its nearest word. Drag the step.

50

The sqrt curve is the paper's formula (Appendix A). The cosine curve (Nichol and Dhariwal, 2021) is drawn for comparison. The five 2-D word vectors are toys; real ones have d = 16 (E2E) or 128 (ROCStories).

Failure. The loss falls fast but samples stay poor, because many steps sit at noise levels where nothing changes. Measure: at each step, the share of noised embeddings whose nearest word is still the original. Fix: a schedule that starts noisier, such as sqrt.

Why does Diffusion-LM start its schedule at a noise of 0.1 instead of near zero?

Chapter 2

The Rounding Problem

Make the denoised vectors land on real words, by changing the loss and the sampler

Denoising ends with x0: one vector per position. Rounding maps each vector back to a word, the one with the highest softmax probability. That works only if the vector sits on a word's embedding. In practice the vectors often sat between words.

The cause is the loss. The first loss asked the network to predict the mean of the next, slightly cleaner step. The rule "commit to one word" only shows up in the terms with t near 0. The fix: predict the clean vectors at every step. Call the network's guess of x0 fθ(xt, t).

Say it aloud

L-x-zero equals the sum over t of the expected squared distance between f-theta of x-t and t, and x-0.

Lx0
L-x-zero the training loss in the x0 form.
Σt
the sum over t one term for each step, from 1 to T.
E
the expected value the average over many noise draws.
fθ(xt, t)
f-theta of x-t and t the network's guess of the clean vectors, given the noisy ones and the step.
x0
x-0 the true clean vectors.
‖ · ‖2
squared distance add the squared differences over every coordinate.
In plain words

Noise a sentence's vectors to a random step t. Ask the network f-theta for the clean vectors. Measure the squared distance to the true x-0. Average over draws and add over steps.

With numbers

With made-up 2-number vectors: the guess is (0.8, 0.1) and x-0 is (1.0, 0.0). The term is 0.2² + 0.1² = 0.05. Every step now pays for a guess that is off the word.

The second fix acts at decoding. The clamping trick snaps the guess fθ to the nearest word embedding before the sampler adds noise for the next step. Each step then starts from real words.

Land on a word

Twenty denoising steps from noise toward "pub". Pick a method and press Play. The dashed ring shows the final rounding.

Toy dynamics in 2-D. The network's guesses are scripted to show each failure; the update rule is the paper's xt−1 = √ᾱ · guess + √(1 − ᾱ) · ε.

The paper's ablation (Figure 4) backs this. Predicting x0 gave good samples at every embedding size tested (16, 64 and 128). Predicting the noise ε, the usual image choice, worked at small sizes and collapsed at larger ones.

Failure. Outputs hold wrong or repeated words although the loss is low. Measure: the distance from each final vector to its nearest embedding, and the gap to the second nearest. Fix: train with Lx0 and decode with clamping.

What does the x0 loss change compared with predicting the mean of the next step?

Chapter 3

Steering the Latent

Push every word vector toward a control at once, with a gradient from a small classifier

Plug-and-play control keeps the language model frozen and adds a small classifier p(c | w). The classifier scores how well the text w meets a control c, such as a sentiment or a parse tree. Bayes' rule joins them: p(w | c) ∝ p(w) · p(c | w). FUDGE reweights each next token by the classifier. PPLM pushes the hidden states of the next token by gradient.

Diffusion-LM does the same on its continuous latents. At each denoising step it moves the vectors xt−1 uphill on two scores. Fluency comes from the diffusion model; control comes from a classifier trained on noisy latents. A weight λ trades the two.

Say it aloud

lambda times log p of x-t-minus-one given x-t, plus log p of c given x-t-minus-one.

λ
lambda the fluency weight. The paper tunes it among 0.1, 0.01, 0.001 and 0.0005.
log p(xt−1 | xt)
log p of x-t-minus-one given x-t fluency: how well the new latent fits the model's own denoising step.
log p(c | xt−1)
log p of c given x-t-minus-one control: the classifier's log probability that the target c holds.
In plain words

Score the latent x-t-minus-one for fluency and multiply by lambda. Add the classifier's score for c. Take three Adagrad steps uphill on the sum, then move to the next denoising step.

With numbers

From the paper: 200 denoising steps × 3 gradient steps = 600 updates for a 64-token sentence. PPLM spends 30 updates per token × 64 tokens = 1,920, one token at a time.

Trade fluency against control

The rings are the fluency hill; the green side is where the classifier says the control holds. The path is 20 denoising steps of 3 gradient steps each. Drag λ.

0.30

Toy 2-D latent: fluency is a Gaussian hill and the classifier a logistic edge. The 3 steps per denoising step are the paper's; the scale of λ here is ours.

Why global rules work: near t = T the latent is coarse, so the classifier shapes the whole sentence; near t = 0 it fixes single words. A later step can also repair an early mistake. A left-to-right method cannot go back.

Failure. The text meets the control but reads badly. Measure: the lm-score, the perplexity of the output under a fine-tuned GPT-2 (lower is better). Fix: raise λ. The paper calls the fluency term "instrumental" for fluent text.

What happens to the toy path when λ is tiny?

Chapter 4

Diffusion-LM's Report Card

Read the control tasks, the compositions and the infilling test against the baselines

The tests use E2E restaurant reviews. Each task draws 200 control targets and makes 50 samples per target. ctrl is the success rate; lm is the lm-score from Chapter 3. The baselines are PPLM and FUDGE on a GPT-2-small model trained from scratch, and a fine-tuned GPT-2 (FT) as an oracle that is not plug-and-play.

Read the results by task

Pick a task. Bars are control success (higher is better); the number after each bar is the lm-score (lower is better).

All numbers from Diffusion-LM: Table 2 (five tasks), Table 4 (Compose: semantic content plus syntax tree), Table 5 (Infill: ROUGE-L on aNLG). PPLM is run only on semantic content.

Check the paper's claim that it "almost doubles" the success rate. Average ctrl over the five tasks: FUDGE (69.9 + 27.0 + 17.9 + 54.2 + 46.9) / 5 = 43.18. Diffusion-LM (81.2 + 90.0 + 86.0 + 93.8 + 99.9) / 5 = 90.18. The ratio is 2.09.

TaskWhat FUDGE needsWhy it fails there
Parts of speech, syntax treeevery prefix to stay validone early mistake makes every continuation score low
Syntax spans, lengtha discriminator that plans aheadsuch a discriminator is hard to train

Diffusion-LM beat FT on syntax trees (86.0 against 76.4 for FT-search) and spans. Composing two controls is a sum of two classifier log probabilities. With semantic content plus a syntax tree, its syntax success is 74.8 against 15.4 for FUDGE, at a worse lm-score (5.92 against 3.52). For infilling it matches an autoregressive model trained on reordered stories: ROUGE-L 28.3 against 27.0, and human ratings show no significant gap.

Failure. A method looks strong on averages but breaks on one task type. Measure: report ctrl and lm per task, as Table 2 does. Fix: test both local controls (semantic content) and global ones (trees, spans, length).

On which kind of control does FUDGE fall furthest behind Diffusion-LM?

Chapter 5

LLaDA: Masks, Not Noise

Corrupt text by hiding words, and train one Transformer to predict all hidden words at once

LLaDA drops the vectors. Its corruption is a mask: a special token M that replaces a word. There is no embedding step to learn and nothing to round. The model predicts words directly with a softmax.

The forward process picks a time t between 0 and 1 and masks each token on its own with probability t. At t = 0 nothing is hidden; at t = 1 everything is. The mask predictor is a Transformer with no causal mask, so every position sees every other. It predicts all masked tokens in one pass.

Call the clean sequence of L tokens x0 and the masked one xt. The indicator 1[xti = M] marks a masked position with 1. The model's probability of the true token at i is pθ(x0i | xt).

Say it aloud

L of theta equals minus the expected value over t, x-0 and x-t of: one over t, times the sum over i of the mask indicator at i, times log p-theta of x-0-i given x-t.

L(θ)
L of theta the training loss for weights θ, in nats.
Et, x0, xt
the expected value over t, x-0 and x-t average over a random t from 0 to 1, a training text and a random masking.
1/t
one over t the weight: large when few tokens are masked.
Σi
the sum over i one term per position, from 1 to L.
1[xti = M]
the mask indicator at i 1 if position i is masked, else 0. Only masked positions count.
log pθ(x0i | xt)
log p-theta of x-0-i given x-t the log probability of the true token at i, given the masked text.
In plain words

Draw t. Mask each token with probability t. At each masked position, take the log probability of the true token. Add them, divide by t and flip the sign. Average over many draws.

With numbers

With made-up numbers: 4 tokens, t = 0.5, two masked, and the model gives the true tokens 0.7 and 0.4. Loss = −(1/0.5) × (ln 0.7 + ln 0.4) = 2 × (0.357 + 0.916) = 2.55 nats.

Why divide by t: at small t the mask hides only a few tokens, so the sum has few terms. The weight 1/t puts every masking level on the same footing, and it makes the loss a bound on likelihood (Chapter 6). MaskGIT trained without the 1/t term and has no such link.

Mask at any ratio

Each token has its own random draw; it is masked if its draw is below t. Drag t, or press BERT's fixed ratio.

0.40

Toy sentence; the masking rule and the 1/t weight are Eq. 3 of LLaDA. BERT's roughly 15% ratio is the paper's comparison.

BERT masks a fixed ratio of about 15%. It never practises the case it meets when it generates from nothing: every token masked. LLaDA draws t uniformly, so it trains at every level, all masked included.

LLaDA 8BValue
Shape32 layers, width 4,096, 32 attention heads, vocabulary 126,464
Parameters8.02B total, 6.98B outside the embeddings
Pretraining2.3T tokens, sequence length 4,096, 0.13 million H800 GPU-hours
Variable length1% of the data cut to a random length from 1 to 4,096
SFT4.5 million prompt and response pairs; only response tokens are masked

Failure. A model trained at a low, fixed mask ratio writes nonsense when asked to fill a whole answer. Measure: the loss at t from 0.9 to 1.0. Fix: draw t uniformly from 0 to 1.

Why does LLaDA draw its mask ratio t uniformly instead of fixing it near 15%?

Chapter 6

A Bound You Can Measure

Score a candidate answer with the likelihood bound, and cut the noise in that score

An autoregressive model computes the exact log likelihood of a text. LLaDA cannot. It has a bound instead: earlier work (Shi, Sahoo and Ou, all 2024) proves −E[log pθ(x0)] ≤ L(θ). A lower loss gives a tighter promise about the likelihood.

The bound also scores answers. Multiple-choice benchmarks pick the answer with the highest conditional likelihood. LLaDA estimates it by averaging the loss over random maskings. The Chapter 5 form is noisy, because the number of masked tokens swings around t × L.

The fix draws a count, not a rate. Call the count l, drawn uniformly from 1 to L, and the text with exactly l random tokens masked xl.

Say it aloud

Minus the expected value over l, x-0 and x-l of: L over l, times the sum over i of the mask indicator at i, times log p-theta of x-0-i given x-l.

−
minus flips log probabilities (negative) into a positive cost.
El, x0, xl
the expected value over l, x-0 and x-l average over a random count l and a random choice of which l tokens to mask.
L / l
L over l the weight: sequence length divided by the number masked.
Σi
the sum over i one term per position.
1[xli = M]
the mask indicator at i 1 if position i is one of the l masked, else 0.
log pθ(x0i | xl)
log p-theta of x-0-i given x-l the log probability of the true token at a masked spot.
In plain words

Pick a count l. Mask exactly l tokens at random. Add the log probabilities of the true tokens at the masked spots, multiply by L over l and flip the sign. Average over draws.

With numbers

With made-up numbers: L = 16 tokens and every token costs 2 nats. This form gives (16 / l) × l × 2 = 32 on every draw. The Chapter 5 form at t = 0.5 masks 8 tokens on average, give or take 2, so its estimate is 32 give or take 8.

Compare the spread of two estimates

Each draw estimates the same 16-token loss once. Grey uses a random rate t; teal uses a random count l. Press Draw and compare the widths.

Toy: 16 fixed per-token losses, mean 2 nats. The two estimators are LLaDA's Eq. 12 and Eq. 14 (Appendix A.2). Draws with t below 0.02 fall in the last bin.

The paper reports that the rate form needs over 1,000 Monte Carlo draws for stable results; the count form needs 128. Its benchmarks use 128 draws, and one draw for MMLU, CMMLU and C-Eval, which score a single answer token.

Failure. Multiple-choice accuracy moves from run to run. Measure: the spread of the likelihood estimate across seeds. Fix: use the count form and enough draws.

Why does masking exactly l tokens give a steadier estimate than masking each with probability t?

Chapter 7

Unmask, Step by Step

Run LLaDA's sampler: predict every masked token, keep the confident ones, mask the rest again

Generation starts from a fully masked answer of length L after the prompt. You choose L and the number of sampling steps N. Each step moves time from t down to s = t − 1/N.

  1. Predict every masked token at once.
  2. Keep some predictions and mask the rest again, so that a share s stays masked.

Random remasking keeps each new prediction masked with probability s/t. Low-confidence remasking keeps the predictions the model is most sure of. Call the number of tokens that should be unmasked at time s nun.

Say it aloud

n-un equals the floor of L times one minus s.

nun
n-un how many answer tokens are words, not masks, after this step.
⌊ ⌋
the floor of round down to a whole number.
L
L the answer length, set before sampling.
s
s the time after this step: 1 is all masked, 0 is done.
In plain words

At time s, a share 1 minus s of the answer should be words. Multiply by L and round down to get n-un. Keep that many tokens, the most confident ones, and mask the rest.

With numbers

With L = 8 and N = 4, s runs 0.75, 0.5, 0.25, 0, so n-un is 2, 4, 6, 8: two new words per step. Random remasking keeps a masked token masked with probability 0.75, then 0.667, 0.5, 0, which also gives two per step on average.

Sample an answer

The bar under each masked slot is the toy model's confidence. A token kept with confidence under 0.5 comes out wrong. Pick a strategy and a step count, then Play or Step.

4

Toy model: confidence rises when neighbours and the numbers a token depends on are already written. The prompt is the Lily example in LLaDA's Table 3; the answer tokens are ours. The keep rule is Algorithm 5 (low-confidence) and Algorithm 4 (random).

The paper's numbers agree in direction. LLaDA 8B Base on GSM8K, with length and steps both 256, scores 21.3 with random remasking and 70.0 with low-confidence (Table 9). Block diffusion splits the answer into blocks and samples them left to right. For LLaDA 8B Instruct it lifts GSM8K from 69.4 to 77.5 (Table 8).

Failure. An Instruct answer comes out far too short. Cause: SFT pads short answers with |EOS| tokens, which become confident and are kept first. Measure: the share of |EOS| in outputs. Fix: set |EOS| confidence to zero, as the paper does on five benchmarks, or sample in blocks.

With L = 16 and N = 4, how many answer tokens are words after the second step under low-confidence remasking?

Chapter 8

LLaDA's Report Card

Compare LLaDA with autoregressive models of the same size, and check what the compute bought

The main comparison is LLaMA3 8B, trained on 15T tokens, and LLaMA2 7B, trained on 2T, evaluated with the same protocol. LLaDA 8B saw 2.3T tokens. The Instruct model had SFT only; the others also had reinforcement learning.

Read LLaDA against LLaMA

Pick a view. Teal is LLaDA, blue the autoregressive models.

From LLaDA (arXiv v3): Table 1 (Base), Table 2 (Instruct), Table 4 (poem completion, 496 pairs), Tables 18 and 19 (GSM8K against pretraining FLOPs for LLaDA 8B and the 7B autoregressive baseline).

The reversal curse is a known failure of autoregressive models: they learn "A is followed by B" but not "B is preceded by A". On 496 Chinese poem pairs, LLaDA scores 51.8 forward and 45.6 reversed, a gap of 6.2. GPT-4o scores 82.7 and 34.3, a gap of 48.4.

How much compute did the 8B run use? The paper counts training FLOPs with the standard rule. Call the parameters outside the embeddings N and the training tokens D.

Say it aloud

C equals six times N times D.

C
C training compute, in floating-point operations (FLOPs).
6
six about 2 FLOPs per parameter per token forward and 4 backward.
N
N parameters outside the embeddings: 6.98 billion for LLaDA 8B.
D
D training tokens: 2.3 trillion.
In plain words

Multiply the non-embedding parameters N by the training tokens D. Multiply by six. The result is C.

With numbers

6 × 6.98 × 109 × 2.3 × 1012 = 9.63 × 1022 FLOPs. The paper's side-by-side runs against autoregressive baselines on the same data stay under 1023 FLOPs.

Failure. Someone reads Table 1 as "diffusion beats autoregression". Measure: same data, same compute. Only the 1B pair shares architecture and data exactly; the 7B baseline differs. Fix: read the scaling curves (Figure 3) next to the tables, and note the training data differ from LLaMA's.

What does LLaDA's poem result show?

Chapter 9

What Diffusion Costs

Count the passes and the work behind each answer, with and without a KV cache

An autoregressive model reuses work. Under a causal mask a token's keys and values never change, so a KV cache stores them and each new token needs one short pass. LLaDA's attention looks both ways, and masked slots change between steps. So every step runs the whole prompt and answer again.

The paper calls LLaDA incompatible with KV caching. It therefore uses plain multi-head attention with 32 key and value heads, where LLaMA3 shares 8. The trade is simple to count: L sequential passes for the autoregressive model, N longer passes for LLaDA.

Count the work for one answer

The answer is 256 tokens. Top: sequential passes, which set latency. Bottom: token positions pushed through the network, which set compute. Change the prompt and the steps.

900

Illustrative counts, not timings. The prompt default is close to GSM8K's average of 894 tokens (Appendix B.7). The 256-token answer and N from 32 to 256 match Figure 5.

The paper measured speed on one A100 with batch size 1 (Appendix B.7). On GSM8K and Math, LLaDA 8B Base matched LLaMA3 8B Base's quality at 1.5 and 1.8 times its throughput. LLaMA3 used a KV cache. On MBPP LLaDA lags. Memory for 512 tokens in and 512 out is 17.03 GB, against 16.32 GB for LLaMA3 with a cache (Table 11).

CostDiffusion-LM (2022)LLaDA (2025)
LikelihoodNLL bound 2.28 vs 1.77 (E2E), 3.88 vs 3.05 (ROCStories)a bound only, not directly comparable
Decoding200 steps, still 7 times slower than ARN passes over the full sequence; no KV cache
Trainingconverges more slowlyno RL alignment yet

Failure. Latency is high for short prompts and long answers. Measure: passes times positions per pass, then real throughput. Fix: fewer steps, at some loss of quality. The paper leaves caching and faster samplers to future work.

Why can LLaDA not reuse a KV cache the way LLaMA3 does?

Chapter 10

Field Guide

Keep the terms, the numbers, the code and the open questions in one place

Diffusion-LM put Gaussian diffusion on learned word vectors. It had to fix rounding, and then it could steer whole sentences by gradient: syntax-tree control rose from 17.9% to 86.0%. LLaDA replaced noise with masks, kept a likelihood bound, and trained 8B parameters from scratch to sit near LLaMA3 8B. Both pay in decoding: no KV cache, many passes.

TermMeaningNumber to remember
sqrt scheduleᾱt = 1 − √(t/T + s)start noise 0.1; T = 2,000
x0 losspredict clean vectors at every stepstable at d = 16, 64, 128
Clampingsnap the guess to the nearest word each stepused at decoding only
Gradient controlλ · fluency + control, 3 Adagrad steps600 updates vs PPLM's 1,920
Syntax tree ctrlshare of parses that matchFUDGE 17.9, Diffusion-LM 86.0
Masked losscross-entropy on masked tokens, times 1/tt uniform in 0 to 1
Count formmask exactly l tokens, weight L/l128 draws vs over 1,000
Low-confidence remaskingkeep the surest predictionsGSM8K 70.0 vs 21.3 random
Reversal gapforward minus reversed poem scoreLLaDA 6.2, GPT-4o 48.4
Training compute6 · N · D9.63 × 1022 FLOPs; 0.13M H800 GPU-hours

Checklist

  1. If a control is global (a tree, a length, an ending), test a model that sees all positions.
  2. For continuous text diffusion, train the x0 loss and decode with clamping.
  3. Check the noise schedule: count how often noise changes a vector's nearest word.
  4. For masked diffusion, draw the mask ratio uniformly and keep the 1/t weight.
  5. Score answers with the count form and enough draws.
  6. Sample with low-confidence remasking; watch the |EOS| share on SFT models.
  7. Compare with autoregressive models at matched data and compute, not across tables.
pythonimport torch, torch.nn.functional as F
MASK = 126336                                  # id of the mask token (any unused id)

def llada_loss(model, x0):                  # x0: (B, L) token ids
    B, L = x0.shape
    t = torch.rand(B, 1).clamp(min=1e-3)      # one mask rate per sequence
    masked = torch.rand(B, L) < t              # mask each token with probability t
    xt = torch.where(masked, MASK, x0)
    logits = model(xt)                         # (B, L, V); no causal mask inside
    ce = F.cross_entropy(logits.transpose(1, 2), x0, reduction="none")
    return (ce * masked / t).sum(1).mean() / L  # 1/t weight, masked tokens only

@torch.no_grad()
def sample(model, prompt, L=256, N=64):     # low-confidence remasking
    x = torch.cat([prompt, torch.full((L,), MASK)])
    P = len(prompt)
    for k in range(N):
        s = 1 - (k + 1) / N                      # time after this step
        probs = model(x[None]).softmax(-1)[0, P:]  # predict every slot at once
        conf, pred = probs.max(-1)
        ans = x[P:]
        conf[ans != MASK] = 2.0                   # written tokens stay written
        n_un = int(L * (1 - s))                   # floor(L(1 - s)) words after this step
        keep = conf.topk(n_un).indices
        new = torch.full((L,), MASK)
        new[keep] = torch.where(ans[keep] != MASK, ans[keep], pred[keep])
        x[P:] = new
    return x[P:]

What the authors leave open

Diffusion-LM lists three drawbacks: higher perplexity, slower decoding and slower training. LLaDA lists more. You set the answer length by hand. Matched comparisons stop below 1023 FLOPs. There is no KV cache or special attention, the samplers are early, and there is no RL alignment yet. Multimodal data and agent use are untested.

Keep going

Credit: Session 18 of Georgia Tech CS 8803, LLM seminar. Papers: Diffusion-LM Improves Controllable Text Generation (Li et al., 2022, arXiv 2205.14217) and Large Language Diffusion Models (Nie et al., NeurIPS 2025, arXiv 2502.09992 v3). The toy models and all made-up numbers are ours.

The takeaway. Left-to-right is one way to factor a text's probability, not the only one. A model that refines every position together can aim at rules that span the sentence and can read both directions. It pays for that at decoding time.

Teach it back: open Present or Teach and explain rounding and low-confidence remasking to a friend. Then go back to the story and predict which writer sets up "under there" before you press Play.

CS 8803 LLM Seminar, Session 18: Diffusion Language Models
Diffusion-LM paper · LLaDA paper · Back to Gleams