Pre-training is a Hot Topic: Contextualized Document Embeddings Improve Topic Coherence

Federico Bianchi, Silvia Terragni, Dirk Hovy

Introduction

Topic modeling is a fundamental NLP task used to discover latent themes within large document collections. Traditionally, models like Latent Dirichlet Allocation (LDA) have relied on Bag-of-Words (BoW) representations. However, BoW ignores word order, syntax, and semantic context, often resulting in incoherent topics that are difficult for humans to interpret. While neural topic models have made strides, they frequently fail to leverage the semantic richness of modern pre-trained language models like BERT. This paper introduces CombinedTM, a framework that bridges this gap by merging BoW representations with contextualized document embeddings.

Methodology

The proposed CombinedTM framework integrates a neural topic model with high-quality sentence embeddings. It specifically utilizes:

  1. ProdLDA (Product-of-Experts LDA): A neural VAE-based topic model that maps documents into a continuous latent space.
  2. SBERT (Sentence-BERT): A siamese network architecture designed to produce semantically meaningful document embeddings.

The core innovation lies in the input layer: the model concatenates the traditional BoW vector with a contextualized SBERT embedding. To ensure compatibility, the SBERT embedding passes through a hidden layer to match the vocabulary's dimensionality before concatenation. This combined representation serves as the input for the VAE's inference network.

Architecture of the CombinedTM model showing the integration of contextualized embeddings and BoW.

Experimental Setup

The authors evaluated CombinedTM across five diverse datasets to ensure robustness:

  • 20Newsgroups: A standard benchmark for classification and clustering.
  • Wiki20K: 20,000 English Wikipedia abstracts.
  • StackOverflow: Short, domain-specific technical text.
  • Tweets2011: Highly sparse social media posts.
  • Google News: News headlines and snippets.

These datasets provide a rigorous test for the model's ability to handle both long-form text and the data sparsity challenges typical of "short text" environments.

Results and Discussion

CombinedTM demonstrates significant improvements in topic quality across multiple metrics, including Coherence ($\tau$), External Coherence ($\alpha$), and Diversity ($\rho$).

Performance comparison of CombinedTM (Ours) against baseline models across five datasets.

Key Findings

  • Superior Coherence: CombinedTM consistently outperformed baselines like LDA, ProdLDA, NVDM, and ETM. For instance, on the Wiki20K dataset, it achieved a coherence score ($\tau$) of 0.1823, compared to ProdLDA's 0.1397.
  • Robust Diversity: The model maintains high topic diversity ($\rho \approx 0.99$), ensuring that the discovered topics remain distinct and informative rather than repetitive.
  • Context as a Regularizer: By incorporating SBERT embeddings, the model uses global semantic context to regularize the BoW-based learning process, preventing the formation of topics based on coincidental word co-occurrences.
  • Effectiveness on Short Text: The use of pre-trained knowledge allows CombinedTM to excel on short-text datasets like Tweets2011, where traditional BoW models struggle due to limited word overlap.
  • Efficiency: Despite the added complexity of BERT embeddings, the model remains efficient. Training one epoch on Google News takes approximately 2.1 seconds on a consumer-grade laptop (GTX 1050).

Conclusion

CombinedTM successfully enhances neural topic modeling by incorporating contextualized embeddings. While the model is currently limited by the 512-token window of standard Transformers, future advancements in long-range language models are expected to further boost performance. The framework remains computationally efficient, making it a practical tool for high-quality topic discovery in diverse text corpora.

Summary updated

BibTeX
@inproceedings{bianchi2021pre,
  author = {Federico Bianchi and Silvia Terragni and Dirk Hovy},
  title = {{Pre-training is a Hot Topic: Contextualized Document Embeddings Improve Topic Coherence}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-short.96},
}
Figure