DL0127 DDPM Training Objective

What is the DDPM training objective, and why do we train the network to predict the noise rather than the clean image directly?

Answer

A denoising diffusion probabilistic model is trained by maximizing a variational bound on the data log-likelihood, and because both the forward corruption and the reverse posterior are Gaussian, that bound collapses into a sum of KL divergences whose only learnable content is a mean-matching term at each noise level. Reparameterizing that mean through the closed-form forward marginal turns every term into a weighted squared error between the injected noise \epsilon and a network prediction, and Ho et al. then drop the per-step weight \lambda_t to get the simple objective L_{\mathrm{simple}} = \mathbb{E}\|\epsilon - \epsilon_\theta(x_t,t)\|^2. Predicting the noise is not a different model from predicting the clean image: \epsilon-prediction, x_0-prediction, and direct mean prediction are affine reparameterizations of one another given x_t and t, so they define the same optimum but different implicit loss weightings and different numerical conditioning. The practical reasons to regress noise are that the target is always unit-variance no matter how noisy the input is, that the residual structure lets the network pass the low-frequency content through instead of re-synthesizing it, and that discarding \lambda_t under this parameterization down-weights the easy low-noise steps by roughly an order of magnitude, which empirically buys much better FID. It also makes the network a rescaled score estimator, which is what connects DDPM to score matching and to every ODE and SDE sampler built on top of it.

(1) The Objective Is One Scalar MSE: sample x_0, sample t \sim \mathcal{U}\{1,\ldots,T\} and \epsilon \sim \mathcal{N}(0,I), form x_t in closed form, and regress \epsilon. No per-step model, no adversarial term, no sequential rollout during training.
(2) It Comes From The ELBO, Not From Heuristics: each L_{t-1} is a Gaussian KL whose learnable part is a mean difference, and substituting the forward marginal converts it into \lambda_t\|\epsilon-\epsilon_\theta\|^2.
(3) Dropping \lambda_t Is A Reweighting Choice: \lambda_t is largest at small t, so setting all weights to 1 shifts capacity toward the high-noise steps that decide global structure.
(4) The Target Is Scale-Stable: \epsilon is standard normal for every t, so a single output head with fixed normalization works across the whole schedule, whereas the difficulty of predicting x_0 varies enormously with t.
(5) Residual Prediction Is Easier For A U-Net: at low noise, most of x_t is already the answer, so predicting the small perturbation avoids forcing the network to reconstruct an image it was handed.
(6) Conditioning Flips At The Two Ends: converting \epsilon_\theta to \hat x_0 amplifies error by 1/\sqrt{\mathrm{SNR}_t}, which is tiny at low noise and roughly 150x at t=T, the reason v-prediction exists.

Left-to-right flow diagram of one DDPM training step: sample a clean image, sample a timestep and Gaussian noise, form the corrupted sample in closed form, pass it through the U-Net to predict the noise, compute the squared error against the sampled noise, and a dashed feedback arrow carrying the gradient step back to the U-Net

Figure 1: One training step. The closed-form forward marginal means an arbitrary timestep can be sampled directly, so training never simulates the chain; the loss is a single unit-variance regression shared by all T noise levels.

The reweighting argument is the one that most candidates miss. Under the ELBO, the term at t=1 carries roughly 50x the weight of the term at t=T for the standard linear schedule, and those low-t terms correspond to removing almost imperceptible noise, a task that contributes little to perceptual quality but a lot to likelihood. Setting every weight to 1 in \epsilon-space is therefore a deliberate trade of likelihood for sample quality, and it is why DDPM reports strong FID with mediocre bits-per-dimension. The conditioning argument cuts the other way at high noise: since \hat x_0 is recovered by dividing by \sqrt{\bar\alpha_t}, a small noise error becomes a large image error near t=T, so pure \epsilon-prediction is a poor target for few-step or distilled samplers that must produce a usable \hat x_0 from the very first step. Finally, the identity \epsilon_\theta = -\sqrt{1-\bar\alpha_t}\,s_\theta shows the trained network is a scaled score function, which is exactly what a probability-flow ODE or an annealed Langevin sampler needs, so the same checkpoint serves DDPM, DDIM, and higher-order solvers.

Mathematical Formulation:
x_t = \sqrt{\bar\alpha_t}\,x_0 + \sqrt{1-\bar\alpha_t}\,\epsilon
L_{t-1} = \lambda_t\,\|\epsilon - \epsilon_\theta(x_t,t)\|^2
\lambda_t = \frac{\beta_t^2}{2\sigma_t^2\alpha_t(1-\bar\alpha_t)}
L_{\mathrm{simple}} = \mathbb{E}\left[\|\epsilon - \epsilon_\theta(x_t,t)\|^2\right]
\hat x_0 = \frac{x_t - \sqrt{1-\bar\alpha_t}\,\epsilon_\theta}{\sqrt{\bar\alpha_t}}
\epsilon_\theta(x_t,t) = -\sqrt{1-\bar\alpha_t}\,s_\theta(x_t,t)

Where:

  • x_0 is a clean training sample, x_t its corrupted version at step t, and \epsilon \sim \mathcal{N}(0,I) the injected noise that serves as the regression target.
  • t \in \{1,\ldots,T\} is sampled uniformly, \beta_t is the schedule, \alpha_t = 1-\beta_t, and \bar\alpha_t = \prod_{s=1}^{t}\alpha_s gives the closed-form marginal that makes single-step training possible.
  • \epsilon_\theta is the U-Net with parameters \theta, conditioned on t through a sinusoidal timestep embedding.
  • \lambda_t is the ELBO weight and \sigma_t^2 the reverse-process variance (commonly \sigma_t^2 = \beta_t); L_{\mathrm{simple}} is L_{t-1} with \lambda_t replaced by 1.
  • \mathrm{SNR}_t = \bar\alpha_t/(1-\bar\alpha_t) is the signal-to-noise ratio, which decreases monotonically in t and sets the error amplification 1/\sqrt{\mathrm{SNR}_t} from noise space into image space.
  • s_\theta(x_t,t) \approx \nabla_{x_t}\log q(x_t) is the score, so a trained \epsilon_\theta doubles as a score model for ODE and SDE samplers.
Two-panel chart: left panel plots the ELBO per-step weight relative to its value at the final timestep on a log axis against the diffusion step, showing roughly fifty times more weight at small t than at large t, next to the flat unit weight used by the simple objective; right panel plots on a log axis the factor by which a prediction error is amplified into clean-image space for noise prediction, clean-image prediction, and v-prediction, with noise prediction rising from about 0.01 to about 150

Figure 2: The two quantitative reasons the parameterization matters. Left: dropping \lambda_t removes a roughly 50x preference for the easiest low-noise steps. Right: the same trained error costs almost nothing in image space at low noise but is amplified by 1/\sqrt{\mathrm{SNR}_t} near t=T, which is where v-prediction stays bounded.

PropertyNoise prediction (DDPM)Clean-image predictionv-prediction
TargetThe sampled noise, standard normal at every tThe data sample itself, with data-dependent statisticsA schedule-dependent mix of noise and data
Implicit weighting under uniform MSEDown-weights low-noise steps, favors perceptual quality over likelihoodUp-weights low-noise steps by the SNR, closer to the raw ELBORoughly balanced across the schedule, close to SNR-plus-one weighting
Numerical weak spotError into image space amplified by about 150x near t = TError into noise space amplified near t = 0, where the residual is tinyAmplification stays at or below 1 in both directions
Typical usePixel and latent diffusion with many sampling steps, Stable Diffusion 1.x and 2.0-baseVery short schedules, consistency-style objectives, some latent decodersProgressive distillation, high-resolution and upscaling models, SD 2.1-v

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 *