I was always told that I needed to know what an ELBO was. Most of the time, I did not see any ELBOs in any of the models that I actually trained. But when I got into diffusion models, that was an area in which the variational lower bound is tied to how the objective is actually derived. So, in this review, we will:

  • Derive the ELBO from first principles
  • Connect the ELBO to diffusion models
Introduction

Modern bayesian statistics is about approximating the posteriors of models which are not easy to compute. Variational inference* is a method that approximates difficult to compute probability densities through optimization, rather than through sampling. Let’s formalize the general problem of ‘modern bayesian statistics’. Consider a joint density of latent variables and observations , .

I.e., draw the latent variable from a prior density and relate the latents to the observation through the likelihood . Then, inference in a Bayesian model is conditioning on the data and computing the posterior . For contrast with variational methods, let’s get into the details of a sampling based method for approximating the posterior.

MCMC (sampling based) methods for approximate inference

First, construct an ergodic Markov chain on z (i.e. all states of z are visited in the limit of time—irreducibility—and is aperiodic, does not get trapped in repeating cycles), whose stationary distribution is the posterior . The Markov chain has transition matrix so a stationary distribution has property . In this case, we cannot sample from directly, but we can ‘evaluate’ the unnormalized posterior . The pointwise evaluator is turned into a sampler. The histogram of the points sampled from this converges to . (So in some sense after sampling you can construct a categorical distribution if you want.)

Algorithm MCMC

1. from current state z, propose z' from some proposal distribution q(z'|z), e.g. a Gaussian centered at z
2. Compute the acceptance ratio acceptance = min(1, p(x|z')p(z')q(z|z') / 
   p(x|z)p(z)q(z'|z) )
3. Accept z' with probabliblity acceptance, o.w. stay at z
   
# the numerator is the reversal and the denominator is the forward

So, What’s the issue with MCMC? We need to sample faster than this. Let’s see how we can optimize for the posterior. Assume a family of approximate densities over the latent variables. Then, find the member of that family that minimizes the KL divergence to the exact posterior, i.e., .

Here are the quantities we’ll be working with.
  • , the marginal density of the observations, is called the evidence
  • and is intractable
Let’s get familiar with the evidence lower bound

The variational inference objective is .

Recall the formula for KL divergence :

Now, let’s expand the KL divergence.

(We can remove the expectation around as it does not depend on )

Now, let’s name this expression the ELBO

We can see that it lower bounds , the evidence.

Here’s an alternative way to write the ELBO.

Connection of ELBO to Diffusion Models

Let’s map some terms from variational inference to diffusion model terminology.

  • the clean latent, is the observation
  • are the latents
  • , the step that produces the clean latent is the ‘likelihood’
  • are latent to latent transitions. This can be thought of as an analogy to the prior
  • is the noising process

What is learned in a diffusion model is the entire model.

Notice that we’re optimizing while is the fixed Gaussian Markov process.

How is each step of the diffusion process aligned?

Let’s start with this form of the ELBO.

, is the diffusion version

Per-step generative: Per-step forward:

When we write notice that we can’t yet align the and transition kernels since they are going in opposite directions

We can use Baye’s rule to invert the direction of . Additionally, the Markov property means that we can condition on . We’ll subtly factor out which will cancel when we do the telescoping sums.

Where the first term is the reconstruction error, the middle term is time-step aligned noise prediction, and the last term is aligning the noise prior.

Sources

  1. https://arxiv.org/abs/1601.00670