skip to content

Search

← From Noise to Image

Part II — The Diffusion Revolution (2015–2022)

Diffusion Foundations

Forward noising, the ELBO reduced to a simple denoising loss, and score functions — the math under everything modern.

2015–2020 15 min read 3 papers

It is June 2020. Generative adversarial networks have spent six years winning every image-quality contest through an adversarial minimax game that produces sharp samples but resists stable training, while variational autoencoders offer tractable, likelihood-based optimization at the cost of blurry output. A three-author paper out of UC Berkeley revives an idea first sketched five years earlier and largely ignored since: destroy an image with noise in small increments, then train a single network to undo that damage one increment at a time. The resulting model matches state-of-the-art GAN image quality on CIFAR-10 with no discriminator, no adversarial loss, and none of the training instability that comes with them.

Where We Were

By the middle of the 2010s, generative image modeling had split into two families, and each owned one half of what a good model needed. The variational autoencoder (Variational Autoencoders), introduced in December 2013, trained an encoder-decoder pair by maximizing a tractable lower bound on data likelihood — the evidence lower bound, or ELBO — giving stable, well-understood optimization with an explicit probabilistic objective. Its cost was visual: the Gaussian assumptions and the averaging effect of maximum-likelihood training under that bound produced samples that were recognizable but soft, missing the high-frequency detail a photograph has.

The generative adversarial network (Generative Adversarial Networks), introduced six months later in June 2014, took the opposite trade. A generator and a discriminator played a minimax game with no explicit likelihood at all, and the resulting samples were sharp. But the adversarial objective was notoriously unstable to optimize, prone to mode collapse — the generator learning to produce a narrow slice of the data distribution rather than its full diversity — and sensitive enough to hyperparameters that stabilizing it became its own multi-year research program: WGAN’s Wasserstein objective in January 2017, WGAN-GP’s gradient penalty two months later, and a run of architectural fixes through ProGAN’s progressive growing in October 2017 (Taming GAN Training). By BigGAN in September 2018 and StyleGAN in December 2018, adversarially trained models were producing high-fidelity images at scale — but the field had spent four years learning to tame one specific training pathology rather than eliminating it (The GAN Golden Age).

Buried in this period was a third approach that neither camp noticed. In March 2015, a paper inspired by non-equilibrium statistical physics proposed a different way to build a tractable generative model: define a forward process that “systematically and slowly” destroys the structure of a data distribution through repeated small steps of noise, and train a neural network to learn the reverse process that restores it, step by step (Sohl-Dickstein et al., 2015). The paper demonstrated the idea on toy two-dimensional data, MNIST digits, and small natural-image datasets, showing it was possible to learn, sample from, and evaluate probabilities under a model built this way — but it produced nothing resembling GAN-quality images, and against the ProGAN and BigGAN results filling ICLR and NeurIPS proceedings later in the decade, it read as a mathematical curiosity rather than a competitor. For four years it stayed that way, cited occasionally, applied by almost no one.

Two generative families raced ahead while a third sat idle for four years Diffusion's 2015 paper read as a curiosity next to the VAE and GAN results filling the same conferences. Grey monospace text is each result's headline number. 2013 VAE Tractable, likelihood based, but blurry stable ELBO training 2014 GAN Sharp samples, but unstable to train minimax game, no bound 2015 Diffusion, buried Nonequilibrium noising, no one else notices overlooked for 4 years 2018 BigGAN, StyleGAN Four years taming the same instability high fidelity, at scale 2019 NCSN revives it Score matching plus annealed Langevin steps Inception score 8.87 2020 DDPM matches GANs No discriminator, no adversarial loss FID 3.17, CIFAR-10 VAE family GAN family, or a result at GAN parity the shelved diffusion idea the turning point that revived it This chapter opens where the amber card ends, eleven months before DDPM.
Diffusion sat next to two thriving families for four years before anyone noticed it solved the same problem differently. PNG ↓

The question sitting unanswered at the end of the 2010s was whether a third path existed: a model with the stable, likelihood-based training of a VAE, but the sample quality of a GAN. Two papers, four years apart in origin but only eleven months apart in publication, would answer it.

The Breakthrough

The revival began from a different mathematical direction than Sohl-Dickstein et al. had taken. In July 2019, Song and Ermon proposed generating samples not by learning a full generative model at all, but by learning the score function — the gradient of the log data density, ∇xlog⁡p(x)\nabla_x \log p(x) — and then using that gradient to walk samples toward high-density regions via Langevin dynamics, a sampling procedure borrowed from statistical physics (Song & Ermon, 2019). Their Noise Conditional Score Network, or NCSN, solved a problem that had stalled earlier score-based attempts: raw data lives on a low-dimensional manifold inside a much higher-dimensional pixel space, where the true score function is undefined off-manifold and poorly estimated on it. NCSN’s fix was to perturb the data with Gaussian noise at several different scales and train one network to estimate the score at every scale jointly, then sample by annealing — running Langevin dynamics starting from a large noise scale and gradually decreasing it as the sample approaches the data manifold. The paper reported that its models “produce samples comparable to GANs on MNIST, CelebA and CIFAR-10,” reaching an Inception Score of 8.87 on CIFAR-10, using a method the paper describes as requiring “no sampling during training or the use of adversarial methods” — no discriminator to train or destabilize.

NCSN and the 2015 diffusion paper had converged on the same shape of solution — corrupt data with noise, then learn to undo the corruption — from opposite theoretical starting points: one from probabilistic latent-variable modeling, the other from score matching and physics-inspired sampling. Eleven months after NCSN, Ho, Jain, and Abbeel connected the two lines explicitly. Their Denoising Diffusion Probabilistic Model, or DDPM, is a direct descendant of Sohl-Dickstein et al.’s forward-and-reverse Markov chain, but it is trained using “a novel connection between diffusion probabilistic models and denoising score matching with Langevin dynamics” — the same score-based idea NCSN had put to work independently (Ho et al., 2020).

The mechanism, described narratively before the equations arrive in the next section: take a real image and add a small, fixed amount of Gaussian noise to it, repeat that a thousand times, and the image becomes indistinguishable from pure noise. That forward process needs no learning at all — it is a fixed schedule. The learning happens in reverse: train a single neural network to look at a noisy image at step tt and predict what noise was added, so that subtracting the prediction recovers a slightly less noisy image at step t−1t-1. Run the trained network a thousand times, starting from pure noise, and it walks backward all the way to a plausible image the network has never seen before. Ho et al. used a U-Net styled after an unmasked PixelCNN++, with group normalization throughout, self-attention at the 16×1616 \times 16 feature-map resolution, and a Transformer-style sinusoidal embedding to tell the shared network which timestep tt it is currently denoising.

Diffusion runs a fixed process forward and a learned one back Nothing in the forward row is trained. Everything worth learning sits in the loop underneath it. Grey monospace text names the chapter's concrete schedule and result. FORWARD PROCESS, FIXED SCHEDULE REVERSE PROCESS, LEARNED BY THE U-NET Clean image x0 Real training image e.g. a CIFAR-10 photo Add Gaussian noise Fixed schedule, no training beta: 1e-4 to 0.02 Pure noise xT Structure fully destroyed T = 1000 steps U-Net predicts noise Sees xt and the timestep t self-attention at 16x16 Subtract, get x(t-1) One reverse step, slightly less noisy moves t toward 0 Sampled image x0 Never in the training data FID 3.17, CIFAR-10 the pivot: fixed to learned repeat, T = 1000 times fixed, no gradient the network's learned step
The top row needs no training at all. Every parameter the model has lives in the loop underneath it, run a thousand times per image. PNG ↓

The result was decisive on the axis that mattered: unconditional CIFAR-10 generation reached a Fréchet Inception Distance of 3.17 and an Inception Score of 9.46, which the paper describes as state of the art for the metric at the time, produced by a model with no discriminator, no adversarial loss, and no mode-collapse failure mode to manage. The paper also showed that its training objective, once simplified, could be interpreted as “a generalization of autoregressive decoding” — a progressive decompression of an image out of noise, one step at a time.

The Mathematics

Notation follows Ho, Jain & Abbeel (2020). The forward process turns a data sample x0x_0 into a sequence of increasingly noisy versions x1,…,xTx_1, \dots, x_T through a fixed Markov chain with no learned parameters:

q(xt∣xt−1)=N ⁣(xt; 1−βt xt−1, βtI)q(x_t \mid x_{t-1}) = \mathcal{N}\!\left(x_t;\ \sqrt{1-\beta_t}\, x_{t-1},\ \beta_t \mathbf{I}\right)

Because each step is Gaussian, the whole chain has a closed form: any noisy version xtx_t can be sampled directly from the original image x0x_0 without simulating every intermediate step.

q(xt∣x0)=N ⁣(xt; αˉt x0, (1−αˉt)I)xt=αˉt x0+1−αˉt ϵ,ϵ∼N(0,I)\begin{aligned} q(x_t \mid x_0) &= \mathcal{N}\!\left(x_t;\ \sqrt{\bar\alpha_t}\, x_0,\ (1-\bar\alpha_t)\mathbf{I}\right) \\ x_t &= \sqrt{\bar\alpha_t}\, x_0 + \sqrt{1-\bar\alpha_t}\, \epsilon, \qquad \epsilon \sim \mathcal{N}(0,\mathbf{I}) \end{aligned}
SymbolMeaning
x0x_0the original, clean data sample
xtx_tthe sample after tt steps of forward noising
βt\beta_tfixed noise-variance schedule at step tt, 10−410^{-4} to 0.020.02 across T=1000T=1000 steps
αˉt\bar\alpha_tcumulative product ∏s=1t(1−βs)\prod_{s=1}^{t}(1-\beta_s), the fraction of original signal remaining
ϵ\epsilonstandard Gaussian noise, the quantity the network learns to predict

Generation runs the chain backward. The true reverse step q(xt−1∣xt)q(x_{t-1}\mid x_t) is intractable to compute directly because it would require knowing x0x_0, so a neural network learns an approximation:

pθ(xt−1∣xt)=N ⁣(xt−1; μθ(xt,t), Σθ(xt,t))p_\theta(x_{t-1} \mid x_t) = \mathcal{N}\!\left(x_{t-1};\ \mu_\theta(x_t, t),\ \Sigma_\theta(x_t, t)\right)
SymbolMeaning
pθp_\thetathe learned reverse-process distribution, parameterized by network weights θ\theta
μθ(xt,t)\mu_\theta(x_t, t)network-predicted mean of the previous, less-noisy step
Σθ(xt,t)\Sigma_\theta(x_t, t)network-predicted (or fixed) variance of that step
θ\thetathe trainable parameters of the U-Net

Training minimizes a variational bound on the negative log-likelihood — the diffusion-specific instance of the evidence lower bound taught in full in the VAE chapter:

Eq ⁣[−log⁡pθ(x0)]  ≤  Eq ⁣[−log⁡p(xT)−∑t≥1log⁡pθ(xt−1∣xt)q(xt∣xt−1)]  =:  L\mathbb{E}_q\!\left[-\log p_\theta(x_0)\right] \;\le\; \mathbb{E}_q\!\left[-\log p(x_T) - \sum_{t \ge 1} \log \frac{p_\theta(x_{t-1}\mid x_t)}{q(x_t \mid x_{t-1})}\right] \;=:\; L
SymbolMeaning
LLthe variational bound being minimized — the training objective
p(xT)p(x_T)the fixed prior at the end of the forward chain, standard Gaussian noise
q(⋅)q(\cdot)the fixed forward process, defining the “target” the reverse process is trained to match

Ho, Jain, and Abbeel’s central contribution was showing that LL, after re-deriving μθ\mu_\theta in terms of a noise-prediction network ϵθ\epsilon_\theta and re-weighting its terms, collapses to a strikingly plain regression loss — the equation concept-ownership in this book calls simply the DDPM loss:

Lsimple(θ):=Et, x0, ϵ[∥ϵ−ϵθ ⁣(αˉt x0+1−αˉt ϵ, t)∥2]L_{\mathrm{simple}}(\theta) := \mathbb{E}_{t,\, x_0,\, \epsilon}\left[\left\lVert \epsilon - \epsilon_\theta\!\left(\sqrt{\bar\alpha_t}\, x_0 + \sqrt{1-\bar\alpha_t}\, \epsilon,\ t\right) \right\rVert^2\right]
SymbolMeaning
LsimpleL_{\mathrm{simple}}the simplified training loss — an unweighted mean-squared-error regression
ϵθ(⋅, t)\epsilon_\theta(\cdot,\ t)the U-Net’s predicted noise, given a noisy input and timestep tt
tta timestep sampled uniformly from 1,…,T1, \dots, T at each training step
x0, ϵx_0,\ \epsilona training image and the random Gaussian noise mixed into it

The score-based line from NCSN and the probabilistic line from Sohl-Dickstein and DDPM turn out to be the same objective in disguise. A noise-prediction network trained on LsimpleL_{\mathrm{simple}} is, up to a known scaling factor, also an estimate of the score function NCSN trains directly:

sθ(xt,t):=∇xtlog⁡p(xt)  ≈  − ϵθ(xt,t)1−αˉts_\theta(x_t, t) := \nabla_{x_t} \log p(x_t) \;\approx\; -\,\frac{\epsilon_\theta(x_t, t)}{\sqrt{1-\bar\alpha_t}}
SymbolMeaning
sθ(xt,t)s_\theta(x_t, t)the network’s implied estimate of the score at noise level tt
∇xtlog⁡p(xt)\nabla_{x_t} \log p(x_t)the true score — gradient of log-density with respect to the noisy sample
ϵθ(xt,t)\epsilon_\theta(x_t, t)the same noise-prediction network trained on LsimpleL_{\mathrm{simple}}
1−αˉt\sqrt{1-\bar\alpha_t}the rescaling factor connecting the two parameterizations

What It Enabled

The immediate consequence was a second viable path to GAN-competitive image quality, this time built on a training procedure with no adversarial component to destabilize. The following table lines up the trade-offs the field had been managing for six years against the one diffusion introduced.

VAEGANDiffusion, 2020
Training signalone closed-form bound, the ELBOtwo competing networks, minimax gameone closed-form regression loss, LsimpleL_{\mathrm{simple}}
Training stabilitystableprone to mode collapse and divergencestable, no adversarial dynamics
Sample quality (2020)blurrybest available (BigGAN, StyleGAN2)matches best GANs on CIFAR-10, FID 3.17
Likelihood / density estimateexplicit lower boundnoneexplicit variational bound
Cost to generate one sampleone decoder forward passone generator forward passup to T=1000T=1000 sequential network passes

That last row was diffusion’s most consequential weakness, and the field went after it almost immediately: reducing the number of sampling steps without discarding the trained model became the subject of the very next chapter’s deterministic samplers (Scores, SDEs, and Faster Sampling) and, later, of dedicated few-step and single-step distillation techniques (Few-Step Generation).

Sample-quality gains followed on a short timeline once the recipe existed. Within a year, diffusion models were shown to outperform GANs on ImageNet-scale image fidelity, a result covered in this book’s chapter on classifier guidance (Guidance), reversing six years of GAN dominance on the field’s headline benchmark. Within eighteen months, running the diffusion process in a pretrained autoencoder’s compressed latent space rather than raw pixels made the same recipe cheap enough to train and run at consumer scale, the foundation under Stable Diffusion (Latent Diffusion and Stable Diffusion).

Two lines converge on DDPM, then fork into the rest of this book Physics-inspired diffusion and score matching were the same idea from two directions. Every later diffusion chapter forks from the meeting point. Grey monospace text names where each result is covered. Sohl-Dickstein, 2015 Nonequilibrium noising forward noise, learned reverse NCSN, 2019 Score matching, Langevin IS 8.87, CIFAR-10 DDPM, 2020 Connects both lines, no discriminator FID 3.17, this chapter DDIM, 2020-10 Deterministic, fewer steps covered in chapter 9 Diffusion beats GANs Classifier guidance, 2021 covered in chapter 10 Latent diffusion, 2021 Runs in compressed latents covered in chapter 13 Classifier-free guidance Drops the classifier, 2022 covered in chapter 10 Stable Diffusion Public release, 2022 covered in chapters 13-14 the two independent origins the unifying breakthrough a direction the field took reused as a later chapter's foundation
Every later chapter in this part of the book forks from this one 2020 meeting point. PNG ↓

Key Papers

PaperAuthorsYearLinkWhy it matters
Deep Unsupervised Learning using Nonequilibrium ThermodynamicsSohl-Dickstein, Weiss, Maheswaranathan, Ganguli2015arXiv:1503.03585First forward-noise, learned-reverse-process generative model; overlooked for four years but the structural ancestor of every later diffusion model
Generative Modeling by Estimating Gradients of the Data DistributionSong, Ermon2019arXiv:1907.05600Revived denoising-based generation via score matching and annealed Langevin dynamics; reached Inception Score 8.87 on CIFAR-10 with no adversarial training
Denoising Diffusion Probabilistic ModelsHo, Jain, Abbeel2020arXiv:2006.11239Reduced the training objective to a simple noise-prediction regression and connected it to score matching; FID 3.17 on CIFAR-10 made diffusion GAN-competitive

PM Lens

Papers referenced