Blei 2003 - Variational Inference and Parameter Estimation

Summary

The posterior is intractable (coupling of and ). Dropping the edges gives a mean-field family ; minimising KL yields closed-form coordinate updates, and variational EM estimates .

Main Content

Why exact inference fails (5.1). is intractable because of the coupling between and in the sum over topics (Dickey 1983, hypergeometric functions). Alternatives: Laplace, variational, MCMC.

Variational family (Eq. 4)

, a Dirichlet parameter, multinomial parameters; chosen by (Eq. 5), equivalent to maximising the ELBO (Jensen lower bound).

Coordinate updates (Eqs. 6-8, Appendix A.3)

Proof sketch: write the ELBO terms; the term is , maximised under by the stated softmax; the term is a Dirichlet with natural parameter ; follows from the exponential-family form of the Dirichlet (A.1: derivative of the log normaliser equals the expected sufficient statistic).

Interpretation: is a posterior Dirichlet given expected counts ; is Bayes’ rule with replaced by . Algorithm (Fig. 6): initialise , ; repeat updating then until convergence. Cost per iteration ; iterations needed are about , so roughly per document. is a document-specific representation on the topic simplex.

Variational EM (5.3, A.4)

E-step: compute for every document. M-step: maximise the bound over . The conditional multinomial has the closed form (Eq. 9); is updated by Newton-Raphson on a Hessian of the form whose inverse is obtained in linear time by the matrix inversion lemma (A.2): with .

Examples

E-step on a toy document

Two topics over four words, , , document . The fixed point gives : almost all expected words are assigned to topic 1.

import numpy as np
from scipy.special import digamma
 
def estep(w, beta, alpha, iters=100):
    k, N = beta.shape[0], len(w)
    gamma = alpha + N / k
    for _ in range(iters):
        phi = beta[:, w].T * np.exp(digamma(gamma) - digamma(gamma.sum()))
        phi /= phi.sum(1, keepdims=True)
        gamma = alpha + phi.sum(0)
    return gamma, phi
 
beta = np.array([[.5, .4, .05, .05], [.05, .05, .45, .45]])
print(estep(np.array([0, 1, 0, 1, 2]), beta, np.array([.5, .5]))[0])   # [4.83 1.17]

Connections

General theory: The ELBO and KL Divergence Minimization, Mean-Field Family and Coordinate Ascent VI (CAVI), Stochastic and Black-Box Variational Inference (the route to large corpora). MCMC alternative mentioned in Sec. 8: collapsed Gibbs (Griffiths and Steyvers 2002).

See Also

Blei 2003 - Latent Dirichlet Allocation - Overview