↑↓ move Enter open ⌘K find from any page 256 of 256 tabs
Loading recorded inference…

What a masked diffusion language model is

A GPT-style decoder writes an answer one token at a time, left to right, each token conditioned on the ones before it. A masked diffusion language model writes it another way. It starts from an answer made entirely of a special [MASK] token and, over a number of steps, replaces masks with words in whatever order it is most sure of. The network behind it is an ordinary transformer without the causal mask: at every step it reads the whole sequence and predicts a token for every masked slot at once.

The page records LLaDA-8B-Instruct (8,015,581,184 parameters) answering “Why is the sky blue? Answer in one sentence.” The chat-formatted question is 24 tokens, followed by 24 answer slots that all start as [MASK], so each step runs 48 positions through the model. The sampler takes 24 steps at temperature 0, unmasks one slot per step, and ends with “The sky appears blue because the Earth's atmosphere scatters blue light more than any other color in the spectrum.”

Masking forward, predicting backward

A diffusion model learns to undo a gradual corruption. For images the corruption adds Gaussian noise (see the DiT tab). For text, LLaDA uses the simplest discrete corruption, masking: pick a time between 0 and 1 and replace each token of the clean sequence by [MASK] independently with probability . At nothing is masked; at everything is.

The reverse process needs one thing from the network: for every masked slot, a distribution over the clean token, given everything that is not masked. Training is therefore masked-token prediction at a random masking ratio, with each slot's cross-entropy weighted by :

With this weighting the loss is an upper bound on the negative log-likelihood of the data, so minimising it trains a generative model of whole sequences rather than a fill-in-the-blank scorer. BERT, by contrast, always masks a fixed 15 % of tokens and has no such bound. The network is never told : for masked diffusion the clean-token conditionals do not depend on it (RADD), so LLaDA's transformer takes no time input. The Training objective popup draws the loss. Pre-training masks the whole sequence, while the Instruct model's fine-tuning masks only the response and keeps the prompt clean. The recording is a run of the sampler, not of training.

Bidirectional attention over prompt and masks

Each masked slot is predicted from context on both sides, so attention has no causal mask. In the Bidirectional Self Attention card every one of the 48 positions, prompt tokens and [MASK] slots alike, attends to all 48, and each row of weights sums to 1 over all of them; the page draws 8 of the 48 columns.

[MASK] is an ordinary row of the embedding table (id 126336), so every masked slot enters block 1 with the same vector. Only position tells them apart: RoPE (base 500,000) rotates queries and keys before the dot product, so a score depends on the offset between two positions. Apart from the missing mask the block is a Llama-style decoder block: 32 blocks of width 4096 with RMSNorm, 32 heads of 128 dimensions, and a SwiGLU MLP, 4096 → 12288 → 4096.

Bidirectionality has a cost. In a GPT-style decoder the keys and values of earlier tokens never change, so they are cached and each new token costs one position. Here every step changes the input and every position sees every other, so the plain sampler runs all 48 positions through all 32 blocks at each of the 24 steps.

Low-confidence remasking

At each step the model predicts every masked slot, but the sampler keeps only some of the predictions. The low-confidence remasking rule takes the arg-max token at each masked slot and its probability , the confidence; it keeps the most confident and puts [MASK] back on the rest:

With 24 slots over 24 steps, , and a kept token never changes again. The Remasking rule popup shows the rule. The Denoising strip shows each step's slots with their confidence bars: at step 1 the model guesses all 24 slots and keeps only “The”, at 0.99. The Probabilities column lists the 16 most likely tokens at the chosen slot, out of a vocabulary of 126,464. The alternative rule, random remasking, keeps slots chosen at random.

The order that results is not left to right. After “The”, “sky”, “blue” and “because”, the sampler fixes the end-of-text tokens and the full stop in slots 22–24 at steps 5–7, before most of the middle. The model is sure early on how the sentence ends and how long it is. The least confident token kept is “ the” at step 9, at 0.332. At step 2, “ sky” and “ blue” had the same bf16 confidence and torch.topk kept “ sky”; the strip marks the tie.

Unmasking several tokens per step is where diffusion language models hope to gain speed; keeping one per step, as here, needs as many passes as answer tokens. LLaDA can also split a long answer into blocks that are unmasked left to right (semi-autoregressive remasking). This recording uses a single block of 24.

Where masked diffusion came from

Austin et al.'s D3PM (2021) carried diffusion to discrete data with transition matrices. One of their choices, an absorbing [MASK] state, tied diffusion to masked and autoregressive models. MaskGIT (2022) generated images with a bidirectional transformer that predicts all masked tokens at once and keeps the most confident, the rule this page uses for text. In 2024 MDLM and MD4 reduced the absorbing-state bound to a weighted sum of masked-token cross-entropies; MDLM approached autoregressive perplexity. RADD showed the network need not see the time. LLaDA (2025) trained such a model from scratch at 8B parameters, with pre-training and supervised fine-tuning, and reported it competitive with LLaMA3 8B in in-context learning.

The Encoder tab (ModernBERT) shows the fixed-ratio masked language model this one generalises, and the DiT tab shows diffusion over continuous image latents.

Papers

  1. Large Language Diffusion Models Shen Nie et al. · arXiv 2025 LLaDA, the model this page records: a masked diffusion language model trained from scratch at 8B parameters, with the low-confidence remasking sampler.
  2. Structured Denoising Diffusion Models in Discrete State-Spaces Jacob Austin et al. · NeurIPS 2021 D3PM: diffusion over discrete tokens, including the absorbing [MASK] state that links diffusion to masked language models.
  3. Simple and Effective Masked Diffusion Language Models Subham Sekhar Sahoo et al. · NeurIPS 2024 MDLM: the masked-diffusion bound as a mixture of masked-language-modelling losses, approaching autoregressive perplexity.
  4. Simplified and Generalized Masked Diffusion for Discrete Data Jiaxin Shi et al. · NeurIPS 2024 MD4: the continuous-time objective as a weighted integral of cross-entropies, the form of the 1/t-weighted loss.
  5. Your Absorbing Discrete Diffusion Secretly Models the Conditional Distributions of Clean Data Jingyang Ou et al. · arXiv 2024 RADD: why the network needs no time input, and the link between absorbing diffusion and any-order autoregressive models.
  6. MaskGIT: Masked Generative Image Transformer Huiwen Chang et al. · CVPR 2022 Parallel decoding with a bidirectional transformer that keeps its most confident predictions, the ancestor of the remasking rule.

See also