Skip to content
AI.info

Natural language processing

Topic Models and Unsupervised Text Discovery

Use topic models, matrix factorization, clustering, and exploratory text analysis while respecting instability and interpretive limits.

By the end you can

Example

A topic is discovered before it is named

A model fitted to 300,000 NIH grant and journal-paper abstracts returned 500 topics. Two experts at the National Institute of Neurological Disorders and Stroke were then asked to grade the 148 topics that fell inside their expertise. Mimno and colleagues reported the verdict plainly in 2011: “Of the 148 topics selected for annotation, 90 were labeled as “good,” 21 as “intermediate,” and 37 as “bad.””

The bad ones were not bad in a single way. The annotators sorted the defects into named types and counted them: chained (23), intruded (21), random (3) and unbalanced (15). One of the categories the model returned was simply “grant mechanisms and publication types” — paperwork boilerplate, a perfectly coherent word list about nothing anyone wanted to study.

The same catalogue turned up from the other end two years later. Chuang and colleagues compared 10,000 topic model variants against 200 expert-provided concepts, and named the recurring failures junk, fused, missing and repeated topics.

The words came from the model. The grades, the labels and the failure taxonomy came from people.

  • The model produced 500 topics, and it took two domain experts to say that 90 of the 148 they could judge were good: the label is an interpretation of a learned pattern, not a field returned by the mathematics.
  • A topic can mix several operational causes that share vocabulary, which is why the annotators did not record one kind of failure but four — chained (23), intruded (21), random (3) and unbalanced (15).
  • Rare but important themes can disappear inside a broad component. Across 10,000 model variants, Chuang and colleagues had to name that outcome too, as missing topics, alongside junk, fused and repeated ones.
  • Boilerplate can form a coherent-looking topic with no analytical value: one category this 500-topic model produced was “grant mechanisms and publication types”.

Visual

A simplified document–topic model

The model is useful as an explanatory lens even when a different algorithm is deployed. Each document receives proportions over latent topics. That mixture influences which latent component generates each position. Each topic carries a distribution over vocabulary terms. Learning then estimates the topic–word and document–topic distributions from the observed counts. Only after that do people examine terms, documents, stability and usefulness.

Only the fourth stage is arithmetic. The first three are assumptions about how the text was produced. The fifth is the work the two annotators in the previous section were doing when they graded 148 word lists as good, intermediate or bad. The generative story explains what the numbers estimate. It does not certify that the estimate corresponds to anything a domain expert would recognise.

FigureProcess · 5 steps
  1. 1. Choose a topic mixture

    Each document receives proportions over latent topics.

  2. 2. Draw a topic for each token

    The mixture influences which latent component generates a position.

  3. 3. Draw a word from that topic

    Each topic has a distribution over vocabulary terms.

  4. 4. Infer hidden structure

    Learning estimates topic–word and document–topic distributions from observed counts.

  5. 5. Interpret and validate

    People examine terms, documents, stability, and usefulness.

Comparison

Three exploratory families

They may reveal related structure while optimizing different objects. Probabilistic topic models represent documents as mixtures of latent word distributions: interpretable word lists, an explicit mixture model, bag-of-words assumptions, and a topic count and priors that matter. Matrix factorization approximates a document–term matrix with lower-rank factors — a linear algebra view, comfortable with TF–IDF, sensitive to signs and scaling, and still requiring interpretation of each factor. Embedding clustering groups contextual or document vectors under a chosen distance and algorithm. It captures semantic similarity, depends on the geometry of the representation, imposes cluster shape assumptions, and leaves the labels human.

The fourth family — projecting high-dimensional representations into two dimensions — is the one most often mistaken for evidence. Wattenberg and colleagues took it apart in Distill in 2016, using controlled examples whose structure they already knew. On the reading everyone performs on such a plot, measuring how far apart the blobs sit: “The basic message is that distances between well-separated clusters in a t-SNE plot may mean nothing.” Size gives nothing either — “you cannot see relative sizes of clusters in a t-SNE plot”. And the clusters need not exist at all. 500 points drawn from a unit Gaussian in 100 dimensions, data with no group structure in it whatever, come out as apparently dramatic clusters at perplexity 2.

The distortion has since been measured rather than demonstrated. Chari and Pachter published the measurements in 2023. In 2-D t-SNE and UMAP embeddings, so few of each point's 30 nearest neighbours survived the projection that the Jaccard distance from the ambient space averaged consistently above 0.7, and max/min distance ratios were distorted 4- to 200-fold. They then built arbitrary “Picasso” embeddings shaped like an elephant or a flower, and those scored comparably to t-SNE and UMAP on the same distance correlations. Reduction to two dimensions, their abstract states, “inevitably induces significant distortion of high-dimensional datasets”. A picture is a useful way to look for something to check. It is not the check.

FigureComparison · 4 columns

Probabilistic topic models

Represent documents as mixtures of latent word distributions.

  • Interpretable word lists
  • Explicit mixture model
  • Bag-of-words assumptions
  • Number and priors matter

Matrix factorization

Approximate a document–term matrix with lower-rank factors.

  • Linear algebra view
  • Works with TF–IDF
  • Signs and scaling matter
  • Factors require interpretation

Embedding clustering

Group contextual or document vectors under a distance and algorithm.

  • Captures semantic similarity
  • Depends on representation geometry
  • Cluster shape assumptions
  • Labels remain human

Visualization methods

Project high-dimensional text representations into two dimensions.

  • Useful exploration
  • Can distort distance and density
  • Sensitive to settings
  • Not proof of clusters

Analogy

Sorting an attic by recurring contents

Opening unlabeled boxes in an attic turns up recurring combinations of maps, tickets, tools, or photographs. You can propose themes, but another person might sort the same objects by owner, year, or purpose.

A person sorting the attic follows a judgment about owner, year, or purpose. A topic model optimizes a numerical objective and can split one document across several components. Either way, the organization that emerges depends on the lens doing the sorting — and, as the NIH annotators found, some boxes turn out to hold the packing material rather than the contents.

Latent structure is a proposal for organizing evidence, not a discovered ground-truth taxonomy.

Coherence alone can reward the wrong thing

A topic whose top words frequently co-occur may look coherent while representing a website template, citation style, or demographic proxy. Conversely, a useful operational theme can contain diverse vocabulary and score poorly.

Combine automated coherence with document inspection, intruder tasks, stability across runs, coverage, distinctiveness, and a defined user task. Report disagreements among reviewers.

That assumption was tested directly in 2009. Chang and colleagues built two human tasks. In word intrusion, “subjects are presented with a set of words and asked to select the word which does not belong with the others”. In topic intrusion, the subject must find “a topic that was not associated with the document by the model”. Both were set against held-out likelihood. The result inverted the usual reading: “Surprisingly, topic models which perform better on held-out likelihood may infer less semantically meaningful topics.” The paper is called Reading Tea Leaves.

In 2021, Hoyle and colleagues asked whether the field had absorbed that. Surveying forty neural topic-modelling papers, they found 0 of 40 — 0% — reporting a human evaluation of coherence, only 28% naming the reference corpus used to compute NPMI, and 30% preprocessing inconsistently across their own datasets. Then they ran the comparison themselves, on New York Times and Wikipedia text, with at least fifteen crowdworkers per topic. NPMI declared D-VAE the winner. The human ratings favoured G-LDA. Their abstract closes on the consequence: “Automated evaluations declare a winning model when corresponding human evaluations do not, calling into question the validity of fully automatic evaluations independent of human judgments.”

A separate benchmark reached the same verdict from a different direction, testing algorithms against a known Wikipedia clustering in PLOS ONE in 2022. Its finding is that “coherence (at least the way it is currently measured in the literature) does not correlate with accuracy”, and that “clustering results that yield coherent topics do not necessarily guarantee correctness”. Two independent groups, two designs, one conclusion. The score and the reader disagree often enough that the score cannot stand in for the reader.

A readable word list is not enough to establish a useful or responsible topic.

Key idea

Topic solutions are conditional on choices

Preprocessing, vocabulary pruning, number of topics, priors, initialization, sampling window, and corpus change can alter the result. Topic identifiers also have no stable cross-run order.

Align or compare components by their word and document distributions, not by topic number. If you are monitoring change over time, separate real corpus movement from refitting instability.

The number of topics is an input, not a discovery. The paper that introduced latent Dirichlet allocation, published by Blei and colleagues in 2003, is candid about what follows. Its worked example fits “a 100-topic LDA model” to 16,000 documents from a subset of the TREC AP corpus. The sentence to keep is their own. Those distributions “seem to capture some of the underlying topics in the corpus (and we have named them according to these topics)”. The hundred was chosen, and the names came from the authors.

How far does a solution actually move when nothing changes but the random start? Belford and colleagues measured it. They ran 100 randomly initialised runs of LDA and of NMF, with a fixed k = 7, on a 2003 New York Times corpus, describing each topic by its top ten terms. The Average Descriptor Set Difference came out at 0.47 for LDA and 0.31 for NMF. Same corpus, same k, same code — and roughly half the descriptor terms changing between runs of the probabilistic model. Their complaint is about practice rather than mathematics: “In many applications of topic modeling, this problem of instability is not considered and topic models are treated as being definitive, even though the results may change considerably if the initialization process is altered.”

The PLOS ONE benchmark repeated the exercise at industrial scale, executing every algorithm 25 times on each Wikipedia-derived dataset — roughly 75,000 test runs over more than 1,000 hours of compute. All LDA variants showed result dispersion, and the online variational-Bayes variants scattered so badly for small k that “a single run [is] almost useless”. That is the operational reading of instability. A single fit is a draw from a distribution of possible solutions, and reporting it alone hides the width of that distribution.

A topic index is not a persistent semantic identity.

Steps

Run an exploratory topic study responsibly

The output should support a question rather than merely produce colorful labels. State the exploration goal first — archive navigation, issue discovery, sampling, or trend hypotheses. Build lexical and embedding baselines, comparing simple term clusters, metadata groups and nearest documents. Sweep defensible settings: topic count, preprocessing, seeds, time periods. Inspect words and documents together, naming topics only after reading representative and boundary cases. Then validate actionability and risk, testing whether the organization helps users without reifying sensitive or misleading categories.

The sweep is the step teams skip, and it is not a formality. Schofield and Mimno moved a single preprocessing switch with everything else held fixed: rule-based, truncation, S-removal and dictionary-based stemmers, plus a no-stemmer control, across four corpora — arXiv articles from early 2015, New York Times articles from 2007, IMDb biographies and Yelp reviews. For every corpus, treatment and K in {10, 50, 200} they trained at least nine MALLET LDA models. Their conclusion, in 2016: “Despite their frequent use in topic modeling, we find that stemmers produce no meaningful improvement in likelihood and coherence and in fact can degrade topic stability.”

The degradation was measured, not impressionistic. For IMDb, NYT and Yelp at 200 topics, and for NYT at 50, the variation of information between the untreated corpus and the Krovetz-stemmed corpus was significantly greater than the untreated corpus's variation with itself. A step most pipelines apply by default, and that no one records in a methods section, moves the solution further than refitting the same corpus does.

FigureProcess · 5 steps
  1. 1. State the exploration goal

    Examples include archive navigation, issue discovery, sampling, or trend hypotheses.

  2. 2. Build lexical and embedding baselines

    Compare simple term clusters, metadata groups, and nearest documents.

  3. 3. Sweep defensible settings

    Vary topic count, preprocessing, seeds, and time periods.

  4. 4. Inspect words and documents together

    Name topics only after reading representative and boundary cases.

  5. 5. Validate actionability and risk

    Test whether the organization helps users without reifying sensitive or misleading categories.

Compare two topic resolutions on the same archive

Fit or simulate solutions with a smaller and a larger number of topics. For each, identify stable themes, splits, merges, boilerplate components, and documents with mixed membership.

Ask a domain expert to complete a document-intrusion task and explain which resolution supports a real decision about navigating or analysing the corpus.

Doogan and Buntine ran that protocol in 2021 and published what happened. They produced 390 topics — 130 per model–dataset combination — with LDA and MetaLDA at K = 10–60 over the Auspol-18 Twitter corpus, itself built from a 123,629-tweet subset of the 1,830,423 tweets carrying the hashtag #Auspol. Four subject-matter experts were asked to label them, yielding 3,120 labels. No coherence measure showed a significant correlation with the number of raters able to label a topic. One LDA topic ranked 9th of 60 on NPMI coherence — “red, wear, flag, blue, gold, black, tape, tie, green, iron” — and could not be labelled at all. The authors put it drily: “Interestingly, the SMEs reported several topics they could not label despite their high coherence scores.” A near-top-ranked topic that four experts cannot name is the whole argument for asking them.

The corpus side of Reading Tea Leaves is worth copying too. One of its corpora was 8447 articles from the New York Times, published between 1987 and 2007, with a vocabulary of 8269 unique types and around one million tokens. The other was a sample of 10000 Wikipedia articles, with 15273 types and three million tokens. Proper nouns were stripped with a part-of-speech tagger for the benefit of the human subjects; without that, “success in early experiments required too much encyclopedic knowledge”. 20 per cent of each corpus was held out for the predictive measures, and the intrusion judgements were collected on Amazon Mechanical Turk. The disagreement between those two families of evidence is the finding. Reproducing it on your own archive is the exercise.

The right topic resolution is the one that survives evidence and serves a declared use—not the one with the prettiest labels.

Key takeaways