TL;DR
DDPM is a recipe for generating images with a diffusion model. Take a training image and add a little Gaussian noise, repeated 1000 times, until nothing of the picture is left. Train one U-Net to guess the noise that was added at any given step. To make a new image, start from pure random noise and repeat the guess-and-subtract step 1000 times. The training loss is just a mean squared error between the true noise and the predicted noise, which made the method simple enough to scale up.
Where you'll see it: the paper that made high-quality image generation from diffusion models practical, and the base of image generators such as Stable Diffusion and many later video and audio models.
The problem
By 2020, the best image generators were GANs. They produced sharp images but were hard to train: the generator and discriminator had to be balanced against each other, and training often collapsed. Likelihood-based models were stable to train but produced blurry or poor samples on natural images. Diffusion models had been proposed in 2015 by Sohl-Dickstein and colleagues, with a tractable training objective and good theory, but nobody had shown they could produce samples that looked as good as GAN output. The gap DDPM closed was to show that a diffusion model, with a particular and simpler way of training it, could compete with GANs on sample quality.
Key idea
Think of a photograph slowly dissolving into static. Each step adds a small amount of noise, so the picture gets a little grainier. After enough steps it is indistinguishable from random static. The chain is easy to run forward: the noise is known, and nothing needs to be learned.
Generation runs the film backwards. Start from static and remove a little noise at a time. The step that undoes one bit of noise is hard to write down by hand, so a neural network learns it. The paper's key move is that this network does not need to predict the cleaner image directly. It only needs to predict the noise that was mixed in, and a loss that asks for exactly that works better in practice than the tighter variational bound that the theory suggests.
flowchart LR x0["clean image x0"] -->|add noise, step 1| x1["x1"] x1 -->|add noise| x2["x2"] x2 -->|"... 1000 steps"| xT["xT ~ pure noise"] xT -->|"learned denoise step"| y2["x2 (generated)"] y2 -->|"learned denoise step"| y1["x1 (generated)"] y1 -->|"learned denoise step"| y0["x0 (generated image)"]
Forward arrows are fixed. Backward arrows are the learned model, run 1000 times.
The method
Setup
A diffusion model is a latent variable model. The data is , and there are latent variables with the same dimension as the data. Here is the number of steps and the paper uses . The forward process is a fixed Markov chain that adds Gaussian noise. With a variance schedule :
Each step shrinks the signal a little by the factor and adds noise with variance . The shrink factor keeps the overall variance from growing as noise is added. Here is a Gaussian over the vector with mean and covariance , and is the identity matrix.
The reverse process is the model. It starts from a standard normal prior and applies learned Gaussian steps:
The paper fixes the reverse variance to with a constant, and learns only the mean .
Closed form for any step
Write and . Then the forward process can be sampled at any step in one jump, without running the chain:
Equivalently, with . This is the reparameterization that makes training cheap: a training step can pick a random and sample directly, and it does not need to simulate the chain. The "reparameterization" of the noise is the same trick described in Reparameterization Trick.
The variational bound
Training maximizes a variational bound on the log likelihood. The paper rewrites the negative bound as a sum of KL divergences:
The target posterior is also Gaussian, with mean
Because every term is a KL between two Gaussians, each is available in closed form. That removes the high-variance Monte Carlo estimates that a naive bound would need.
The noise parameterization
Matching means, reduces to a weighted squared error between and . The paper's choice is to parameterize the mean through a noise predictor :
With this choice, the per-step loss becomes a weighted squared error on the noise:
Here is a constant that does not depend on . The paper notes that this objective resembles denoising score matching over several noise levels, which connects the model to Langevin dynamics for sampling.
The simplified objective
The paper's main training objective drops the time-dependent weight:
where is drawn uniformly from to . This is a plain Mean Squared Error between the noise and the predicted noise. The paper's explanation for why it works better for sample quality is that the dropped weight down-weights the very small-noise steps. Those steps are easy to denoise and were carrying a lot of the loss without helping the image look good. Training on the true bound gives better likelihoods, but this simpler objective gives better samples.
Training and sampling
Training (Algorithm 1 in the paper) is a loop: sample an image from the dataset, sample uniformly, sample , take a gradient step on , and repeat. The paper uses Adam with default settings, a learning rate of (lowered to for the images, which were unstable at the larger rate), batch size 128 on CIFAR-10 and 64 on larger images, and an exponential moving average of the weights with decay 0.9999 for evaluation.
Sampling (Algorithm 2) starts from and, for down to , computes
with at the last step. The paper observes that this update looks like Langevin dynamics, with acting as a learned gradient of the data density.
Schedule and architecture
The paper uses , with rising linearly from to . These values keep near zero, so is almost exactly the prior. The network is a U-Net based on PixelCNN++ with group normalization, self-attention at the resolution, and the sinusoidal position embedding of the time step added into each residual block. The CIFAR-10 model has 35.7 million parameters. The LSUN and CelebA-HQ models have 114 million.
Worked examples
Take a one-dimensional "image" with , and suppose at some step . Draw noise .
- Signal coefficient: .
- Noise coefficient: .
- Noisy sample: .
- Check by inverting: .
Interpretation: at this step the sample is still mostly signal, but the noise has moved it from 1.0 to 1.433. Training sees the pair , and the network's job is to recover from and alone.
Use one denoising step with , , , , and . Suppose the network predicts .
- Factor for the noise term: .
- Multiply by the prediction: .
- Subtract from : .
- Scale by : .
- Add noise. With and a draw : .
Interpretation: the mean step barely moved the value because the predicted noise was small and is small. Almost all of the change in a single step comes from the injected noise . The full 1000-step chain is needed to go from static to an image.
For one sampled pair with true noise and predicted noise , the contribution to is . Averaging this quantity over a batch of images and random values gives the training loss. A network that predicts everywhere would have loss equal to the average of , which is in expectation for standard normal noise. The gap between and the trained loss measures how much of the noise the network can explain.
Results
Sample quality on CIFAR-10. Trained on the simplified objective, the unconditional model reaches an Inception score of 9.46 and a Fréchet Inception Distance (FID) of 3.17, computed against the training set. The paper reports that this FID is better than most models in the literature, including class-conditional ones (the paper's Table 1, which lists the comparison models, is not reproduced in the course's text copy, so the Inception score is quoted from the paper's summary, not rechecked here). Measured against the test set, the FID is 5.24. The paper trains on the true variational bound as well, which gives better codelengths but worse samples.
Ablation on the objective. Predicting the mean works well only when trained on the true bound. An unweighted Mean Squared Error on the mean performs poorly. Learning the reverse variance destabilizes training and reduces quality, so fixed variances are used. Predicting the noise performs about as well as predicting the mean when trained on the bound, and much better when trained on .
Likelihood. The paper is honest that the lossless codelengths are not competitive with the best likelihood models. They are better than the large annealed importance sampling estimates reported for energy-based models and score matching at the time. The gap between train and test codelength is at most 0.03 bits per dimension, so the model is not overfitting.
Rate and distortion. Treating the bound terms through as rate and as distortion, the best-sample-quality CIFAR-10 model has a rate of 1.78 bits per dimension and a distortion of 1.97 bits per dimension (the paper's text in Section 4.3). The distortion of 1.97 is in bits per dimension, while the paper's Table 4 (test set, full chain) lists distortion as root mean squared error: rate 1.77581 bits per dimension and RMSE 0.95 on a 0 to 255 scale. These are the same quantity in two units, and the rates agree. More than half of the lossless codelength pays for imperceptible detail. Table 4 shows where the bits go: after 900 reverse steps the cumulative rate is only 0.12 bits per dimension and the RMSE is already 12.0, and the remaining 1.66 bits per dimension, spent in the last 100 steps, only take it from 12.0 down to 0.95.
Other datasets. At resolution on LSUN, FIDs for the model are 6.36 on Bedroom, 7.89 on Church and 19.75 on Cat (Table 3). A larger Bedroom model reaches 4.90. Against ProgressiveGAN (8.34, 6.42, 37.52) the model is better on Bedroom and Cat and worse on Church. It does not beat the stronger StyleGAN results in the same table (Bedroom 2.65, Church 4.21, Cat 8.53) or StyleGAN2 (Church 3.86, Cat 6.93). So the claim is competitive with the GANs of the time, not better than the best.
Why it mattered
DDPM showed that a likelihood-based, stable-to-train model could produce images that people and metrics rated as competitive with GANs. That changed where the field spent its effort. Within two years, diffusion models had become the default for high-resolution image generation. Later work followed up on the connection to score matching and stochastic differential equations, moved the diffusion to a learned latent space in latent diffusion models, and used the same recipe for text-to-image, video and audio generation.
The paper also introduced the view of sampling as progressive decoding. Early steps determine coarse structure and late steps add fine detail. That view is one reason diffusion sampling is a useful tool for controlling image content.
Tradeoffs and failure modes
| Situation | What goes wrong | Better choice |
|---|---|---|
| You need fast generation of one image | 1000 U-Net evaluations per sample is slow compared with a GAN generator | Fewer-step samplers, or latent diffusion, which runs the chain in a compressed space |
| You need exact likelihoods | The lossless codelengths are not competitive with the best autoregressive or flow models | Use the true variational bound and accept worse samples, or use a likelihood-focused model |
| The data is not images | The U-Net and the linear schedule are tuned for image resolution and pixel scale | Adapt the architecture and schedule to the modality |
| Training on very small | The simplified loss gives these steps little weight, so they may be under-trained | This is intended; use the true bound if small-noise accuracy matters |
| Reusing the schedule at a different resolution | The schedule keeps near zero only for the scale used in the paper | Re-check and the signal-to-noise ratio at the new scale |
The method also inherits the general concerns of generative models. The paper's broader impact section notes that these models can produce convincing fake images and reflect dataset bias.
History
Sohl-Dickstein, Weiss, Maheswaranathan and Ganguli introduced the diffusion probabilistic model in 2015. Their version used the same forward and reverse chain idea but did not reach the sample quality of GANs. Song and Ermon later showed that denoising score matching at several noise levels, followed by annealed Langevin dynamics, could produce good samples. Ho, Jain and Abbeel published DDPM in 2020. Their contribution was the noise-prediction parameterization, the simplified loss, and the empirical result that these choices gave high-quality samples on CIFAR-10 and LSUN. The paper appeared at NeurIPS in 2020. It caught on because the training loop was simple, the results matched the strongest GAN baselines, and the code was released.
Reading guide
Read these in order. Each row lists the paper section and the prerequisites it depends on.
- Section 1, Introduction. Needs Diffusion Model (the general idea of a noising chain and a learned reverse chain) and an idea of what GANs and VAEs are.
- Section 2, Background. Needs Markov Chain for the forward and reverse chains, Gaussian (Normal) Distribution for every step, and Variational Lower Bound (ELBO) for the training bound.
- Equations 4 and 5. Needs Reparameterization Trick for the closed-form jump, and Kullback–Leibler Divergence for the bound decomposition.
- Section 3.2, Reverse process. Needs Score Matching and Langevin Dynamics for the link between the noise predictor and the score. Needs Mean Squared Error for the simplified loss.
- Section 3.3 and 3.4. Needs the idea of a discrete decoder from a continuous Gaussian. Needs Stochastic Gradient Descent for training.
- Section 4 and Appendix B, experiments. Needs U-Net and Convolutional Neural Network for the architecture, Encoder-Decoder Architecture for skip connections, and Exponential Moving Average for evaluation weights.
- Section 4.3 and Section 4.4. The rate-distortion and interpolation parts are easier after reading Latent Variable Model.
Check yourself
QuestionRecall: what does the forward process add at each step, and what is the variance of the added noise?Show answer
At each step the forward process multiplies the current state by and adds Gaussian noise with variance . The shrink factor keeps the total variance from growing, so the data gradually turns into a standard normal sample.
QuestionComputation: with , and , what is ?Show answer
- .
- .
- .
So , which equals in this case. This is a coincidence of the chosen numbers. In general is a mix of signal and noise weighted by and .
QuestionWhy does the paper train on the simplified loss instead of the exact variational bound, even though the bound is the principled objective?Show answer
The exact bound puts a weight on each step's error, and that weight is largest for the steps with the least noise. Those steps are easy to denoise, so they dominate the loss without teaching the model much about the global structure of images. Dropping the weight shifts the model's effort toward the harder, noisier steps. The paper finds that this improves sample quality, at the cost of a slightly worse likelihood.
QuestionWhy is the model parameterized to predict the noise instead of the clean image or the mean?Show answer
Predicting makes the reverse mean a fixed function of and the prediction. With the training loss written in terms of , the loss has the same form as denoising score matching, which ties the model to Langevin sampling. The paper reports that predicting is as good as predicting the mean on the true bound, and much better on the simplified loss. Predicting led to worse early samples in the authors' experiments.
QuestionApplied: a team wants to generate 1000 images on a fixed budget of network calls, and their sampler takes 1000 steps per image. What is the cost, and what change would reduce it?Show answer
Each image needs 1000 forward passes of the U-Net, so 1000 images need 1,000,000 passes. The paper sets so that the number of network evaluations matches earlier work. The cost per image is proportional to the number of steps, so a sampler that uses fewer steps (for example, later few-step samplers, or running the chain in a latent space) cuts the cost roughly in proportion. This is not something the paper itself tests, and fewer steps generally cost some sample quality.
Sources
- Ho, Jain, Abbeel, "Denoising Diffusion Probabilistic Models" (2020): https://arxiv.org/abs/2006.11239
- Sohl-Dickstein et al., "Deep Unsupervised Learning using Nonequilibrium Thermodynamics" (2015): https://arxiv.org/abs/1503.03585