12.2 The Reverse Process

DATA 443/643 · Week 12 · PDF · Slides

MSE on the noise you added. T reverse steps. Lab 12 uses the oracle mean.

These notes match the lecture slides. Use (slides) on the course hub for the deck.

Generation walks the forward process backward. You start from xT~𝒩(0,𝐈) and, step by step, remove a bit of noise until you have x0. By the end you should be able to write the noise-prediction loss, take one reverse-step mean, and say what Lab 12’s oracle is replacing.


1. What the diffusion reverse process is

The reverse is: predict the noise you added, take a step toward x0, repeat T times. A net εθ(xt,t) predicts the ε from note 12.1. Training is ordinary MSE on that noise. Sampling starts from xT~𝒩(0,𝐈) and denoises.

Ho et al. (DDPM) made noise prediction the default parameterization. Predicting ε is equivalent (up to scaling) to predicting x0 or the score ∇xtlogq(xt). Pick one parameterization and stay consistent.

You cannot write the true reverse kernel in closed form for images, because it would need the unknown data density. If you knew x0, the true posterior q(xt−1∣xt,x0) is Gaussian with a closed-form mean. Lab 12 uses that oracle mean for a single step so you can see the geometry without training a U-Net. A trained εθ is what replaces the known ε (and therefore the known x0) at sample time.


2. Why we use it

MSE on a known ε is easier than a GAN min-max. There is no discriminator to race. The forward jump from note 12.1 already gave you xt in one line, so the loss never unrolls a reverse chain.

The cost sits at sample time. You pay T network calls (or fewer with DDIM / distilled samplers). That is the trade: stable regression training, slow ancestral sampling. GANs (Week 11) sample in one forward pass and fight mode collapse instead.

For a project, report the sampler (T, DDPM vs DDIM) next to the metric. Changing T at test time is part of the method. Classifier-free guidance, which steers the same reverse chain with a text condition, is the next note.


3. Architecture

The network is a denoiser that sees a noisy input and a timestep: a U-Net or a DiT on xt with a time embedding. The same xt is a different problem at t=10 and at t=900, so t is an input, not a footnote.

Lab 12 uses an oracle mean so you see the geometry without training. You are not training a U-Net in that lab. You know x0, so you can form the true posterior mean and check that one reverse step moved closer.

From noise, one reverse step toward the data

Sampling is an iterative procedure. Start at xT, apply the reverse-step mean (plus a little noise except at t=1), and walk down to x0. Each step is one network call once εθ exists.


4. How it works, step by step

Training is ordinary regression.

  1. Sample x0 from the data, t uniformly from 1…T, and ε~𝒩(0,𝐈).
  2. Form xt with the one-liner from note 12.1.
  3. Predict εθ(xt,t). Take MSE against the true ε. No adversary. No reverse chain inside the loss.

Sampling is the reverse walk.

  1. Draw xT~𝒩(0,𝐈).
  2. For t=T,…,1, plug εθ(xt,t) into the reverse-step mean below, and add σtz for t>1.
  3. Return x0.

If you knew x0, Lab 12 skips the net and uses the true posterior mean for a single step. The lab check is ‖xt−x0‖ versus ‖x^−x0‖ at t=20: the second should be smaller. If εθ=0 (the net refuses to denoise), the subtracted term vanishes and you mostly rescale xt, which is not a sample from the data.


5. Mathematical formulas

The training loss is

𝔼t,x0,ε\|ε−εθ(xt,t)\|2.

Given xt and a noise prediction, a typical mean for xt−1 is

xt−1=1αt(xt−1−αt1−α¯tεθ(xt,t))+σtz,

with z~𝒩(0,𝐈) for t>1, and σt from the schedule (often σt2=βt). At a generic t you do not jump all the way to x0; you move closer. Forgetting σtz on the way down makes every sample look identical.


6. Positive points and negative points

Positive.

  • MSE on ε is ordinary regression, which is easier to stabilize than a GAN min-max.
  • Predicting ε is enough: it is equivalent (under the usual parameterization) to predicting the posterior mean.
  • Lab 12’s oracle mean lets you see one reverse step without training a U-Net.
  • You can change T (or switch to DDIM) at sample time and treat the sampler as part of the method.

Negative.

  • Ancestral sampling costs many network calls; quality versus speed is a real knob.
  • Omitting t as an input makes the same xt look like one problem at every noise level.
  • Dropping σtz collapses diversity: every run hugs the mean.
  • Classifier-free guidance, which steers this chain with text, is extra machinery (next note).

When not to. If you need one-pass samples and can live with collapse, that is still a GAN. If you need text control, do not stop at this unconditional reverse chain.


7. Teaching this note

About 35 minutes at the board, then ~6 minutes of video.

  • 0–10 min. MSE on ε. Same xt formula as 12.1.
  • 10–22 min. Write one reverse-step mean. Circle the εθ term.
  • 22–33 min. Worked scalar reverse step, then the Lab 12 oracle story.
  • Then play Umar Jamil 13:00–16:36 (training loop, then sampling loop). Pause when he draws one denoising step.

8. Worked example

Reuse x0=1.0, α¯t=0.64, ε=2.0, so xt=2.0 as in note 12.1. Take αt=0.64 for a single-step cartoon (so αt=0.8, 1−αt=0.36, 1−α¯t=0.6).

Suppose εθ=ε=2.0 exactly, and drop σtz for the mean:

xt−1=10.8(2.0−0.360.6·2.0)=1.25(2.0−1.2)=1.25×0.8=1.0.

The reverse mean lands on x0. That is the oracle: if you predict the true noise, one algebraic step peels it off (here αt=α¯t, a first-step special case). At a generic t you do not jump all the way to x0; you move closer. Lab 12 checks ‖xt−x0‖ vs ‖x^−x0‖ at t=20 and wants the second smaller.

If εθ=0 (the net refuses to denoise), the subtracted term vanishes and you mostly rescale xt, which is not a sample from the data.

Oracle reverse mean: <math xmlns=2.0 peels back to 1.0" src="files/graphics/12.2-diffusion-reverse/reverse-mean.png" />

Sampling is an iterative procedure. You pay T network calls (or fewer with DDIM). A GAN still samples in one pass and fights collapse instead.


9. Where students get stuck

  • Training a U-Net in Lab 12. The lab uses the true posterior mean because you know x0.
  • Omitting t as an input to εθ. The same xt is a different problem at t=10 and at t=900.
  • Forgetting σtz on the way down and then wondering why every sample looks identical.

10. Video

Watch Umar Jamil, How diffusion models work, 13:00–16:36.

Pause on the training objective (predict the noise) and on the sampling loop (many reverse steps). Same URL as note 12.1; do not replay 7:35–13:00 unless needed.


11. Practice

  1. If εθ=ε exactly, what should happen to ‖xt−1−x0‖ relative to ‖xt−x0‖, in expectation, for mid-range t?

  2. Why add σtz on the way down instead of always taking the mean?

  3. You may not train a score network in Lab 12. What replaces εθ for that one reverse step?

  4. xt=3, αt=0.25, α¯t=0.25, εθ=2, no extra noise. Compute the reverse mean. (αt=0.5, 1−α¯t=0.75≈0.866, 1−αt=0.75.)

  5. Training samples t uniformly from 1…T and one ε. Why is that enough, instead of a full reverse chain inside the loss?