- Introduced by
- Ho, J., Jain, A. & Abbeel, P.
- Year
- 2020
- Type
- Generative deep learning (denoising diffusion)
What does it do?
A diffusion model is a generative deep-learning method, introduced in its denoising form (DDPM) by Ho, Jain and Abbeel in 2020.
It learns to generate samples, most prominently images, by reversing a step-by-step noising process. It is a common approach for high-fidelity image generation, including latent-diffusion systems such as Stable Diffusion. The approach has also been explored for audio and molecular structures.
The intuition behind the method
Imagine gradually blurring a photo into pure static by adding a little random noise at a time. A diffusion model learns the reverse journey: it starts from random noise and removes a little noise at each step until a clean sample emerges. Because each learned step only has to undo one small amount of noise, the task is easier to learn than generating a whole image in one pass. The cost of this design is that generation requires many sequential steps.
History
Denoising Diffusion Probabilistic Models were introduced by Ho, Jain and Abbeel in 2020, and the original paper reported image generation results. In 2022 Rombach and colleagues introduced Latent Diffusion Models, which run the diffusion process in a compressed latent space; this made high-resolution synthesis more practical and underlies systems such as Stable Diffusion. Diffusion models are now a widely used approach in generative modelling.
When to use it
Choose a diffusion model when the goal is to generate new images (and, where applicable, audio or molecular structures) and sample quality matters more than generation speed. Training from scratch needs a substantial training set. The required size depends on the task, the dimensionality of the data and the size of the network, so no fixed minimum applies. A small dataset usually calls for fine-tuning a pretrained diffusion model in a related domain, if one exists. If no suitable pretrained model is available, a simpler generator such as a variational autoencoder is one option to weigh against a diffusion model. It typically samples faster but often yields lower sample fidelity, so the choice should be validated on the target task. Diffusion models are a poor fit when accelerator hardware is unavailable or when fast single-pass generation is required, because sampling runs the denoising network many times in sequence.
Limitations and considerations
- Training from scratch needs a large training set, and the required size depends on the task, the data dimensionality and the model size. With limited data, fine-tuning a pretrained model or using a simpler generator is often more practical.
- Training large diffusion models typically requires GPU or TPU accelerators. Sampling on CPU is much slower and is often impractical for large models or high resolutions, although small models at low resolution can run on CPU. The cost depends on model size, resolution and the number of sampling steps.
- Sampling iterates the denoising network over many steps, so generating one sample requires many sequential network passes.
- The quality of generated samples depends on the amount and coverage of the training data, so a narrow or unrepresentative dataset yields a narrow or unrepresentative generator.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- The original DDPM paper reports image quality competitive with GANs.
- Training uses a regression-style denoising objective and does not require an adversarial discriminator, which tends to make training more stable than GAN training in practice.
- Latent-diffusion variants run the denoising loop in a compressed latent space, which makes high-resolution generation computationally more practical.
- The denoising formulation supports conditional generation, such as text-conditioned image synthesis in latent-diffusion systems.
Applications
- High-resolution image synthesis and text-to-image generation.
- Audio generation, which has been explored in the literature.
- Generation of molecular structures, which has also been explored in the literature.
- Conditional generation and data augmentation using pretrained backbones.
How it works
How it works
A fixed forward process corrupts each training example by adding small amounts of Gaussian noise over many steps, until the data becomes approximately pure noise. Here beta_t is the variance of the noise added at step t, set in advance by a fixed noise schedule over the total number of steps T. This process has no learnable parameters; it defines the trajectory from clean data to noise that the model later learns to reverse.
Formula
q(x_t \mid x_{t-1}) = \mathcal{N}(x_t; \sqrt{1-\beta_t}\,x_{t-1}, \beta_t I)A neural network, typically a U-Net, is trained to predict the noise added at a given step. Minimising the squared error between the true and predicted noise, averaged over time steps and training examples, teaches the network how to move a noisy input one step closer to clean data.
Formula
\mathcal{L} = \mathbb{E}_{t, x_0, \epsilon}\big[\,\lVert \epsilon - \epsilon_\theta(x_t, t) \rVert^2\,\big]To generate a sample, the model starts from random noise and repeatedly applies the learned denoising update, subtracting the scaled predicted noise and adding a small random term z at each step. Here alpha_t = 1 - beta_t, where beta_t is the noise variance of step t from the fixed schedule; alpha-bar_t is the product of alpha_s over s = 1 to t, and sigma_t sets the scale of the fresh noise. Latent-diffusion variants, including the Stable Diffusion family, run this loop in a compressed latent space rather than in pixel space, which reduces the computational cost of high-resolution generation.
Formula
x_{t-1} = \frac{1}{\sqrt{\alpha_t}}\Big(x_t - \frac{\beta_t}{\sqrt{1-\bar{\alpha}_t}}\,\epsilon_\theta(x_t, t)\Big) + \sigma_t zCommon pitfalls
- Training from scratch on a small dataset when a pretrained diffusion model in a related domain could be fine-tuned instead.
- Underestimating compute: training and sampling both depend heavily on accelerator hardware and on the number of sampling steps.
- Expecting real-time output when the multi-step sampling loop makes each generation inherently slow.
- Choosing a diffusion model without checking whether a simpler generator, such as a variational autoencoder, meets the requirements.
Frequently asked questions
How is a diffusion model different from a GAN?
Both are generative models, but a GAN trains a generator against a discriminator, which can be unstable and prone to mode collapse. A diffusion model instead learns to reverse a fixed noising process one small step at a time, which trains as a regression problem and tends to be more stable.
How much data do I need?
No fixed minimum applies. The amount of data needed depends on the task, the dimensionality of the data and the size of the network, and training from scratch typically calls for a substantial dataset. With limited data, fine-tune a pretrained diffusion model in a related domain if one is available, or consider a simpler generator such as a variational autoencoder. Check the choice by validation on the target task.
Why is generation slow?
Sampling starts from noise and applies the learned denoising step many times in sequence, so producing one sample requires many network passes. Latent-diffusion variants reduce the cost by working in a compressed latent space.
Do I need special hardware?
Training large diffusion models typically requires GPU or TPU accelerators. Sampling on CPU is much slower and is often impractical for large models or high resolutions, though small models at low resolution can run on CPU. The cost depends on model size, resolution and the number of sampling steps.
Related methods
Sources
Ho, J., Jain, A. & Abbeel, P. (2020). Denoising Diffusion Probabilistic Models. NeurIPS.
Open publication referenceRombach, R., Blattmann, A., Lorenz, D., Esser, P. & Ommer, B. (2022). High-Resolution Image Synthesis with Latent Diffusion Models. CVPR.
Open publication reference