Vibe Engines
YouTube
Paper Breakdowns  /  DDPM
Paper 22~13 min readNeurIPS 2020worked math + runnable code
Paper Breakdown

DDPM,
explained.

Diffusion was a decade-old idea that never quite worked — beautiful in theory, mediocre in practice. Then this paper made one deceptively humble change: instead of predicting complicated distributions, just train a network to guess the noise. That single simplification turned diffusion from a curiosity into the method behind DALL·E, Midjourney, and Stable Diffusion. Here's the original math, made intuitive.

The delta

What changes against GANs: the hard part is made fixed and known

Rung 2's difficulty is that both halves of the game are learned, so nothing is stable. This rung's change is to make one direction fixed, simple and known in advance: define a process that takes an image and adds a little Gaussian noise, over and over, for many steps, until nothing is left but noise. That direction involves no learning at all — it is a schedule someone wrote down.

All the model has to learn is to undo one step of it. And because each forward step is a small Gaussian perturbation, the corresponding reverse step is also approximately Gaussian, which makes it something a network can be asked to predict. Generation is then: start from pure noise, apply the learned reverse step many times, arrive at an image.

The training objective is where this becomes remarkable. After simplification, what the network is asked to do is: given a noisy image and how noisy it is, predict the noise that was added — and the loss is a plain squared error on that prediction. Generative modelling has become regression. There is no adversary, so no saddle point and no instability; the loss is a number that decreases and means something; and because every training example is a real image with noise on it, there is no mechanism for mode collapse — the model never gets to choose which parts of the distribution to cover. Stated against rung 2, that is the whole argument, and it is why this family won.

01

The core intuition

Imagine dropping ink into water. It disperses until the glass is a uniform haze — an easy, predictable process to run forward. Now imagine running it backward: reassembling that haze into the original drop. Impossible to do exactly, but if you learned, at every tiny moment, how to nudge the haze one step back toward order, you could reverse the whole thing.

That's diffusion. The forward direction gradually destroys an image into noise — trivial. The reverse direction rebuilds an image from noise — hard, and exactly what we train a network to do. Generate by starting from pure noise and running the learned reverse steps until a picture appears.

02

The forward process: adding noise on a schedule

The forward process is a fixed Markov chain with no learnable parameters. Over T steps (the paper uses T = 1000), it repeatedly adds a little Gaussian noise. A noise schedule β₁ … β_T — small numbers that grow over time — sets how much noise each step injects:

q(x_t | x_{t-1}) = 𝒩( √(1−β_t)·x_{t-1},  β_t·I )

In words: each step shrinks the current image slightly and sprinkles in fresh noise. Start with a clean image x₀; after enough steps you reach x_T, which is indistinguishable from pure Gaussian noise. This process is a given — its only purpose is to define the corruption the network must learn to undo.

Forward adds noise · reverse removes it
x₀
→β→
x₁
→β→
x₂
→ … →
x₍T₋₁₎
→β→
x_T
clean image← learned reverse ←pure noise
03

The trick that makes training cheap

Adding noise a thousand times to make one training example would be painfully slow. A neat property of Gaussians rescues it: you can jump straight to any timestep in one shot. Define α_t = 1−β_t and ᾱ_t = α₁·α₂·…·α_t, and then

x_t = √(ᾱ_t)·x₀ + √(1−ᾱ_t)·ε,  ε ~ 𝒩(0, I)

So to make a training example at noise level t, you take a clean image, pick a random t, sample one blob of noise ε, and combine them by the formula above — no thousand-step loop needed. This closed form is what makes DDPM training efficient, and it's the key to the objective coming up.

04

The reverse process: the learned part

Reversing the chain means going from x_t to a slightly cleaner x_{t-1}. The true reverse step is intractable, but if each forward step adds only a little noise, each reverse step is well-approximated by a Gaussian too — so we train a network to predict its mean.

That network is a U-Net: an encoder-decoder with skip connections, well suited to images, that also takes the timestep t as input so it knows how noisy things currently are. Apply it repeatedly — x_T → x_{T-1} → … → x₀ — and noise becomes an image. All the model's intelligence lives in this one denoising network.

05

The masterstroke: just predict the noise

Earlier diffusion work derived a complicated variational bound and tried to predict full distributions — fiddly and unstable. DDPM's decisive move was to reparameterize the problem. Since x_t = √(ᾱ_t)x₀ + √(1−ᾱ_t)ε, knowing the noise ε is equivalent to knowing the clean image. So just predict ε. The training loss collapses to plain mean-squared error:

L = 𝔼x₀,ε,t ‖ ε − εθ(x_t, t) ‖²

The recipe is almost embarrassingly simple: take a clean image, add a known amount of noise, and ask the network to guess the noise you added. Penalize the squared error. That's it. This "simple objective" trained far more stably than the full variational bound and produced dramatically better samples — the entire reason diffusion suddenly worked.

Why this matters

Predicting noise turns generative modeling into ordinary supervised regression. No adversarial game, no delicate distribution matching — just "guess the noise," a loss any practitioner can train reliably. Simplicity was the breakthrough.

06

The schedule, worked with real numbers

The paper's exact recipe: T = 1000 steps, β rising linearly from 0.0001 to 0.02. Everything interesting lives in the cumulative product ᾱ_t = Π(1−β_s) — the fraction of original signal surviving at step t. Compute it:

Step tᾱ_tSignal √ᾱ_tNoise √(1−ᾱ_t)What the image looks like
100.9980.9990.04essentially clean
1000.8970.9470.32visibly grainy, fully recognizable
5000.0790.280.96mostly noise — structure barely ghosts through
10000.000040.0061.00indistinguishable from pure noise

Two things to notice. The destruction is front-loaded gently — after 100 of 1000 steps, 95% of the signal amplitude survives; the schedule spends most of its budget in the middle. And at t = 1000 the signal fraction is 0.6% — which is why sampling can start from pure random noise: the endpoint of the forward process genuinely is one.

The reparameterization the whole paper turns on is one line of algebra on the shortcut formula. If you know the noise, you know the image:

Training teaches a network to estimate ε; the identity above converts that estimate back into an image, one denoising step at a time. Generative modeling became regression on noise.

Since then

What the authors admit, and what happened next

The cost is stated plainly and it is severe: sampling requires many sequential network evaluations — on the order of a thousand in this paper — where a GAN generates in one. Diffusion traded a training problem for a sampling problem, and at publication that made it orders of magnitude slower to generate with. Rungs 5 and 7 are both attacks on this one sentence.

The objective is also acknowledged to be a reweighted version of the proper variational bound rather than the bound itself — the simplification that makes it a clean regression drops terms, and it is justified because it works better, not because it is exact. An honest and consequential piece of empirical pragmatism.

How it held up: it displaced rung 2 as the default for image generation within about two years, and the reasons are the ones above — stable training and full distribution coverage beat one-shot sampling speed, because speed turned out to be fixable and instability did not. Everything from rung 5 to rung 8 is a refinement of this rung, which makes it the most load-bearing paper on the ladder.

SOLVE IT YOURSELF

Diffuse and recover, in 25 lines

The full forward process on a 1-D "image," running in your browser through WebAssembly: build the paper's exact β schedule, watch ᾱ decay through the table's checkpoints, then prove the reparameterization — given the true noise, recovery of x₀ is exact at any step. The trained network's entire job is estimating that ε; everything else is this algebra.

YOUR TASK

Write the body of forward. Everything else in the file is already written; this is the function the paper is about. Press ▶ Run to check it against the 5 assertions below — they start red.

WHAT IT HAS TO SATISFY — 5 ASSERTIONS
  1. Alpha-bar decays monotonically
  2. Endpoint is pure noise
  3. Recovery is exact given true noise
  4. No noise at t=0: surviving signal fraction is 1
  5. The linear beta schedule increases over time
CPython · WebAssembly
07

Sampling and results

To generate, start from pure noise x_T ~ 𝒩(0, I). At each step, run the network to predict the noise, subtract off a scaled portion to get a cleaner estimate, add a touch of fresh noise for stochasticity, and repeat down to x₀. After all T steps you have a fresh image the model has effectively imagined from static.

PropertyGANsDDPM
Generationone forward passmany denoising steps
Trainingadversarial (unstable)simple MSE (stable)
Sample diversityprone to mode collapsehigh, covers the data

DDPM produced image quality competitive with the best GANs of the time — without the instability or mode collapse — establishing diffusion as a serious, and soon dominant, family of generative models.

08

The limits

The obvious cost is speed. Generating one image means running the network hundreds or a thousand times — orders of magnitude slower than a GAN's single pass. DDPM also operates directly in pixel space, so high-resolution generation is very expensive in both compute and memory.

Both limits drove the follow-up work. DDIM and other fast samplers cut the step count dramatically; latent diffusion moved the whole process into a compressed space to slash the per-step cost. DDPM is the sturdy foundation those improvements were built on, not the final, efficient product.

09

Why it still matters

DDPM is the paper that made diffusion work, and it launched the generation era we're living in. Every major image and video generator — DALL·E 2, Imagen, Midjourney, Stable Diffusion — descends from the forward/reverse framework and the noise-prediction objective defined here. When a model "denoises" its way to a picture, it's running DDPM's idea.

Its deeper lesson is about the power of the right reframing: a hard generative problem became a simple supervised one by choosing to predict noise. That move dethroned GANs as the default for high-fidelity generation and reoriented the whole field around iterative denoising.

Read next

Pair this with latent diffusion (which made it efficient enough for Stable Diffusion) and DDIM (which cut the 1000 sampling steps to ~50). DDPM is the mathematical bedrock beneath both.

Check yourself

5 questions on this paper

Answer each one out loud before you open it. Recalling an answer is what makes it stick; recognising one you have just read is not. Your score is kept on this device.

What is DDPM?

Show answer

DDPM (Denoising Diffusion Probabilistic Models, Ho et al., 2020) is the paper that made diffusion generative models practical. It defines a fixed forward process that gradually adds Gaussian noise to an image over many steps, and trains a neural network to reverse that process step by step — turning random noise back into a realistic image. Its key contribution was a simple, stable training objective.

What is the forward process in diffusion?

Show answer

The forward process is a fixed Markov chain that adds a small amount of Gaussian noise to the image at each of many timesteps, controlled by a noise schedule. After enough steps the image becomes pure noise. It has no learnable parameters — its only job is to define the corruption the model must learn to undo, and thanks to a math trick you can jump to any noise level in one step.

What is the reverse process?

Show answer

The reverse process is the learned part: a neural network (a U-Net) that takes a noisy image and a timestep and predicts how to make it slightly less noisy. Starting from pure noise and applying this network repeatedly, step by step, gradually produces a clean image. Training teaches the network to invert each small noising step of the forward process.

What does DDPM actually train the network to predict?

Show answer

DDPM's key simplification is that the network is trained to predict the noise that was added, rather than the clean image or a complex distribution. The loss is just the mean-squared error between the true added noise and the network's predicted noise. This simple objective turned out to be far more stable and effective than earlier variational formulations.

How is DDPM different from GANs?

Show answer

GANs generate an image in a single forward pass and train two networks in a delicate adversarial game that is prone to instability and mode collapse. DDPM generates gradually over many denoising steps and trains one network with a simple regression loss, making it far more stable and diverse — at the cost of slower, multi-step sampling.

Where this sits

Generating pixels

Ten papers from the first latent-variable generator to video and real-time 3D. The diffusion half is strictly cumulative — each rung removes a cost the last one paid.

  1. 1VAE2014
  2. 2GANs2014
  3. 3VQ-VAE2017
  4. 4DDPM2020
  5. 5DDIM2021
  6. 6Classifier-Free Guidance2021
  7. 7Latent Diffusion2022
  8. 8Sora2024
  9. 9NeRF2020
  10. 103D Gaussian Splatting2023

All 110 papers, in 19 ladders →

Finished this one? 0 / 110 Paper Breakdowns done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns