Scalable Collapsed Inference for High-Dimensional Topic Models

Rashidul Islam, James R. FouldsNAACL 2019

Abstract

This paper introduces SparseSCVB0, an online inference algorithm designed to scale topic modeling to millions of documents and thousands of topics without sacrificing the accuracy of collapsed variational inference. By employing a sparse Monte Carlo approximation and a Metropolis-Hastings Walker, SparseSCVB0 achieves sublinear scaling with respect to the number of topics. Experimental results on massive corpora, including the full Wikipedia dataset with 10,000 topics, demonstrate significant improvements in runtime and topic coherence compared to standard stochastic variational inference (SVI) and the original SCVB0 algorithm.

Introduction

Topic modeling, particularly Latent Dirichlet Allocation (LDA), is essential for uncovering latent themes in large-scale text corpora. However, as datasets grow, the demand for high-dimensional models (thousands of topics) increases. Existing algorithms typically face a trade-off between document scaling, topic scaling, and inference accuracy. Online algorithms like SVI handle large document counts but often lack accuracy. Conversely, "collapsed" inference methods like SCVB0 offer superior convergence but suffer from $O(K)$ computational complexity per word, where $K$ is the number of topics. SparseSCVB0 addresses these limitations by providing a stochastic, collapsed, and sparse inference framework.

Methodology

The core of SparseSCVB0 is the transformation of dense variational updates into sparse approximations. The algorithm builds upon Stochastic Collapsed Variational Bayes (SCVB0) with several key innovations:

  • Sparse Monte Carlo Approximation: Instead of computing a full $K$-dimensional distribution for each word, the algorithm draws a small number of samples ($S$) to form a sparse "pseudo-distribution."
  • Metropolis-Hastings Walker (MHW): To maintain efficiency, an alias table method is used to propose topic assignments in $O(1)$ or $O(k_d)$ time, where $k_d$ is the number of topics active in a document.
  • Sparsification and Clumping: A thresholding heuristic zeros out negligible document-topic counts to prevent model bloat. Additionally, updates for identical word types within a document are "clumped" to reduce redundant computation.

Experimental Results

The algorithm was evaluated on datasets ranging from NIPS (small) to Wikipedia (4.6 million articles).

Computational Efficiency

SparseSCVB0 exhibits sublinear runtime growth as the number of topics increases. While the original SCVB0 scales linearly, SparseSCVB0 remains efficient even at 10,000 topics. On the Wikipedia dataset, a 10,000-topic model was trained in just 36 hours on a single CPU core.

Runtime comparison between SparseSCVB0 and original SCVB0 showing sublinear scaling with topics (a) and efficiency over iterations (b).

Topic Quality

In terms of topic coherence—a metric for the semantic interpretability of topics—SparseSCVB0 consistently outperforms SVI and matches or exceeds the original SCVB0. The figure below illustrates the coherence distributions across various datasets, highlighting the robustness of the sparse approximation.

Topic coherence comparison across four datasets, demonstrating that SparseSCVB0 maintains or improves quality relative to SVI and original SCVB0.

Discussion and Conclusion

SparseSCVB0 successfully hits the "trifecta" of scaling: documents, topics, and accuracy. Interestingly, the "noise" from Monte Carlo sampling aids the model in escaping poor local optima early in training, effectively acting as an optimizer. While the current implementation is single-threaded, the sparse stochastic approach is well-suited for future integration into distributed frameworks. Future work may also address sensitivity to hyperparameter schedules and the potential for "warm starts" in extremely high-dimensional settings.

Summary updated

BibTeX
@inproceedings{islam2019scalable,
  author = {Rashidul Islam and James R. Foulds},
  title = {{Scalable Collapsed Inference for High-Dimensional Topic Models}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/n19-1291},
}
Figure