Interactive Topic Models with Optimal Transport

Garima Dhanania, Sheshera Mysore, Chau Minh Pham, Mohit Iyyer, Hamed Zamani, Andrew McCallumarXiv 2024 · DOI

Introduction

Traditional topic modeling often suffers from a "usability gap." Unsupervised methods like Latent Dirichlet Allocation (LDA) frequently generate "latent" topics that lack clear semantic meaning or fail to align with an analyst's specific research goals. Conversely, supervised approaches require extensive, labor-intensive manual labeling of training data, which is often impractical for large-scale exploratory analysis.

While modern Large Language Models (LLMs) offer powerful zero-shot classification capabilities, they are difficult to scale to millions of documents and struggle to handle large numbers of potential topics simultaneously due to context window limitations. To bridge this gap, researchers from UMass Amherst have introduced the Editable Topic Model (EDTM). This framework allows analysts to "steer" the modeling process using natural language labels, descriptions, or seed documents, combining the semantic depth of LLMs with the global optimization strengths of Optimal Transport.

Methodology: Scoring and Assignment

EDTM re-imagines topic modeling as a global assignment problem rather than a local classification task. The framework operates in two distinct stages:

1. Document-Topic Scoring

Instead of relying on word frequency counts, EDTM leverages pre-trained Language Models (LMs) to calculate the "affinity" between documents and user-provided labels. The authors explore two primary architectures:

  • Bi-encoders (BE): These models are computationally efficient, mapping documents and labels into a shared embedding space to calculate similarity.
  • Cross-encoders (CE): While more demanding, cross-encoders process document-label pairs together, capturing deeper semantic nuances and typically yielding higher accuracy.

2. Optimal Transport (OT) Assignment

The core innovation of EDTM is the use of Optimal Transport to resolve assignments. Rather than a "greedy" approach—where each document is simply assigned to its most similar label—EDTM uses the Sinkhorn algorithm to find a globally optimal mapping across the entire document collection. This ensures a more balanced and coherent distribution, preventing the model from being overly influenced by local noise.

The EDTM framework: (1) Document-topic scoring to generate a cost matrix C, and (2) Topic assignment using Optimal Transport to produce the final mapping Q.

A key feature of this stage is the support for Partial Assignment. If an analyst provides an incomplete taxonomy, the model can be configured to leave "high-cost" documents unassigned, avoiding forced, incorrect categorizations.

Experimental Evaluation

The framework was rigorously tested across four English datasets with diverse characteristics:

  • Twitter: Short-form text with 6 high-level labels.
  • Wiki: Wikipedia articles with 15 high-level and 114 fine-grained labels.
  • Bills: US Congressional bill summaries with 21 high-level and 45 fine-grained labels.
  • Bookgenome: Goodreads descriptions with a massive set of 226 user-generated tags.

Key Results and Insights

EDTM demonstrated superior performance across nearly all benchmarks, outperforming traditional baselines like LDA and BertTopic, as well as direct prompting of GPT-3.5-Turbo.

Performance comparison of EDTM variants (NN and EDTM with Bi-encoders/Cross-encoders) against baselines. EDTM consistently achieves higher P1 and MI scores.

Global vs. Greedy Assignment

The results confirm that Optimal Transport (EDTM) consistently outperforms Nearest Neighbor (NN) greedy assignment. By optimizing for the whole collection, the model achieves better alignment with human-defined categories.

Semantic Power of Descriptions

One of EDTM's strengths is its ability to utilize detailed topic descriptions. Providing "finer-grained" text boosts performance significantly, as the underlying LMs can better resolve the intended meaning of a category.

Scalability and Robustness

Even on the complex Bookgenome dataset with 226 labels, EDTM maintained high mutual information (MI) scores. This demonstrates its utility for real-world taxonomies that would exceed the context limits of standard LLM prompts. Furthermore, the model proved robust to "analyst error"; when a major label was omitted, EDTM intelligently reassigned documents to the next most logical category or left them unassigned.

Conclusion and Future Directions

EDTM provides a powerful, interactive framework for topic modeling that respects analyst intuition while maintaining algorithmic rigor. While the cross-encoder version offers the best performance, its computational cost remains a consideration for massive datasets. Future work may explore multi-topic assignments—allowing documents to belong to multiple categories—and extending the framework to multilingual settings. By leveraging Optimal Transport, EDTM successfully bridges the gap between the flexibility of human analysts and the scale of modern machine learning.

Summary updated

BibTeX
@misc{dhanania2024interactive,
  author = {Garima Dhanania and Sheshera Mysore and Chau Minh Pham and Mohit Iyyer and Hamed Zamani and Andrew McCallum},
  title = {{Interactive Topic Models with Optimal Transport}},
  year = {2024},
  eprint = {2406.19928},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.19928},
}
Figure