NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Topic Discovery via Latent Space Clustering of Pretrained Language Model Representations

Yu Meng, Yunyi Zhang, Jiaxin Huang, Jiawei Han · DOI

Abstract

Topic models are essential for automatic topic discovery but face limitations like ignoring word order and complex inference. Pretrained language models (PLMs) offer superior representations but are not easily adapted for topic discovery. We propose TopClus, a joint latent space learning and clustering framework built on PLM embeddings. By projecting embeddings into a spherical latent space and jointly modeling topic-word and document-topic distributions, TopClus generates coherent, diverse topics and meaningful document summaries. Evaluations on NYT and Yelp datasets show TopClus outperforms traditional topic models in coherence, diversity, and representation quality.

Introduction

Traditional topic models, such as Latent Dirichlet Allocation (LDA), have long been the standard for text analysis. However, they are constrained by the bag-of-words assumption, a lack of external linguistic knowledge, and the need for complex approximate inference. While Pretrained Language Models (PLMs) like BERT address the first two issues, their raw embedding space is often unsuitable for broad topic discovery. The authors demonstrate that BERT’s Masked Language Modeling (MLM) objective creates a highly fragmented space where every word essentially forms its own cluster, making standard clustering algorithms like K-Means ineffective for identifying stable, high-level topics.

The TopClus Framework

To overcome these challenges, TopClus introduces a framework that learns a joint latent space specifically designed for clustering.

The TopClus framework: from original BERT embeddings to a latent spherical space for joint clustering and reconstruction.

The architecture is built on three pillars:

  1. Attention-Based Document Embeddings: Instead of simple averaging, TopClus employs an attention mechanism to identify topic-indicative words, creating a weighted document representation.
  2. Latent Spherical Space: High-dimensional BERT embeddings are projected into a lower-dimensional spherical space. The model utilizes the von Mises-Fisher (vMF) distribution, as angular similarity is a more effective proxy for semantic meaning than Euclidean distance in high dimensions.
  3. Joint Learning via EM: The model optimizes three losses simultaneously: a Clustering Loss to sharpen word-topic assignments, a Topical Reconstruction Loss to ensure topics summarize documents effectively, and a Preservation Loss to maintain the semantic richness of the original PLM.

Experimental Evaluation

The model was evaluated on the New York Times (NYT) dataset (long-form news) and the Yelp dataset (short-form reviews).

t-SNE visualizations of document representations for the NYT and Yelp datasets.

TopClus demonstrated significant improvements over baselines like LDA, CorEx, ETM, and BERTopic:

  • Topic Coherence: In human intrusion tests, TopClus scored 0.93 on NYT, significantly higher than LDA (0.53) and BERTopic (0.70).
  • Topic Diversity: TopClus achieved near-perfect diversity scores (0.99 on NYT), avoiding repetitive word usage across topics.
  • Document Clustering: TopClus outperformed BERTopic and ETM in document classification tasks (NMI score), indicating its latent representations are more semantically robust.

Key Insights

A primary takeaway is the "MLM Trap": BERT's ability to distinguish fine-grained word variations makes its raw space too crowded for broad topic discovery. TopClus resolves this by guiding dimensionality reduction with a clustering objective, ensuring that topics become linearly separable in the latent space. Furthermore, the focus on vector direction over magnitude in a spherical space more accurately captures semantic relatedness.

Conclusion and Future Work

TopClus provides a simpler, more effective alternative to traditional topic models by leveraging PLMs. While it currently requires a pre-specified number of topics ($K$), future work could involve automatic $K$ determination and extending the framework for hierarchical topic discovery. Despite the computational overhead of training a neural network atop a PLM, the gains in coherence and diversity make it a powerful tool for modern text analysis.

Summary updated

BibTeX
@inproceedings{meng2022topic,
  author = {Yu Meng and Yunyi Zhang and Jiaxin Huang and Yu Zhang and Jiawei Han},
  title = {{Topic Discovery via Latent Space Clustering of Pretrained Language Model Representations}},
  booktitle = {The Web Conference},
  year = {2022},
  doi = {10.1145/3485447.3512034},
}
Figure