Abstract
Short-form text documents, such as tweets and news snippets, present a significant challenge for traditional topic modeling due to data sparsity. This paper introduces DistilBERTopic, a framework that leverages DistilBERT embeddings, Singular Value Decomposition (SVD) for dimensionality reduction, and HDBSCAN for clustering. Experimental results on TMNews and Twitter datasets demonstrate that DistilBERTopic significantly outperforms state-of-the-art baselines in both classification accuracy and topic coherence.
Introduction
Traditional topic models like Latent Dirichlet Allocation (LDA) rely on word co-occurrence, which is often insufficient for short texts where documents may share a topic but have no overlapping words. This "data sparsity" problem limits the effectiveness of bag-of-words approaches. DistilBERTopic addresses this by using contextual embeddings to capture semantic meaning, allowing for more robust topic discovery in short-form text without requiring external metadata.
Methods
The DistilBERTopic pipeline consists of five main stages:
- Pre-processing: Text is cleaned through lowercasing, tokenization, stop-word removal, and Porter stemming.
- Embedding: DistilBERT generates dense vector representations of documents, capturing semantic context. This allows the model to understand that words like "galaxy" and "star" are related even if they do not appear together.
- Dimensionality Reduction: Singular Value Decomposition (SVD) reduces the high-dimensional embeddings to a manageable space while preserving semantic variance, overcoming the "curse of dimensionality."
- Clustering: HDBSCAN identifies clusters of related documents and filters out noise, ensuring that "garbage" data does not pollute the discovered topics.
- Topic Discovery: A probabilistic framework defines topics based on the relationship between words and the discovered clusters.
Datasets
The model was evaluated on two distinct short-text datasets: TMNews, a collection of over 32,000 news snippets, and a Twitter dataset focused on technology brands.
Results and Discussion
DistilBERTopic was compared against several state-of-the-art baselines, including the Biterm Topic Model (BTM) and TRNMF. The model consistently achieved the highest classification accuracy across different numbers of topics ($K$). For instance, on the Twitter dataset with $K=30$, DistilBERTopic achieved an accuracy of 0.842, significantly higher than BTM's 0.586.
Key findings include:
- Context over Co-occurrence: Moving from word counts to vector space allows the model to handle synonyms and varied phrasing effectively.
- Robustness to Noise: HDBSCAN's ability to ignore outliers leads to higher topic coherence compared to traditional partitioning methods.
Conclusion
DistilBERTopic provides a powerful solution for short-text topic modeling by combining deep learning embeddings with robust clustering. Future work will explore alternative embedding techniques and different clustering algorithms to further optimize performance and computational efficiency.
Summary updated