What is a diffusion model?
A diffusion model is a generative model that learns to turn random noise into realistic data by reversing a gradual noising process. During training, real images are corrupted with Gaussian noise at random strengths, and a neural network learns to predict that noise. To generate, the model starts from pure noise and removes the predicted noise a little at a time until an image appears.
The approach was introduced by Sohl-Dickstein et al. in 2015 and made practical by Denoising Diffusion Probabilistic Models (DDPM, Ho et al., 2020). Diffusion models power text-to-image systems such as Stable Diffusion, DALL·E 2, and Imagen, and are also used for audio, video, and molecule generation.
Key ideas
- The forward process adds Gaussian noise on a fixed schedule; nothing in it is learned.
- The network learns one task: predict the noise in a noisy image at step t.
- Generation starts from fresh noise and removes predicted noise step by step, so it produces a new sample, not a stored one.
- The noise schedule controls how quickly the signal disappears.
- Fewer sampling steps are faster; methods like DDIM keep quality with far fewer steps.
- Classifier-free guidance trades diversity for closer prompt matching.
Short takes on this topic
Common questions
How are diffusion models different from GANs?
A GAN generates an image in one pass and is trained by pitting a generator against a discriminator, which can be unstable and can miss parts of the data. A diffusion model is trained with a simple regression loss and generates over many steps. It is slower to sample but more stable to train and usually covers the variety in the data better.
How does a text prompt control the image?
The prompt is turned into vectors by a text encoder, such as CLIP's or T5's. The denoising network reads those vectors through cross-attention at every step, so the noise it predicts depends on the prompt.
Why predict the noise instead of the clean image?
Given the noisy image and the step t, either one can be computed from the other, so the choices are mathematically equivalent. In practice, predicting the noise gave better results in DDPM. Some later models predict a mix of the two, called v-prediction.
Are diffusion models only used for images?
No. The same method generates audio, video, 3D shapes, and molecular and protein structures. Anything that can be represented as numbers and gradually noised can be modeled this way.
Related explainers
- Autoencoders & VAEs — From compression to generation — standard and variational autoencoders
- GANs — Two networks competing to create
- Cross-Attention — Attending across sequences and modalities
- Probability & Distributions — Spam, densities, and the math of uncertainty
- Sampling & Monte Carlo — Random sampling, the law of large numbers, and Monte Carlo estimation
- Image Segmentation — Classify every pixel in an image — from semantic regions to individual object instances
References
- Sohl-Dickstein et al. (2015), "Deep Unsupervised Learning using Nonequilibrium Thermodynamics"
- Ho, Jain & Abbeel (2020), "Denoising Diffusion Probabilistic Models"
- Song, Meng & Ermon (2020), "Denoising Diffusion Implicit Models"
- Nichol & Dhariwal (2021), "Improved Denoising Diffusion Probabilistic Models"
- Rombach et al. (2022), "High-Resolution Image Synthesis with Latent Diffusion Models"
- Ho & Salimans (2022), "Classifier-Free Diffusion Guidance"
Last updated