BERTopic
Modular topic modeling framework using transformer embeddings and c-TF-IDF for interpretable, coherent topics.
BERTopic
BERTopic is a topic modeling technique that leverages transformer-based embeddings (BERT, Sentence-BERT, OpenAI) to create dense clusters of documents, then uses class-based TF-IDF to produce coherent, interpretable topic representations.
Key Features
- Transformer embeddings: Use any sentence-transformer, OpenAI, or Hugging Face embedding model as the backbone
- Modular design: Swap out any component — embedding, dimensionality reduction (UMAP), clustering (HDBSCAN), and vectorization
- Dynamic topics: Track how topics evolve over time with
topics_over_time - Guided modeling: Seed the model with keywords to steer topic discovery
- Zero-shot classification: Assign documents to pre-defined topics without training
- Visualization: Built-in Plotly visualizations — topic hierarchy, similarity heatmap, topic evolution
- Online learning: Incrementally update the model with new documents
Quick Start
pip install bertopic
from bertopic import BERTopic
from sklearn.datasets import fetch_20newsgroups
docs = fetch_20newsgroups(subset="all")["data"]
model = BERTopic(language="english", calculate_probabilities=True)
topics, probs = model.fit_transform(docs)
print(model.get_topic_info().head(10))
model.visualize_topics()
Add to ai-supply
npx ai-supply add bertopic-topic-modeling
Curated mirror of the open-source BERTopic (MIT). Get it from the source.
Compromise signals — malicious or tampered code (leaked secrets, backdoors, a dropped executable) — reduce the score, and known dependency CVEs carry a bounded penalty (they warrant review but never QUARANTINE — update the dependency to clear). Other dangerous-by-capability traits are risk surface, expected for some capabilities. Every finding is mapped to its OWASP control below.
Findings mapped to the OWASP Top 10 for LLM Applications (2025) and the OWASP Machine Learning Security Top 10. Expand any flagged control for the exact findings — compromise reduces the score; expected/risk-surface do not, except a known CVE, which carries a small bounded penalty (high/critical → Review).
The same gate an agent runs before installing (POST /api/v1/trust/bertopic-topic-modeling/check). Click a policy:
Consume BERTopic programmatically. Authenticate with an API key or session — see Authorize an agent.
# Agents: CHECK BEFORE YOU INSTALL (no auth) — score, grade, level, capability manifest
curl https://ai-supply.store/api/v1/trust/bertopic-topic-modeling
# Gate against your org policy (returns { pass, violations })
curl -X POST https://ai-supply.store/api/v1/trust/bertopic-topic-modeling/check \
-H "Content-Type: application/json" \
-d '{"minGrade":"B","denyPermissions":["shell"],"denyUnknownEgress":true}'
# CLI
npx ai-supply add bertopic-topic-modeling
# REST (install → download)
curl -X POST https://ai-supply.store/api/v1/listings/bertopic-topic-modeling/install \
-H "Authorization: Bearer $AIM_KEY"
# MCP tool
install_listing({ "slug": "bertopic-topic-modeling" })OpenAPI spec →Curated mirror — latest upstream source. See the repository for tagged releases.