Skip to content

Diffusion model

Also called: diffusion models, denoising diffusion model, DDPM, latent diffusion model

Published:

How does a diffusion model generate an image?

It starts from pure noise. The Hugging Face Diffusers documentation describes a pipeline that creates random noise the size of the target image and passes it through the model several times [2]. At each step the model predicts the noise residual, and a scheduler uses that prediction to compute a slightly less noisy image [2]. The loop runs until the set number of steps is used up.

A concrete case: in the Diffusers tutorial, the google/ddpm-cat-256 model turns noise into a picture of a cat in 25 steps [2].

Where did the approach come from?

The paper that put diffusion on the map for image synthesis is DDPM, by Ho, Jain and Abbeel in 2020. They describe diffusion probabilistic models as latent variable models inspired by nonequilibrium thermodynamics [1]. Their best results came from a training objective built on a link between diffusion models and denoising score matching with Langevin dynamics [1]. On unconditional CIFAR-10 the model scored an Inception score of 9.46 and an FID of 3.17, state of the art at the time [1].

Where does Stable Diffusion fit in?

Stable Diffusion is a text-to-image latent diffusion model. Instead of denoising raw pixels, it works on a compressed, lower-dimensional representation of the image, which saves memory [2]. The text prompt goes through a text encoder and steers the denoising towards an image that matches it [2].

Frequently asked questions

Do diffusion models only make images?

Images are the best-known use, but the same idea can be applied to other kinds of data.

What happens if I use more denoising steps?

More steps usually give a more refined result but take longer to generate.

Sources

  1. Denoising Diffusion Probabilistic Models — arXiv
  2. Understanding pipelines, models and schedulers — Hugging Face Diffusers

Related terms