Variational Inference: Approximating the Impossible
In deep learning, we often want to know the probability of some "hidden" state given our observed data . This is . Unfortunately, for complex data like images, this is usually intractable—it would take an infinite amount of time to calculate.
Variational Inference (VI) is our trick to turn an impossible integration problem into a solvable optimization problem.
1. The Core Idea: Distribution Matching
Since we can't find the true distribution , we choose a simpler "proxy" distribution (usually a Gaussian) and try to make it as similar to the true distribution as possible.
We measure this similarity using the Kullback-Leibler (KL) Divergence:
Our goal is to minimize this divergence.
2. The ELBO (Evidence Lower Bound)
Since we don't know , we can't minimize the KL Divergence directly. However, using some clever math (Bayes' Rule), we can derive the ELBO:
- Reconstruction Term: Does our hidden state actually represent the image ?
- Prior Matching: Is our distribution of hidden states "well-behaved" (e.g., similar to a standard Gaussian)?
In Diffusion models, the ELBO becomes our loss function. We maximize it to ensure our model generates realistic data.
3. Why VI for Diffusion?
Diffusion models are essentially deep hierarchical VAEs (Variational Autoencoders) with thousands of layers.
- Forward Path: We know the distribution —it's just adding noise.
- Reverse Path: We don't know —that's what the neural network has to learn.
By using the ELBO, we provide the network with a mathematically sound objective to learn the denoising process.
Think of Variational Inference as "Curve Fitting" for probability distributions. Instead of finding the exact curve, we pick a flexible curve (Gaussian) and stretch it until it fits the data as best as it can.