Improving Neural Topic Models using Knowledge Distillation

Alexander Hoyle, Pranav Goel, Philip Resnik

TL;DR

This paper introduces a modular framework that uses knowledge distillation to bridge the gap between the contextual power of transformers and the interpretability of topic models. By using a BERT-based model as a "teacher," the authors significantly improve the quality and coherence of topics generated by standard neural topic models without sacrificing their human-readable nature.

What Problem Does This Paper Address?

Topic modeling is a staple of NLP used to discover the underlying themes in massive document collections. Traditionally, these models rely on a "bag-of-words" (BoW) approach, which treats documents as simple counts of words. This is problematic because BoW is sparse and ignores context—it doesn't know that "Picasso" and "Cubism" are related unless they frequently appear together in the specific dataset being trained.

On the other hand, large pre-trained transformers like BERT are masters of context, but they are "black boxes." They have millions of parameters and don't naturally produce the low-dimensional, interpretable "topics" that researchers need for data exploration. The challenge is: How do we inject BERT's deep linguistic knowledge into a topic model while keeping the model simple and interpretable?

Methods

The authors propose a "Teacher-Student" approach called BAT (BERT-based Autoencoder as Teacher).

  1. The Teacher: They take a pre-trained transformer (DistilBERT) and fine-tune it as a deterministic autoencoder on the target corpus. Its job is to reconstruct a document's word distribution. Because it's a transformer, its output is "dense"—it assigns probability mass not just to words present in the text, but also to semantically related terms that might be missing.
  2. The Student: This is a standard Neural Topic Model (NTM), such as SCHOLAR or W-LDA.
  3. Knowledge Distillation: During training, the student NTM isn't just trying to reconstruct the original sparse BoW. It is also tasked with matching the dense, context-aware word distribution produced by the BAT teacher.

This process is illustrated in Figure 1: The BAT framework: Distilling knowledge from a transformer into a topic model

Figure 1: Improving a base neural topic model with knowledge distillation. A document is mapped through both a standard BoW representation and a BERT-based Auto-encoder “Teacher” (BAT), yielding two distribu- tions over words. These are used as the ground truth in the “student” topic model’s document reconstruction loss LKD (backpropagated along the dotted line). Cru- cially, the BAT distribution assigns mass to unobserved but related terms (unbolded).

The loss function is a weighted combination of the standard reconstruction loss and the distillation loss, controlled by a hyperparameter $\lambda$. This allows the topic model to learn from "soft labels"—essentially hints from BERT about which words are related.

Datasets

The researchers evaluated their method on three diverse, standard English-language datasets:

  • 20 Newsgroups (20NG): A collection of newsgroup posts across 20 topics.
  • Wikitext-103 (Wiki): A large-scale collection of high-quality Wikipedia articles.
  • IMDb: A dataset of movie reviews, often used for sentiment and topical analysis.

The statistics for these datasets are summarized below: Corpus statistics for evaluation

Corpus statistics for evaluation

Key Insights and Ideas

  • Contextual Smoothing: The BAT teacher acts as a sophisticated "smoother." By predicting related but unobserved words, it helps the topic model generalize better, especially on short or sparse documents.
  • Modularity is Key: One of the biggest strengths of this approach is that it requires almost no changes to the underlying topic model architecture. It’s a "plug-and-play" loss term that can be added to various NTMs (the authors proved this by applying it to both VAE-based and Wasserstein-based models).
  • Preserving the "Topic Space": Rather than creating entirely new topics, BAT tends to refine the topics the base model would have found anyway, making them more "pure" and semantically focused.
  • Interpretability vs. Power: The authors argue that we don't need to replace topic models with transformers; we just need to use transformers to help train better topic models.

Key Results

The primary metric used was NPMI (Normalized Pointwise Mutual Information), which measures how often the top words in a topic co-occur (a proxy for human-judged coherence).

  • State-of-the-Art Coherence: Across all three datasets and different topic counts ($K=50, 200$), the BAT-augmented models consistently outperformed the base models and other strong baselines like DVAE.
  • Quantitative Gains: For example, on the 20NG dataset with 50 topics, the base SCHOLAR model achieved an NPMI of 0.322, while SCHOLAR+BAT reached 0.354.

The full results for the SCHOLAR-based models are shown here: NPMI results showing consistent improvement with BAT

NPMI results showing consistent improvement with BAT
  • Qualitative Improvement: In head-to-head comparisons, BAT-augmented topics were more specific. A "hockey" topic might move from generic terms like "ice" and "player" to more specific, coherent terms like "Stanley Cup" and "Maple Leafs."

The authors also showed that BAT improves the majority of individual topics when compared directly to the base model: Comparison of matched topic pairs

Figure 2: Jensen-Shannon divergence for aligned topic pairs in the SCHOLAR and SCHOLAR+BAT models.

Limitations and Future Work

  • Downstream Performance: Interestingly, while BAT makes topics more coherent for humans, it doesn't significantly improve performance on "extrinsic" tasks like document classification. The authors suggest this is a common trade-off in topic modeling.
  • Computational Overhead: Training the teacher model adds an initial step to the pipeline, though once the teacher's "logits" are saved, the student's training time remains the same.
  • Future Directions: The authors plan to explore how the choice of the teacher's pre-training corpus (e.g., using a medical-specific BERT for medical documents) affects the resulting topics. They also see potential in using this method to better understand the "black box" of neural networks through the lens of interpretable topics.

Summary updated

BibTeX
@inproceedings{hoyle2020improving,
  author = {Alexander Hoyle and Pranav Goel and Philip Resnik},
  title = {{Improving Neural Topic Models using Knowledge Distillation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  doi = {10.18653/v1/2020.emnlp-main.137},
}
Figure