Keerthi Sravan Ravi

What is ELBO?

Just another chain-of-thought on understanding and remembering ELBO.

Let 𝐗 be data samples {x1,x2,...,xN}, and 𝐙 be the latent variables {z1,z2,...,zN}. Consider a scenario wherein we wish to determine the posterior p(𝐙|𝐗). Now, as per Bayes' theorem:

p(𝐙|𝐗)=p(𝐗|𝐙) p(𝐙)p(𝐗)

However, p(𝐗) (aka the evidence) is intractable. One alternative is to look at variational inference to compute a proxy distribution q(𝐙) that is close enough to the posterior p(𝐙|𝐗). One appropriate measure of closeness here would be the Kullback-Leibler divergence, DKL:

q*(𝐙)=argminq DKL[q(𝐙)∥p(Z|X)]

Kullback-Leibler (KL) divergence

Now, minimizing the KL divergence would look like this:

DKL[q(𝐙)∥p(Z|X)]=∫q(𝐙) logq(𝐙)p(Z|X) d𝐙=𝔼[logq(𝐙)p(Z|X)]=𝔼[log q(𝐙)]−𝔼[log p(Z|X)]=𝔼[log q(𝐙)]−𝔼[log p(Z,X)−log p(𝐗)]=𝔼[log q(𝐙)]−𝔼[log p(Z,X)]+𝔼[log p(𝐗)]DKL[q(𝐙)∥p(Z|X)]=𝔼[log q(𝐙)]−𝔼[log p(Z,X)]+log p(𝐗)...(1)

Enter, ELBO

We are back to square one: p(𝐗) is intractable. However, there is one thing we can do: we can compute KL divergence up to a constant. To do this, let us define the evidence lower bound (ELBO) as the remaining terms in (1):

ELBO(q):=𝔼[log p(Z,X)]−𝔼[log q(𝐙)]...(2)

Note the reversal of the terms in ELBO between (1) and (2).

Now, (1) becomes:

DKL[q(𝐙)∥p(Z|X)]=−ELBO(q)+log p(𝐗)log p(𝐗)=DKL[q(𝐙)∥p(Z|X)]+ELBO(q)...(3)

In (3), log p(𝐗) is a constant, and DKL is non-negative. This essentially means:

log p(𝐗)≥ELBO(q)

Now for the grand reveal: the log of the evidence, p(X) is lower bounded by ELBO(q). What this means is that maximizing ELBO(q) minimizes DKL!