Two Ways an AI Can Write: Word by Word, or Sketch Then Sharpen (Autoregressive vs Diffusion Models)

12 min read

The short answer

Autoregressive models write text left to right, one token at a time. A token is a small chunk of text, often a word or part of a word. Each token is conditioned on (computed from) all the tokens before it. Diffusion language models start from a fully masked sequence, a row of blanks. They refine the passage in parallel over several steps. They unmask the confident tokens first and revise the rest. Neither style is faster. Speed depends on steps, length, and hardware.

New to these terms? Every word is explained in the series glossary.

I picture the difference with two writers. The first writer writes a sentence word by word and never looks back. Each word locks in before the next one is chosen. The second writer sketches the whole sentence at once in rough form, then sharpens it. She fixes the weak words and keeps the strong ones. The first writer is fast per word and cannot revise. The second writer revises constantly and pays for every pass over the whole sentence. That trade is the whole article.

How autoregressive generation works

Autoregressive generation is the default in almost every language model you have used. The model reads the prompt, the text you sent. It predicts the most likely next token. It appends that token. Then it repeats. Each step depends on all previous steps. The order is fixed: left to right, one token per forward pass. A forward pass is one run of the model over its input.

This design has one large advantage. Each token only depends on earlier tokens. So the model can cache the work it did for them. That cache is the KV cache. KV stands for key and value. These are the intermediate numbers the attention mechanism (the step that lets each token look back at earlier ones) computes for each token. The keys and values for past tokens are stored and reused. So each new token needs only a small amount of fresh compute. I explain it in detail in the companion article on this blog, "What is a KV cache, and why it decides what you can serve".

The weakness is that the model cannot revise. Once a token is written, it stays. A bad early word must be steered around for the rest of the sentence. The model also cannot see the future when it picks the first word.

How diffusion language models work

Diffusion language models work the other way round. The best-known form is masked diffusion. Training, the phase where the model learns, masks a random fraction of a sentence's tokens. It teaches the model to predict them. Generation starts from a fully masked sequence of a chosen length. The model predicts all masked positions at once. It keeps the confident predictions, remasks the rest, and repeats until every position is filled.

Two real models show the idea at scale. LLaDA was published in February 2025. It is an 8 billion parameter (learned numbers) diffusion model trained from scratch. Its authors report it as competitive with LLaMA 3 8B on in-context learning. In-context learning means learning from examples given in the prompt, without retraining. Dream 7B was published in August 2025. It adapts a pretrained (already trained) autoregressive model into a diffusion model. It starts from Qwen2.5 7B weights (learned numbers) and trains on 580 billion tokens. Its authors report strong results on general, mathematical, and coding tasks. Mercury, from Inception Labs, is the commercial implementation for code generation. Those are the authors' and the company's own claims, dated 2025.

The key property is parallelism with revision. All positions update together. So a word in the middle can be chosen with knowledge of the word at the end. A bad early guess can be remasked and fixed in a later step.

The worked example: the same sentence, both ways

A small simulation (a small program that imitates a process) shows the two traces side by side. It uses a toy mask predictor from a tiny corpus (collection of text) of six similar sentences, using a bigram model plus a positional prior. A bigram model predicts a word from the previous word only. A positional prior is a guess based on where a word sits in the sentence. It is written in Python. This is a simulation, not a real diffusion model. It shows the shape of the process, not the quality of a real model. The target sentence was "the cat sat on the warm roof".

The autoregressive trace took 7 steps, one token per step:

step 1: the
step 2: the cat
step 3: the cat sat
step 4: the cat sat on
step 5: the cat sat on the
step 6: the cat sat on the warm
step 7: the cat sat on the warm roof

The diffusion trace took 4 steps, filling two positions per step:

step 0: [MASK] [MASK] [MASK] [MASK] [MASK] [MASK] [MASK]
step 1: [MASK] [MASK] [MASK] on the [MASK] [MASK]
step 2: [MASK] [MASK] sat on the warm [MASK]
step 3: the cat sat on the warm [MASK]
step 4: the cat sat on the warm roof

Both traces reached the target. The diffusion trace finished in fewer steps, 4 against 7. But each of its steps reprocessed the whole sequence. Each autoregressive step processed only one new token, with the rest cached. Counting steps alone would mislead you. Four full-sequence passes can cost more than seven cached single-token passes. That is why this article makes no general speed claim. Speed depends on the number of refinement steps, the sequence length, and the hardware. The honest answer is to measure on your own workload.

Notice the diffusion trace filled the middle first: "on the" in step 1, then "sat" and "warm" in step 2. Real masked diffusion models show the same habit. They commit to confident content words early and leave uncertain edges for later. The autoregressive trace could never do that.

Here is the core of the simulation, shortened to the loop that matters. The corpus and the scoring function are left out for space.

python
seq = ["[MASK]"] * n
step = 0
while "[MASK]" in seq and step < 8:
    step += 1
    scored = []
    for i, tok in enumerate(seq):
        if tok != "[MASK]":
            continue
        left = seq[i-1] if i > 0 and seq[i-1] != "[MASK]" else None
        right = seq[i+1] if i+1 < n and seq[i+1] != "[MASK]" else None
        (best_s, best_w), (second_s, _) = best_for(i, left, right)
        scored.append((best_s - second_s, i, best_w))
    scored.sort(reverse=True)
    for _, i, best_w in scored[:2]:
        seq[i] = best_w
    print(f"step {step}:", " ".join(seq))

The full script also has a remask step. A filled token whose neighbours stop fitting gets masked again. It did not trigger in this run. The toy corpus is small and the target sentence is in it. In a real model, remasking triggers often. It is how diffusion output recovers from early mistakes.

Animation: Autoregressive writes one token per step, left to right. Diffusion fills the middle first and finishes in 4 steps.

The comparison, side by side

AutoregressiveDiffusion
Generation orderLeft to right, one token at a timeWhole sequence at once, refined over steps
RevisionNone, a written token stays writtenYes, low-confidence tokens are remasked and fixed
InfillingAwkward, it must generate up to the gap and stopNatural, masked positions are filled from both sides
KV cacheYes, past keys and values are reusedNo, in the plain form, the whole sequence is reprocessed each step
Output lengthDecided as it goes, any lengthFixed in advance, the mask count sets the length
Best fit todayOpen-ended text, chat, long generationEditing, infilling, structured text, short constrained outputs

Read the table as trade-offs, not a scoreboard. The KV cache row matters most for serving cost, the cost of running a model for users. It gets its own section below.

The KV cache catch, and the block diffusion fix

Here is the problem most explainers miss. The KV cache works because autoregressive attention is causal. Causal attention means token 5 attends to tokens 1 to 4, never to token 6. When token 6 arrives, the work for tokens 1 to 5 is still valid. So it is cached and reused. That reuse is what makes serving cheap.

Diffusion generation breaks that property. Its attention is bidirectional. Bidirectional attention means every position attends to every other position, including positions that have not been decided yet. When one token changes in a refinement step (one round of updating the whole passage), the attention inputs for the whole sequence change. So the cached keys and values go stale. The cache cannot be reused across steps. Each refinement step pays the full cost of the sequence again.

That is a real serving disadvantage. A model that needs 10 refinement steps over a 500-token sequence does 10 full passes. An autoregressive model does 500 small cached steps. Which is cheaper depends on hardware and step count. But diffusion starts from behind.

Block diffusion is the current fix. It comes from Arriola and colleagues, "Block Diffusion: Interpolating Between Autoregressive and Diffusion Language Models", ICLR 2025, a major AI conference. The model generates block by block, autoregressively across blocks, and runs diffusion inside each block. Once a block is finished, its keys and values are cached. Later blocks reuse them. The paper's own summary is that block diffusion gets high quality, arbitrary-length generation, KV caching, and parallel sampling (choosing several tokens at once) together. It is a compromise. Full diffusion gives up the cache. Full autoregression gives up parallelism. Blocks split the difference.

If you remember one thing from this article, make it this. The KV cache is not a detail. It is the reason autoregressive models are cheap to serve. Any challenger must answer it. Block diffusion is the best answer so far.

flowchart TD
    A[Prompt] --> B[Block 1: start fully masked]
    B --> C[Diffusion inside block: refine in parallel]
    C --> D[Block 1 finished]
    D --> E[Cache its keys and values]
    E --> F[Block 2: masked, attends to cached block 1]
    F --> G[Diffusion inside block 2]
    G --> H[Cache block 2]
    H --> I{More text needed?}
    I -- Yes --> F
    I -- No --> J[Done: any length, KV cache reused]

Diagram: Block diffusion: diffusion inside each block, then cache the block so later blocks can reuse it.

Where diffusion fits today

Diffusion language models are not replacing autoregressive models this year. They are winning in the places where their strengths matter and their weaknesses do not.

Infilling is the clearest win. Infilling means filling a gap in the middle of a text. Filling a gap in a sentence, a function, or a document is natural for a model that sees both sides of the gap. An autoregressive model must generate up to the gap and hope it lands correctly. A diffusion model just masks the gap and fills it.

Editing is close behind. Changing one paragraph while keeping the rest fixed is a masked refinement problem. The model reworks the masked span with the surrounding text as context. The unmasked text stays untouched.

Structured and scientific text is the third fit. Code with strict syntax, JSON (a structured data format) with fixed fields, and scientific text with rigid formats all benefit from a model that can see the whole output while it writes.

Open-ended chat is still the autoregressive model's home. Long, free-form generation with unknown length plays to left-to-right writing. And the KV cache makes it cheap.

Try this

Take one infilling task and try it in both styles. Write a short Python function with one line masked out. For example, a function that reads a file and returns its lines, with the return statement replaced by a blank. First, ask an autoregressive model to complete it. Give it the code up to the blank and nothing after. Then give a diffusion model, or a diffusion demo such as the LLaDA demo page, the code with the blank in the middle and the code after it included. Compare the two answers. The autoregressive model must guess the rest of the function from the start alone. The diffusion model sees the code after the blank and can use it.

The LLaDA demo page is the place to try it.

FAQs

Are diffusion language models faster than autoregressive models?

There is no general winner. A diffusion model takes fewer steps, but each step reprocesses the whole sequence. An autoregressive model takes one step per token, but each step is small and cached. Which is faster depends on the number of refinement steps, the sequence length, and the hardware. Measure on your workload instead of trusting a headline number.

Can a diffusion model write long text?

Plain masked diffusion fixes the output length in advance. That makes long open-ended text awkward. Block diffusion fixes this by generating block by block, so the total length is not fixed. Long text is still easier for autoregressive models today.

Why do diffusion models need a fixed length?

Generation starts from a fully masked sequence. The mask count is chosen before generation begins. The model fills those positions and stops. It cannot decide mid-generation to add more positions, because there is no mechanism for growing the sequence. Block diffusion works around this by adding blocks one at a time.

What is the KV cache, and why does it matter here?

The KV cache stores the keys and values computed for past tokens so they are not recomputed for each new token. It works for autoregressive models because their attention is causal. Diffusion models use bidirectional attention, so the cache goes stale each step. The companion article, "What is a KV cache, and why it decides what you can serve", explains it in full.

Should I use a diffusion model for my project?

Use one if your task is infilling, editing, or structured generation with fixed formats. Use an autoregressive model if your task is open-ended chat or long free-form text. If you are unsure, try the infilling test in the Try this section and let the result decide.

Sources

  • Nie, Shen, and colleagues. Large Language Diffusion Models, LLaDA. https://arxiv.org/abs/2502.09992. February 2025. Checked 14 November 2026, re-checked 21 November 2026.
  • Ye, Jiacheng, and colleagues. Dream 7B: Diffusion Large Language Models. https://arxiv.org/abs/2508.15487. August 2025. Checked 14 November 2026, re-checked 21 November 2026.
  • Arriola, Marianne, and colleagues. Block Diffusion: Interpolating Between Autoregressive and Diffusion Language Models. ICLR 2025. https://arxiv.org/abs/2503.09573. Checked 14 November 2026, re-checked 21 November 2026.
  • Inception Labs, Khanna and colleagues. Mercury: Ultra-Fast Language Models Based on Diffusion. Technical report on Mercury Coder, June 2025. https://arxiv.org/pdf/2506.17298