Large Language Models Offer an Alternative to the Traditional Approach of Topic Modelling

Yida Mu, Chun Dong, Kalina Bontcheva, Xingyi Song

Topic modelling has long been the cornerstone of automated text analysis, allowing researchers to categorize vast quantities of unstructured data. However, traditional methods such as Latent Dirichlet Allocation (LDA) and embedding-based tools like BERTopic often struggle with human interpretability and semantic nuance. At LREC-COLING 2024, researchers from the University of Sheffield presented a compelling alternative: using Large Language Models (LLMs) to directly identify and summarize topics.

The Friction of Traditional Topic Modelling

For decades, the standard output of a topic model has been a "bag of words"—a list of terms like dog, cat, vet, leash—which requires a human analyst to infer the overarching theme. This process introduces several challenges:

  1. Interpretability: The cognitive load of labeling clusters is high, as researchers must "eyeball" word lists to guess the actual topic.
  2. Semantic Blindness: Statistical models often fail to distinguish between overlapping topics or subtle nuances in language.
  3. Static Nature: These models are typically rigid; processing new, "unseen" documents often requires retraining the entire model, making them ill-suited for dynamic data streams like Twitter (X) feeds.

A Multi-Stage Prompting Framework

To address these issues, the authors proposed a framework that moves beyond simple zero-shot prompting. Their methodology involves three distinct experimental stages designed to refine the output of models like GPT-3.5 and LLaMA-2:

  • Experiment 1 (Out-of-the-Box Batching): Documents are fed to the LLM in batches to respect context windows. While effective, this initial stage often results in topics that are too generic (e.g., labeling all vaccine-related documents simply as "Vaccine").
  • Experiment 2 (Seed Topic Guidance): To control granularity, the researchers introduced "seed topics." By providing a few example labels, the model is guided toward the desired level of detail, such as distinguishing between "side effects" and "general health."
  • Experiment 3 (Summarization and Merging): Because batch processing can generate thousands of redundant topics, a final step involves the LLM reviewing its own output to merge duplicates and synthesize a concise "Top N" list.

Experimental Setup and Evaluation

The framework was tested on two contrasting datasets: the 20 News Group (20NG), representing long-form, diverse categories (politics, autos, religion), and the CAVS (VAXX) dataset, a collection of short, messy Twitter posts regarding COVID-19 vaccine hesitancy.

To measure success, the researchers introduced new evaluation metrics:

  • Topic Distance: Utilizing Jaccard similarity to ensure topics are distinct and non-overlapping.
  • Semantic Granularity: Using BERT embeddings to evaluate how well the model captures specific nuances.

Key Insights

The study revealed several critical findings regarding the behavior of LLMs in categorization tasks:

  • The Granularity Trap: LLMs are so proficient at summarization that they default to the most general category possible unless constrained. Adding manual constraints (e.g., "don't use the word COVID-19 in the topic name") is essential for useful results.
  • Seeds as Anchors: Providing even a small number of seed topics acts as a powerful signal for the model to understand the intended scale of analysis.
  • Temporal Sensitivity: In the vaccine hesitancy case study, the model successfully tracked the evolution of public concern over time—from "autism" in the pre-pandemic era to "rushed development" during the rollout, and finally to "blood clots" as new data emerged.

Results and Future Directions

Qualitatively, LLM-generated topics were found to be more intuitive and descriptive than the word lists produced by LDA or BERTopic. Quantitatively, the framework achieved a 70.0 Recall score using LLaMA-2-7B on the vaccine dataset, indicating high effectiveness in identifying specific concerns when guided by seeds. Furthermore, LLMs proved to be "plug-and-play," requiring significantly less preprocessing (like stemming or lemmatization) than traditional models.

Despite these successes, hurdles remain. The researchers noted that context windows still limit the number of documents that can be processed simultaneously, and the cost and compute requirements for high-end API models like GPT-4 can be prohibitive compared to the "free" compute of LDA.

Future work will focus on context window extension techniques (such as LongLoRA) and more robust automated protocols for benchmarking LLM-driven topics against traditional standards.

Summary updated

BibTeX
@inproceedings{mu2024large,
  author = {Yida Mu and Chun Dong and Kalina Bontcheva and Xingyi Song},
  title = {{Large Language Models Offer an Alternative to the Traditional Approach of Topic Modelling}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2024},
}
Figure