Every model on this page is the same stack of transformer blocks with two dials set differently: the attention mask (which positions each position may read) and the objective (which tokens it is asked to predict, from what input). The mask decides what can be cached and whether the model can generate; the objective decides how much training signal each sequence gives. Multi-token prediction and diffusion attack the decoder's one-token-per-forward loop from opposite sides.
You need: the decoder block and its causal attention (The transformer from zero) and what a KV cache holds (Attention variants). Width, depth, the attention variant and mixture of experts are shared by every family; recurrent mixers (Beyond attention) have no bidirectional form. The root, Topic: llm-architecture, puts the three families in one table in its section 10; this page owns the masks, the objectives, MTP and diffusion LMs.
Running example: the topic's tiny GPT (6 layers, 256 wide, 5.8M parameters) trained on TinyStories, its reference checkpoint ref_baseline_s1500 (held-out loss 2.278), and the 256-token running sequence about Roxy the rhinoceros. Labels: measured on Apple M1 Pro here; vendor; independent; derived with the formula shown.
Eight positions per family, illustrative choices of which are hidden; the rates are the real ones (BERT 15%, T5 15% in spans of mean 3, LLaDA one random rate t per sequence).
| Family | Mask | Objective | Loss terms per 256-token window | Generates by | Used for, October 2026 |
|---|---|---|---|---|---|
| Decoder-only (causal LM) | causal: position i reads 0..i | next token | 255 (every position) | one token per forward, KV cache | almost every chat, code and reasoning model |
| Encoder (masked LM) | bidirectional: every position reads every position | recover masked tokens (BERT: 15%) | about 38 | it does not, in practice | embeddings, retrieval, rerankers, classifiers (ModernBERT, Ettin) |
| Encoder-decoder | bidirectional encoder; causal decoder that also reads the encoder (cross-attention) | span corruption (T5) or input to output | targets only (about a fifth of input length in T5) | decoder, one token per forward; input encoded once | input-heavy tasks: translation, summarisation, speech (Whisper), T5Gemma 2 |
| Prefix LM | bidirectional over the prompt, causal after it | next token on the continuation | continuation only | like a decoder | a training mode (UL2's S-denoiser, T5Gemma's PrefixLM), rarely a product |
| Decoder + MTP | causal | next token plus one or more further tokens | 255 + 254 per extra depth | one token per forward, or 1 to 2 with the MTP draft verified | DeepSeek-V3/V3.2, GLM-4.5, Qwen3-Next, MiMo, Gemma 4 |
| Masked diffusion LM | bidirectional | recover tokens masked at a random rate t, weighted 1/t | a random share t of positions | start fully masked, unmask many tokens per forward in any order | fast generation: Mercury, Gemini Diffusion, DiffusionGemma; LLaDA in research |
Attention scores form a T by T matrix: row i is the query (the position asking), column j the key (the position read). The mask adds minus infinity to forbidden cells before the softmax, so their weight is exactly zero. Left unmasked, a model asked to predict token i+1 while it can see token i+1 learns to copy; the mask is how one architecture serves both understanding and writing. The first 12 tokens of the running sequence under each pattern, the marked query (a ball, an illustrative choice) fed by every key it may read:
Fig. 2 · Which keys each query may read, and what that lets you cache
The mask is free and decides the cache. Same FLOPs, same parameters. A causal model's past keys and values never change when a token arrives, so they are computed once and kept: the KV cache. Under a bidirectional mask every new token changes every earlier position's output, so an encoder or a diffusion LM recomputes the whole sequence every pass. An encoder-decoder's decoder caches its own causal KV plus the cross-attention keys and values of the encoder output, computed once per input; T5Gemma 2 fuses the decoder's self- and cross-attention into one attention with one mask.
A mask is a training-time contract. Step 5 is the test: we took the reference tiny GPT, trained causally, and changed only the mask at inference (src/lab/masks.py, the topic's 20 fixed held-out batches of 32 windows, 640 windows of 256 tokens; correction: the 2026-10-18 page said "20 windows", checked against the script). Predict before it plays: with a bidirectional mask the model can see the very token it must predict. Does its loss go down?
measured on Apple M1 Pro (CPU, 4 threads), 2026-10-18; the causal row reproduces the topic's reference 2.278 (measured there on MPS). The loss rises by nats: the model never learned to use the future, and the extra keys disturb representations learned under the causal contract. With a 128-token prefix even the causal suffix degrades, because it reads keys computed under a mask the model never saw. What transfers: the direction (a mask is learned, not a switch); the size of the gap does not.
kv_idx <= q_idx (masking_utils.py line ); bidirectional_mask_function returns q_idx >= 0, always true (line ). ModernBERT sets self.is_causal = False (modeling_modernbert.py line ).modeling_t5gemma2.py line , "Fused causal and encoder mask".| mask at inference | held-out loss | first 128 positions | last 128 positions | running sequence |
|---|---|---|---|---|
| causal (as trained) | ||||
| bidirectional | ||||
| prefix LM, prefix 128 |
Click any token to make it the query: highlighted tokens are the keys it may read; the green underline marks the positions the family's objective scores (BERT's 15% sample for the bidirectional case); the slider moves the prefix or encoder boundary.
The code that ran. The topic's tiny GPT builds an additive mask in attn_bias (root src/data/tiny_gpt.py); this page swaps in a version with a mode switch without editing the shared file (src/lab/fo_common.py):
MASK = {"mode": "causal", "prefix": 0}
def attn_bias(cfg, layer_idx, q_pos, k_pos, device, slopes=None):
diff = q_pos[:, None] - k_pos[None, :]
if MASK["mode"] == "causal":
keep = diff >= 0
elif MASK["mode"] == "bidir":
keep = torch.ones_like(diff, dtype=torch.bool)
elif MASK["mode"] == "prefix":
keep = (diff >= 0) | (k_pos[None, :] < MASK["prefix"])
return torch.zeros(keep.shape, device=device).masked_fill(~keep, float("-inf"))[None]
def enable_masks():
tiny_gpt.attn_bias = attn_bias
tiny_gpt.is_local = lambda cfg, li: True # forces the explicit softmax path (SDPA would apply is_causal)
Output of masks.py (scrubbed of timings), Apple M1 Pro, CPU, torch 2.14.1. The is_local override matters: the tiny GPT's fast path calls F.scaled_dot_product_attention(..., is_causal=True) and would ignore any custom mask.
Which positions are masked or corrupted is one seeded draw (illustrative positions); the rules are the real ones.
An objective turns raw text into (input, target) pairs and a loss. The same 40 tokens of the running sequence under six of them; the top row is what the model reads, the bottom row what it is scored on:
[MASK] and 1 stayed unchanged (green), none a random token (struck through when it happens). All 6 are scored, each from both sides.<X0> stands for <extra_id_0>): input 37 tokens, target 9 (the sentinels, the hidden tokens and a closing sentinel). The encoder reads the input both ways, the decoder writes the target.[MASK], 10% a random token, 10% stay unchanged, because [MASK] never appears at fine-tuning and a model that only sees [MASK] at scored positions learns nothing useful about real tokens there. transformers 5.20.1 keeps these defaults in DataCollatorForLanguageModeling: mlm_probability = 0.15, mask_replace_prob = 0.8, random_replace_prob = 0.1 (data/data_collator.py lines ). The cost is signal: about 38 loss terms per 256-token window against CLM's 255. ELECTRA (Clark et al. 2020, ICLR 2020) answered with replaced-token detection, where "the task is defined over all input tokens rather than just the small subset that was masked out"; ModernBERT raised the masking rate to 30%.<extra_id_0>, ...); the target is each sentinel followed by the tokens it replaced. T5's default corrupts 15% in spans of mean length 3 (T5 paper page, whose Reading runs T5's own masking code on text you type). Per 512 input tokens the target is tokens ( corrupted, sentinels, one end token), so the decoder, the expensive autoregressive half, works on about a fifth of the text.| objective | input tokens | loss terms | each scored token sees | generates? |
|---|
derived: MLM 15% of 256; T5's lengths from its random_spans_helper arithmetic (round(0.15 L) noise tokens, round(noise / 3) spans, one sentinel per span, one end token); prefix LM with a 128 prefix; MTP one extra depth; diffusion at the mean rate 0.5.
Pair the next-token objective with a bidirectional mask and the target sits in the input, one position to the right: one attention head that reads position i+1 solves the task. We fine-tuned the reference tiny GPT for 150 steps (16 windows of 256 per step, learning rate 1e-3) with exactly this mistake (src/lab/masks.py):
Fig. 4 · The loss collapses below anything the data allows: the same checkpoint before and after 150 steps of leaking
Greedy decoding from the opening of the running sequence, the reference model against the leaky one:
Real output, greedy, 40 tokens (src/lab/out/masks.json), measured on Apple M1 Pro (CPU), the same run as the figure.
Writing your own attention with F.scaled_dot_product_attention(q, k, v) and forgetting is_causal=True (the default is False); passing a padding mask and assuming it also makes attention causal; or loading a decoder checkpoint into an encoder class. The symptom is always the same: a training loss far below anything plausible for the data (here nats per token on stories whose honest loss is about 2.3), then nonsense at generation. A loss that is too good is a bug until proven otherwise.
Many jobs never generate text: embed a query and a million documents and find the nearest, label a ticket, score whether a passage answers a question. For those the best representation of each token uses the words on both sides, in one forward pass. An encoder is the same stack with a bidirectional mask, trained with MLM; a task head reads its per-token vectors: a pooled vector for classification and embedding models, a relevance score over a concatenated query and document for a cross-encoder reranker, per-token labels for tagging. A decoder takes the same small head, but under the causal mask only the last position has seen the whole text, so the head reads the last non-padding token's hidden state (with right padding, simply reading the last position reads a pad token instead); on one IMDb split Raschka's fine-tuned GPT-2 124M reached 91.88% against ModernBERT large's 95.07%, single runs (Raschka on text classification).
Measured: both sides win, once the model has learned to use them. The masked diffusion model of section 8 is, at a fixed rate, an MLM encoder adapted from the reference tiny GPT. We hid a fixed random 15%, 50% or 90% of 16 held-out windows and asked it to recover them in one bidirectional pass; the causal reference predicted the same positions from the true left context (every real token before the blank, which the encoder is not given). Predict: at 90% hidden, which wins?
At 15% hidden the encoder beats the causal model clearly; at 90% the order reverses, because the encoder sees almost nothing while the causal model still sees the true past. That is why MLM masks a small share, and why a diffusion LM's first steps, with almost everything masked, are its least certain. Turning right-hand context into accuracy has to be learned: after the first adaptation steps the encoder did not yet win at 15% ( against the causal ). At full pretraining the gap is the same sign: BERT Table 5 gives 87.9 against 77.8 F1 on SQuAD dev for the same model trained left to right.
What changed since BERT. RoBERTa dropped next-sentence prediction (which the BERT paper page treats as unproven: one run, reversed by RoBERTa) and trained longer on more data with dynamic masking. ModernBERT (December 2024) brought the decoder era's parts into an encoder: RoPE, GeGLU, alternating global and 128-token sliding-window layers, MLM at 30%, 2 trillion tokens at native context 8,192; base about 149M parameters, large about 395M. Ettin (Seq vs Seq paper page, July 2025) trained encoders and decoders in pairs on the same data and recipe from 17M to 1B: encoders win classification and retrieval, decoders win generation, at every size, and 50B tokens of continued training on the other objective closes neither gap (the 400M encoder reaches 91.3 on MNLI against the 1B decoder's 89.9).
Cost and how to check. An encoder forward costs about 2N FLOPs per token (N parameters), like a decoder's prefill, with no KV cache afterwards; at 149M parameters it embeds a chunk in one pass on a CPU. Size buys a decoder-as-embedder its lead back only at large ratios (the Ettin paper page puts the largest ratio a native model wins at 2.7x, against the abstract's "10x"). An encoder's config names a ...ForMaskedLM or ...Model class rather than ...ForCausalLM, its attention sets is_causal = False, and its tokenizer has a [MASK] (or <mask>) token; model.generate either fails or produces filler.
| share hidden | positions scored | encoder (both sides, corrupted) loss | top-1 | causal (true left context) loss | top-1 |
|---|
Final model; the -step model reached top-1 at 15%.
global_attn_every_n_layers (default 3) and halves local_attention (128) into a 64-token window on each side (configuration_modernbert.py lines and ).Top-1 accuracy on the hidden positions, measured on Apple M1 Pro (CPU), src/lab/diff_eval.py, after adaptation steps.
A bidirectional encoder reads the input once; a causal decoder writes the output, and in every block a cross-attention layer lets each output position read every encoder vector (the encoder-decoder view of the mask figure in section 1). The input can be long and fully bidirectional while generation stays causal.
Fig. 5 · Read the input once, cross-attend from every decoder layer
Twice the parameters, the same FLOPs. T5 compared architectures at equal compute (Table 2 of T5): a 12 + 12 layer encoder-decoder has twice the parameters (2P) of a 12-layer decoder yet the same FLOPs (M) over an input plus target of the same total length, because each token passes through only one 12-layer stack:
| T5 Table 2 (denoising objective) | params | FLOPs | GLUE | SuperGLUE | CNN/DM |
|---|---|---|---|---|---|
| encoder-decoder | 2P | M | 83.28 | 71.36 | 19.24 |
| encoder-decoder, shared weights | P | M | 82.81 | 70.73 | 18.78 |
| prefix LM (decoder-only) | P | M | 81.82 | 68.11 | 18.61 |
| language model (causal decoder) | P | M | 74.70 | 55.02 | 17.93 |
Published, T5 Table 2 (arXiv 1910.10683; values as printed in the T5 page's tables.json), 220M-class models, one run each; the T5 page puts the paper's run-to-run noise at a fraction of these gaps. With fine-tuning on understanding-heavy benchmarks, bidirectional reading of the input was worth about 7 to 8 GLUE points over a causal decoder in 2019.
Why decoders won anyway. Wang et al. 2022 (arXiv 2204.05832, models over 5B parameters on 170B tokens) found that after purely unsupervised pretraining causal decoders have the strongest zero-shot generalisation, while non-causal MLM models win only after multitask fine-tuning. A general assistant answers anything zero-shot and writes long outputs from short prompts, and one stack makes caching, batching and serving simpler.
Where encoder-decoders still win: long input, short output tied to it: translation, summarisation, speech recognition (Whisper: "We chose an encoder-decoder Transformer", Radford et al. 2022, section 2.2). T5Gemma and T5Gemma 2 (paper page) build encoder-decoders by copying a pretrained decoder's weights into both stacks and continuing with UL2 or PrefixLM: after instruction tuning the 2B-2B beats Gemma 2 2B by 7.1 points (46.1 against 39.0); the unbalanced 9B-2B decodes at about 1.05x Gemma 2 2B's latency with much higher accuracy on GSM8K; T5Gemma 2's 4B-4B scores 81.7 on RULER 32K against Gemma 3 4B's 66.8 although pretrained at 16K (57.6 against 51.7 at 128K). The paper page's verdict: the direction is believable, the sizes are single runs from models with about twice the parameters. The shape is also back at frontier scale for a serving reason rather than quality: DeepSeek-V4.1-Flash (September 2026, 552B, open) splits 40 layers into a 20-layer encoder and a 20-layer decoder to shrink the KV cache of long agent loops (DeepSeek owns how).
A prefix LM is a decoder with the prefix mask of section 1: prompt read bidirectionally, continuation causally, only the continuation scored. It buys most of the encoder-decoder's gain with one stack (T5 Table 2: 81.82 against 83.28 GLUE; the causal LM 74.70). The price is at inference: the prompt's keys and values depend on the whole prompt, so a prompt cannot be extended without recomputing its cache, which breaks the multi-turn and prefix-caching tricks serving relies on (Batching, KV cache and scheduling). And it has to be trained as one: our causal checkpoint run with a 128-token prefix got worse even on the scored suffix (section 1). A fine-tuning-time variant keeps the causal model and adds a bidirectional read: Bitune reads the prompt twice, causally and bidirectionally with an adapter each, mixes the two sets of keys and values per block with learned weights and still generates causally (+0.1 to +4.0 points over LoRA on five 2B to 8B models, for about 3 times the fine-tuning time).
UL2 (Tay et al., arXiv 2205.05131) mixes three denoisers in one run, each announced by a mode token: R (regular span corruption, mean spans 3 and 8 at 15%), S (sequential: one span covering the last quarter of the input, which is prefix LM), X (extreme: spans of 64 tokens or corruption at 50%). Its 20B model reported beating 175B GPT-3 on zero-shot SuperGLUE (vendor, 2022). UL2 survives as the adaptation objective of T5Gemma.
Next-token prediction asks each position about one token, so a model can do well on local patterns without planning; and at inference the decoder makes one forward per token, each limited at small batch by reading the weights from memory, not by arithmetic (Performance math). Multi-token prediction adds loss terms for tokens two or more places ahead: a denser training signal, and a ready-made guess for the next forward to check.
Fig. 6 · Two ways to predict the token after next: the sequential module is told the next token
eh_proj in the checkpoint)Cost. One extra block in training, nothing at inference: the module can be discarded. DeepSeek-V3's MTP layer is 13.46B parameters, mostly its own stored copies of the embedding and output head, which is why the Hub says 685B where the paper says 671B (bill in the closed block). Benefit, published: DeepSeek-V3 Table 4 shows real but small single-run gains at 15.7B and 228.7B (and MMLU 0.9 lower at large scale); as a draft in serving, the second-token guess has "between 85% and 90%" acceptance and gives "1.8 times TPS" (section 5.4.3).
The baseline tiny GPT with a sequential depth-1 module beside it, λ = 0.3, at exactly the reference budget (1,500 steps of 8,192 tokens, same seed, schedule and batches; src/lab/train_mtp_joint.py, MPS). Predict, then switch the x-axis:
At equal tokens the main model's loss ends at with MTP against for the reference (seed 0), and against with seed 1, gaps several times the rerun spread of the seed-0 baseline (2.2744 to 2.2811). But the module adds a seventh block and a second pass through the output head, more training FLOPs per step (derived from the Block lab's FLOP counts); spent on plain next-token training instead (1,980 steps), the baseline reaches . At equal compute MTP loses at this scale, in line with Gloeckle et al.'s small-model result (their parallel heads; ours is the sequential design) and with DeepSeek's evidence being single runs at large scale. What transfers: an MTP loss is cheap to add and free at inference; whether it pays must be measured at equal compute and at your scale.
Both designs trained on top of the frozen reference, 600 steps each, only the module learning (src/lab/mtp_frozen.py, CPU). In self-speculative greedy decoding each forward of the main model checks the previous draft and makes a new one, so it emits 2 tokens when the draft was right and 1 when it was wrong, and the output is identical to plain greedy decoding. One prompt, the running sequence's opening, decoded with each draft:
Over the 8 evaluation prompts, 120 new tokens each, the sequential draft gives tokens per forward and the parallel head , output identical to plain greedy in every case (). The sequential module, told token t+1, predicts t+2 almost as well as the main model predicts t+1; the parallel head must guess t+1 too. Tokens per forward is not speed: on a GPU the verifying forward costs about a normal decode step only while decoding is memory-bound; Speculative decoding owns the batch-size crossover and the acceptance rule for sampling.
measured on Apple M1 Pro (CPU), 2026-10-18; greedy, no KV cache (each forward recomputes the sequence; counts of forwards, not timings, are the result).
The Config calculator (on Topic: llm-architecture) counts DeepSeek-V3's MTP layer at parameters (13.46B), which with the main model's and 41.5M FP8 scales reproduces the Hub's 684,531,386,000 exactly. Split by the formula above (derived, src/lab/make_page_data.py from the calculator's DeepSeek-V3 config):
| part of the MTP layer | parameters | share |
|---|
The checkpoint stores its own copies of the embedding and output head inside layer 61 (the calculator's mtp_copy; GLM-4.5 does the same, Qwen3-Next does not), although training shares them. Loading DeepSeek-V3 in transformers 5.20.1 silently drops the layer: _keys_to_ignore_on_load_unexpected = [r"model\.layers\.61.*"] (modeling_deepseek_v3.py line ), so a "671B" model in memory is correct and the MTP draft is not there, while serving engines load it for drafting (Speculative decoding lists 27 MTP model types in vLLM v0.31.0).
| DeepSeek-V3 Table 4 | small MoE | + MTP | large MoE | + MTP |
|---|
Published (DeepSeek-V3 Table 4, values from the DeepSeek-V3 paper page's tables.json): small 15.7B total (2.4B active) on 1.33T tokens, large 228.7B (20.9B active) on 540B tokens; the MTP module is discarded at evaluation, so inference cost is identical. The paper page's verdict: real but small, single-run gains.
| predictor (128 held-out windows) | parameters | loss | top-1 | agrees with main model's greedy choice |
|---|
The last column is the draft acceptance rate under greedy decoding with a teacher-forced prefix.
| prompt | sequential: forwards | tokens per forward | acceptance | parallel: forwards | tokens per forward | acceptance | joint-trained module: tokens per forward | identical to greedy |
|---|
Acceptance counts every forward after the first (which has no draft yet). The joint-trained column uses the main model and module trained together from scratch, decoding that model's own greedy text.
derived: expected tokens per forward = 1 + a + a² + ... + ak when each further draft token is accepted with the same probability a and only after the previous one. Defaults: DeepSeek-V3's lower reported acceptance (85%) at its trained depth 1 gives 1.85 tokens per forward against the 1.8x TPS they report (vendor, section 5.4.3): the small gap is the cost of the extra module and verification.
Training loss on the token two places ahead, 600 steps of 16 windows of 256, AdamW lr 1e-3, only the module learning (trunk, embedding, final norm and head frozen). The sequential module starts from a better place because it is given the real next token. Parameters: sequential (one block plus the 512 to 256 projection and two norms), parallel ; main model .
A decoder writes 48 tokens in 48 forwards, each waiting for the last. An image diffusion model starts from noise and refines the whole picture at once over a fixed number of steps (Diffusion from zero teaches it for pixels). A diffusion language model does the same for text with masking as the noise: start from a row of [MASK] tokens and fill in several per forward, in any order. Here is ours (the reference tiny GPT adapted into one, below) writing the same 48-token continuation of the running sequence's opening that the causal model writes token by token:
Fig. 7 · Fewer sequential forwards, more token positions processed: one continuation, two decoders
[MASK] tokens.[MASK] at t = 1.Why 1/t: at rate t the expected number of masked tokens is tL; dividing by t makes every rate contribute a comparable per-sequence term, and the result bounds the likelihood, so training it is maximum-likelihood training of a generative model rather than a fixed-rate MLM. The bound is not a perplexity: our adapted model's and the causal model's 2.28 are not the same kind of number.
measured on Apple M1 Pro (CPU), src/lab/diff_eval.py, greedy commits with low-confidence remasking (LLaDA). "Token positions processed" counts what each forward reads: the causal model with a KV cache processes each new token once after a prefill of the prompt; every diffusion step reads the prompt and all 48 answer slots, because nothing can be cached between steps.
Adapting a trained AR model is how DiffuLLaMA (Gong et al., ICLR 2025: GPT-2 and LLaMA from 127M to 7B, under 200B tokens) and Dream 7B (HKU blog, April 2025: "initialized with weights from Qwen2.5 7B", 580B tokens) were built; LLaDA 8B was trained from scratch on 2.3T tokens with 0.13 million H800 GPU hours. We added a [MASK] token to the reference checkpoint's embedding, switched the mask to bidirectional and trained with the LLaDA loss for steps of 16 windows ( at learning rate 1e-3, then the rest at 5e-4; src/lab/train_diffusion.py, CPU, minutes in all). Held-out bound: at the start, after the first stage, at the end.
An AR checkpoint's output at position i was trained to predict token i+1. Dream "predicts all the masked tokens in a shifted manner": the masked token at i is read from the logits at i−1, keeping that alignment. Our first 100-step probe without it reached a held-out bound of ; with it, . Without the shift the adapted model spends its budget relearning which position answers which question. LLaDA, trained from scratch, needs no shift.
Fewer steps, more tokens per forward, lower quality. 48-token continuations of the 8 evaluation prompts, judged by an independent model (SmolLM2-135M's per-token loss on the continuation; lower is more fluent to that judge):
Committing more tokens per forward from the same, partly masked context lowers quality. Random remasking instead of confidence order is clearly worse at 48 steps ( against ), as in LLaDA's own ablation, but at 12 steps it is better here ( against ): committing the 4 most confident slots at once tends to pick the same easy pieces in neighbouring places, which random order avoids. LLaDA's table is at one step per token; this toy does not test it at few steps. The tiny model is small and briefly adapted: read the ordering, not the gap to AR.
The causal model continues prompt 7 with "". The diffusion model at 12 steps writes "". Our tokenizer splits the name Roxy into pieces (R, o, x, y), and each step predicts every masked slot independently given the current context, so slots filled in the same step cannot agree: the name comes out as fragments ("R", "Ro", "Roy") and confident common pieces land side by side ("named named"). This conditional-independence cost grows with tokens per step, which is why fewer steps lose quality and why production systems commit in small blocks with confidence thresholds.
Every diffusion step is a full bidirectional forward over prompt plus answer, and nothing can be cached between steps because every position's keys change as tokens are committed ("LLaDA is incompatible with KV caching"). So diffusion trades more FLOPs for fewer sequential forwards: worth it when decoding is memory-bound (one user, small batch), not when a server is already compute-bound at large batch. For the 48-token continuation of an -token prompt, 12 diffusion steps process token positions against the AR decoder's (derived; the counter in the figure). Block diffusion (Arriola et al., ICLR 2025) fixes the caching problem: generate blocks left to right, diffuse inside each block, cache the finished ones. DiffusionGemma uses the same block-AR idea; its paper page runs that sampler on its own toy.
| decoder | forwards for 48 tokens | tokens per forward | judge loss | distinct bigrams |
|---|
measured, greedy (argmax) commits, 2026-10-18. Judge: SmolLM2-135M (revision 93efa2f0), per-token loss of each continuation given its prompt, re-tokenised with its own tokenizer, mean over the 8 prompts. A judge from outside the topic avoids the bias of scoring the causal model's greedy text with the causal model itself (that self-score is in src/lab/out/diffusion_eval.json). Repetitive text scores well with any language-model judge, so distinct bigrams are shown beside it. The 1,500-step model scored worse everywhere (in src/lab/out/diffusion_eval.json): more adaptation helps at every step count.
| decoder | continuation of prompt 7 (48 tokens) |
|---|
| LLaDA 8B Base, length 256, Table 9 | BBH | GSM8K | Math | HumanEval | MBPP |
|---|---|---|---|---|---|
| random remasking | 32.1 | 21.3 | 9.2 | 11.6 | 21.0 |
| low-confidence remasking | 45.0 | 70.0 | 30.3 | 32.9 | 40.2 |
Gemini Diffusion against Gemini 2.0 Flash-Lite (vendor, speed averaged over the reported evals): HumanEval 89.6 against 90.2, MBPP 76.0 against 75.8, GPQA Diamond 40.4 against 56.5, Global MMLU Lite 69.1 against 79.0.
Held-out loss bound on 64 windows with a fixed masking draw, every 100 steps of train_diffusion.py --shift: the reference checkpoint plus one [MASK] embedding row, bidirectional mask, LLaDA loss, AdamW, 16 windows of 256 per step, CPU: steps at lr 1e-3 (50 warmup steps, cosine decay), then 3,000 more at 5e-4 on new windows (--resume). The page's diffusion results use the final model; the 1,500-step model's are in src/lab/out/diffusion_eval.json.
| Family | Open examples | What the checkpoint tells you |
|---|---|---|
| Decoder-only | Llama 3/4, Qwen3, DeepSeek-V3.2, Kimi K2, gpt-oss, Gemma 3/4 (the root's Architecture map has 46) | ...ForCausalLM in architectures |
| Decoder + MTP | DeepSeek-V3/V3.2 (1 module, 13.46B and 13.48B), GLM-4.5 (5.54B) and GLM-4.5-Air (3.62B), Qwen3-Next (1.65B), MiMo and Gemma 4 (drafting heads in vLLM) | num_nextn_predict_layers (DeepSeek, GLM) or mtp_num_hidden_layers (Qwen3-Next); MiniMax-M2's config names 3 MTP modules that are not in the released weights |
| Encoder | ModernBERT base and large, Ettin (17M to 1B), the encoders inside embedding and reranker models | ...ForMaskedLM, a mask token, is_causal = False |
| Encoder-decoder | T5 and Flan-T5, T5Gemma and T5Gemma 2, Whisper, DeepSeek-V4.1-Flash | is_encoder_decoder: true, separate encoder and decoder layer counts |
| Diffusion LM | LLaDA 8B, Dream 7B, DiffusionGemma (open weights); Mercury and Gemini Diffusion are served, not released | a bidirectional backbone plus a sampler with steps and block length; custom generation code |
MTP parameter counts from the root's Config calculator (FACTS, 2026-10-18); MiMo and Gemma 4 from the Speculative decoding page's vLLM v0.31.0 survey.
Built 2026-10-18 from the repository, rebuilt 2026-10-23 with the four lab tabs folded into Reading (source in this page's src/). Measured results: Apple M1 Pro, CPU at 4 threads or MPS, shared machine. Published numbers are labelled vendor or independent and dated at the point of use.
Links checked 2026-10-18. Times are rough reading times (for knowledge-base pages, the time each page states, or its Reading tab word count at 220 words a minute). "Maker" means written by the lab that built the thing; "third-party" means anyone else.
The parent: section 10 puts the families in one table; the Config calculator counts MTP layers; the Block lab measures the tiny GPT's FLOPs this page reuses. 23 min, plus 13 in closed details
MTP as a drafter in serving: acceptance rules, EAGLE, the batch-size crossover, engine support. 36 min
What each token caches; why the causal mask makes caching possible. 37 min, plus 28 in closed details
The decoder block and its training loop, from an empty file. 40 min, plus 22 in closed details
Sibling pages: the memory side of long inputs; recurrent mixers, which have no bidirectional form. Long context 22 min, plus 13 in closed details; Beyond attention 30 min, plus 17
The causal objective at scale: data, schedules, budgets. about 30 min of Reading
Where encoders earn their keep in 2026. about 27 and 32 min
Diffusion for images: the forward and reverse processes this page reuses with masks. about 43 min
Masked LM, 80/10/10, the leak animation, a toy BERT against its left-to-right twin. 23 min
Span corruption run with T5's own code; the three mask patterns animated on T5's own examples; the architecture and objective ablations. 23 min
Encoders against decoders on equal data. 24 min
Building encoder-decoders from decoder checkpoints. 23 min
Block-AR diffusion at 26B, its sampler and its speed. 24 min
The MTP module in the context of the whole model. 32 min
Maker. Masked diffusion at 8B from scratch; the sampler and remasking ablations used here. 60 min
Maker. Why the loss is a mixture of MLM losses. 45 min
Maker. Between AR and diffusion, with a KV cache. 40 min
Maker (Meta). Parallel heads; why small models lose. 45 min
Maker. The sequential MTP module in two pages. 10 min
Maker. A 2024 encoder recipe. 40 min
Maker (Google). Mixture of denoisers. 50 min
Third-party study (BigScience). Causal against non-causal at 5B. 40 min
Maker. The adaptation route this page's toy follows, with the shift. 30 min
Maker. Commercial diffusion LMs; speed figures as stated, labelled on the Reading tab. 20 min
Maker (Google). Replaced-token detection: a loss on every token for an encoder. 35 min