Denoising Diffusion Probabilistic Models
Diffusion models generate realistic data by learning to undo noise: train a network to remove a little static from a slightly corrupted image or price path, then chain thousands of tiny cleanup steps starting from pure static to synthesize something new.
Prerequisites: Latent Variable Models and the ELBO, Markov Chains
Building a model that generates realistic new data — a face, a price path — directly in one shot is hard: the network would have to leap straight from nothing to a fully coherent, detailed output, getting every pixel or every price tick right simultaneously with no room to fix mistakes along the way. Diffusion models sidestep this by never asking for a one-shot leap. Instead they train on a much easier task — given a slightly noisy version of real data, predict just the noise that was added — and then chain thousands of these easy, small corrections together, starting from pure static, to gradually sculpt something realistic out of nothing. Each individual step barely has to do anything; the difficulty gets spread across the whole chain instead of concentrated in one shot.
The analogy: restoring a photo through a thousand small touch-ups
Imagine a photo restorer handed a picture with static sprinkled on it — not ruined, just slightly grainy. Removing that light static and recovering something close to the clean photo is a manageable task; a competent restorer can do it confidently. Now imagine the same restorer handed a photo that is pure static, no picture underneath at all, and asked to produce a photorealistic image from it in one pass — an impossible task, there's no signal there to recover. But suppose instead they're allowed a thousand passes: touch up the static very slightly, then touch up the result very slightly again, then again, each time using the same "remove a little static" skill they're actually good at. After a thousand tiny touch-ups, structure emerges from noise gradually, the same way a print slowly appears in a darkroom developing bath. Diffusion models train the "remove a little static" skill on real data, then run that skill in reverse, a thousand small steps starting from pure noise, to synthesize something new.
The mechanism: add noise forward, learn to remove it backward
The forward process takes a real data point and corrupts it over steps by mixing in a little Gaussian noise at each step, so that (the data after steps of corruption) is a weighted blend of the previous step and fresh noise:
Here (a small number between 0 and 1, called the noise schedule) controls how much noise gets mixed in at step , and is a fresh draw of standard noise. In words: each step keeps most of the previous signal and adds a small, controlled dose of static, and after enough steps is indistinguishable from pure noise — no signal left at all. Crucially, this forward corruption is not learned; it's a fixed, known recipe, so at training time the exact amount of noise added at any step is known precisely.
The reverse process is what actually gets trained: a network that looks at a noisy and the step number , and predicts exactly which noise was added to produce it. The training loss is simply how far off that prediction is:
In words: take a real data point, corrupt it a known random amount, ask the network to guess the noise, and penalize the squared distance between its guess and the true noise. Once trained, generation runs the process backward: start from pure noise , use the network's noise prediction to subtract a small estimated amount of noise, arrive at a slightly cleaner , and repeat all the way down to — a real-looking sample built entirely by iterative, small denoising steps.
The noise schedule typically grows across the steps — small early, larger later — which the function-plot explorer below can approximate with a growing curve; watch how a slowly-rising function stays gentle at first and steepens later, the same shape used to keep early denoising steps easy and let later steps do more work per step.
Worked example 1: one forward noising step by hand
Take a single clean value (think of it as one price on a synthetic path) and a noise level , so and . Draw . Then
The value moved from to — mostly still the original signal, with a small, known amount of noise mixed in. A network trained on this exact pair would be graded on how close its prediction comes to .
Worked example 2: one reverse denoising step
Suppose after training, the network is given at step 1 and predicts (close to, but not exactly, the true used above). Reconstructing an estimate of by inverting the forward formula:
The network's estimate, , lands very close to the true original value of — the small error in its noise prediction ( vs the true ) only produced a small error in the reconstructed value. In a real model this single step is followed by hundreds or thousands more like it, each one nudging a noisy sample a little closer to something realistic, and each one only responsible for a small, forgivable amount of error.
Diffusion models never learn to generate directly — they learn only to predict noise in a corrupted sample, a task simple enough to train reliably. Realistic generation emerges purely from chaining that one learned skill across hundreds or thousands of small reverse steps, starting from pure static.
What this means in practice
Diffusion models are the dominant approach behind modern image and audio generators, and the same machinery is being explored for synthetic financial time series — generating plausible price paths or order-flow sequences by learning to denoise corrupted historical data, then sampling new paths from pure noise. Because generation requires running the network many times in sequence (once per denoising step), diffusion models are markedly slower to sample from than a single-pass generator like a VAE, a real cost that motivates active research into fewer, larger denoising steps.
It's tempting to think the forward noising process is the "generative" part being learned, since it's the one described first. It's the opposite: the forward process is fixed and known by design, never learned — it's just a scheduled recipe for destroying signal. The only thing the network ever learns is the reverse step, predicting noise from a corrupted sample. Mixing these up leads to the common misconception that diffusion models need to be trained to add realistic noise, when in fact adding noise is trivial and fixed; removing it is the entire learning problem.
Practice
- If were set to exactly at some step, what would become in terms of , and why would that step destroy all remaining signal in one move?
- Using the reverse formula above, find if but the network's noise prediction is badly wrong at . How far off does the reconstruction land, and what does that suggest about early training?
- Why does generation from a trained diffusion model require running the network hundreds of times, while a variational autoencoder produces a sample from a single forward pass through its decoder?
Related concepts
Practice in interviews
Further reading
- Ho, Jain & Abbeel, Denoising Diffusion Probabilistic Models (2020)
- Sohl-Dickstein et al., Deep Unsupervised Learning using Nonequilibrium Thermodynamics (2015)