Sub topic 15
Understanding and Reducing Outliers in BERTopic
Assume you know how sentence embeddings, HDBSCAN, and c-TF-IDF work. This chapter focuses on documents that BERTopic cannot confidently assign to a cluster.
What topic -1 means
BERTopic uses HDBSCAN to group nearby document embeddings. HDBSCAN labels a document -1 when it looks like noise rather than a member of a dense cluster. BERTopic calls these documents outliers.
An outlier is not necessarily a bad document. It may be unusually worded, short, multilingual, ambiguous, or about a rare subject. A document can also become an outlier because min_cluster_size is too large or because UMAP placed related documents far apart.
The outlier label is useful during discovery. It prevents weak assignments from contaminating topic descriptions. The trade-off is that your final topic counts may exclude documents that matter to your analysis.
| Situation | Reasonable action |
|---|---|
| You need precise, high-confidence topics | Keep outliers separate |
| You need broad corpus coverage | Try reassignment and validate it |
| Most documents are outliers | Revisit preprocessing and model settings |
Reducing outliers
reduce_outliers tests possible assignments using a selected strategy. Embedding-based reassignment compares an outlier with topic representations in embedding space. Other strategies can use probability distributions, c-TF-IDF similarity, or a combination of methods.
# Assumes topic_model, docs, and topics come from fit_transform(docs)
new_topics = topic_model.reduce_outliers(
docs,
topics,
strategy="distributions",
threshold=0.1,
)
topic_model.update_topics(docs, topics=new_topics)
print(topic_model.get_topic_info().head())The threshold controls how confident a reassignment must be. A higher threshold assigns fewer documents and usually produces safer changes. A lower threshold increases coverage but can create noisy topics.
After reassignment, update_topics recalculates topic representations. Always compare the old and new topic sizes, inspect representative documents, and check whether the top words still describe a coherent theme. Do not treat a larger topic count as automatic improvement.
Common failure modes
- Over-assignment: Almost every outlier is forced into a topic, even when it represents a genuinely new theme.
- Topic contamination: Generic documents add common words to an otherwise focused topic.
- Unstable results: Small changes to UMAP or HDBSCAN produce different outlier sets.
- Misleading labels: Top words are read as topic names without checking example documents.
A useful workflow is to keep the original labels, create reduced labels as a separate version, and compare both with manual samples and coherence measures.
Exercise
Why might you keep topic -1 instead of reducing every outlier?
Show answer
Some outliers are genuinely rare or ambiguous, so forcing them into existing topics can make those topics less meaningful.