Bookmarks

Diffusion model

A generative model that creates an image (or audio, or video) from random noise by removing the noise step by step.

Also: diffusion network, latent diffusion model, denoising diffusion model, latent diffusion

checked 18 Nov

All terms

A diffusion model is trained to recover data from noise. To create a picture, it starts with random noise and turns it into an image over dozens of steps, while a text description determines what the image should look like.

How it works

During training, Gaussian noise is gradually added to real images until only noise remains, and the neural network learns to predict that noise at each step. Generation runs in reverse: the model estimates the noise in the current image, a scheduler subtracts part of it, and this repeats until a clean result emerges. The number of steps is set by the num_inference_steps parameter; the DDPM paper used 1,000 steps, while 25 are enough in the Diffusers documentation examples.

Latent diffusion

Working with pixels is expensive, so in latent diffusion an autoencoder (VAE) first compresses the image into a compact latent representation, and the noise is removed there. In Stable Diffusion 1.x, the latent representation is 8 times smaller in height and width than the image: 512×512 pixels become 64×64. A text prompt is turned into vectors by a text encoder and mixed in through attention layers. The guidance_scale parameter (7.5 in the documentation example) determines how strictly the model follows the prompt.

What a pipeline consists of

ComponentWhat it does
Text encoderturns the prompt into conditioning vectors
Denoising networkpredicts the noise in the latent representation at each step (a UNet or a transformer)
Schedulerdecides how much noise to remove at a step and defines the set of steps
VAEconverts the latent representation into the final image

Diffusion probabilistic models were proposed by Sohl-Dickstein and co-authors in 2015, the DDPM method by Jonathan Ho, Ajay Jain and Pieter Abbeel in 2020, and the latent variant by Robin Rombach and co-authors in 2021. Examples of open-weight models are Stable Diffusion and FLUX.

Sources

the term is written from these pages

Verified 18 Nov

Not to be confused with

what it is mixed up with and how it differs

  • LLMlarge language model

    An LLM predicts the next token of text, while a diffusion model cleans up noise step by step.

  • multimodal model

    A multimodal model usually reads an image and answers about it in text, while a diffusion model creates an image from text.

In depth in the references

where the topic is covered in detail