AI Infra
0%
Part II · Chapter 13

Non-Autoregressive and Diffusion Language Models

AuthorChangkun Ou
Reading time~20 min

Chapter 12 described paths through continuous states. Text poses a different problem: its state is categorical, and its length is usually not known in advance. non-autoregressive generation (NAR) generation attacks the serial dependency of left-to-right decoding by predicting several positions together. diffusion adds a forward corruption process and a learned reverse process. The two ideas overlap, but they are not synonyms. A one-pass translation model can be non-autoregressive without being a diffusion model, while a block diffusion model can remain autoregressive across blocks.

The attraction is shorter dependency depth. For an LL-token output, autoregression has LL causally ordered decode steps; a masked model may revise all LL positions in KK rounds. That does not make its work L/KL/K times cheaper. Each round can score a full sequence, and changing bidirectional states prevents the usual causal key-value cache from being reused unchanged. The useful comparison is therefore not “serial versus parallel,” but dependency depth, total model work, output-length handling, and quality under one serving contract.

2026-08-03T22:54:22.563421 image/svg+xml Matplotlib v3.11.0, https://matplotlib.org/ 1 0 1 1 0 2 output length (tokens) 0 50 100 150 200 250 dependent steps autoregressive iterative NAR
Figure 13.1. Dependency depth under a simple decoding model. Autoregression needs one dependent round per output token, while an eight-round iterative decoder keeps its round count fixed as length grows. This is algorithmic depth, not measured latency or total compute.

Separate the factorization from the execution plan

Here, cc is a source or prompt and y=(y1,,yL)y=(y_1,\ldots,y_L) is its output. An autoregressive model writes

pθ(yc)=i=1Lpθ(yiy<i,c).p_\theta(y\mid c) =\prod_{i=1}^{L}p_\theta(y_i\mid y_{<i},c).

Here, θ\theta denotes model parameters; LL is output length; yiy_i is token ii; and y<iy_{<i} contains the earlier output tokens. The factorization gives a natural stopping rule because the model can emit an end-of-sequence token. With a causal key-value cache, each decode invocation processes one new query position while reusing keys and values from the prefix.

The original one-shot non-autoregressive translation model instead used

pθ(yc,L,z)=i=1Lpθ(yic,L,z).\begin{gathered} p_\theta(y\mid c,L,z) =\\[-0.4em] \prod_{i=1}^{L}p_\theta(y_i\mid c,L,z). \end{gathered}

where zz is an optional latent alignment or fertility variable. Output positions share the encoded source and latent variables, but their sampled tokens do not condition on one another. All positions can therefore be scored in one model evaluation once LL and zz are chosen. Across operating points, Gu et al. reported substantial latency reductions; the smallest reported gap to their autoregressive teacher was 2 BLEU, while higher-quality decoding reduced the speed advantage (Gu et al. 2018). BLEU measures n-gram overlap with reference translations; its difference is specific to the dataset, tokenization, and decoding setup, not a universal quality unit.

Iterative models introduce states y(K),,y(0)y^{(K)},\ldots,y^{(0)} and factorize one refinement step across positions:

pθ ⁣(y(k1)y(k),c)=i=1Lpθ ⁣(yi(k1)y(k),c).\begin{gathered} p_\theta\!\left(y^{(k-1)}\mid y^{(k)},c\right) =\\[-0.4em] \prod_{i=1}^{L} p_\theta\!\left(y_i^{(k-1)}\mid y^{(k)},c\right). \end{gathered}

Here, kk is the current refinement round, y(k)y^{(k)} is the whole current sequence, and y(0)y^{(0)} is the final output. Positions are parallel within a round, but round k1k-1 waits for round kk. The model may revise masks, tokens, or sequence length depending on the algorithm.

Design Dependent decode rounds Work inside one round Length mechanism
causal autoregression LL one new position with cached prefix stop token
one-shot NAR 11 all LL positions predicted or latent length
iterative refinement KK usually many or all positions fixed, predicted, inserted, or collapsed
block diffusion KL/BK\lceil L/B\rceil one block of at most BB positions append blocks until stopping

In the last row, BB is block size and KK is the number of denoising rounds per block. This table counts dependency, not FLOPs or wall-clock time.

Why an independent draft can mix valid translations

Translation is multimodal: one source sentence can have several valid targets. If one mode says “I do not know” and another says “I don't know,” independent position predictions can combine pieces of both. The resulting token marginals may each look plausible while the joint sentence does not. Repetition and omission are visible symptoms, but the underlying issue is the conditional independence assumption, not a rule that every non-autoregressive model must fail.

Early systems reduced this uncertainty in two ways. Gu et al. used a fertility latent, an integer count describing how many target positions each source token produces. It supplies an alignment and helps determine output length. They also trained on decoded outputs from an autoregressive teacher. Sequence-level knowledge distillation replaces each set of human references with a narrower teacher-generated target (Kim and Rush 2016). Zhou et al. measured this effect as lower alignment-based word-translation entropy on WMT14 English-German. In their experiments, stronger non-autoregressive students tended to benefit from more complex distilled data (Zhou et al. 2020). This is an empirical proxy and capacity trend, not a general theorem about the true sequence entropy.

Distillation was central to classic non-autoregressive translation, but it is not a mathematical requirement for all parallel generation. It changes the training distribution, transfers the teacher's errors and preferences, and can make a student's apparent speed-quality result depend on an unreported teacher. A fair record names the teacher, decoding method, and whether evaluation uses human references or teacher outputs.

Refinement predates diffusion language models

Several pre-diffusion systems added structure without returning to strict left-to-right decoding:

Method Training or decoding move How it handles length What remains serial
Mask-Predict mask low-confidence positions and predict them again predict length before refinement a fixed number of refinement rounds
Levenshtein Transformer alternate deletion, placeholder insertion, and token filling grow and shrink the sequence edit iterations
CTC-based decoding emit blanks and repeated labels, then collapse a monotonic alignment marginalize compatible alignments usually one or a few model rounds
Glancing Transformer reveal selected reference tokens during training predict length at inference no iterative inference in its one-pass form
SUNDAE train on unrolled denoising steps and repeatedly repair token sequences usually fix a canvas denoising iterations

Mask-Predict improved over one-shot decoding by spending a predetermined number of confidence-based refinement rounds (Ghazvininejad et al. 2019). The partially autoregressive Levenshtein Transformer made insertion and deletion explicit (Gu et al. 2019). CTC systems marginalized monotonic alignments containing blanks and repeats (Libovický and Helcl 2018; Chan et al. 2020). Glancing training exposed a decreasing number of target tokens as training progressed (Qian et al. 2021), while SUNDAE trained a denoiser through more than one of its own predicted states (Savinov et al. 2022).

These methods established useful operations: draft, mask, insert, delete, collapse, and refine. Mask-Predict resembles absorbing-state diffusion at the algorithmic level, but it was not derived as the reverse chain of D3PM and does not inherit a diffusion likelihood bound merely because it uses masks. That distinction matters when comparing objectives.

Put diffusion on categorical states

D3PM replaces Gaussian corruption with a Markov chain over a finite vocabulary (Austin et al. 2021). Represent one token as a one-hot vector xt{0,1}Vx_t\in\{0,1\}^{V}, where VV is vocabulary size. With a column-stochastic transition matrix Qt[0,1]V×VQ_t\in[0,1]^{V\times V}, one forward step is

q(xtxt1)=Cat(xt;Qtxt1),Qˉt=QtQt1Q1.\begin{aligned} q(x_t\mid x_{t-1}) &=\operatorname{Cat}(x_t;Q_t x_{t-1}),\\ \bar Q_t&=Q_tQ_{t-1}\cdots Q_1. \end{aligned}

and the direct marginal is

q(xtx0)=Cat(xt;Qˉtx0).q(x_t\mid x_0) =\operatorname{Cat}(x_t;\bar Q_t x_0).

Here, qq is the fixed forward process; tt is a corruption step; Cat(x;π)\operatorname{Cat}(x;\pi) is a categorical distribution with probability vector π\pi; and Qˉt\bar Q_t is the cumulative transition. For a sequence, the usual construction corrupts token positions independently even though the reverse model reads the whole corrupted sequence.

An absorbing process adds a special mask state mm. In continuous time, the single-position marginal can be written

q(ztx)=Cat(zt;πt(x)),πt(x)=αtx+(1αt)m,t[0,1].\begin{gathered} q(z_t\mid x)=\operatorname{Cat}(z_t;\pi_t(x)),\\ \pi_t(x)=\alpha_t x+(1-\alpha_t)m,\\ t\in[0,1]. \end{gathered}

Here, xx is the clean one-hot token, ztz_t is its corrupted state, mm is the one-hot mask token, πt(x)\pi_t(x) is the displayed categorical probability vector, and αt\alpha_t is a decreasing keep probability with ideal endpoints α0=1\alpha_0=1 and α1=0\alpha_1=0. Once masked in the forward process, a token remains masked. The network therefore receives sequences made from clean vocabulary items and a known mask symbol, rather than arbitrary Gaussian vectors that later need rounding.

Continuous embedding diffusion is a different branch. Diffusion-LM corrupts word embeddings and uses gradients through the continuous state for controllable generation (Li et al. 2022). Plaid develops a likelihood-based continuous language model at larger scale (Gulrajani and Hashimoto 2023). Those models must connect continuous outputs back to discrete tokens; absorbing diffusion stays categorical throughout. Results from the two branches should not be merged into one quality claim.

Derive the masked-diffusion training loss

For the absorbing process, a substitution-based reverse parameterization copies unmasked tokens and predicts a clean-token distribution only at masked positions. Under that parameterization, the continuous-time negative evidence lower bound reduces to (Sahoo et al. 2024; Shi et al. 2024)

θ(x,zt)=i:zt(i)=m×[logpθ ⁣(x(i)zt,t)],LMDLM=01αt1αt×Ex,zt ⁣[θ(x,zt)]dt.\begin{gathered} \ell_\theta(x,z_t) =\sum_{i:\,z_t^{(i)}=m}\\[-0.3em] \quad\times\left[-\log p_\theta\!\left(x^{(i)}\mid z_t,t\right)\right],\\ \mathcal L_{\mathrm{MDLM}} =\int_0^1 \frac{-\alpha_t'}{1-\alpha_t} \\[-0.3em] \quad\times\mathbb E_{x,z_t}\!\left[\ell_\theta(x,z_t)\right]dt. \end{gathered}

Here, x=(x(1),,x(L))x=(x^{(1)},\ldots,x^{(L)}) is a clean sequence; ztz_t is produced by independently masking its positions with keep probability αt\alpha_t; αt=dαt/dt\alpha_t'=d\alpha_t/dt; ii indexes positions currently equal to mask mm; and θ\ell_\theta sums negative log-probabilities over those positions, using pθ(x(i)zt,t)p_\theta(x^{(i)}\mid z_t,t) as the model's clean-token probability at position ii. Because αt\alpha_t decreases, the weight αt/(1αt)-\alpha_t'/(1-\alpha_t) is nonnegative. In practice, training samples times and masking patterns rather than evaluating the integral exactly. The apparent singularity at the clean endpoint is interpreted as a limit; the probability of observing a masked position vanishes there, and implementations use numerically stable finite sampling.

The inner term is masked-token cross-entropy. The diffusion objective is therefore a weighted family of masked-language-model losses over many corruption levels. It is not identical to ordinary BERT training: BERT uses a particular masking recipe and was not defined with this reverse process, carry-over rule, time weighting, or likelihood bound. An existing masked language model does not become a complete generator until its training and sampling contracts supply those missing pieces.

Generation starts from an output canvas of LL masks. At each reverse step, the model predicts clean tokens from the entire current state, the sampler reveals a schedule-dependent subset, and the absorbing reverse parameterization carries already revealed tokens forward. Unlike confidence-based Mask-Predict variants, this ancestral sampler need not re-mask a revealed token. The final step must remove every remaining mask. Length LL still has to be chosen, predicted, or handled by a blockwise extension.

Distinguish concrete-score caching from a KV cache

SEDD describes a continuous-time discrete diffusion through ratios of noisy marginal probabilities. For neighboring sequences xx and yy that differ at one token position, its concrete score is

st(x)y=pt(y)pt(x).s_t(x)_y=\frac{p_t(y)}{p_t(x)}.

Here, ptp_t is the noisy sequence distribution at time tt, and st(x)ys_t(x)_y is the ratio associated with the transition from xx to yy. A neural network approximates the ratios required by the sparse token transition graph rather than representing an exponentially large sequence transition matrix. SEDD's score-entropy objective improved perplexity over earlier diffusion language models and was competitive with GPT-2-scale autoregressive baselines in its experiments (Lou et al. 2024). Its reported network-evaluation tradeoff is internal to those tested samplers; one full-sequence diffusion evaluation is not cost equivalent to one cached autoregressive token step.

RADD specializes the score for absorbing diffusion. It factorizes the required ratio into a clean-data conditional distribution and a known time-dependent scalar (Ou et al. 2025). If xtiyx_t^{i\leftarrow y} replaces mask position ii in xtx_t with clean token yy, then the population relation is

pt ⁣(xtiy)pt(xt)=αt1αt×p0 ⁣(Xi=yXU=xt,U).\begin{gathered} \frac{p_t\!\left(x_t^{i\leftarrow y}\right)}{p_t(x_t)} =\frac{\alpha_t}{1-\alpha_t}\\[-0.2em] \quad\times p_0\!\left(X_i=y\mid X_U=x_{t,U}\right). \end{gathered}

Here, UU is the set of unmasked positions; XU=xt,UX_U=x_{t,U} means that the clean random sequence XX agrees with the visible tokens in xtx_t; p0p_0 is the clean data distribution; and αt/(1αt)\alpha_t/(1-\alpha_t) is the known schedule factor. The learned conditional on the right need not take tt as input even though the analytic scalar remains time-dependent. If a reverse transition leaves the corrupted sequence unchanged, that denoiser's output can be reused at the next time point. This is model-output caching across an unchanged state. It is different from a causal KV cache, which reuses prefix keys and values while appending a new token.

RADD also connects absorbing diffusion to any-order autoregressive factorizations. The probability model may reveal variables in many orders rather than one fixed left-to-right order. That representational equivalence does not make the execution plans equivalent: a bidirectional denoiser can still score a whole canvas repeatedly.

Recover length and prefix caching with blocks

Full-sequence masked diffusion normally begins with a fixed canvas. Full bidirectional attention also changes hidden states throughout that canvas after each reveal, so the standard causal prefix KV cache cannot simply be carried between rounds. Block diffusion changes the factorization: it generates blocks autoregressively, then denoises positions within the current block in parallel (Arriola et al. 2025). Completed blocks form a stable prefix, so their KV state can be cached, and generation can continue for an arbitrary number of blocks.

ar Autoregressive one token per step causal prefix cache bd Block diffusion causal across blocks parallel within a block ar->bd increase block size md Full masked diffusion fixed canvas parallel refinement rounds bd->md one full block
Figure 13.2. Dependency structure: autoregression is serial by token, block diffusion is serial across blocks, and full masked diffusion refines a fixed canvas.

The following runnable makes only this dependency accounting concrete. It assumes that a masked pass predicts every position in its current block, ignores prompt prefill, and does not pretend that one position prediction has constant hardware cost.

from math import ceil

length = 128
rounds = 8
block_size = 16

autoregressive = {
    "dependent_evaluations": length,
    "position_predictions": length,
}
full_masked = {
    "dependent_evaluations": rounds,
    "position_predictions": length * rounds,
}
block_diffusion = {
    "dependent_evaluations": ceil(length / block_size) * rounds,
    "position_predictions": length * rounds,
}

for name, cost in [
    ("autoregressive", autoregressive),
    ("full masked", full_masked),
    ("block diffusion", block_diffusion),
]:
    print(
        f"{name:16} dependent={cost['dependent_evaluations']:3d}, "
        f"positions={cost['position_predictions']:4d}"
    )

With these assumptions, full masked diffusion has the shortest dependency chain but predicts eight times as many token positions as cached autoregression. Block diffusion lies between them in dependency depth while doing the same illustrative number of within-block position predictions as full masked diffusion. Actual latency depends on attention shape, kernels, batch, memory traffic, and how much parallel hardware each evaluation can use.

Read scale demonstrations as scoped evidence

Large diffusion language models established that the objective can train or be adapted beyond the earlier GPT-2-scale experiments. They did not create one controlled comparison in which only the factorization changed.

System What its construction demonstrates What it does not establish by itself
LLaDA 8B masked diffusion can be pretrained from scratch and instruction-tuned parity with an externally trained 8B autoregressive model under matched data and compute
Dream 7B autoregressive weights can initialize a diffusion model the same result from diffusion pretraining alone
LLaDA-MoE a 7B-total, 1.4B-active sparse diffusion model can train on roughly 20T tokens equal cost or quality to a matched sparse autoregressive run
LLaDA 2.0 converted autoregressive MoE weights can produce diffusion models up to 100B total parameters a 100B diffusion model trained from scratch

LLaDA's paper reports strong results against its own autoregressive baselines and selected external models, including an 8B model trained from scratch (Nie et al. 2025). Dream instead initializes from Qwen2.5 autoregressive weights (Ye et al. 2025). LLaDA-MoE reports 7B total parameters, 1.4B active parameters, and approximately 20T training tokens (Zhu et al. 2025). LLaDA 2.0 converts pretrained autoregressive models through staged block and full-sequence diffusion training, reaching 100B total parameters in its sparse variant (Bie et al. 2025). These are distinct claims about training route, active compute, and total model capacity.

Mercury and Seed Diffusion also report high code-generation throughput (Inception Labs et al. 2025; Song et al. 2025). Those results show that engineered diffusion systems can occupy useful speed-quality operating points. They are not a portable multiplier for the model class: the reports use different models, tokenizers, accelerators, output lengths, batches, and quality suites.

Benchmark the deployed generator, not the label

A reproducible comparison fixes the task and reports the complete decode contract:

Dimension Report
quality likelihood bound or perplexity with identical tokenization, task metrics, and human evaluation where needed
dependency output length, denoising rounds, block size, and network-function evaluations
work positions scored per evaluation, attention pattern, active parameters, and any skipped or cached states
latency time to first visible output, time to complete, and per-request latency at declared batch
throughput requests and tokens per second, including tokenizer and post-processing policy
hardware accelerator, count, precision, compiler, kernels, and memory limits
output policy fixed or predicted length, stop rule, mask schedule, confidence rule, and sampling randomness

Perplexity is not directly comparable when tokenizers differ because a “token” then represents different amounts of text. Tokens per second has the same problem. Character or byte throughput can supplement it, but quality and latency must still be measured on the same requests. For interactive use, a system that finishes quickly but exposes no stable prefix may also feel different from a streaming autoregressive system with a low time to first token.

Method choice follows the workload:

Workload Useful starting point Main risk to test
open-ended streaming chat autoregressive or blockwise generation end-to-end latency and stop behavior
fixed-length infilling or constrained editing masked diffusion or iterative refinement mask schedule and global consistency
translation with strict latency target one-shot or iterative NAR mode mixing, length, and teacher dependence
batch code completion benchmark AR, block, and full diffusion under one harness tokenizer-adjusted throughput and correctness
arbitrary-order completion masked or any-order model calibration under unusual reveal orders
What's contested

It remains unsettled where diffusion language models beat autoregression after quality, hardware, output length, and serving software are controlled. Parallel position updates and bidirectional context are real advantages for fixed-canvas editing and arbitrary-order completion. Autoregression retains a simple stop rule, stable streaming prefix, and mature causal caching. Scale demonstrations remove “these models cannot be made large” as a blanket objection, but parameter count and author-reported throughput do not prove frontier-quality or cost-matched parity. The evidence supports a broader design space, not a settled successor.

Lower-layer constraint

The serving stack determines whether parallel token prediction becomes a latency win. A full masked round exposes parallel work but often recomputes a bidirectional canvas. Autoregression exposes little parallelism within one request but reuses a causal prefix. Block diffusion trades between those properties. The decisive measurements are network evaluations, positions recomputed, cache bytes, memory bandwidth, batch, and kernels. “Eight rounds” is an algorithm description; it is not a serving result.

Further reading

Comments

Log in to comment