Improving Topic Modeling by Distilling Soft Labels from Language Models
Organizations: University of British Columbia, Vancouver, Canada.
Abstract
Traditional neural topic models are typically optimized by reconstructing the document's Bag-of-Words (BoW) representations, overlooking contextual information and struggling with data sparsity. In this work, we introduce a novel topic model training framework by Distilling Soft Labels (DSL) from Language Models (LMs). To construct the contextually enriched reconstruction signals, we project the next token probabilities, conditioned on a specialized prompt, onto a pre-defined vocabulary, and train the topic models to reconstruct the soft labels using the LM hidden states. This produces higher-quality topics that are more closely aligned with the underlying thematic structure of the corpus. Extensive experiments demonstrate that DSL achieves substantial improvements in topic coherence and assignment accuracy over existing baselines. Additionally, we also introduce a retrieval-based metric, which shows that our approach significantly outperforms existing methods in identifying semantically similar documents, highlighting its effectiveness for retrieval-oriented applications.
Figures & tables
| 20NewsGroup | TweetTopic | StackOverflow | ||||||||||
| Method | LLM | IRBO | Purity | LLM | IRBO | Purity | LLM | IRBO | Purity | |||
| Baselines | ||||||||||||
| LDA | .341 | 2.22 | .977 | .301 | .350 | 1.95 | .992 | .441 | .354 | 2.00 | .977 | .174 |
| ProdLDA | .351 | 2.49 | .992 | .356 | .355 | 2.11 | .994 | .533 | .352 | 2.62 | .991 | .265 |
| CombinedTM | .351 | 2.57 | .993 | .391 | .360 | 2.36 | .988 | .588 | .364 | 2.85 | .986 | .306 |
| ZeroShotTM | .354 | 2.53 | .994 | .397 | .356 | 2.30 | .994 | .573 | .363 | 2.84 | .993 | .307 |
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
| LLM Rating System Prompt |
| You are a helpful assistant evaluating the top words of a topic model output for a given topic. Please rate how related the following words are to each other on a scale from 1 to 3 (“1” = not very related, “2” = moderately related, “3” = very related). |
| Reply with a single number, indicating the overall appropriateness of the topic. |
| Instruction Prompt Variants |
| 1. Name the document’s central theme. |
| 2. Give a single label that sums up the text. |
| 3. Tag the document with its main idea. |
| 4. Read the following document in full, identify its principal theme, and output a one-word label that best conveys that unifying concept. |
| 5. Generate a tag that captures the primary theme running through the entire document. |
Topic Modeling
Topic modeling discovers recurring themes and document-topic structure in text, helping organize, compare, and track large collections.
See all 57 papers