Diffusion Language Models
Language AI HandbookAll chapters In a basic left-to-right sampler, each next-token probability is conditioned on the committed prefix. Speculative verification can check several candidates in one target model pass while preserving that factorization. Masked diffusion uses a different conditional. It can infer several missing positions from visible tokens on either side.
The chain rule writes a string’s joint probability as a product of next-token probabilities conditioned on its prefixes. For a string of length over a vocabulary of tokens, a parameter-shared causal model computes categorical factors, one per position. Teacher forcing supplies the observed prefixes, and a causal mask lets one forward pass score all positions during training. Unrestricted conditional tables still have independent parameters, just like the full joint distribution. Left-to-right sampling commits to the position order chosen by the model.
In the absorbing-mask formulation used here, generation begins with a sequence of [MASK] tokens. At each step the model sees the partial sequence and predicts a distribution over the original token at each masked position. The sampler can reveal several positions together and choose their order. Samplers that allow remasking can also reconsider an earlier reveal.
Several positions can be proposed in a single model call. A -round sampler uses fewer sequential calls than a basic -call autoregressive sampler when , though each full-sequence call evaluates every position. Visible text on either side of a gap can guide an infill. A sampler that explicitly remasks previous predictions can also revise them. The application and implementation determine how these choices affect quality and elapsed time.
Discrete diffusion has been used for text at character and token resolution. D3PM includes character-level experiments. In LLaDA’s same-data scaling study, the smaller models match in architecture dimensions, while the larger diffusion and autoregressive models have 8.02B and 6.83B total parameters, respectively. The published comparison against an external Llama 3 8B uses different training data. D3PM. LLaDA, §3.1 and Appendix B.2
The trade-offs are real, and you should understand them before proceeding:
- Likelihood evaluation. The reverse chain defines a normalized distribution. Evaluating its exact likelihood can require summing many latent paths. Training commonly optimizes a variational bound, and benchmark reports should label an exact value, a bound, or an estimate of that bound.
- Sampling work. This full-sequence implementation evaluates all positions in each of denoising rounds. Bidirectional computation over changing tokens lacks the unchanged-prefix cache used by ordinary causal decoding.
- Sampling policy. The schedule and order determine which intermediate inputs the denoiser sees. Confidence ordering or token revision may implement a different sampler from the fixed reverse transitions used to derive the objective.
A likelihood bound and a measured runtime answer different questions. Report the estimator and normalization for likelihood. For speed, measure the complete request under a fixed hardware, precision, sequence-length, and batch protocol. The number of serialized model calls and the positions evaluated per call help explain those measurements.
The worked example distinguishes three quantities: the per-position predictions, the joint posterior they approximate, and the likelihood bounded by the objective. We define the corruption process and training objective, verify the calculation by enumerating a two-token example, then train and sample from a small model.
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!