Part of the generative visual computing notes.
Maximum likelihood
Suppose a coin has an unknown probability of heads. We observe eight heads and two tails in ten independent tosses. For that ordered sequence, the likelihood is . The log likelihood is
Setting its derivative to zero gives , so the maximum-likelihood estimate is . If we record only the number of heads, a binomial coefficient appears in the likelihood. It does not change the maximizing value because it is independent of .
For a dataset, maximum likelihood chooses parameters that assign high probability or density to the observed examples. It does not treat the parameter itself as a random variable unless a prior is introduced.
Cross-entropy and KL divergence
For discrete distributions and ,
and
The entropy does not depend on the fitted model . Minimizing population negative log likelihood therefore minimizes forward KL, when these quantities are well defined. Empirical average negative log likelihood estimates the population objective from the available examples.
Direction matters. If but , forward KL is infinite. Reversing the arguments changes which unsupported assignments receive that penalty. KL is nonnegative, but it is not a symmetric distance.
Hidden choices
Consider two coins chosen with equal prior probability. Coin A gives heads with probability , and coin B gives heads with probability . After observing heads,
The hidden coin identity is a latent variable. In a larger model, the marginal likelihood sums or integrates over all latent possibilities:
This integral can be difficult even when the joint density is easy to evaluate.
Deriving the lower bound
Introduce a tractable distribution and expand its KL divergence to the true posterior. Bayes’ rule gives
Rearranging,
where
The second term in the identity is nonnegative, so is a lower bound. Equality holds when the approximate posterior matches the true posterior, subject to the usual support conditions.
There are two different KL terms here. KL to the true posterior is the approximation gap. KL to the prior is the computable regularizer in the training objective. Confusing them makes the derivation difficult to follow.
For a fixed generative model, improving the variational distribution tightens the bound. When both networks are trained, the model and the approximation change together. A larger ELBO is useful evidence about the bound, but it does not separately identify how much the likelihood and the posterior approximation improved.
Worked example: the Gaussian KL term
Let the approximate posterior be and the prior be . The second argument here is the variance. Then
If the expected reconstruction log probability is , the ELBO is about . Minimizing the negative ELBO therefore gives a loss of . A good reconstruction alone is not sufficient: moving the posterior away from the prior also has a cost. These numbers illustrate the objective for one observation, not a bound on every possible reconstruction sample.
Further reading
Auto-Encoding Variational Bayes derives the variational objective and reparameterized estimator. Compare its Gaussian KL expression with the calculation above, taking care to distinguish variance from standard deviation.