Abstract
Tree-based topic models offer a powerful way to incorporate domain knowledge and complex word correlations into latent variable models. However, the computational overhead of traversing tree structures and calculating complex normalizers often makes these models impractical for large datasets. This paper introduces a highly efficient inference algorithm that leverages bucket factorization, "lazy" refinement strategies, and structural optimizations. Our approach achieves up to a 10x speedup over standard Gibbs sampling, enabling the use of sophisticated tree-based priors in large-scale and interactive applications.
Introduction: The Challenge of Tree-Based Priors
Standard Latent Dirichlet Allocation (LDA) typically assumes a symmetric prior over words, treating all terms as equally related a priori. Tree-based priors address this limitation by encoding hierarchical relationships (e.g., from WordNet) into the model. For instance, a tree can specify that "king" and "queen" are related via a common ancestor node. While this significantly improves semantic coherence, it breaks the mathematical simplicity of LDA. In standard LDA, topic assignment is computationally inexpensive; in tree-based models, one must traverse paths and compute complex normalizers for every token, leading to prohibitive runtimes on large corpora.
Proposed Methodology: Efficient Inference
The authors bridge the efficiency gap between SparseLDA and expressive tree-based models through three primary innovations:
1. Bucket Factorization
The complex tree-based sampling equation is refactored into three distinct "buckets":
- $s$ (Smoothing-only): Represents the prior probability of a topic/path.
- $r$ (Document-topic): Captures probability based on topic frequency within the current document.
- $q$ (Topic-word): Reflects probability based on word frequency within a topic. This factorization allows the sampler to bypass topics with zero counts for specific words, drastically narrowing the search space.
2. Refined Bucket (RB) Sampling
Calculating the $s$ bucket remains expensive as it involves all possible topics and paths. To mitigate this, the authors employ a "lazy" refinement strategy. They first compute an easily obtainable upper bound ($s'$). The exact, computationally intensive value of $s$ is only calculated if a random sample falls within the range defined by the upper bound.
3. Structural Optimizations
- Cousin Sets: Nodes in tree models are coupled; changing a count at one leaf affects the normalizers for all leaves sharing an ancestor. The authors isolate these "cousin sets" to perform localized updates rather than recomputing the entire tree.
- Sorting: The algorithm maintains sorted lists of topics by document prominence (SD) and paths by word prominence (SW), facilitating faster identification of the "winning" topic-path combination.
Experimental Setup
The methodology was evaluated using the New York Times Editorials (1987–1996) corpus, comprising 13,284 documents and over 2.7 million tokens. WordNet 3.0 was utilized to generate tree-based priors, establishing correlations between words based on synsets.
Results and Analysis
The proposed optimizations yield dramatic performance improvements across several dimensions.
Efficiency through Coherence
A key finding is that as the model becomes more constrained with additional correlations—thereby increasing semantic coherence—the proposed algorithm actually gains speed. As shown in Figure 1, while the Naive approach slows down with increased complexity, the Fast-RB variants exploit the resulting sparsity.
Scalability and Performance Gains
The performance gains are summarized in the table below, showing scaling across topic counts, vocabulary size, and correlation density.
For a configuration with 500 topics, the Naive sampler required approximately 71 seconds per iteration, whereas the FAST-RB-sDW version completed the same task in just ~7.4 seconds—a nearly 10x speedup. Furthermore, while the Naive sampler scales poorly with vocabulary size, the FAST-RB method demonstrates much more linear scaling.
Conclusion and Future Directions
While these optimizations significantly lower the barrier to using tree-based models, they do introduce some memory overhead for maintaining sorted structures and cousin sets. Additionally, the model's quality remains dependent on the underlying tree structure. Future work may explore applying these "lazy" sampling techniques to other complex domains, such as cross-lingual retrieval or unsupervised word sense disambiguation, where capturing semantic correlations is essential for performance.
Summary updated