Diffusion Language Models › Sampling
Language AI HandbookAll chapters Start each position at . At step , evaluate the denoiser on the current state, then draw each reveal decision with probability for the linear schedule. For each selected position draw a clean token from its predicted categorical distribution. Copy the other positions through unchanged.
Schedules and the quality/latency dial
Changing changes both the number of model calls and the distribution of reveal groups. At , independent reveal decisions still allow some steps to reveal several tokens and others to reveal none. Alternatively, a decoder can explicitly reveal one position per call and require exactly calls. In that case every next draw conditions on the previously revealed tokens.
Heuristic sampling: where theory stops
Some decoders replace random Bernoulli selection with a fixed count such as , where is the number of remaining masks. They can choose those positions at random or rank candidate tokens by the denoiser's confidence. LLaDA describes a confidence heuristic in which the lowest-confidence predictions at still-masked positions are kept masked. Tokens committed at earlier steps stay visible. A different revision algorithm may explicitly mask previous commitments again. Both selecting by confidence and revising positions change the sampler, so the likelihood bound from the derived random-reveal model does not automatically describe their output distributions.
Self-conditioning
A denoiser may also receive its own earlier clean estimate as input. This is called self-conditioning. It changes what the prediction depends on, beyond the current partial string and the time. To implement it, provide the same kind of signal during training that later steps will have at generation time. Training and inference implementations can have different costs if inference reuses an estimate that it has already computed.
Compute, latency, and the missing cache
Count only generated positions and hold the model width and prompt length fixed. Cached autoregressive decoding adds one new position per generation step. Naive full-sequence denoising recomputes all positions at each of its steps. The total counts are and respectively, before accounting for attention. With dense attention over positions, total attention work across the denoising rounds scales as for fixed width.
The ratio below counts evaluated positions relative to the cached autoregressive baseline. Attention operations and elapsed time require separate accounting.
PythonIn [10]Expand
import numpy as np
step_budgets = np.array([4, 8, 16, 32, 64])
relative_work = step_budgets.astype(float)
budget_labels = [str(int(t)) for t in step_budgets]
budget_xpos = np.arange(len(step_budgets))VisualizationOut [11]Expand

The naive denoiser may need fewer sequential network calls when . Timing depends on the cost of each call, memory movement, batch size, precision, hardware and implementation. Position counts alone give no wall-clock prediction. In a fully bidirectional transformer, even a visibly unchanged position can have a new hidden representation after a mask elsewhere is filled, which prevents ordinary causal KV caching across rounds. Block diffusion defines a different attention structure, allowing completed blocks to be cached while denoising the next block.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!