# Topic modeling

> Canonical: https://skillalmanac.com/glossary/topic-modeling | Last verified: 2026-11-25 | Index status: index-eligible

Topic modeling represents recurring themes across a document collection. Classic unsupervised methods discover topics without predefined category labels, but supervised topic models also exist. Topics and their names require interpretation.

Also called: topic modelling, topic model, topic models, topic modeling in NLP.

## In plain language

Classic unsupervised topic modeling is a way to ask a computer what a pile of documents is about without telling it the subjects in advance. Picture ten thousand customer reviews. A topic model might report that some reviews cluster around delivery, others around battery life, and many mix both. A person still has to read each group and name it, and the groups can be fuzzy or hard to interpret. IBM notes that words with more than one meaning cause problems and that judging a topic model with numbers can be unreliable, so treat the output as a starting point for reading, not as a verdict.

## Technical definition

A well-known method is latent Dirichlet allocation (LDA), presented by Blei, Ng and Jordan in the Journal of Machine Learning Research in 2003. Their abstract describes it as a generative probabilistic model for collections of discrete data such as text corpora, a three-level hierarchical Bayesian model in which each item is a finite mixture over underlying topics. In scikit-learn, LatentDirichletAllocation takes a document-term matrix and decomposes it into a topic-term matrix and a document-topic matrix, using variational Bayes: fit defaults to learning_method='batch', while 'online' updates from minibatches and partial_fit supports online learning. Supervised topic models, such as McAuliffe and Blei's sLDA, also use document labels.

## How it shows up when you use agents

Topic modeling is a text-analysis method, not a feature of Claude Code, Codex or Cursor. It turns up when you hand an agent a large pile of text, such as support tickets, survey answers, meeting notes or a long log, and ask what is in it. An agent can answer in two quite different ways, and it helps to know which one you got.

- **The model reads and summarises.** A [large language model](/glossary/large-language-model) reads the text, or a sample of it, and names themes in its own words. This is flexible, but it sees only what fits in its [context window](/glossary/context-window), so a sample can miss rare themes.
- **A script fits a topic model.** The agent writes code that runs a method such as LDA on a document-term matrix and prints top words per topic. Check which documents survived preprocessing, filtering or subsampling; a script does not automatically cover every supplied document. The topics still need interpretation.

What breaks when this is misunderstood: people read a topic's top words as a finished label, or assume the topics were discovered with no input from the user. The safer habit is to ask the agent which approach it used, how many documents it covered and what settings it chose, then read a few documents from each topic before trusting a theme. Related ideas are [unsupervised learning](/glossary/unsupervised-learning), for classic label-free topic discovery, and [embeddings](/glossary/embedding), which are another way to group text by meaning.

## Common confusions

- **Topic modeling versus classification.** Classic unsupervised topic discovery finds latent themes to interpret. Classification assigns categories, but can use supervised, zero-shot or rule-based methods; supervised topic models also exist, so labels alone do not define the whole distinction.
- **Topic modeling versus keyword extraction.** Keyword extraction lists important words in one document. In LDA, as the paper's abstract puts it, each item in a collection is a finite mixture over underlying topics.
- **LDA versus topic modeling.** LDA is one well-known topic model. IBM describes its classic unsupervised form; the wider family also includes supervised variants.
- **Myth: the output is objective.** IBM notes that evaluating topic models is difficult and that quantitative metrics may be unreliable. Treat the topics as a reading aid.

## Worked examples in this catalogue

### [user-research-synthesis](https://skillalmanac.com/skills/skill-almanac/user-research-synthesis)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill's catalogue line says it turns many interview notes into themes where every claim cites verbatim quotes by participant id.

Why it exercises the concept: It is a human-readable version of the same goal, finding themes across many documents. The contrast is that its themes come from reading and carry quotes as evidence, while a topic model proposes word groupings statistically and leaves the naming to you.

### [log-error-clustering](https://skillalmanac.com/skills/skill-almanac/log-error-clustering)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill's catalogue line says it turns a huge log into a ranked table of distinct error signatures, with counts, timing and a triage order.

Why it exercises the concept: Grouping many short texts into a handful of recurring kinds is the same shape of problem as topic modeling. This skill groups by error signature, a simpler rule than a probabilistic topic model, so it is a contrast case.

### [data-analysis-eda](https://skillalmanac.com/skills/skill-almanac/data-analysis-eda)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill's catalogue line says it is a fixed exploratory-analysis procedure and CSV profiler that keeps findings descriptive, evidenced and caveated.

Why it exercises the concept: Topic modeling is an exploratory step. A descriptive, caveated habit is a sensible stance for its output: topics suggest where to look and do not prove what the documents mean.

## Related terms

- [Unsupervised learning](https://skillalmanac.com/glossary/unsupervised-learning.md)
- [Natural language processing (NLP)](https://skillalmanac.com/glossary/natural-language-processing.md)
- [Embedding](https://skillalmanac.com/glossary/embedding.md)
- [Semantic search](https://skillalmanac.com/glossary/semantic-search.md)
- [Machine learning (ML)](https://skillalmanac.com/glossary/machine-learning.md)

## Sources

- [Latent Dirichlet Allocation](https://jmlr.org/papers/v3/blei03a.html), Journal of Machine Learning Research (Blei, Ng and Jordan, 2003) (accessed 2026-11-24)
- [Decomposing signals in components (matrix factorization problems): Latent Dirichlet Allocation](https://scikit-learn.org/stable/modules/decomposition.html), scikit-learn (accessed 2026-11-24)
- [What is topic modeling?](https://www.ibm.com/think/topics/topic-modeling), IBM (accessed 2026-11-24)
- [LatentDirichletAllocation: learning_method, fit and partial_fit](https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.LatentDirichletAllocation.html), scikit-learn (accessed 2026-11-25)
- [Supervised Topic Models](https://papers.neurips.cc/paper_files/paper/2007/hash/d56b9fc4b0f1be8871f5e1c40c0067e7-Abstract.html), McAuliffe and Blei (NIPS 2007) (accessed 2026-11-25)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-25. [Glossary index](https://skillalmanac.com/glossary.md).
