Diffusion For Babies
A Tutorial
Christian Simon
4
Meta -Emu
Runway
Imagen
Stable Image
Diffusion in Physics
Can we borrow this concept for machine learning problems?
How to get to this point?
Neural Network Training
Neural Network Training
x
y
f(.;θ)
Gaussian Distribution
Love Distribution
Decoder θ
pθ(x)
Training a function to map from Gaussian dist. to ♡ dist.
Gaussian Distribution
Love Distribution
Decoder θ
pθ(x)
Dataset: {x1, x2, x3, …, xN} ~ pdata(x)
How to estimate θ?
Decoder θ
Gaussian Distribution
Love Distribution
Diffusion
Decoder θ
pθ(x)
Dataset: {x1, x2, x3, …, xN} ~ pdata(x)
Maximum Likelihood Estimation (MLE)
Gaussian Distribution
Love Distribution
Diffusion
Decoder θ
pθ(x)
Dataset: {x1, x2, x3, …, xN} ~ pdata(x)
Let’s make it easier to compute!
Let’s make it easier to compute!
Remember expectation to integral
Remember expectation to integral
Similarity Between 2 Distributions
Matching Two Distributions
Gaussian Distribution
Love Distribution
Diffusion
Estimation
True/Data
Decoder θ
pθ(x)
Dataset: {x1, x2, x3, …, xN} ~ pdata(x)
pdata(x)
KL
Div.
p(z)
Matching Two Distributions
Gaussian Distribution
Love Distribution
Decoder θ
pθ(x)
p(z)
Remember: p(x,z) = p(z|x)p(x)
Simplifying the Formulation
Gaussian Distribution
Love Distribution
Decoder θ
p(z)
z
q(z | x)
Dataset: {x1, x2, x3, …, xN} ~ pdata(x)
Encoder
pθ(x|z)
We can use this integral to 1, depending on preference.
Remember integral to expectation
Derive
Remember:
Derive
Derive
Derive
REMEMBER THIS?????
Variational AutoEncoder
How do we connect these two algorithms?
Encoding is a function to add noise
Decoding is (trainable) parameterized function to denoise
Layer is represented as denoising iterations, while VAE is not
q
p
Remember:
q
q
Back to Distribution Matching using KL Divergence
Recursive
Simplify
Inference DDIM
DDIM >>>> DDPM (Sampling in standard diffusion models)
Denoising Diffusion Implicit Models - DDIM
200 steps >>>> 1000 steps
Stable Diffusion
Diffusion for Classification
Diffusion - Interrupted Optimization
Drawbacks
Some Open Topics