Lecture 16:
Diffusion Models
Spring 2026
Taxonomy of Generative Models
Diffusion
Generative models
Explicit density
Implicit density
Tractable density
Approximate density
Variational
Stochastic
Direct
Stochastic
Generative Adversarial Networks (GAN)
Variational Autoencoders (VAE)
Boltzmann Machine
Fully Visible Belief Nets
PixelRNN/CNN
Today
Spring 2025
2
Score-based Generative Modeling
Spring 2025
3
Score-based Generative Modeling
Spring 2025
4
Score-based Generative Modeling
Spring 2025
5
Score-based Generative Modeling
This part is constant�(independent of the score function sθ).
x ∈ RD
sθ(x) : RD → RD
▽xsθ(x) ∈ RD×D
We don’t know this distribution. 😅
Spring 2025
6
Challenge 1: Limited Support
In the low data density regions, the score estimation becomes inaccurate.�→ Due to the lack of data samples, there is no sufficient evidence to estimate score functions accurately in these regions.
Spring 2025
7
Proposed Solution: Denoising Score Matching
A similar idea to the denoising autoencoders.
Spring 2025
8
Proposed Solution: Denoising Score Matching
Because qσ(x̃ | x) = 𝓝(x̃; x, σ2)!
A density function that is added with a pre-specified Gaussian noise (𝝈)
qσ(x̃ | x) = 𝓝(x̃; x, σ2).�That is, x̃ = x + σε, where ε~𝓝(0, σ2).
Spring 2025
9
Sampling with Langevin Dynamics
Gradient of the force calculated from the particle interaction potentials
A zero-mean stationary Gaussian process
Score function sθ(x)
zt ~ 𝓝(0, I): to avoid local minimum
Spring 2025
10
Challenge 2: Incorrect Relative Density
When two modes of the data distribution are separated by low density regions, it is not able to correctly recover the relative weights of these two modes in reasonable time.�→ Langevin dynamics have incorrect relative density between the two modes.
Images from https://yang-song.net/blog/2021/score/
Spring 2025
11
Proposed Solution: Multiple Noise Levels
Spring 2025
12
Annealed Langevin Dynamics
Spring 2025
13
Noise Conditional Score Networks: Training
Spring 2025
14
Noise Conditional Score Networks: Inference
Spring 2025
15
Noise Conditional Score Networks: Examples
Spring 2025
16
Spring 2025
17
Denoising Diffusion Probabilistic Models (DDPM)
Spring 2025
18
Forward Diffusion Process
Spring 2025
19
Forward Diffusion Process
Reverse Diffusion Process
Spring 2025
20
Introduction
Reverse process
Forward process
Spring 2025
21
Forward (Diffusion) Process
Spring 2025
22
Forward (Diffusion) Process
Reparameterization trick: let αt = 1 - βt, .
.�
When we merge two Gaussians with different variance, 𝓝(0, σ12I) and 𝓝(0, σ22I), the new distribution is 𝓝(0, (σ12+σ22)I).�
Spring 2025
23
Forward (Diffusion) Process
When we merge two Gaussians with different variance, 𝓝(0, σ12I) and 𝓝(0, σ22I), the new distribution is 𝓝(0, (σ12+σ22)I).�
Spring 2025
24
Reverse (Denoising) Process
In short, our goal is to learn this conditional distribution.
Chain rule hold: iid, Markovian assumption
Spring 2025
25
Reverse (Denoising) Process
The blue term enforces p ≈ q.
Now, in order to minimize our desired negative log-likelihood -log pθ(x0), we minimize this variational bound term.
Spring 2025
26
Reverse (Denoising) Process
Reverse conditional probability becomes tractable when conditioned on x0 ,(still mathematically equivalent due to Markovian assumption) and using Bayes’ rule, can be expressed as Gaussian distribution.
Spring 2025
27
Reverse (Denoising) Process
Prior matching term.
LT is constant, since q has no learnable parameters and xT is the input.
Reconstruction term.
This is modeled with a separate discrete decoder derived from
Consistency term.
KLD compares two Gaussian distributions, so we have a closed form solution.
For this, we will first find the single-Gaussian expression of the true distribution q(xt-1 | xt, x0), and will model pθ(xt-1 | xt) to approximate it.
Spring 2025
28
Reverse (Denoising) Process
From the reparameterization trick in page page 21:
Spring 2025
29
Reverse (Denoising) Process
From the diffusion kernel in page 21:
Exercise!
Middle school math:
Find the μ and β to make this a perfect square.
Spring 2025
30
Reverse (Denoising) Process
For this part, we got
Spring 2025
31
Reverse (Denoising) Process
Constant terms ignored.
Reparametrize the Gaussian noise term to make it predict ε from the input xt.
This is often very large for small t and very small for large t.�Empirically, simply removing this improves the sample quality.
Spring 2025
32
DDPM: Model Architecture
Spring 2025
33
DDPM: Summary
Spring 2025
34
DDPM: Examples
Spring 2025
35
DDPM: Limitations
Spring 2025
36