On Smoothing and Inference for Topic Models

Arthur U. Asuncion, Max Welling, Padhraic Smyth, Yee Whye Teh

Abstract

For years, researchers debated which inference algorithm was best for Latent Dirichlet Allocation (LDA). This paper reveals that the choice of algorithm matters far less than the tuning of hyperparameters. By optimizing smoothing parameters, the performance gap between popular methods vanishes, allowing practitioners to utilize the most efficient option: a simplified algorithm called CVB0.

Introduction

Topic modeling, particularly Latent Dirichlet Allocation (LDA), is a fundamental tool for discovering latent themes in large text corpora. Historically, the field has been divided between competing inference methods, including Collapsed Gibbs Sampling (CGS), Variational Bayes (VB), and Maximum A Posteriori (MAP) estimation. Previous literature often claimed significant performance advantages for one method over another. However, this study suggests these differences were largely artifacts of suboptimal hyperparameter settings—specifically, using uniform smoothing parameters for algorithms that inherently require different levels of calibration.

The Smoothing Framework

The authors unify these disparate algorithms under a single mathematical framework. They demonstrate that CGS, VB, and MAP updates are all variations of the same product-of-counts formula, differing primarily by small "offsets" in the numerator (e.g., -0.5 for VB and -1.0 for MAP).

These offsets effectively subtract mass from word counts during updates. Consequently, if one uses the same small priors for VB that are standard for CGS, VB will appear to underperform. To achieve parity, one must increase the smoothing priors for VB to compensate for this internal subtraction. This insight reframes the "algorithmic choice" problem as a "hyperparameter optimization" problem.

Comparative Analysis

The study evaluates several techniques across seven diverse text corpora, including standard benchmarks like NIPS, 20 Newsgroups (NEWS), and New York Times (NYT) articles. The algorithms compared include:

  • Collapsed Gibbs Sampling (CGS): The stochastic standard.
  • Variational Bayes (VB): A common deterministic alternative.
  • Collapsed Variational Bayes (CVB): A more complex approximation.
  • CVB0: A zeroth-order approximation of CVB that simplifies the math by removing expensive mathematical functions like the digamma.

Key Results

Accuracy Parity

The most significant finding is that when hyperparameters are optimized—either through Minka’s fixed-point iterations or grid search—the performance differences (measured by perplexity) almost entirely disappear across all datasets.

Perplexity comparison across seven datasets showing performance parity when hyperparameters are optimized.

As shown in the figure above, once the "offset" penalty is accounted for via proper smoothing, CGS, CVB, and CVB0 achieve nearly identical results. Even standard VB, which often performs poorly in literature, reaches parity when using an "alternative" prediction formula that mirrors its learning update.

Efficiency and Convergence

While accuracy is similar, computational efficiency varies wildly. CVB0 emerges as the "Goldilocks" algorithm: it is deterministic, avoids complex calculations, and converges rapidly.

In convergence tests, CVB0 reached target perplexity levels significantly faster than standard VB. For example, on the KOS dataset, CVB0 trained in just 4 seconds compared to 73.8 seconds for standard VB. When parallelized on an 8-core machine, CVB0 could learn a high-quality model in a mere 1.5 seconds.

Conclusion

This research demonstrates that the perceived superiority of certain LDA inference algorithms was largely due to unfair comparisons involving unoptimized smoothing. For practitioners, the choice of algorithm should be driven by speed and ease of implementation rather than theoretical accuracy claims. CVB0 provides the best balance of speed, stability, and performance, making it the recommended choice for large-scale topic modeling. Future work remains to determine if these smoothing insights extend to more complex directed graphical models beyond LDA.

Summary updated

BibTeX
@inproceedings{asuncion2009smoothing,
  author = {Arthur U. Asuncion and Max Welling and Padhraic Smyth and Yee Whye Teh},
  title = {{On Smoothing and Inference for Topic Models}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2009},
  url = {https://openreview.net/forum?id=rDBTdABmUOu},
}
Figure