Using Variational Inference and MapReduce to Scale Topic Modeling

Ke Zhai, Jordan L. Boyd-Graber, Sebastian Bruch

TL;DR

This paper introduces Mr. LDA, a novel approach to scale Latent Dirichlet Allocation (LDA) for massive document collections by leveraging variational inference within the MapReduce framework. This method offers an efficient and extensible way to perform topic modeling on big data, enabling new applications like informed priors and multilingual topic discovery.

What Problem Does This Paper Address?

Topic modeling, particularly Latent Dirichlet Allocation (LDA), is a powerful technique for uncovering themes in large document collections. However, as datasets grow exponentially, traditional LDA inference methods struggle with scalability. Existing approaches often rely on Gibbs sampling, which faces challenges with shared state, numerous short iterations, and inherent randomness, making them difficult to parallelize effectively in distributed systems like MapReduce. The paper addresses the need for a scalable, efficient, and easily extensible LDA inference method that can handle web-scale data.

Methods

The core contribution is Mr. LDA, a parallelized LDA algorithm built on the MapReduce framework and utilizing variational inference. Unlike many other scalable LDA methods that use Gibbs sampling, Mr. LDA employs variational inference, which is argued to be more amenable to parallelization.

Key aspects of the method include:

  • Variational Inference: Instead of sampling, Mr. LDA optimizes a variational distribution to approximate the true posterior. This approach naturally breaks down dependencies between documents, allowing for parallel processing.
  • MapReduce Implementation: The algorithm is structured around the MapReduce paradigm:
  • Mappers: Each mapper processes a single document, computing document-specific variational parameters ($\gamma$ and $\phi$).
  • Reducers: Reducers aggregate sufficient statistics to update topic-specific parameters ($\lambda$).
  • Driver: A central driver program updates global parameters (like $\alpha$) and monitors convergence.
  • Order Inversion Design Pattern: This pattern is used to efficiently compute marginal sums and update parameters, minimizing communication overhead.
  • Extensibility: The modular design of Mr. LDA allows for straightforward extensions, such as incorporating informed priors and handling multilingual corpora.

Datasets

The paper uses the following datasets:

  • TREC document collection: A large collection of newswire documents from the Financial Times and LA Times, containing over 100,000 distinct word types and half a million documents.
  • BlogAuthorship corpus: A collection of approximately 10 million blog posts from American users.
  • Wikipedia corpus: Paired English and German Wikipedia articles (approximately 500k in each language) for the polylingual LDA experiments.

No new benchmarks were introduced; standard datasets were used to evaluate the scalability and performance of Mr. LDA.

Key Insights and Ideas

  • Variational Inference is Key to Scalability: The paper strongly advocates for variational inference over Gibbs sampling for large-scale LDA. The independence assumption in the variational distribution between documents is crucial for parallelization in MapReduce, avoiding the synchronization bottlenecks inherent in Gibbs sampling.
  • MapReduce Fits Variational Inference Naturally: The paper demonstrates how the components of variational inference (document-specific updates and global parameter updates) map well onto the mapper/reducer architecture of MapReduce.
  • Modularity Enables Extensions: The component-based design of Mr. LDA makes it highly flexible. The authors showcase this by easily integrating informed priors (using the LIWC dictionary) and developing a polylingual LDA model. This suggests Mr. LDA can serve as a general framework for various LDA extensions.
  • Efficient Hyperparameter Optimization: The driver program's ability to efficiently update hyperparameters like $\alpha$ is critical for model quality and ensures that different inference techniques yield comparable results.

Key Results

  • Scalability: Mr. LDA demonstrates good scalability. Doubling the corpus size resulted in less than a 20% increase in training time, indicating effective parallelization. Training time increased approximately linearly with the number of documents.
  • Number of Topics: Training time increased gradually with the number of topics, but the number of iterations required for convergence remained in the dozens, significantly fewer than the hundreds often needed by Gibbs sampling.
  • Informed Priors: Experiments showed that informed priors could lead to discovering radically different words and topics, reflecting the specific nature of the corpus (e.g., distinguishing between news media and blog posts).
  • Polylingual LDA: The framework successfully handled multilingual topic modeling, learning common topic structures across languages while also capturing language-specific nuances.

Limitations and Future Work

  • Limitations:
    • The paper notes that while the number of reducers is important, the majority of the work is done in the mappers. The number of reducers is often limited by the number of topics due to partitioning.
  • While the paper discusses the trade-off between the number of mappers and network traffic, it suggests that choosing the "correct amount of resources" is crucial for optimal performance.
  • Future Work:
    • Incorporate Efficient Data Structures: The authors suggest that Mr. LDA could benefit from incorporating efficient, scalable data structures that have improved other statistical models, potentially enhancing performance and scalability.
  • Generalize to Other Models: The variational inference approach used in Mr. LDA is applicable to many other models beyond LDA. Developing automatic methods to derive inference for these models within a parallel computing environment is a promising direction.
  • Online/Streaming Inference: Extending Mr. LDA for online or streaming inference would allow for the analysis of even larger document collections and more efficient handling of incoming data.

Summary updated

BibTeX
@misc{zhai2011using,
  author = {Ke Zhai and Jordan L. Boyd-Graber and Sebastian Bruch},
  title = {{Using Variational Inference and MapReduce to Scale Topic Modeling}},
  year = {2011},
  eprint = {1107.3765},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1107.3765},
}
Figure