Skip to content
mlmentorship

Autoregressive vs. diffusion generation

Two paradigms for generative modeling: predict the next element step-by-step (autoregressive) or iteratively denoise from pure noise (diffusion). Different costs, different strengths.

Published · 7 min read ·Core ·Intermediate

Visual quick review

Visual first · depth when needed

Distinguish autoregressive sampling, which appends one element per serial step, from diffusion sampling, which revises every element of the current state in parallel at each serial denoising step.

Preparing the visual…

Summary

Autoregressive (AR) models factorize and generate one element at a time. Diffusion models learn to invert a Markov noising process and generate by iteratively denoising from Gaussian noise. AR dominates language; diffusion dominates images.

The two paradigms produce very different production tradeoffs:

AspectAutoregressiveDiffusion
Sampling sequential steps (one per token) sequential steps (~10–1000 denoise steps)
Parallelism within sampleNone during generationFull (one denoise step is parallel)
Quality scalingCompute and dataCompute and data + step count
Modality strengthDiscrete sequences (text, code)Continuous (images, audio)
ConditioningPrefix promptCross-attention or classifier-free guidance
LikelihoodExact, easy to computeVariational lower bound; sample-based

Learning objective

At one serial sampling step, which parts of the state can change?

Autoregressive appending versus diffusion whole-state revision Two aligned sampling timelines each contain four positions. On the autoregressive timeline, A is given, then each serial model call appends exactly one new element while earlier elements remain fixed. On the diffusion timeline, a complete four-position noise state exists from the start, and each serial denoising call revises all four positions together until a clean sample is reached. AUTOREGRESSIVE: append one element; keep the prefix fixed given prefix A ? ? ? serial call 1 append B A B ? ? serial call 2 append C A B C ? serial call 3 append D A B C D one new element one new element one new element DIFFUSION: revise the entire current state within each denoising step xT: full noise state ·×~· serial call 1 xT−1: less noisy ╱○△╲ serial call 2 xT−2: structure emerges AB△D … serial calls x0: clean sample ABCD all positions revised together all positions revised together Both timelines are serial across calls; only diffusion parallelizes work across positions inside a call.
Read it this way: scan left to right along both rows. An autoregressive call freezes the existing prefix and adds one element, so the three new elements shown require three dependent calls. A diffusion call consumes and revises the whole noisy state at once, but the next denoising call must still wait for that complete state. Mechanism checked against PixelRNN and DDPM; the schematic is original.

Autoregressive

The model factorizes the joint distribution by the chain rule:

A neural net (transformer, RNN) parameterizes each . Training: maximize log-likelihood = minimize cross-entropy (one prediction per token, all positions in parallel via teacher forcing). Sampling: feed back the previous output, generate the next.

Strengths: exact likelihood, simple training, parallel teacher-forced loss, strong on discrete sequences.

Weakness: serial sampling. Each step waits for the previous. This is the bottleneck that motivates speculative decoding.

Diffusion

Define a forward noising process: with . The forward step is a small Gaussian (variance schedule ). The reverse (denoising) step is approximated by a learned model :

Training: sample a clean , sample noise , sample , compute noisy , fit with MSE.

Sampling: , then iterate the reverse step times (typically 10–1000).

Strengths: high-fidelity continuous generation, stable training (no GAN instability), good likelihood estimates with importance-weighted ELBO.

Weakness: slow sampling. Most efforts (DDIM, distillation, consistency models) reduce step count.

When AR vs. diffusion

ModalityProduction default 2026
TextAutoregressive (Llama, GPT, Mistral)
CodeAutoregressive (GPT-4, Codex)
ImagesDiffusion (Stable Diffusion, FLUX, Imagen)
AudioMixed: AR (WaveNet legacy), diffusion (modern TTS), latent autoregressive
VideoDiffusion (Sora, Veo, Stable Video) with latent compression
Molecules / proteinsDiffusion (RFdiffusion)

For text, AR has structural advantages: discrete vocabulary, natural causal ordering, and chain-of-thought reasoning emerges from sequential generation. For images, no natural sequential ordering exists, and diffusion’s iterative refinement maps better to gradual denoising.

Hybrid and emerging approaches

  • Latent diffusion (Stable Diffusion): VAE compresses to latent space; diffusion happens there.
  • Discrete diffusion for text (D3PM, Plaid): apply diffusion to discrete tokens with a categorical noise process.
  • Flow matching (Meta, 2023): generalizes diffusion to a deterministic ODE; faster sampling.
  • Consistency models (Song 2023): one or few-step diffusion via distillation.
  • Diffusion language models (LLaDA, 2024): diffusion applied to text; competitive with AR at smaller scale, scaling unclear.

Common pitfalls

  • Comparing AR perplexity with diffusion ELBO directly. Different objectives; not directly comparable.
  • Treating diffusion step count as fixed. It is a sample-time hyperparameter; reducing improves throughput at quality cost.
  • Forgetting AR is parallel during training. The “AR is slow” concern applies to inference, not training.
  • Assuming diffusion is universally better than GANs. It is for image fidelity and training stability, not necessarily for inference speed; GANs still dominate latency-critical settings.