DL0102 Diffusion vs GAN vs VAE

Explain the fundamental principles of Diffusion Models, and compare their pros and cons with GANs, VAEs, and Flow-based models.

Answer

A diffusion model defines a fixed forward process that gradually corrupts data into Gaussian noise over T steps, then learns the reverse process that removes a little noise at a time. The forward chain has no parameters and admits a closed form, so training reduces to a plain regression: sample a clean image x_0, sample a timestep t and noise \epsilon, build the noisy state x_t, and ask the network to predict \epsilon. This denoising objective is a weighted variational bound on the log-likelihood and is also equivalent to score matching, which is why the same network can be plugged into an SDE or ODE sampler. The practical consequence is that diffusion buys stable training and excellent mode coverage at the price of many network evaluations per sample, whereas a GAN generates in one forward pass but fights an unstable min-max game, a VAE trains stably but produces blurry samples under a Gaussian decoder, and a normalizing flow gives exact likelihoods but pays for invertibility with architectural constraints and parameter count.

(1) Fixed Corruption, Learned Reversal: only the reverse direction has parameters, so there is no adversary and no discriminator to balance, which removes the main source of GAN training instability.
(2) Closed-Form Training Target: because q(x_t \mid x_0) is Gaussian, any timestep can be sampled directly without simulating the chain, making each training step O(1) in T.
(3) Score Interpretation: the noise predictor is a rescaled estimate of \nabla_{x_t}\log q(x_t), which links diffusion to Langevin dynamics and to probability-flow ODE samplers such as DDIM.
(4) Sampling Is The Bottleneck: quality scales with the number of function evaluations, so a 1000-step DDPM sampler costs three orders of magnitude more compute per image than a GAN generator.
(5) Coverage Versus Speed: the likelihood-flavored objective penalizes dropped modes, which is exactly the failure GANs are known for, so the two families sit on opposite corners of the quality/diversity/speed trade-off.

Diagram of a diffusion chain: five states from a clean image to pure noise, with upper arrows showing the fixed forward noising process q and lower arrows showing the learned reverse denoiser p theta, plus a dashed arc marking the closed-form jump from x0 to any xt

Figure 1: The forward process is fixed and parameter-free, and the dashed arc is the closed form that lets training jump straight to any x_t; every arrow in the lower reverse path costs one network evaluation at sampling time.

The four families differ mostly in how they pay for tractability. A VAE keeps an explicit encoder and decoder and optimizes a lower bound, so the mismatch between the true posterior and the Gaussian approximation shows up as blur and posterior collapse. A normalizing flow refuses any approximation and computes exact likelihoods, but every layer must be invertible with a cheap Jacobian determinant, which caps expressiveness per parameter. A GAN drops likelihood entirely and optimizes a discriminator-defined divergence, which produces sharp samples in one step but offers no signal that the whole data distribution is covered. Diffusion sidesteps all three constraints by turning generation into a long sequence of easy denoising problems, and then spends compute at inference to pay for it.

Mathematical Formulation:
q(x_t \mid x_{t-1}) = \mathcal{N}(x_t; \sqrt{1-\beta_t}\, x_{t-1}, \beta_t I)
\bar{\alpha}_t = \prod_{s=1}^{t} (1 - \beta_s)
x_t = \sqrt{\bar{\alpha}_t}\, x_0 + \sqrt{1 - \bar{\alpha}_t}\, \epsilon
\mathcal{L}_{\text{simple}} = \mathbb{E}_{t, x_0, \epsilon} [ \| \epsilon - \epsilon_\theta(x_t, t) \|^2 ]
s_\theta(x_t, t) = -\frac{\epsilon_\theta(x_t, t)}{\sqrt{1 - \bar{\alpha}_t}}

Where:

  • x_0 is a clean data sample and x_t the noised state at step t, with x_T approximately standard Gaussian.
  • \epsilon \sim \mathcal{N}(0, I) is the injected noise and \epsilon_\theta the learned noise predictor with parameters \theta.
  • t \in \{1, \ldots, T\} is sampled uniformly during training, and s indexes the product defining the cumulative signal retention.
  • \beta_t is the noise schedule, typically small and increasing, and \bar{\alpha}_t is the cumulative signal factor giving signal-to-noise ratio \bar{\alpha}_t / (1 - \bar{\alpha}_t).
  • s_\theta is the implied score function, the quantity an SDE or probability-flow ODE sampler integrates.
  • Required initial condition: sampling starts from x_T \sim \mathcal{N}(0, I), which is only valid if the schedule drives \bar{\alpha}_T to (near) zero.
PropertyDiffusionGANVAENormalizing Flow
Training objectiveDenoising regression on a fixed forward process, no adversaryMin-max game against a discriminatorELBO: reconstruction plus KL to the priorExact log-likelihood via change of variables
Network calls per sample10 to 1000, or 1 to 4 after distillation111
Sample fidelityState of the art for images, video, and audioVery sharp, still strong under a one-step budgetBlurry with a Gaussian decoderBelow GAN and diffusion at equal compute
Mode coverageBroad, the objective penalizes missing massMode collapse is the classic failureBroad but over-smoothedBroad, likelihood forbids ignoring regions
Density estimateBound or ODE-based estimate, not exact in closed formNoneLower bound onlyExact and tractable
Architecture constraintFree, any denoiser such as a U-Net or a DiTFreeFreeInvertible layers with cheap Jacobian determinant
Typical failureSlow sampling, schedule and guidance artifactsUnstable training, collapsed diversityBlur and posterior collapseVery large models for modest sample quality
Triangle diagram of the generative learning trilemma with vertices high sample quality, fast sampling, and mode coverage; GAN sits on the quality-speed edge, VAE and normalizing flow on the speed-coverage edge, and diffusion on the quality-coverage edge

Figure 2: The generative learning trilemma: each family wins two corners and pays on the third, and most modern work on diffusion (distillation, consistency training, rectified flow) is an attempt to drag it toward the fast-sampling corner without losing coverage.


Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *