In a DDPM, why is the reverse-time conditional q(xt−1∣xt,x0) tractable when conditioned on x0 even though q(xt−1∣xt) is not, and how do you derive its mean μ~t(xt,x0) and variance β~t by completing the square in Bayes’ rule?

Deep learning, Diffusion models
Level L5 Expert. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can derive the exact Gaussian reverse posterior used in the DDPM variational ELBO and understand why conditioning on x0 avoids the intractable data integral.

Key idea

The unconditional reverse transition q(xt−1∣xt) requires integrating over the unknown data distribution q(x0). Conditioning on x0 fixes both factors in Bayes’ rule—q(xt∣xt−1) and q(xt−1∣x0)—as explicit Gaussians, so their product is Gaussian with variance β~t=1−αˉt−11−αˉtβt.

Steps

  1. Contrast q(xt−1∣xt) with q(xt−1∣xt,x0): by Markovity of the forward chain, q(xt∣xt−1,x0)=q(xt∣xt−1). Bayes’ rule gives q(xt−1∣xt,x0)=q(xt∣xt−1) q(xt−1∣x0)q(xt∣x0), avoiding any integral over the unknown pdata(x0).
  2. Write the exponent (quadratic in xt−1, treating each coordinate independently since covariances are isotropic): −12[(xt−αt xt−1)2βt+(xt−1−αˉt−1 x0)21−αˉt−1−(xt−αˉt x0)21−αˉt].
  3. Collect the xt−12 coefficient to find 1/β~t: αtβt+11−αˉt−1=αt(1−αˉt−1)+βtβt(1−αˉt−1)=αt−αˉt+1−αtβt(1−αˉt−1)=1−αˉtβt(1−αˉt−1), so β~t=1−αˉt−11−αˉtβt.
  4. Collect the linear −2xt−1(… ) coefficient to find μ~t/β~t: αtβtxt+αˉt−11−αˉt−1x0. Multiply by β~t=1−αˉt−11−αˉtβt: μ~t(xt,x0)=αˉt−1 βt1−αˉtx0+αt(1−αˉt−1)1−αˉtxt.
  5. Connect to the ELBO: the DDPM variational bound decomposes into step-wise KL terms Lt−1=DKL(q(xt−1∣xt,x0) ∥ pθ(xt−1∣xt)). Setting pθ to have variance β~tI reduces Lt−1 to squared error 12β~t∥μ~t(xt,x0)−μθ(xt,t)∥2, which after substituting x0=(xt−1−αˉt ε)/αˉt yields the weighted noise-prediction loss.

Common mistakes

How long your answer should be

One page; 8–10 minutes.

Last checked on 4 December 2026.

Read this

Previous in Deep learning: For linear regression y^=∑iwixi with inverted dropout on the inputs (keep probability p), why does the expected squared loss equal the ordinary squared loss plus an adaptive L2 penalty? What is the closed-form solution, and what does the penalty say about how dropout regularises?
Next in Deep learning: For a positive pair (x,y)∼p(x,y) and K−1 independent negative samples y2,…,yK∼p(y) with critic score f(x,y), how do you prove that minimising the InfoNCE loss LK=−E[log⁡ef(x,y)ef(x,y)+∑j=2Kef(x,yj)] maximises a lower bound on the mutual information I(X;Y)≥log⁡K−LK, and what is the optimal critic f∗(x,y)?