# maartengr/bertopic

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/maartengr-bertopic).**

7,403 stars · 879 forks · Python · mit

## Links

- GitHub: https://github.com/MaartenGr/BERTopic
- Homepage: https://maartengr.github.io/BERTopic/
- awesome-repositories: https://awesome-repositories.com/repository/maartengr-bertopic.md

## Topics

`bert` `ldavis` `machine-learning` `nlp` `sentence-embeddings` `topic` `topic-modeling` `topic-modelling` `topic-models` `transformers`

## Description

BERTopic is a topic modeling library used to extract interpretable themes from collections of text documents and images. It functions as a document clustering framework that transforms unstructured data into numerical vectors to group semantically similar content.

The project distinguishes itself through a multimodal embedding tool that allows for joint clustering of text and images in a shared vector space. It also features a class-based TF-IDF representation engine to identify representative words for clusters and an integrated system for using large language models to generate natural language labels and summaries for discovered topics.

The library covers a broad range of capabilities, including dynamic topic analysis to track themes over time, guided discovery for steering extraction with seed words, and online incremental learning for processing data streams. Its analytical surface includes the creation of topic hierarchies, outlier reduction, and a variety of visualization tools such as 2D document mapping and temporal evolution graphs.

The framework provides modular pipeline customization and supports GPU acceleration for dimensionality reduction and clustering.

## Tags

### Artificial Intelligence & ML

- [Document Clustering Frameworks](https://awesome-repositories.com/f/artificial-intelligence-ml/document-clustering-frameworks.md) — Provides a comprehensive pipeline for transforming unstructured text into vectors to group semantically similar documents.
- [Topic Modeling Libraries](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-modeling-libraries.md) — Provides a comprehensive toolkit for identifying latent thematic structures in large text collections using unsupervised algorithms. ([source](https://maartengr.github.io/BERTopic/getting_started/visualization/visualization.html))
- [Class-Based TF-IDF](https://awesome-repositories.com/f/artificial-intelligence-ml/class-based-tf-idf.md) — Implements a class-based TF-IDF engine to identify the most representative words for discovered topic clusters.
- [Clustering Algorithms](https://awesome-repositories.com/f/artificial-intelligence-ml/clustering-algorithms.md) — Groups similar documents into clusters using various algorithms to identify underlying themes. ([source](https://maartengr.github.io/BERTopic/getting_started/clustering/clustering.html))
- [Density-Based Clustering](https://awesome-repositories.com/f/artificial-intelligence-ml/density-based-clustering.md) — Groups documents into clusters by identifying high-density regions in vector space while isolating noise as outliers.
- [Document Analysis](https://awesome-repositories.com/f/artificial-intelligence-ml/document-analysis.md) — Groups semantically similar documents into dense clusters while identifying and excluding noise as outliers. ([source](https://maartengr.github.io/BERTopic/algorithm/algorithm.html))
- [Dynamic Topic Analysis](https://awesome-repositories.com/f/artificial-intelligence-ml/dynamic-topic-analysis.md) — Tracks how the prevalence and keywords of specific themes evolve over time within a dataset.
- [Text Embedding Extraction](https://awesome-repositories.com/f/artificial-intelligence-ml/feature-extraction/text-embedding-extraction.md) — Converts raw text into numerical embeddings using semantic models to facilitate document clustering. ([source](https://maartengr.github.io/BERTopic/algorithm/algorithm.html))
- [Cluster-Based Keyword Scoring](https://awesome-repositories.com/f/artificial-intelligence-ml/information-extraction/keyword-and-phrase-extraction/cluster-based-keyword-scoring.md) — Calculates importance scores for words within a cluster using a modified TF-IDF algorithm to describe the topic. ([source](https://maartengr.github.io/BERTopic/getting_started/ctfidf/ctfidf.html))
- [Multimodal Document Clustering](https://awesome-repositories.com/f/artificial-intelligence-ml/multimodal-document-processing/multimodal-document-clustering.md) — Groups mixed-media data by creating shared vector representations for both text and images in a single space.
- [Multimodal Embedding Models](https://awesome-repositories.com/f/artificial-intelligence-ml/multimodal-embedding-models.md) — Creates shared vector spaces for text and images to perform joint multimodal clustering and analysis.
- [Semantic Document Categorization](https://awesome-repositories.com/f/artificial-intelligence-ml/semantic-document-categorization.md) — Groups unstructured text into predefined or discovered categories based on semantic similarity. ([source](https://maartengr.github.io/BERTopic/usecases.html))
- [Predefined Topic Identification](https://awesome-repositories.com/f/artificial-intelligence-ml/speaker-embeddings/embedding-similarity-analysis/similar-topic-discovery/predefined-topic-identification.md) — Matches documents to user-defined labels using cosine similarity while clustering remaining documents. ([source](https://maartengr.github.io/BERTopic/getting_started/zeroshot/zeroshot.html))
- [Temporal Topic Analysis](https://awesome-repositories.com/f/artificial-intelligence-ml/temporal-topic-analysis.md) — Calculates how topic representations and frequencies evolve across a series of timestamps. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Text Embedding Generators](https://awesome-repositories.com/f/artificial-intelligence-ml/text-embedding-generators.md) — Transforms text documents into numerical vector representations to enable semantic grouping and clustering. ([source](https://maartengr.github.io/BERTopic/api/backends.html))
- [Theme Extraction](https://awesome-repositories.com/f/artificial-intelligence-ml/theme-extraction.md) — Provides the core capability of identifying recurring themes within document collections to describe core subjects. ([source](https://maartengr.github.io/BERTopic/usecases.html))
- [Topic Label Management](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-label-management.md) — Enables the creation and updating of user-defined labels for topics to improve result interpretability. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Generative Labeling](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-label-management/generative-labeling.md) — Produces natural language topic summaries by passing representative keywords and documents to a generative text model. ([source](https://maartengr.github.io/BERTopic/api/representations.html))
- [Generative Labeling Pipelines](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-label-management/generative-labeling-pipelines.md) — Utilizes text-generation pipelines to produce descriptive natural language labels for discovered topic clusters. ([source](https://maartengr.github.io/BERTopic/api/representations.html))
- [Label-Based Discovery Guidance](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-label-management/label-based-discovery-guidance.md) — Steers the modeling process using pre-defined categories while still discovering new unknown topics. ([source](https://maartengr.github.io/BERTopic/getting_started/semisupervised/semisupervised.html))
- [Guided Topic Discovery](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-modeling-libraries/guided-topic-discovery.md) — Steers the topic extraction process using seed words or predefined categories to prioritize specific known themes. ([source](https://maartengr.github.io/BERTopic/index.html))
- [Multimodal Topic Modeling](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-modeling-libraries/multimodal-topic-modeling.md) — Processes both text and images simultaneously to identify topics across different media types. ([source](https://cdn.jsdelivr.net/gh/maartengr/bertopic@master/README.md))
- [Supervised Topic Modeling](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-modeling-libraries/supervised-topic-modeling.md) — Integrates external labels during the fitting process to guide topic creation or analyze classes. ([source](https://maartengr.github.io/BERTopic/index.html))
- [Topic Convergence Guidance](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-modeling-libraries/topic-convergence-guidance.md) — Nudges the model toward specific themes by using seed keywords to influence clustering. ([source](https://maartengr.github.io/BERTopic/getting_started/guided/guided.html))
- [Multimodal Embedding Generation](https://awesome-repositories.com/f/artificial-intelligence-ml/vector-embeddings/multimodal-embedding-generation.md) — Generates shared vector representations for both text and images to enable joint multimodal clustering. ([source](https://maartengr.github.io/BERTopic/api/backends.html))
- [Multimodal Embeddings](https://awesome-repositories.com/f/artificial-intelligence-ml/vector-embeddings/multimodal-embeddings.md) — Projects text and images into a shared vector space to enable joint clustering of different media types.
- [Multimodal Clustering](https://awesome-repositories.com/f/artificial-intelligence-ml/vector-embeddings/multimodal-embeddings/multimodal-clustering.md) — Identifies topics by clustering a combination of text and images using multimodal embeddings. ([source](https://maartengr.github.io/BERTopic/getting_started/multimodal/multimodal.html))
- [Dimensionality Reduction](https://awesome-repositories.com/f/artificial-intelligence-ml/dimensionality-reduction.md) — Compresses high-dimensional embeddings into a lower-dimensional space to optimize clustering performance. ([source](https://maartengr.github.io/BERTopic/algorithm/algorithm.html))
- [Document Topic Prediction](https://awesome-repositories.com/f/artificial-intelligence-ml/generative-ai-resources/diffusion-visual-models/generative-ai-models/latent-space-generative-models/topic-models/document-topic-prediction.md) — Predicts the most likely topic and probability for unseen documents using a previously fitted model. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Manual Topic Modeling](https://awesome-repositories.com/f/artificial-intelligence-ml/generative-ai-resources/diffusion-visual-models/generative-ai-models/latent-space-generative-models/topic-models/manual-topic-modeling.md) — Processes documents using pre-generated labels instead of discovering new clusters automatically. ([source](https://maartengr.github.io/BERTopic/api/cluster.html))
- [Hierarchical Topic Aggregation](https://awesome-repositories.com/f/artificial-intelligence-ml/hierarchical-topic-aggregation.md) — Builds a tree structure of topics by iteratively merging the most similar clusters based on embedding distances.
- [Incremental Model Updating](https://awesome-repositories.com/f/artificial-intelligence-ml/incremental-updates/incremental-model-updating.md) — Learns from mini-batches of data to update topics without retraining the entire dataset. ([source](https://maartengr.github.io/BERTopic/getting_started/online/online.html))
- [Inference Execution](https://awesome-repositories.com/f/artificial-intelligence-ml/inference-execution.md) — Assigns topics to new documents via cosine similarity between embeddings to bypass full clustering pipelines. ([source](https://maartengr.github.io/BERTopic/getting_started/best_practices/best_practices.html))
- [Interactive Topic Hierarchies](https://awesome-repositories.com/f/artificial-intelligence-ml/interactive-topic-hierarchies.md) — Generates interactive diagrams that show how topics relate and merge at different granularities. ([source](https://maartengr.github.io/BERTopic/api/plotting/hierarchical_documents.html))
- [Keyword Diversification Strategies](https://awesome-repositories.com/f/artificial-intelligence-ml/keyword-diversification-strategies.md) — Limits duplicate words within a topic by comparing word embeddings to ensure a diverse set of representative keywords. ([source](https://maartengr.github.io/BERTopic/getting_started/tips_and_tricks/tips_and_tricks.html))
- [Outlier Reassignment](https://awesome-repositories.com/f/artificial-intelligence-ml/label-assignment-strategies/outlier-labeling/outlier-reassignment.md) — Assigns documents labeled as noise to the nearest existing topic based on probability or embeddings. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Topic Cluster Management](https://awesome-repositories.com/f/artificial-intelligence-ml/label-assignment-strategies/outlier-labeling/topic-cluster-management.md) — Provides tools to merge similar topics or assign outlier documents to existing clusters. ([source](https://cdn.jsdelivr.net/gh/maartengr/bertopic@master/README.md))
- [Topic Outlier Reduction](https://awesome-repositories.com/f/artificial-intelligence-ml/label-assignment-strategies/outlier-labeling/topic-outlier-reduction.md) — Maps documents labeled as noise to the most similar existing topics using embedding strategies. ([source](https://maartengr.github.io/BERTopic/getting_started/best_practices/best_practices.html))
- [Pipeline Component Customization](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-training-and-tuning/fine-tuning-and-customization/model-customization/pipeline-component-customization.md) — Allows swapping or removing specific components for embedding and clustering to tailor the modeling process. ([source](https://maartengr.github.io/BERTopic/))
- [Term Frequency Analyzers](https://awesome-repositories.com/f/artificial-intelligence-ml/natural-language-processing-tools/term-frequency-analyzers.md) — Plots the rank of words across topics to determine the necessary number of representative terms. ([source](https://maartengr.github.io/BERTopic/api/plotting/term.html))
- [Online Learning](https://awesome-repositories.com/f/artificial-intelligence-ml/online-learning.md) — Updates document vocabularies and cluster centroids using mini-batches to process data streams without full retraining.
- [Incremental Vectorization](https://awesome-repositories.com/f/artificial-intelligence-ml/online-learning/incremental-vectorization.md) — Provides the ability to update document vocabularies and representations incrementally as new data arrives. ([source](https://maartengr.github.io/BERTopic/api/vectorizers.html))
- [Semantic Similarity Calculation](https://awesome-repositories.com/f/artificial-intelligence-ml/semantic-analysis-tools/semantic-similarity-calculation.md) — Calculates the mathematical relationship between vector representations to assign documents to topics or merge clusters.
- [Semantic Cluster Relationship Mapping](https://awesome-repositories.com/f/artificial-intelligence-ml/semantic-cluster-relationship-mapping.md) — Maps topics and their relative sizes in a 2D space to reveal relationships between semantic clusters. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Embedding Similarity Analysis](https://awesome-repositories.com/f/artificial-intelligence-ml/speaker-embeddings/embedding-similarity-analysis.md) — Calculates and analyzes the cosine similarity between topic embeddings to identify related themes. ([source](https://maartengr.github.io/BERTopic/getting_started/visualization/visualize_topics.html))
- [Keyword Extraction](https://awesome-repositories.com/f/artificial-intelligence-ml/speaker-embeddings/embedding-similarity-analysis/similar-topic-discovery/keyword-extraction.md) — Extracts the most similar words to a topic using cosine similarity between word embeddings. ([source](https://maartengr.github.io/BERTopic/api/representations.html))
- [Temporal Topic Evolution Graphing](https://awesome-repositories.com/f/artificial-intelligence-ml/temporal-topic-evolution-graphing.md) — Graphs the change in prevalence of different topics over time to identify thematic trends. ([source](https://maartengr.github.io/BERTopic/api/plotting/dtm.html))
- [Topic Count Optimization](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-count-optimization.md) — Implements logic to merge similar topics and optimize the final number of extracted themes. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Topic Distribution Analysis](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-distribution-analysis.md) — Calculates the relative contribution of multiple topics to a document by analyzing sliding windows of tokens. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Topic Evolution Tracking](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-evolution-tracking.md) — Tracks how topic representations and key terms evolve across different time intervals. ([source](https://maartengr.github.io/BERTopic/getting_started/topicsovertime/topicsovertime.html))
- [Topic Granularity Control](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-granularity-control.md) — Adjusts cluster size and total topic counts to control the number and size of generated themes. ([source](https://maartengr.github.io/BERTopic/getting_started/best_practices/best_practices.html))
- [Topic Hierarchy Creation](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-hierarchy-creation.md) — Builds a hierarchical tree of topics based on cosine distance to visualize merged topic levels. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Topic Hierarchy Dendrograms](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-hierarchy-dendrograms.md) — Generates dendrograms that visualize how topics merge, assisting in the determination of optimal topic counts. ([source](https://maartengr.github.io/BERTopic/getting_started/visualization/visualize_hierarchy.html))
- [Label-Based Topic Modeling](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-label-management/label-based-topic-modeling.md) — Transforms predefined document clusters into interpretable topics using class-based TF-IDF representations. ([source](https://maartengr.github.io/BERTopic/getting_started/manual/manual.html))
- [LLM Pipeline Integration](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-label-management/llm-pipeline-integration.md) — Integrates custom chains to create topic labels using various LLM providers and prompt pipelines. ([source](https://maartengr.github.io/BERTopic/api/representations.html))
- [Zero-Shot Labeling](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-label-management/zero-shot-labeling.md) — Maps discovered topics to a predefined list of candidate labels without requiring labeled training data. ([source](https://maartengr.github.io/BERTopic/api/representations.html))
- [Cluster Merging](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-modeling-libraries/cluster-merging.md) — Combines multiple specific topics into a single consolidated topic and updates the resulting representations. ([source](https://maartengr.github.io/BERTopic/getting_started/hierarchicaltopics/hierarchicaltopics.html))
- [Dynamic Topic Analysis](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-modeling-libraries/dynamic-topic-analysis.md) — Tracks how topic representations and frequencies evolve over time using temporal analysis.
- [LLM Topic Labeling](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-modeling-libraries/llm-topic-labeling.md) — Uses large language models to generate descriptive natural language labels for discovered topic clusters.
- [Representation Refinement](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-modeling-libraries/representation-refinement.md) — Updates the words that describe a topic by adjusting parameters without requiring a full model retrain. ([source](https://cdn.jsdelivr.net/gh/maartengr/bertopic@master/README.md))
- [Representation Updating](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-modeling-libraries/representation-updating.md) — Recalculates term importance using updated parameters such as stop words without re-fitting the model. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Topic Projection Visualizations](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-projection-visualizations.md) — Generates interactive 2D projections to visualize the global relationships and relative sizes of extracted topics. ([source](https://maartengr.github.io/BERTopic/getting_started/visualization/visualize_topics.html))
- [Topic Similarity Heatmaps](https://awesome-repositories.com/f/artificial-intelligence-ml/topic-similarity-heatmaps.md) — Generates heatmaps based on cosine similarity matrices to visually show relationships between topics. ([source](https://maartengr.github.io/BERTopic/api/plotting/heatmap.html))
- [Hybrid Word and Document Embeddings](https://awesome-repositories.com/f/artificial-intelligence-ml/vector-embeddings/hybrid-word-and-document-embeddings.md) — Merges word-level and document-level embedding models into a single workflow for comprehensive text representations. ([source](https://maartengr.github.io/BERTopic/api/backends.html))
- [Incremental](https://awesome-repositories.com/f/artificial-intelligence-ml/vocabulary-management/incremental.md) — Updates tokenization dynamically and uses filters to prevent vocabulary bloat in online settings. ([source](https://maartengr.github.io/BERTopic/getting_started/online/online.html))

### Part of an Awesome List

- [Semantic](https://awesome-repositories.com/f/awesome-lists/ai/text-clustering/semantic.md) — Organizes documents into groups based on semantic similarity using embedding models and dimensionality reduction.
- [Embedding Model Integrations](https://awesome-repositories.com/f/awesome-lists/ai/hugging-face-ecosystem/embedding-model-integrations.md) — Connects third-party libraries or custom cloud APIs to transform text into vector representations for topic modeling. ([source](https://maartengr.github.io/BERTopic/getting_started/embeddings/embeddings.html))
- [Topic Statistics Extraction](https://awesome-repositories.com/f/awesome-lists/ai/information-extraction/topic-statistics-extraction.md) — Retrieves detailed statistics for topics, including frequency, top words, and representative documents. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Language Model Development](https://awesome-repositories.com/f/awesome-lists/ai/language-model-development.md) — Topic modeling technique using transformers and dense clustering.

### Data & Databases

- [Cluster Visualizations](https://awesome-repositories.com/f/data-databases/cluster-visualizations.md) — Plots documents and their assigned topics in 2D space to show spatial distribution. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Thematic](https://awesome-repositories.com/f/data-databases/cohort-analysis/thematic.md) — Creates topic representations specific to different user groups to compare how various cohorts discuss themes. ([source](https://maartengr.github.io/BERTopic/api/bertopic.html))
- [Scatter Charts](https://awesome-repositories.com/f/data-databases/data-visualization-charts/scatter-charts.md) — Creates interactive 2D scatter plots of topics to visualize the relationships between extracted themes. ([source](https://maartengr.github.io/BERTopic/getting_started/visualization/visualization.html))
- [Document Embedding Projections](https://awesome-repositories.com/f/data-databases/document-embedding-projections.md) — Plots individual documents in a 2D plane to verify topic assignments and cluster distributions. ([source](https://maartengr.github.io/BERTopic/getting_started/visualization/visualization.html))
- [Document Topic Mapping](https://awesome-repositories.com/f/data-databases/document-topic-mapping.md) — Maps documents and associated topics into a 2D space to inspect cluster relationships. ([source](https://maartengr.github.io/BERTopic/api/plotting/documents.html))
- [Seed Word Prioritization](https://awesome-repositories.com/f/data-databases/search-indexing-technologies/search-indexing/search-information-retrieval/query-interfaces-dsls/multi-term-search-processors/term-weighting-algorithms/seed-word-prioritization.md) — Increases the weight of seed words to ensure domain-specific terminology appears in topic representations. ([source](https://maartengr.github.io/BERTopic/getting_started/seed_words/seed_words.html))
- [Diversity-Aware](https://awesome-repositories.com/f/data-databases/similarity-search/diversity-aware.md) — Selects keywords that balance semantic similarity with diversity to avoid redundant terms in topic descriptions. ([source](https://maartengr.github.io/BERTopic/api/representations.html))

### Graphics & Multimedia

- [Visual Topic Summaries](https://awesome-repositories.com/f/graphics-multimedia/visual-topic-summaries.md) — Assigns representative images or captions to identified topics to provide a visual summary of the content. ([source](https://maartengr.github.io/BERTopic/getting_started/multimodal/multimodal.html))

### Software Engineering & Architecture

- [Modular Modeling Pipelines](https://awesome-repositories.com/f/software-engineering-architecture/modular-design-patterns/modular-modeling-pipelines.md) — Provides a modular pipeline architecture allowing the swapping of embedding, dimensionality reduction, and clustering components.

### System Administration & Monitoring

- [Trend Analysis](https://awesome-repositories.com/f/system-administration-monitoring/trend-analysis.md) — Monitors how the prevalence and nature of specific themes evolve over time across a dataset. ([source](https://maartengr.github.io/BERTopic/usecases.html))
