DDPM: the forward process
How diffusion destroys data on purpose: a Markov chain of small Gaussian steps, a closed-form jump to any step t, and noise schedules that end in N(0, I).
Many small steps
The topic Energy-based models ended with a bill: sampling an EBM takes hundreds of gradient steps on a learned landscape, and training needs such samples after every update. Diffusion models keep the walk from noise to data but change what is learned. They reach noise in many small steps of a fixed process, each step adds a little Gaussian noise, and no step has to be invertible, unlike the layers of a flow (see The change of variables).
Start from a data point , say an image. Add a little noise to get , a little more to get , and so on up to :
This is the forward process. Two properties define it. First, each step looks only at the previous point: is drawn from a distribution that ignores . A chain like this is a Markov chain. Second, is fixed in advance. It has no parameters, and nothing in it is trained.
Why destroy data on purpose? Because of where the chain ends. We want to be distributed as , whatever image we started from. That is a prior we can sample from, like in a VAE or a flow. If a model learns to walk the chain backwards, from to , it turns noise into data. The idea comes from Sohl-Dickstein et al. (2015); DDPM (Ho, Jain and Abbeel, 2020) made it produce good images. This topic builds the forward chain. The walk back comes next.
First attempt: just add noise
The simplest step adds fresh noise with variance to every coordinate:
The square root is there because is a variance: has variance . Each is drawn independently of everything before it.
Several steps merge into one. Unrolled, . A sum of independent Gaussians is Gaussian, and the variances add (see Multivariate Gaussians). So has the same distribution as with a single . After steps,
This is a useful shortcut and a useless destination. The mean stays at forever, and the variance grows without bound. The chain never settles on any fixed distribution, let alone . The image does not disappear; it drowns in ever larger noise. Such a process is called variance-exploding. Some models do use it and stop at a large finite noise level, but DDPM takes a different route.
Shrink, then add noise
To pull the mean towards zero, each step must also shrink the previous point. Give it a scale :
Track the variance of one coordinate. The fresh noise is independent of , so the variances add, and the scale enters squared:
With this is the exploding chain: at every step. With the old variance shrinks while fresh noise refills it. The target has variance in every coordinate. So we want a step that leaves variance alone: if , then as well.
You have met such a step. In Multivariate Gaussians, for independent the mix was again . That is this step with and . A step that keeps variance in place has a second virtue: it pulls any other variance towards , a little at every step.
Jump straight to step t
Requiring , that is , gives the DDPM step. Let the noise variance change from step to step, , and write . Then
Now merge two steps, as we did for the naive chain. Substitute into the second step:
The two noises are independent, so they merge into one Gaussian with variance . The same thing happens at every further step, by induction. Write and suppose , with built from the earlier noises and so independent of . One more step multiplies the coefficient of by , giving , and the noise variance becomes . Then
This is the affine sampling trick again: from The reparameterization trick, with mean and scale . One draw of gives for any directly, without running the steps before it. That matters for training, which will need noisy images at random steps over and over. The two squared coefficients always sum to . With , the formula covers too.
Where the chain ends
As long as the steps do not shrink towards zero, say every , the product obeys and falls to zero as grows. (Factors merely below are not enough: with shrinking fast, the product can stall at a positive value.) In the closed form the image term fades out, the noise scale rises to , and approaches , whatever the image.
Here is a constant , so that , next to the naive chain with the same :
| mean coefficient | noise std | naive noise std | ||
|---|---|---|---|---|
For small the two chains agree. Then the naive noise overshoots and keeps growing, while DDPM's approaches from below.
The whole data distribution behaves the same way, not just one image. Draw from the data, independently of . Then, per coordinate, , that is, . Variance stays at every step, and for any other variance the gap to is multiplied by . That is why this chain is called variance-preserving. The two-bump density from The change of variables would spread out, its bumps would drift towards and merge, and it would end as a single bell, .
In practice is finite, so is close to but not equal to it. DDPM uses and ends at , so . Images are scaled to first, so what remains of the image is tiny next to noise of scale . That is why generation can start from . A chain too short to forget the image would break this: a sampler started from pure noise would start from the wrong distribution.
Noise schedules
The list is the noise schedule. It sets how fast falls, that is, how fast the image is destroyed.
DDPM uses a linear schedule: , and grows linearly from to . Small early steps keep the first close to the image; larger late steps finish the job. With this schedule drops below at and stays below from on. The last third of the chain works on what is already almost pure noise.
Nichol and Dhariwal (2021) found this wasteful for small images ( and ). On ImageNet , a model trained with the linear schedule loses almost nothing in quality when the noisiest of its reverse steps are skipped. Their cosine schedule prescribes directly instead of :
Here falls almost linearly through the middle of the chain and changes slowly near both ends:
| schedule | from | |||
|---|---|---|---|---|
| linear | ||||
| cosine |
Information is destroyed more evenly over time. The small offset keeps the first step from being vanishingly small. The steps are then recovered from and capped at , because the formula gives at the very end.
Signal and noise
Schedules are easier to compare on one scale. In the squared coefficient of the image is and the noise variance is . Their ratio is the signal-to-noise ratio:
For data of unit variance it is the ratio of the signal variance to the noise variance. It falls monotonically with ; for the linear schedule, from about at to at . Signal and noise are equally strong where . A schedule is just a choice of how , often its logarithm, goes down from large to nearly zero. Everything else in the forward process stays the same.
So the forward process is complete. It is fixed, it has no parameters, and for any it hands us a noisy in a single draw. To generate, we have to run it backwards: start from and step from to until we reach . The next topic, DDPM: reverse process and objective, sets up a model for that step back and the loss that trains it.
Check your understanding
The same questions as in Pulse. Answers are shared between modes.
Go deeper — optional
Code and labs do not count toward the main percentage or the certificate.
- DDPM: β schedule and sampling x_toptional
Computes ᾱ_t for a linear β schedule and checks marginal variance. Self-check in the notebook.
~20 min · easier on a computer · DDPM forward process topic read.
Self-check in the notebook — not part of mastery or the certificate.
Answers are saved on the server and tied to this browser until you sign in.