The simple and elegant idea
The fundamental principle of diffusion models can be summarized in two steps: take an image and progressively add noise until you get pure random Gaussian noise. Then learn to reverse this process: start from pure noise, remove noise step by step, and reconstruct a coherent image.
It's a deceptively simple idea. And yet, it triggered a revolution. In 2022, Stable Diffusion, DALL-E 2, and Midjourney showed that this approach produces better images than Generative Adversarial Networks (GANs) and sharper ones than Variational Autoencoders (VAEs). Where a GAN rests on a fragile balance between two competing networks, and a VAE produces blurry images, diffusion has just one network to train and one target to hit.
The founding paper goes by the name DDPM, for Denoising Diffusion Probabilistic Models. Most of the numbers quoted on this page come from it.
Denoising Diffusion Probabilistic ModelsTwo figures from the paper's abstract, to anchor what follows. On CIFAR-10 (a set of 60,000 small 32x32-pixel images) in unconditional generation, the authors report an Inception Score of 9.46 and an FID of 3.17. The Inception Score (IS) reads upward: the higher, the better. The FID (Fréchet Inception Distance) reads downward: the lower, the better. Both are computed by running images through a reference classification network, and neither ever compares across image sets.
The abstract also notes that on a 256x256 set of scene photographs, sample quality was "similar to ProgressiveGAN," a GAN of that era. In other words: in 2020 diffusion matched GANs; overtaking them came later.

Forward process: from signal to noise

The step-by-step progression
The forward process is fixed and not learned: no network weights are involved, only constants decided in advance. It's simply the progressive addition of Gaussian noise. At each step (from 1 to ; the DDPM paper uses in its experiments), you mix the image with a bit of noise:
Symbol by symbol: is the step number; is the image after noising steps, the one from the previous step; (the Greek letter alpha) is a number between 0 and 1 fixed in advance for this step; (epsilon) is the noise added at this step, drawn as , the normal distribution centred on zero with each coordinate of width 1; is the square root, whose purpose is explained just below.
The intuition is that of a mixer: controls the proportion between signal and noise at each step. When is close to 1, you mostly keep the existing signal and add very little noise. When is small, you drown the signal under the noise.
Why square roots? This is a variance-preserving process: the coefficients and guarantee that the total variance of stays at 1 at each step. Indeed, if has variance 1 and does too, then . Without these square roots (if you directly used and as coefficients) the variance of would be . The signal would swell or collapse over steps, making the process unstable. The square roots are therefore the key to keeping each step properly normalized.
The noise schedule
The amount of noise added at each step is set by the noise schedule: the list, decided before training, of the 1000 values of , where (beta) is simply the share of noise added at step . Two common schedules:
Linear schedule, the one in the original DDPM paper: increases in a straight line from to . So the noising is very light at first (preserving fine details), then accelerates. Simple and effective.
Cosine schedule: smoother progression, particularly useful for high-resolution images. The noising is more uniform throughout the process, which avoids destroying the image's large structures too quickly.
Jumping directly to step t
Crucial mathematical property: thanks to the properties of the Gaussian, you can compute directly from without going through all intermediate steps.
Let's first define : it's the cumulative product of all values up to step :
Intuitively, measures how much of the original signal survives after noise steps. Since each , this product decreases over steps: at the beginning is close to 1 (signal dominates), at the end it tends toward 0 (noise completely dominates).
With this definition, the direct jump formula is:
with .
Why can you jump directly from to ? Because the sum of independent Gaussians is itself a Gaussian. Each forward step adds Gaussian noise, and by "unrolling" the recurrence over steps, all these individual noises combine into a single Gaussian term. You can therefore compute the result of noising steps in a single operation.
Why is this crucial for training? Because during training, you need to noise an image to a randomly drawn step . Without this formula, getting would mean chaining 500 steps one by one. With it, a single computation suffices, whatever is.
At step : the original image, intact. At step : the image is blurry, fine details have disappeared but the major structures are visible. At step : you can vaguely make out shapes, dominant colors. At step : pure noise, indistinguishable from . All information has been destroyed. But each individual step only added a small perturbation, which makes the process potentially reversible step by step. This is where the magic happens.
Reverse process: learned denoising
The objective
Reverse the forward process. Start from pure noise and go back step by step to a clean image .
Mathematically, this means learning , the vertical bar reading "given": the probability of the image at step given the one at step . In other words: "given this noisy image at step , what did it look like at the previous step, with just a tiny bit less noise?" If you can answer this question for each , you can go back from (noise) to (image) step by step.
The denoising network
In practice, you train a network (typically a U-Net, described below) to predict the noise that was added:
Symbol by symbol: (epsilon) is the true noise, the one actually added and therefore known during training; is the noise predicted by the network; the subscript (the Greek letter theta) stands for the whole set of the network's learned weights, a universal convention in machine learning, and the point not to miss here. and are the network's two inputs; the sign means "should come close to".
Three kinds of object coexist in these formulas, and mixing them up makes the page unreadable.
- Learned: only , the denoising network's weights. That is the sole part of the formula training modifies.
- Fixed in advance: the noise schedule, i.e., all the and . These are constants the engineer picks before starting; the model does not learn them.
- Drawn at random or computed on the fly: the noise , the step , and hence the noisy image . They change with every training example.
The network receives as input the noisy image along with an encoding of the timestep (as sinusoids, like the position encoding in transformers, see positional encoding). Its task: predict the Gaussian noise that was added to obtain .
Why predict noise rather than the image?
This is a parameterization choice, that is, "how to formulate the problem." You could train the network to predict directly, or , and mathematically it would be equivalent: knowing lets you recover by rearranging the direct-jump formula, and vice versa. But predicting the noise turns out to be more stable in practice, for a simple reason: the target is always noise of the same strength, whatever is. Predicting , by contrast, is an almost trivial task when is small and an almost impossible one when is large, the network would have to learn two very different jobs through the same output.
DDPM training: remarkable simplicity
The training algorithm is almost strikingly simple:
- Sample an image from the dataset
- Draw a random timestep from
- Draw noise
- Compute via the forward formula (a single computation, no need to iterate)
- Pass and through the network, get the prediction
- Minimize:
That's it. A simple mean squared error (MSE) between the true noise and the predicted noise: subtract, square, add up. No complex loss, no second adversarial network, no delicate balancing act.
Let's compare with the alternatives. A GAN demands a fragile balance between generator and discriminator, suffers from mode collapse (the generator produces only a small part of the possible images), and is notoriously difficult to train. A VAE forces a delicate tradeoff between its reconstruction loss and its Kullback-Leibler regularization, the KL, a measure of how far apart two probability distributions are, see its own lesson and often produces blurry images. Diffusion, meanwhile: a single network, a single loss, and training that behaves well in practice. One caution though: "behaves well" is not "converges for certain", no deep-network training offers that guarantee. It is this robustness that allowed scaling to resolutions and quality levels out of reach for GANs.
Each training step is essentially a classic supervised denoising task: "here's a noisy image, predict the noise." Nothing more. This simplicity makes diffusion extremely robust and easy to reproduce, unlike GANs which require complex training tricks.
U-Net architecture: the denoising network

The standard denoising network is a U-Net: the name comes from its shape, a U you descend one branch of and climb back up the other. It originated in medical image segmentation and serves here because it returns an image the same size as the one you hand it, which is exactly what denoising needs.
- Encoder (downward branch): convolutions that reduce spatial resolution while increasing the number of channels. The 256x256 image becomes 128x128, then 64x64, etc.
- Bottleneck (lowest point): minimum resolution, maximum channels. This is where the network takes in the whole image at a glance and can grasp its overall structure.
- Decoder (upward branch): progressive climb back to the original resolution.
- Skip connections between encoder and decoder at each resolution: they pass information straight across from one side of the U to the other, bypassing the bottleneck. Without them, fine details (textures, edges) would be lost in the squeeze.
- Attention blocks at intermediate resolutions: self-attention, the mechanism that lets every position in the image consult every other, to pick up relationships between distant regions.
- Temporal conditioning: the step is encoded as sinusoids and injected into each layer. This is what lets the network know how much noise it should remove, the same noisy image calls for different treatment at step 50 than at step 900.
Inference: generating images from nothing
The generation process is the reverse of the forward:
- Sample pure noise:
- For each step :
- Predict the noise:
- Compute using and the schedule parameters
- Add a small stochastic noise (except at the last step ) to maintain diversity
The result: a realistic synthetic image, progressively built from pure noise.
The major tradeoff: slowness
Main disadvantage: with the original settings, generating one image means passing through the U-Net 1000 times in a row, each pass being a full computation. The arithmetic is direct: 1000 steps against a single pass for a GAN, so a factor of roughly 1000 in the number of operations. That gap (rather than a figure in seconds, which would depend on the hardware) is what explains the race for acceleration described below.
Acceleration techniques
Several approaches have been developed to drastically reduce this cost:
DDIM (Denoising Diffusion Implicit Models): a deterministic reformulation of denoising (that is, with no random draw at each step) which allows "skipping" intermediate steps. The paper shows respectable results at around 50 to 100 steps. The idea: instead of following the full trajectory with its random zigzags, you follow a smoother, more direct path.
DPM-Solver: treats denoising as solving an ordinary differential equation (ODE: an equation describing how a quantity evolves continuously, here the image along its denoising trajectory). Instead of a thousand naive little steps, you use finer numerical methods that cover several steps at once. The authors report comparable quality at 10 to 20 steps.
Consistency distillation: you train a "student" model to reproduce in one to four steps what the "teacher" model does in a thousand. The student learns to jump straight from noise to the final image, summarizing the entire denoising trajectory.
There's a deep mathematical link between diffusion and score matching. Predicting noise amounts to estimating the score of the noised distribution, the score being the gradient of the log probability density, which put simply is the direction in which real data gets denser. Song et al. brought diffusion models, score matching, and stochastic differential equations (SDEs: differential equations with an added randomness term) under one framework. All of that is developed in the lesson on score-based models and flow matching.
Guidance: controlling what the model generates
Classifier guidance
First approach: use an already-trained classifier to "guide" denoising toward a target class. At each step, you add the direction the classifier points in to the denoising process, pushing the image under construction toward the desired class. The tradeoff: the more you guide, the more faithful the images are to the requested class and the less varied they become.
Classifier-free guidance (the current standard)
Often abbreviated CFG. A leaner approach that requires no external classifier. During training, the model learns to denoise with and without the instruction (text, class, etc.), all it takes is hiding the instruction on a fraction of the examples. At generation time, you combine the two predictions:
Symbol by symbol: is the noise predicted without the instruction (unconditional); the noise predicted with it; the noise actually used for the denoising step; is a hand-set dial called the guidance scale.
Why does the difference work? The term isolates the instruction's own contribution: the unconditional model predicts "generic" noise, the conditional model predicts noise steered by the instruction, so their difference is the instruction's net effect. Multiplying that difference by amplifies it. Concretely: amounts to ignoring the instruction entirely, recovers exactly the normal conditional behaviour (you subtract only to add it straight back), and exaggerates the requested features, images that match the instruction better, but vary less. Values used in practice typically sit between 5 and 15 depending on the model, and are worth tuning rather than copying. This is the mechanism that lets Stable Diffusion and DALL-E turn a prompt, the natural-language instruction the user writes, into an image.
Stable Diffusion doesn't work on pixels but in the latent space of a VAE trained in advance. The VAE's encoder compresses the image into a much smaller representation, diffusion operates entirely in that reduced space, and then the VAE's decoder climbs back to the final image.
The gain can be computed by hand. A 512x512 colour image is 512 × 512 × 3 = 786,432 numbers. Its latent version, in the most widespread configuration, is 64x64 with 4 channels, i.e., 64 × 64 × 4 = 16,384 numbers. The ratio is 786,432 ÷ 16,384 = 48. That factor of 48 is what makes diffusion practical at high resolution: without it, noising and denoising an image pixel by pixel a thousand times over would cost nearly fifty times as much.
Summary
Diffusion models rest on a remarkably simple idea: progressively noise data until pure noise, a fixed process, with nothing to learn, then learn to reverse it with a U-Net. Training is simple and robust: a single loss, the mean squared error between the noise added and the noise predicted, against the delicate balancing acts of a GAN. Generation was slow at first (a thousand steps), but DDIM, DPM-Solver, and distillation have brought that down to a few dozen, or even a handful. Classifier-free guidance allows conditioning generation on text. Since 2022, diffusion models dominate image generation; Stable Diffusion, DALL-E 2, and Midjourney all descend from them. For the rest of the story, unification with score estimation, then the flow matching that dominates today, see the next lesson. For how diffusion was adapted to text, where noise becomes masking, see diffusion language models.
1. In a diffusion model, what exactly does training modify?
2. Why train the network to predict the added noise rather than the original image, when the two formulations are mathematically equivalent?
3. During training, why is the direct-jump formula (computing x_t from x_0 in a single operation) crucial?
4. With classifier-free guidance (CFG), what happens when you push the guidance scale w above 1?
5. Why does Stable Diffusion run diffusion in the latent space of a VAE rather than directly on pixels?