NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Autoencoding Variational Inference For Topic Models

Akash Srivastava, Charles Sutton

Executive Summary

This paper introduces AVITM, the first successful application of Autoencoding Variational Bayes (AEVB) to Latent Dirichlet Allocation (LDA). By using a Laplace approximation to handle the notoriously tricky Dirichlet prior and neural "inference networks" to bypass slow iterative updates, the authors achieve massive speedups. Furthermore, this black-box approach enables ProdLDA—a novel topic model that produces significantly more interpretable topics with minimal mathematical overhead.

The "Flexibility Tax" of Traditional Topic Models

Topic models like Latent Dirichlet Allocation (LDA) are foundational for unsupervised text analysis, but they come with a significant "flexibility tax." Whenever a researcher wants to tweak the model—such as adding a new hierarchy or altering a distribution—they typically must spend days or weeks re-deriving complex mathematical inference algorithms (e.g., collapsed Gibbs sampling or mean-field variational inference).

While the broader machine learning community has shifted toward "black-box" inference using Variational Autoencoders (VAEs), applying this paradigm to topic models has been notoriously difficult due to two main hurdles:

  1. The Dirichlet Prior: Unlike Gaussian distributions, the Dirichlet distribution—which is essential for sparse topic modeling—is incompatible with the standard "reparameterization trick" used in VAEs.
  2. Component Collapsing: Neural networks used for inference often fall into a bad local optimum where every "topic" looks identical, rendering the model useless.

The AVITM Solution

To bridge this gap, the authors propose AVITM (Autoencoded Variational Inference for Topic Models). Their approach relies on three key technical innovations:

  • Laplace Approximation: To make the Dirichlet prior compatible with neural networks, the authors approximate it using a Logistic Normal distribution. By performing a Laplace expansion in the "softmax basis," they create a differentiable version of the prior that a neural network can easily optimize.
  • Inference Networks: Instead of running a slow optimization process for every new document at test time, AVITM trains a neural network to directly map a document's word counts to its topic distribution. This reduces inference to a single, lightning-fast forward pass.
  • ProdLDA: To demonstrate the power of their black-box approach, the authors introduce ProdLDA. In standard LDA, words are modeled as a mixture of topics, which can lead to "blurry" results. In ProdLDA, words are modeled as a product of experts. Because AVITM is a black-box method, this fundamental architectural change required modifying only one line of code—a feat that would have required a complete mathematical overhaul using traditional methods.
  • Stability Tricks: To prevent "component collapsing," the model utilizes Batch Normalization and high-momentum ADAM optimization, helping it navigate away from the trap of identical topics.

Datasets

The researchers evaluated their models on two standard text benchmarks:

  • 20 Newsgroups: A collection of ~11,000 newsgroup posts categorized into 20 topics, using a 2,000-word vocabulary.
  • RCV1 Volume 2: A much larger dataset consisting of approximately 800,000 Reuters news stories with a 10,000-word vocabulary.

Key Insights

  • The "One Line of Code" Revolution: By decoupling the model definition from the inference engine, researchers can experiment with radical new architectures (like ProdLDA) without needing expertise in variational calculus.
  • Sharpness Matters: ProdLDA produces much "sharper" and more coherent topics than standard LDA. Mixture models (LDA) tend to be additive and can easily incorporate "noise" words, whereas products of experts (ProdLDA) require all "experts" to agree, naturally filtering out irrelevant terms.
  • Inference Networks are Accurate Mimics: The neural network doesn't just approximate the posterior; it learns to mimic the result of full variational optimization so closely that running extra optimization on test data provides almost no additional benefit.

Key Results

  • Topic Coherence: ProdLDA significantly outperformed all baseline models. On the 20 Newsgroups dataset (50 topics), ProdLDA achieved a coherence score (NPMI) of 0.24, compared to 0.11 for standard LDA and 0.17 for the gold-standard Collapsed Gibbs sampling.
Topic Coherence (NPMI) Results
  • Speed: AVITM is remarkably efficient. On the 20 Newsgroups dataset, it trained in just 46 seconds, compared to 18 minutes for standard mean-field inference.
  • Scalability: On the million-document RCV1 corpus, AVITM finished in under 1.5 hours on a single GPU. In contrast, the standard scikit-learn implementation of LDA failed to converge even after 24 hours.

Limitations and Future Work

While the Laplace approximation is highly effective, it remains an approximation of the true Dirichlet prior. Furthermore, while the authors successfully mitigated component collapsing for these specific models, it remains a general risk in AEVB that requires careful hyperparameter tuning (such as adjusting learning rates and batch normalization).

For future work, the authors suggest extending this black-box framework to more complex scenarios, including dynamic topic models (where topics evolve over time) and correlated topic models (where certain topics are likely to co-occur).

Summary updated

BibTeX
@inproceedings{srivastava2017autoencoding,
  author = {Akash Srivastava and Charles Sutton},
  title = {{Autoencoding Variational Inference For Topic Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2017},
}
Figure