Topic Modeling That Ditched Bag-of-Words for BERT Embeddings
It modernizes topic modeling with transformer embeddings and a modular pipeline you can rewire without starting from scratch.

What it does
BERTopic clusters documents into interpretable topics by combining transformer embeddings with a class-based TF-IDF variant. Instead of relying on word co-occurrence like traditional LDA, it uses dense sentence embeddings to group similar documents, then extracts distinctive terms for each cluster. The result is a topic model that understands semantic similarity and assigns human-readable labels.
The interesting bit
The library treats its pipeline—embeddings, dimensionality reduction, clustering, and topic representation—as loosely coupled stages rather than a rigid black box. That modularity is what lets it support everything from supervised and zero-shot topic assignment to dynamic tracking over time, multimodal image-text clustering, and LLM-generated topic summaries without architectural contortions.
Key highlights
- Pipeline stages are swappable: you can replace sentence-transformers, UMAP, HDBSCAN, or c-TF-IDF with alternatives
- Built-in LLM integration for generating topic labels, summaries, and phrases via OpenAI or local models
- Supports multilingual modeling, multimodal image-text topics, and dynamic topic evolution over time
- Lightweight inference mode that drops Transformers, UMAP, and HDBSCAN dependencies entirely
- Includes visualization tools similar to LDAvis for exploring topic landscapes interactively
Verdict
Worth a look if you are building production topic models or exploring large document collections and need more flexibility than LDA provides. Skip it if you just want a quick, single-purpose clustering script—the breadth of options adds cognitive overhead.
Frequently asked
- What is MaartenGr/BERTopic?
- It modernizes topic modeling with transformer embeddings and a modular pipeline you can rewire without starting from scratch.
- Is BERTopic open source?
- Yes — MaartenGr/BERTopic is open source, released under the MIT license.
- What language is BERTopic written in?
- MaartenGr/BERTopic is primarily written in Python.
- How popular is BERTopic?
- MaartenGr/BERTopic has 7.8k stars on GitHub.
- Where can I find BERTopic?
- MaartenGr/BERTopic is on GitHub at https://github.com/MaartenGr/BERTopic.