Efficient and Flexible Topic Modeling using Pretrained Embeddings and Bag of Sentences
Johannes Schneider
TL;DR
This paper confronts the limitations of traditional topic models like LDA in aligning topics with human judgment by leveraging contextual sentence embeddings. It introduces a bag-of-sentences model (BoS) and a SenClu inference framework that uses hard sentence-group assignments and an EM procedure with annealing, guided by topic-document priors. By computing topic vectors from assigned sentence embeddings and ranking words via a combined frequency–relevance score, the approach achieves state-of-the-art topic coherence with modest computational costs compared to neural baselines. The method offers flexible priors, fast inference, and practical interpretability, with code and data available at the project link, making it attractive for real-world topic modeling tasks that require multi-topic documents and high-quality topics.
Abstract
Pre-trained language models have led to a new state-of-the-art in many NLP tasks. However, for topic modeling, statistical generative models such as LDA are still prevalent, which do not easily allow incorporating contextual word vectors. They might yield topics that do not align well with human judgment. In this work, we propose a novel topic modeling and inference algorithm. We suggest a bag of sentences (BoS) approach using sentences as the unit of analysis. We leverage pre-trained sentence embeddings by combining generative process models and clustering. We derive a fast inference algorithm based on expectation maximization, hard assignments, and an annealing process. The evaluation shows that our method yields state-of-the art results with relatively little computational demands. Our method is also more flexible compared to prior works leveraging word embeddings, since it provides the possibility to customize topic-document distributions using priors. Code and data is at \url{https://github.com/JohnTailor/BertSenClu}.
