A beginner-friendly walkthrough of the mathematical prerequisites for reading the Denoising Diffusion Probabilistic Models (DDPM) paper by Jonathan Ho, Ajay Jain, and Pieter Abbeel. This first installment doesn't touch the main method — it clears away the "background" hurdles so that, by the end, you can read Section 2 (Background) without getting stuck.
Why this series exists
If your math is, let's say, average — and if you haven't spent much time around AIGC (text-to-image, text-to-video, and friends) — then opening the DDPM paper for the first time is rough. You glance at the title, Denoising Diffusion Probabilistic Models, and by the time you hit the second paragraph of the Background section you're already lost in a thicket of notation.
Here's the thing: you've almost certainly learned all of this math before. You just quietly handed it back to your teachers somewhere along the way. So when people call DDPM "zero-barrier," my honest reaction the first time through was: this isn't zero-barrier — it's barriers everywhere.
The goal of this post is to lower that barrier. If you're already an expert, feel free to skip this entirely — we're only collecting the prerequisite math and the little stumbling blocks you hit while reading the Background section, all in one place. By the end you'll have the six things you need to read the paper comfortably.
Setting the stage: the notation that trips everyone up
The Background section opens with:
Diffusion models are latent variable models of the form where are latents of the same dimensionality as the data .
The first thing that stops you cold is . What is that?
It's just shorthand for the whole sequence:
Written as a probability, it's the joint distribution over through :
Once you know that, the defining equation reads cleanly:
- — anything with the subscript is produced by our model (a deep neural network). We're using the network to predict a distribution.
- — here means . We integrate out every latent variable , and the only variable left standing is . So the integral of the joint over all the latents gives back the marginal .
This is just the basic marginalization rule from probability.
A note on rigor: Anything at or below a high-school level we'll use without proof. For some post-high-school results I'll sketch a proof; for the genuinely messy ones I'll skip the derivation to keep the pace. If you want a particular formula derived, that can go in a follow-up.
That's hurdle one cleared. On to the next.
Prerequisite 1: The reverse process
The joint distribution is called the reverse process, and the paper defines it as a Markov chain with learned Gaussian transitions starting at :
What does "reverse" mean here?
It refers to time. In DDPM:
- Forward direction: (the index increases — clean image gets progressively noisier).
- Reverse direction: (the index decreases — noise gets progressively denoised).
We start from , the prior distribution, which we simply define to be a standard Gaussian (pure Gaussian noise). The whole model is the journey from that prior back to the data distribution.
Deriving the product form
The transition term seems to appear out of nowhere. Let's derive it on a small example so it stops feeling like magic.
Start from the only tool we need — the conditional probability rule you learned in high school:
There are two ways to split . Which split we pick is the trick, and it's dictated by the direction of the process. The reverse process runs backward in time, so we want to peel off variables along decreasing time — which means the conditioning variable should be the later (larger-index) one.
Take a three-variable example, . Group together as one block and condition on :
Now split the block the same way — keep time decreasing, so is conditioned on :
Putting it together:
Applying the Markov property
DDPM assumes the Markov property: a state depends only on the adjacent time step. Anything further back can be dropped. So in , the condition is non-adjacent to and can be crossed out:
Which gives:
Generalizing from to , you can write it in one step — pull out the last term and take the product:
This is a reverse process: the larger time index sits in the condition, the smaller one is what we predict.
Prerequisite 2: The forward process
Next comes the forward process (forward process), also a Markov chain — the paper tells you
so directly:
The forward process is the noising direction: we're given a clean image and progressively add Gaussian noise. Because it's forward, the Markov dependence points to the next time step, and crucially the condition is given.
Deriving the product form
Same trick, opposite direction. Consider . Ignore the given for a moment and just split .
For the forward process we want the conditioning index to be smaller than the predicted one. Peel off first (the smallest), conditioning the rest on it:
Split again the same way:
So:
Now reattach the given as a "carry-along" condition on every term:
Apply the Markov property — each state depends only on the immediately previous one ( depends only on , not on or ):
Switching from to and generalizing to terms:
Reverse vs. forward — the one rule to remember
When you decompose a joint with conditional probability, can become or . Which one you pick depends on the direction:
| Process | Direction | Conditioning index | Why |
|---|---|---|---|
| Reverse | the larger time index | We solve for images going backward, so the larger time sits in the condition. | |
| Forward | the smaller time index | We're given and add noise, so the smaller time sits in the condition. |
The two split in opposite ways — that's the whole subtlety, and it's easy once you've worked the small examples by hand.
Prerequisite 3: The variational bound (and Jensen's inequality)
Now the paper hits you with the training objective:
This is the "variational bound on negative log likelihood." At first glance the left and right sides look unrelated — and that sign is doing a lot of quiet work. Let's reconstruct it.
The objective
In image generation we want the probability of generating the image we want to be large — we want our samples to be real images, not noise or garbage. So our goal is to maximize . Since this is an optimization problem, maximizing is equivalent to minimizing the negative:
The sign is a matter of convenience; ignore it for now and analyze the quantity itself.
Reusing earlier results
Good papers are logically tight — every formula they already wrote down tends to get reused. We have two such formulas sitting around: the marginalization rule, and the decomposition. Let's force both into play.
Step 1 — marginalize. Using :
Step 2 — multiply and divide by . We still haven't used the forward decomposition, so let's "force" it in by multiplying and dividing by . Since we're integrating over , we need a distribution over to take an expectation against:
Step 3 — recognize the expectation. An integral of the form is exactly an expectation with respect to :
The subscript on matters enormously. Always be clear which distribution you're taking the expectation over — here it's .
We're now almost at the paper's form. The only difference is the order of and . Can we just swap them? No — and that's where Jensen's inequality comes in.
Jensen's inequality (with the trap that catches everyone)
Start with the definition of a convex function (Chinese: 下凸, "convex from below"). A real-valued function on a convex subset is convex if for any two points and :
(The weighted average of the function values lies above the function of the weighted average — the chord sits above the curve.)
Generalizing to many points gives Jensen's inequality for a convex , with weights (in fact ) and :
Because with , the weights act exactly like a probability distribution (the discrete analogue of ). So this is precisely:
Here is the trap. Our is , and is concave (Chinese: 上凸, "convex from above"), not convex. A lot of blog posts quote only the convex version — and don't even tell you their is convex. If you sketch you'll see immediately it curves the other way, so the inequality flips:
Geometrically: take on the curve and . The point on the curve above the midpoint is higher than the midpoint of the chord . That's concavity, and it's the reason the inequality reverses.
Putting it together
Apply the concave (flipped) Jensen to our expression — moves inside the expectation and the relation becomes :
This already matches the paper's right-hand side — except for a missing negative sign. Easy: negate both sides (which flips to ), consistent with "maximize minimize the negative":
That's the variational bound. The paper never tells you it relies on Jensen's inequality — so without knowing it, you simply can't reproduce this step. The rest of the bound's expansion into per-step terms we'll cover next time.
Prerequisite 4: The normal distribution PDF
For a Gaussian , the probability density is:
You've seen this since high school / early college. It shows up everywhere downstream — including the eventual derivation of the posterior mean .
Prerequisite 5: Sum of independent Gaussians
If
then their sum is again Gaussian, with means adding and variances adding:
That the mean and variance add follows from the basic linearity/variance properties of expectation. The harder part — proving that the sum is itself normally distributed — uses the convolution formula (the same convolution you know from CNNs):
Prerequisite 6: KL divergence
The Kullback–Leibler (KL) divergence measures how similar two distributions are:
Key intuitions:
- Smaller KL more similar distributions (not the other way around).
- always.
- If , the ratio is always , , so .
- The further apart and are, the larger the value.
So in training we want this value to be small — we're driving two distributions together. When both and are Gaussian, substituting the normal PDF yields a clean closed-form expression (which we'll use later).
The six things — your checklist
If you're solid on these six, you can read the DDPM Background section with zero barriers:
- Joint-distribution notation & marginalization — , and .
- Reverse process decomposition — conditional probability + Markov property; condition on the larger time index.
- Forward process decomposition — same tools, condition on the smaller time index.
- Variational bound — maximize minimize its negative, plus Jensen's inequality (remember: is concave, so the inequality flips).
- Normal distribution PDF and the sum-of-Gaussians rule (via convolution).
- KL divergence — definition, non-negativity, and "smaller = more similar."
Everything after this in the paper is mostly elementary math — the formulas get long, but they no longer require clever tricks.
What's next
Next time we'll tackle the method itself: the tractable forward posterior
with
where and . We'll see why we must condition on to turn the unknown into the known, derive the mean and variance, and then use reparameterized sampling to iterate all the way from pure noise back to a clean image .
See you in the next one.
Notes taken from a video tutorial on DDPM (Part 1 of the series).
References
- Ho, J., Jain, A., & Abbeel, P. (2020). Denoising Diffusion Probabilistic Models. NeurIPS 2020. arXiv:2006.11239