Skip to main content
QUICK REVIEW

[Paper Review] WarpLDA: a Cache Efficient O(1) Algorithm for Latent Dirichlet Allocation

Jianfei Chen, Kaiwei Li|arXiv (Cornell University)|Oct 29, 2015
Topic ModelingComputer Science38 references23 citations
TL;DR

WarpLDA proposes an O(1) time-complexity algorithm for Latent Dirichlet Allocation (LDA) that achieves cache efficiency by restricting random memory accesses to vectors small enough to fit in the L3 cache, reducing latency and boosting performance. It enables training on billion-scale corpora at 11G tokens per second, outperforming state-of-the-art methods by 5–15x in speed.

ABSTRACT

Developing efficient and scalable algorithms for Latent Dirichlet Allocation (LDA) is of wide interest for many applications. Previous work has developed an O(1) Metropolis-Hastings sampling method for each token. However, the performance is far from being optimal due to random accesses to the parameter matrices and frequent cache misses. In this paper, we first carefully analyze the memory access efficiency of existing algorithms for LDA by the scope of random access, which is the size of the memory region in which random accesses fall, within a short period of time. We then develop WarpLDA, an LDA sampler which achieves both the best O(1) time complexity per token and the best O(K) scope of random access. Our empirical results in a wide range of testing conditions demonstrate that WarpLDA is consistently 5-15x faster than the state-of-the-art Metropolis-Hastings based LightLDA, and is comparable or faster than the sparsity aware F+LDA. With WarpLDA, users can learn up to one million topics from hundreds of millions of documents in a few hours, at an unprecedentedly throughput of 11G tokens per second.

Motivation & Objective

  • To address the performance bottleneck in large-scale LDA inference caused by frequent random memory accesses and poor cache locality in existing O(1) sampling algorithms.
  • To design a sampling algorithm that maintains O(1) time complexity per token while minimizing the size of randomly accessed memory per document.
  • To enable scalable, high-throughput LDA training on billion-scale corpora by optimizing memory access patterns for modern CPU memory hierarchies.
  • To develop a system framework that supports distributed, memory-efficient computation of LDA using sparse matrix operations.
  • To demonstrate that cache-aware design can yield significant performance gains even when time complexity is already optimal.

Proposed method

  • WarpLDA employs a Monte-Carlo Expectation Maximization (MCEM) framework to decouple updates to document-topic and word-topic counts, enabling delayed and reorganized access patterns.
  • It reorders token processing within documents to group accesses to topic vectors, ensuring that only O(K) memory per document is randomly accessed, fitting within the L3 cache.
  • The algorithm uses a Metropolis-Hastings (MH) sampling strategy with a small number M of parallel chains (e.g., M=1, 2, or 4) to maintain convergence speed while reducing memory pressure.
  • A distributed sparse matrix framework is designed to efficiently manage and update the sparse topic-word and document-topic count matrices across multiple machines.
  • The system leverages NUMA-aware memory access and thread-level parallelism to minimize latency and maximize throughput on multi-core and distributed systems.
  • By carefully ordering token visits and deferring updates, WarpLDA reduces cache misses despite random access patterns, achieving high performance without sacrificing O(1) time complexity.

Experimental results

Research questions

  • RQ1Can O(1) time-complexity LDA algorithms achieve better performance by improving cache locality, even when time complexity is already optimal?
  • RQ2What is the impact of random memory access patterns on LDA inference performance, particularly in large-scale settings?
  • RQ3Can a reordering strategy reduce the size of randomly accessed memory per document to fit within the L3 cache, thereby reducing latency?
  • RQ4How does the proposed algorithm scale across multi-core and distributed systems for billion-scale topic modeling?
  • RQ5Can the MCEM framework with delayed updates enable both O(1) complexity and improved memory efficiency in LDA sampling?

Key findings

  • WarpLDA achieves a throughput of 11 billion tokens per second on 256 machines, enabling training on billion-scale corpora in under 5 hours.
  • It is consistently 5–15x faster than the state-of-the-art MH-based LightLDA across all tested configurations.
  • In most settings, WarpLDA outperforms the sparsity-aware F+LDA, particularly in high-topic-count scenarios (e.g., K=10^6).
  • The algorithm scales efficiently with 17x speedup on 24 cores and 13.5x speedup across 16 machines, demonstrating strong multi-core and distributed scalability.
  • By restricting random access to O(K) memory per document—small enough to fit in L3 cache—WarpLDA reduces memory latency and improves performance significantly.
  • The learned 1 million-topic model on ClueWeb12 (639M documents) converges meaningfully in just 5 hours, validating its practicality for large-scale applications.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.