AI Compass
Compass

Diffusion models

The second large model family alongside transformers: denoising rather than continuing, why that suits images better, and where the two meet.

·2 min read·By Fachredaktion Technik
DETAIL
3 sections

The idea

Two directions. Forward: take an image and add noise step by step until nothing is recognisable. That path is trivial and needs no model. Backward: learn to undo one of those steps.

If you can undo one step you can undo them all. So you start at pure noise and denoise repeatedly until an image stands there.

The difference from a language model

Language modelDiffusion model
Producesone token after anothereverything at once, refined step by step
Step countas many as there are tokensfixed, usually 20 to 50
Suited tosequences with an orderimages, audio, anything without a fixed order
Steeringprompt in the contextprompt as a condition at every step

The noise schedule

How quickly noise increases is a design decision with a noticeable effect.

ScheduleShapeProperty
LinearuniformSimple, the original variant
Cosineslow at first, faster laterBetter detail fidelity
Sigmoidsoft at both endsFor high resolutions

The reason for cosine: with a linear schedule the image is near pure noise after a third of the steps, and the remaining two thirds contribute little to learning.

The solvers

SolverStepsNote
DDPM1,000Original, stochastic
DDIM20 to 100Deterministic, same seed same image
DPM-Solver++15 to 30The usual choice today
Distilled1 to 4A model learns to take several steps at once

Forward and backward

Forward process and training objective

x_t = √ᾱ_t · x₀ + √(1−ᾱ_t) · ε L = E [ ‖ ε − ε_θ(x_t, t, c) ‖² ]

The noisy state can be computed in one step, and the network is trained to identify the noise that was mixed in.

x₀
the clean image
x_t
the image after t noise steps
ᾱ_t
cumulative product of the schedule factors
ε_θ
the network predicting the mixed-in noise

One denoising step, DDIM

x̂₀ = (x_t − √(1−ᾱ_t)·ε_θ) / √ᾱ_t x_{t−1} = √ᾱ_{t−1} · x̂₀ + √(1−ᾱ_{t−1}) · ε_θ

From the noisy image and the predicted noise, the clean image is estimated and then remixed to the next lower noise level.

x̂₀
the clean version estimated from the current state

DDIM's determinism matters practically: the same seed and the same condition give exactly the same image, which is what makes reproducibility and targeted variation possible at all.

Why latent

Diffusion on pixels at 1024 by 1024 by 3 means 3.1 million dimensions per step, and there are twenty to fifty steps. A preceding autoencoder compresses by a factor of 8 per side:

LevelDimensionsRatio
Pixel space 1024² × 33,145,7281
Latent space 128² × 465,5361/48

Compute per step falls accordingly at barely visible quality cost. That is why image generation runs on a card with 8 GB.

Where diffusion and transformers meet

Current image models replace the once-standard U-Net with a transformer over image patches. The diffusion process is unchanged; only the network predicting the denoising step is a transformer. The same scaling properties as for language models then apply, more parameters and more data improve results predictably, which was less clearly true for U-Nets.

Related courses and sources

PaperFreeEN

Denoising Diffusion Probabilistic Models

Removing noise step by step instead of generating an image in one pass. The basis of every current image model.

For understanding every current image model, thought through from noise.

PaperFreeEN

High-Resolution Image Synthesis

Diffusion in a smaller latent space rather than in pixels. The step that made image generation possible on ordinary hardware.

For anyone running image generation themselves; explains why it works on ordinary hardware.

BookFreeEN

Understanding Deep Learning

A modern textbook with unusually clear figures that already covers transformers and diffusion models in full. Free as a PDF.

For a modern entry point; it already covers transformers and diffusion in full.

Was this page helpful?
Diffusion models