The Reverse Process: Why a Gaussian Is Enough, and What the Network Should Predict
Published:
The approximation that carries the method
Sampling requires \(q(\mathbf{x}_{t-1}\mid\mathbf{x}_t)\), and by Bayes’ rule that is
The marginal \(q(\mathbf{x}_{t-1})\) is the data distribution pushed through \(t-1\) noising steps: intractable, multimodal, the very thing we are trying to model. So the ratio is not Gaussian in general.
The escape is a scale argument. Take logarithms:
The first term is a sharp quadratic of width \(\sqrt{\beta_t}\) in \(\mathbf{x}_{t-1}\). The second is the awkward one, but it is only evaluated inside that narrow window. Expanding \(\log q\) to first order about \(\mathbf{x}_t/\sqrt{1-\beta_t}\) leaves a quadratic in \(\mathbf{x}_{t-1}\) — a Gaussian — with the neglected curvature term of order \(\beta_t\). This is Feller’s observation, and it is why \(T\) has to be large: the step size is the approximation error. Take steps too big and the true reverse conditional becomes multimodal, and no single-mean Gaussian can represent it.
Note what the expansion produces: the linear coefficient is \(\nabla \log q(\mathbf{x}_{t-1})\), the score. The reverse step is a Gaussian whose mean has been nudged along the score.
The exact posterior, once you condition on the endpoint
Training does not need \(q(\mathbf{x}_{t-1}\mid\mathbf{x}_t)\); it needs a target. And if we also condition on the clean image \(\mathbf{x}_0\), the posterior is Gaussian exactly, with no small-\(\beta\) assumption, because both \(q(\mathbf{x}_t\mid\mathbf{x}_{t-1})\) and \(q(\mathbf{x}_{t-1}\mid\mathbf{x}_0)\) are Gaussian in \(\mathbf{x}_{t-1}\):
with \(\alpha_t = 1-\beta_t\) and \(\bar{\alpha}_t = \prod_{s\le t}\alpha_s\) as in the forward process. The mean is a blend of where you are and where you came from. The two coefficients sum to at most one — exactly one only at \(t=1\), and strictly less otherwise — and they collapse neatly once \(\mathbf{x}_0\) is eliminated.
Substituting \(\mathbf{x}_0 = (\mathbf{x}_t - \sqrt{1-\bar{\alpha}_t}\,\boldsymbol{\epsilon})/\sqrt{\bar{\alpha}_t}\) and using \(\sqrt{\bar{\alpha}_{t-1}}/\sqrt{\bar{\alpha}_t} = 1/\sqrt{\alpha_t}\), the \(\mathbf{x}_t\) coefficients combine as \(\big[\beta_t + \alpha_t(1-\bar{\alpha}_{t-1})\big]/\big[(1-\bar{\alpha}_t)\sqrt{\alpha_t}\big] = 1/\sqrt{\alpha_t}\), leaving
This is the sampler. Knowing the noise that produced \(\mathbf{x}_t\) is equivalent to knowing the exact posterior mean, so predicting \(\boldsymbol{\epsilon}\) is a sufficient parameterisation — the result that turns the whole ELBO into an MSE.
Three targets, one quantity
Any one of \(\boldsymbol{\epsilon}\), \(\mathbf{x}_0\) and \(\mathbf{x}_t\) determines the third. Writing \(a = \sqrt{\bar{\alpha}_t}\) and \(b = \sqrt{1-\bar{\alpha}_t}\) with \(a^2+b^2=1\), so that \(\mathbf{x}_t = a\mathbf{x}_0 + b\boldsymbol{\epsilon}\):
\(\hat{\mathbf{x}}_0 = (\mathbf{x}_t - b\,\boldsymbol{\epsilon}_\theta)/a\). An error \(\delta\) in \(\boldsymbol{\epsilon}_\theta\) becomes \((b/a)\delta\) in \(\hat{\mathbf{x}}_0\). At \(t\to T\), \(a\to 0\) and the amplification diverges.
\(\hat{\boldsymbol{\epsilon}} = (\mathbf{x}_t - a\,\hat{\mathbf{x}}_0)/b\). An error \(\delta\) in \(\hat{\mathbf{x}}_0\) becomes \((a/b)\delta\) in \(\hat{\boldsymbol{\epsilon}}\). At \(t\to 0\), \(b\to 0\) and this diverges instead.
\(v = a\boldsymbol{\epsilon} - b\mathbf{x}_0\). Then \(\mathbf{x}_0 = a\mathbf{x}_t - b v\) and \(\boldsymbol{\epsilon} = b\mathbf{x}_t + a v\), both with coefficients bounded by 1 — no amplification anywhere.
The \(v\) identities are worth checking rather than trusting: \(a\mathbf{x}_t - bv = a(a\mathbf{x}_0+b\boldsymbol{\epsilon}) - b(a\boldsymbol{\epsilon}-b\mathbf{x}_0) = (a^2+b^2)\mathbf{x}_0 = \mathbf{x}_0\), and symmetrically for \(\boldsymbol{\epsilon}\). Geometrically \((\mathbf{x}_t, v)\) is \((\mathbf{x}_0,\boldsymbol{\epsilon})\) rotated by the angle \(\phi_t = \arctan(b/a)\), which is why the transformation is norm-preserving in both directions.
Fixed or learned variance
The posterior variance \(\tilde{\beta}_t\) is known, so a natural choice is \(\sigma_t^2 = \tilde{\beta}_t\). Ho et al. show this is optimal when \(\mathbf{x}_0\) is deterministic, while \(\sigma_t^2 = \beta_t\) is optimal when the data is \(\mathcal{N}(\mathbf{0},\mathbf{I})\); the two bracket the truth. In practice they behave almost identically, and for the linear schedule they are numerically close away from \(t=1\): at \(t=500\), \(\sqrt{\beta_t} = 0.10020\) against \(\sqrt{\tilde{\beta}_t} = 0.10016\); at \(t=100\), \(0.04552\) against \(0.04511\). The ratio \(\tilde{\beta}_t/\beta_t = (1-\bar{\alpha}_{t-1})/(1-\bar{\alpha}_t)\) is below one but approaches it once \(\bar{\alpha}_t\) is small.
They diverge exactly where it matters for likelihood. As \(t\to1\), \(\bar{\alpha}_0 = 1\) forces \(\tilde{\beta}_1 = 0\) while \(\beta_1 = 10^{-4}\) — an infinite relative gap on the term that dominates the negative log-likelihood. Nichol & Dhariwal therefore learn an interpolation in log space,
with \(v_\theta \in [0,1]\) an extra network output. This improves log-likelihood noticeably and, because it sharpens the variance at small \(t\), also permits far shorter sampling schedules. It does not improve FID much: sample quality was already dominated by the mean, which is where all the earlier discussion lives.
References
- Feller, W. On the Theory of Stochastic Processes, with Particular Reference to Applications. Proceedings of the First Berkeley Symposium on Mathematical Statistics and Probability, 1949. (The small-step Gaussian-reversal argument that Sohl-Dickstein et al. build on.)
- Ho, J., Jain, A., & Abbeel, P. Denoising Diffusion Probabilistic Models. NeurIPS 2020.
- Nichol, A., & Dhariwal, P. Improved Denoising Diffusion Probabilistic Models. ICML 2021.
- Salimans, T., & Ho, J. Progressive Distillation for Fast Sampling of Diffusion Models. ICLR 2022.
