Paper commentary
Diffusion Models Beat GANs on Image Synthesis
- Problem GANs hold the best sample quality on most image generation tasks, while diffusion models still trail them on harder datasets such as ImageNet.
- Method Improves the diffusion UNet through a series of ablations, then adds classifier guidance, which shifts each reverse sampling step by the scaled gradient of a noise-trained classifier.
- Results Reached FID 2.97 on ImageNet 128×128 with ADM-G and FID 4.59 on ImageNet 256×256, both with 250 sampling steps.
Why GANs still lead image synthesis
GANs currently hold the best sample quality on most image generation tasks when judged by FID, Inception Score and Precision. They are also hard to train, since they collapse without carefully chosen hyperparameters and regularizers, and they capture less diversity than the best likelihood-based models. Diffusion models are likelihood-based, cover the data distribution well, have a stationary training objective and scale easily, and they have recently produced high-quality images.
On harder datasets such as LSUN and ImageNet, diffusion models still trail GANs. The best ImageNet 256×256 result from an upsampling diffusion stack still had an FID that was not competitive with BigGAN-deep.
The authors hypothesize two causes: GAN architectures have been refined heavily, and GANs can trade diversity for fidelity, producing high-quality samples without covering the whole distribution. The study therefore improves the architecture first, then adds a way to trade diversity for fidelity.
How diffusion sampling and training work
Training draws a data sample, a timestep and noise, forms the noised sample x_t, and fits the network ε_θ(x_t, t) with a mean-squared error between the predicted and true noise. Ho et al. found that this simple loss, L_simple, works better in practice than the variational lower bound L_vlb.
Each reverse step is modelled as a Gaussian p_θ(x_{t-1} | x_t) with a mean computed from ε_θ and a variance Σ_θ, and the variance can be fixed or learned. Nichol and Dhariwal learn the variance by interpolating in log space between β_t and β̃_t through a network output v, \\[ \\Sigma_\\theta(x_t,t) = \\exp\\big(v \\log \\beta_t + (1-v)\\log \\tilde\\beta_t\\big) \\] Training uses the hybrid objective L_simple + λL_vlb, which this work adopts throughout.
DDIM uses a non-Markovian noising process with the same forward marginals as DDPM but a different reverse noise. Setting that reverse noise to zero makes the sampler deterministic, and the authors use this DDIM sampler when they take fewer than 50 sampling steps.
How sample quality is measured
FID is the default metric because it captures both diversity and fidelity and has been the common standard in state-of-the-art generative modeling. Inception Score rewards covering the ImageNet class distribution while producing convincing single-class samples, but it does not reward diversity within a class and can stay high for models that memorize a small subset.
sFID applies FID to spatial features instead of pooled features, which rewards coherent high-level structure. Improved Precision and Recall separate fidelity, the fraction of model samples inside the data manifold, from diversity, the fraction of data samples inside the sample manifold. Precision or IS is used to measure fidelity and Recall to measure diversity.
Published numbers are not always comparable, because some papers use arbitrary training subsets as reference and implementation details change FID values.
Architecture changes that improve FID
The starting point is the UNet from Ho et al., with residual layers, downsampling and upsampling convolutions, skip connections, a global attention layer at 16×16 with a single head, and a timestep projection in each residual block. The authors vary depth against width, the number of attention heads, attention at 32, 16 and 8 resolutions, BigGAN residual blocks for resampling, and rescaling of residual connections by 1/√2.
Each comparison trains on ImageNet 128×128 with batch size 256 and samples with 250 sampling steps.
Apart from residual rescaling, the other modifications improve FID and have a positive compounding effect.
Plotting FID against wall-clock time favors 64 channels per head, which the authors adopt as their default, and this choice also matches common Transformer designs.
Replacing AdaGN with the addition plus GroupNorm layer from Ho et al. raised FID from 13.06 to 15.08.
The ablations in this section used 128 base channels and trained for 700K iterations.
Steering sampling with classifier gradients
Earlier work showed that a pre-trained diffusion model can be conditioned with classifier gradients, and the authors build on that idea. They train a classifier p_φ(y | x_t, t) on noisy images x_t and use ∇_{x_t} log p_φ(y | x_t) to guide sampling toward a target label y.
Conditioning the reverse transition on y multiplies the unconditional transition by the classifier probability and renormalizes, \\[ p_{\\theta,\\phi}(x_t \\mid x_{t+1}, y) = Z\\, p_\\theta(x_t \\mid x_{t+1})\\, p_\\phi(y \\mid x_t) \\] where Z is a normalizing constant. A Taylor expansion of the classifier log-probability around the mean μ, under a low-curvature assumption that holds in the limit of infinitely many steps, leaves a Gaussian whose mean is shifted by Σg, with g the classifier gradient at μ, \\[ z \\sim \\mathcal{N}(\\mu + \\Sigma g, \\Sigma) \\]
The sampler multiplies this gradient by a gradient scale s, which the authors include as an optional factor in the sampling algorithm. Because DDIM is deterministic, the stochastic derivation does not apply, so the authors use the score view of the noise predictor, ∇_{x_t} log p_θ(x_t) = -ε_θ(x_t)/√(1-ᾱ_t), and combine it with the classifier gradient.
The resulting modified noise prediction is \\[ \\hat\\epsilon(x_t) := \\epsilon_\\theta(x_t) - \\sqrt{1-\\bar\\alpha_t}\\,\\nabla_{x_t}\\log p_\\phi(y \\mid x_t) \\] and it replaces ε_θ in the regular DDIM update.
The classifier reuses the downsampling trunk of the UNet, with an attention pool at the 8×8 layer, and it is trained on the same noising distribution as its diffusion model. Random crops are added to reduce overfitting.
In early unconditional ImageNet experiments a gradient scale larger than 1 was needed: at scale 1 the classifier gave the desired classes about 50% probability, but the samples did not match them visually. Larger scales pushed the classifier probabilities close to 100%, because scaling by s makes the guided distribution proportional to p(y | x)^s, which is sharper than p(y | x) when s is above 1.
The authors note that a larger scale concentrates samples on the classifier modes, which favors fidelity at the cost of diversity.
How the gradient scale trades recall for precision
On an unconditional diffusion model, guidance toward the class Pembroke Welsh corgi at scale 1.0 gave FID 33.0 and samples that were not convincing for the class. At scale 10.0 the same setup gave FID 12.0 and more class-consistent images.
On ImageNet 256×256, with models trained for 2M iterations at batch size 256, the conditional model without guidance reached FID 10.94 with precision 0.69 and recall 0.63. At scale 1.0 the same model reached FID 4.59, with precision rising to 0.82 and recall falling to 0.52. At scale 10.0 it reached FID 9.11, with precision 0.88 and recall 0.32.
Guidance therefore improves precision at the cost of recall, which the authors present as a trade-off between fidelity and diversity.
For the unconditional model, FID was 26.21 without guidance, 33.03 at scale 1.0 and 12.00 at scale 10.0. Guidance with a high enough scale brings the unconditional model close to the FID of the unguided conditional model, although training with class labels still helps.
Figure 4 varies the gradient scale from 0 to 10 for a class-conditional ImageNet 128×128 model. Scaling beyond 1.0 smoothly trades recall for higher precision and IS, and FID and sFID reach their best values at an intermediate scale.
Comparison with GANs on LSUN and ImageNet
Without classifier guidance, ADM reaches the best FID in Table 5 on LSUN bedrooms, horses and cats and on ImageNet 64×64. The dropout variant of ADM reached FID 1.90 on bedrooms, 2.57 on horses and 5.57 on cats, against StyleGAN's 2.35, StyleGAN2's 3.84 and StyleGAN2's 7.25 on the respective classes. On ImageNet 64×64, ADM reached FID 2.61, against 4.06 for BigGAN-deep.
The LSUN models were sampled with 1000 steps.
On ImageNet 128×128, ADM-G reached FID 2.97 against 6.02 for BigGAN-deep, with recall 0.59 against 0.35. On ImageNet 512×512 it reached FID 7.72 against 8.43 for BigGAN-deep, with recall 0.42 against 0.29. BigGAN-deep keeps higher precision in all three ImageNet rows, at 0.86, 0.87 and 0.88 against 0.78, 0.82 and 0.87 for ADM-G.
The authors state that these guided models match GAN-level perceptual quality while keeping higher recall, and that they can do so with only 25 diffusion steps.
Figure 6 sets BigGAN-deep samples at truncation 1.0 with FID 6.95 beside guided diffusion samples with FID 4.59 and with training-set images. The authors argue that the diffusion samples show more modes, such as zoomed ostrich heads, single flamingos, different cheeseburger orientations and a tinca fish without a human holding it.
Guidance combined with upsampling
Two-stage upsampling trains a low-resolution diffusion model and a second model that upsamples its output. The upsampler is conditioned on the low-resolution image, concatenated channel-wise to its input after simple interpolation, and sampling feeds the low-resolution sample into it.
The authors use the upsampling stack of Nichol and Dhariwal with their architecture changes, calling it ADM-U, with base resolutions of 64 for the 256×256 models and 128 for the 512×512 models. When guidance is combined with upsampling, only the lower-resolution model is guided.
At 256×256, ADM-U reached FID 7.49 with 250 base and 250 upsampling steps, against 10.94 for ADM. Adding guidance to the base model gave FID 4.59, and guidance plus ADM-U gave FID 3.94. At 512×512, ADM-U reached FID 9.96, and guidance plus ADM-U reached FID 3.85 with 250 steps for both models. Using 25 steps for the guided base model and 250 for the upsampler gave FID 4.11 at 512×512.
Upsampling raises precision while keeping recall high, whereas guidance provides a knob that trades recall against much higher precision. The best FIDs come from guidance at the lower resolution before upsampling, which the authors read as evidence that the two approaches complement each other.
Guidance against BigGAN-deep truncation
The truncation trick for GANs samples the latent vector from a truncated normal distribution, and raising truncation lowers diversity while raising fidelity.
Figure 5 compares BigGAN-deep at truncation levels 0.1 to 1.0 with classifier guidance at varying gradient scales on ImageNet 128×128. Classifier guidance is strictly better than BigGAN-deep when FID is traded against Inception Score. For the precision and recall trade-off, guidance is only a better choice up to a certain precision threshold, beyond which it cannot reach higher precision.
Limitations
Classifier guidance is currently limited to labeled datasets, and no effective strategy is given for trading diversity against fidelity on unlabeled data. The authors suggest that clustering samples into synthetic labels, or training discriminators to detect samples from the true distribution, could extend the method.
Diffusion models are still slower than GANs at sampling time because they need multiple denoising steps and therefore multiple forward passes. The single-step distillation of DDIM by Luhman and Luhman is not yet competitive with GANs, although it beats earlier single-step likelihood models.
FID, Inception Score and precision-recall are not perfect proxies for sample quality, and better metrics remain an open problem. Some values in Table 5 are taken from earlier papers because public models or samples were not available.
The classifier-guided conditional experiments cover ImageNet at 128×128, 256×256 and 512×512, and the LSUN experiments cover only the bedroom, horse and cat classes.
Paper info
- Authors
- Prafulla Dhariwal, Alex Nichol
- Venue
- arXiv · Preprint
- First published
- 2021-5-11
- Added
- 2026-10-20
- Updated
- 2021-6-1
- Version
- v4
- arXiv
- 2105.05233
- Category
- cs.LG · cs.AI · cs.CV · stat.ML
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Prafulla Dhariwal, Alex Nichol (2021). Diffusion Models Beat GANs on Image Synthesis. arXiv:2105.05233v4. https://arxiv.org/abs/2105.05233v4
BibTeX
@misc{dhariwal2021diffusion,
title = {{Diffusion Models Beat GANs on Image Synthesis}},
author = {Prafulla Dhariwal and Alex Nichol},
year = {2021},
eprint = {2105.05233},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2105.05233v4}
}