Topic Models Beyond LDA

Where topic modeling went after LDA. Topic models as smoothing for retrieval, models with correlated, evolving, supervised, and author-specific topics, nonparametric models that infer the number of topics, nonnegative matrix factorization compared with LDA on Reuters, and neural, embedding-based, and language-model-based approaches.

After LDA, topic modeling went three ways: extensions that change one piece of LDA's generative story (correlated, dynamic, supervised, author and structural topic models, and the hierarchical Dirichlet process, which infers the number of topics), matrix factorization, and neural and language-model methods. In retrieval, LDA topics helped as smoothing beside exact word matching: Wei and Croft (2006) report mean average precision 8 to 22 percent above query likelihood on five TREC collections, while the topic estimate alone hurt. Nonnegative matrix factorization with the KL divergence reproduces pLSA's best fit on the six-document example (log-likelihood −10.549). On Reuters with 20 topics and squared error, NMF scored mean NPMI coherence 0.288 against LDA's 0.251, while leaving subjects out.

This topic began with a search for boat among the six documents. Word matching finds $d_2$ (boat ocean) and misses $d_3$, which says only ship. LSI reached $d_3$ from the query boat ocean, and pLSA and LDA gave every document a mixture of topics. This article follows topic modeling after LDA. It also reports the published evidence that topic models made retrieval better: as smoothing beside exact word matching, they did, by measurable amounts.

Latent Dirichlet allocation became less a single model than a template. Its generative story can be changed piece by piece: add time, add authors, add labels, relax the assumption that topics are unrelated, or let the data choose how many topics there are. Each change gives a new model with its own inference procedure. Separately, methods from outside the Bayesian tradition came to compete with LDA at its main job: matrix factorization, and later neural networks and pretrained language models.

First we return to retrieval and work LDA-based smoothing on the six documents. Then we survey extensions of LDA, and nonnegative matrix factorization on the six documents and on Reuters. Finally we turn to neural approaches and look back over the course.

Topic models in retrieval

LSI was proposed as a retrieval model, and on Cranfield it beat BM25. LDA was applied to retrieval differently, as a way of smoothing a document's language model. In the query likelihood approach, a document is ranked by the probability that a model of its words would generate the query. That model must give some probability to words the document does not contain. Wei and Croft (2006) mixed the usual estimate, the document's word frequencies smoothed with the collection's, with a topic-based estimate:

$$P(w \mid d) = \lambda\, P_{\text{doc}}(w \mid d) + (1 - \lambda) \sum_{k} P(w \mid z = k)\, P(z = k \mid d).$$

The second term lets a document about oil exploration give some probability to drilling even if it never uses the word, because its topics do.

In their paper (eq. 7) the first term is the Dirichlet-smoothed estimate of language models for retrieval. With $N_d$ the length of the document, $P_{\text{ML}}$ a maximum-likelihood estimate (a relative frequency) and $\mu$ the smoothing parameter,

$$P_{\text{doc}}(w \mid d) = \frac{N_d}{N_d + \mu}\, P_{\text{ML}}(w \mid d) + \left( 1 - \frac{N_d}{N_d + \mu} \right) P_{\text{ML}}(w \mid \text{collection}).$$

They used $\lambda = 0.7$ and $\mu = 1000$. The topics and mixtures in the second term were posterior estimates from collapsed Gibbs sampling, with $\alpha = 50/K$ and $\beta = 0.01$, and $K = 800$ topics chosen on one of their collections.

The six documents show the effect in miniature. Take the one-word query boat and the two topics of pLSA's best fit:

  • sea: ship 0.4, boat 0.2, ocean 0.4;
  • travel: voyage 0.6, trip 0.4.

Set $\lambda = 0.7$, the paper's value. To keep the arithmetic short, use an unsmoothed document estimate, which is the first term with $\mu = 0$.

Example (two documents without the query word). Neither $d_3$ (ship) nor $d_1$ (ship ocean voyage) contains boat, and the mixture scores $d_3$ higher. It is entirely about the sea, while $d_1$ is one-third travel, and only the sea topic gives boat any probability:

Document $P_{\text{doc}}(\text{boat} \mid d)$ $\sum_k P(\text{boat} \mid k) P(k \mid d)$ Mixture
$d_2$ = boat ocean 0.500 0.200 0.410
$d_3$ = ship 0 0.200 0.060
$d_1$ = ship ocean voyage 0 0.133 0.040
$d_4$, $d_5$, $d_6$ (travel) 0 0 0

The document containing boat still ranks first, by far, because the exact-match term carries most of the weight. Behind it, the topic term separates the documents that lack the word, and the travel documents get nothing. With word matching alone, those five documents would tie at zero. The values are from beyond_toy.py in tools/experiments/topics/.

Wei and Croft reported improvements over query likelihood alone on all five TREC collections they tested. Their mean average precision, from their Tables 4 and 5:

Collection Query likelihood With LDA smoothing Relevance model
AP 0.2179 0.2651 0.2745
FT 0.2589 0.2807 0.2835
SJMN 0.2032 0.2307 0.2633
LA 0.2468 0.2666 0.2614
WSJ 0.2958 0.3253 0.3422

Computed from these values (two of the paper's printed percentages, +7.54 for FT in Table 4 and +0.20 for LA in Table 5, disagree with its own MAP values, which give +8.4 and +2.0), the gain over query likelihood runs from 8 percent (LA) to 22 percent (AP, the collection on which the parameters were tuned). The last column is the relevance model, the probabilistic form of pseudo-relevance feedback. LDA smoothing came within 5 percent of it on three collections, was 12 percent below it on SJMN, and was 2 percent above it on LA. Unlike feedback, it needs no extra retrieval at query time. These are the paper's results. This site has not run LDA smoothing on a test collection; its own retrieval experiment in this topic is the LSI experiment on Cranfield.

The cost is fitting a topic model to the whole collection. And the topic term must be combined with exact matching, not substituted for it: the authors report that using the LDA estimate alone hurt retrieval. Topic models have since been used more for exploring collections than for ranking. Matching beyond shared words passed to dense neural representations, which encode queries and documents as vectors and retrieve by nearest neighbors (Karpukhin and colleagues, 2020; dense passage retrieval describes their system); the history of information retrieval places them. A second line kept the inverted index and learned to add the missing words instead: learned sparse retrieval indexes a text under terms it does not contain, with weights set by a trained model.

Most of the work after LDA went into the model itself.

Extensions of LDA

Each of these models changes one piece of LDA's generative story:

  • Correlated topic models (Blei and Lafferty, 2007). LDA's Dirichlet prior cannot express that some topics tend to appear together, such as genetics and disease. Replacing it with a logistic normal distribution, which has a covariance matrix, lets the model learn which topics co-occur.
  • Dynamic topic models (Blei and Lafferty, 2006). A topic's vocabulary changes over time. The dynamic model lets each topic's word distribution drift from one time period to the next. A physics topic can then be traced through a century of a journal's articles as its characteristic words change.
  • Supervised LDA (Blei and McAuliffe, 2007). Each document has a response, such as a rating, and the topics are fitted to predict it as well as to explain the words. Labeled LDA (Ramage, Hall, Nallapati, and Manning, 2009) instead ties topics to the tags people have given documents.
  • Author-topic models (Rosen-Zvi, Griffiths, Steyvers, and Smyth, 2004). Topics are attached to authors, and a document's words come from the topics of its authors. The model can then describe what each author writes about.
  • Structural topic models (Roberts and colleagues, 2014). Document metadata, such as the date, the source, or a survey respondent's party, can shift both topic prevalence and topic vocabulary. Structural topic models are widely used in political science.

Choosing the number of topics automatically

Every model above needs $K$ in advance. The hierarchical Dirichlet process (Teh, Jordan, Beal, and Blei, 2006) allows an unbounded number of topics and infers how many the data support. Its prior uses only finitely many topics in any finite collection. The approach is called nonparametric, though it has concentration parameters of its own that influence how many topics it finds. As evaluating topic models explains, the right number of topics depends on the purpose as well as the data. Automatic selection removes a choice without removing the need to judge the result.

All of these models keep LDA's probabilistic machinery. A different line drops it and goes back to factoring a matrix, as LSI did.

Nonnegative matrix factorization

Nonnegative matrix factorization (NMF) factors the document-term matrix $X$, of size documents by terms, into two nonnegative matrices, $X \approx WH$ (Lee and Seung, 1999). Each row of $H$ is a topic's weights over terms, and each row of $W$ is a document's weights over topics. Like LSI, it is a low-rank approximation. Unlike LSI, it allows no negative values. A document can only be built up by adding topics, never by subtracting them, so the factors read as parts. With the Kullback–Leibler divergence as its measure of error, NMF is closely related to pLSA: Gaussier and Goutte (2005) showed that a pLSA solution is, after normalization, a solution of that NMF problem.

NMF on the six-document example

We factor the example's $5 \times 6$ term-document count matrix (here terms by documents, so the term factor comes first) with two components. The result shows both the parts-based reading and the role of the error measure.

Example (what KL-divergence NMF must find). Given Gaussier and Goutte's result, NMF with the generalized KL divergence should find, if it reaches the best optimum, the best pLSA solution, up to scaling. The two problems share their solutions, but both are fitted by local search, so a given run of either can stop at a different local optimum. With multiplicative updates and the best of 20 random starts, the term factor is

ship boat ocean voyage trip
Component 1 0.742 0.371 0.742 0 0
Component 2 0 0 0 1.537 1.025

and the document factor gives $d_1$ weights 1.078 and 0.390, $d_2$ 1.078 and 0, and $d_3$ 0.539 and 0. The travel documents weight only on component 2. Every entry is nonnegative, and the components are the sea and travel word groups.

The computation confirms it. Dividing each component's term weights by their sum (0.742 + 0.371 + 0.742 = 1.855 for the first, 1.537 + 1.025 = 2.562 for the second) turns them into $P(w \mid z)$ = (0.4, 0.2, 0.4) and (0.6, 0.4). Multiplying the document weights by the same sums gives expected counts. $d_1$'s are $1.078 \times 1.855 = 2.0$ and $0.390 \times 2.562 = 1.0$, so its mixture is (0.667, 0.333). That is exactly the best pLSA solution, with the same log-likelihood, −10.549, as Gaussier and Goutte (2005) predict.

With squared error instead, the solution changes. The first component becomes ship 0.63, boat 0.28, ocean 0.73, and voyage 0.36 (raw weights; the scale of a component is arbitrary), absorbing part of voyage to fit $d_1$ better.

Example (the price of nonnegativity). LSI's rank-2 approximation of the same matrix has Frobenius error 1.668, and no nonnegative rank-2 factorization can do better. By the Eckart–Young theorem, proved in latent semantic indexing, no matrix of rank at most 2 can beat LSI's, and NMF's product is such a matrix. Its error is 1.736, the best of 20 random starts, close to but above 1.668. So requiring every entry to be nonnegative costs at most 0.068 here; local search does not prove that no nonnegative factorization does better.

NMF on Reuters

NMF is fast, deterministic with a fixed initialization, and often gives readable topics. It was run on the same Reuters training stories as the LDA experiment, with 20 topics, applied to TF-IDF weights with scikit-learn's default squared-error objective rather than the KL divergence. It reached a mean NPMI coherence of 0.288, against 0.251 for LDA. Its least coherent topic scored 0.020, against LDA's −0.329.

The more coherent model is not thereby the better one. The comparison has a catch that coherence does not show. About half of NMF's twenty topics described the formats of earnings reports: dividend notices, tables of revenue and share counts, notes on discontinued operations, half-year figures, and so on. Several are highly coherent, because those notices use fixed phrases; the dividend topic scored 0.476. NMF had one topic for acquisitions where LDA had three, and none for coffee and cocoa, which LDA found. Coherence scores each topic alone. It can reward narrow, formulaic topics, and it does not penalize a model for leaving subjects out. Judging a model also requires asking what it covers.

The last line of work replaces counting words with what neural networks have learned about them.

Neural and embedding-based topic models

  • Neural variational topic models. ProdLDA (Srivastava and Sutton, 2017) fits an LDA-like model with a neural network that maps a document to its topic proportions, trained by variational autoencoding, which maximizes an evidence lower bound as variational inference for LDA does. Inference for a new document is a single pass through the network. The embedded topic model (Dieng, Ruiz, and Blei, 2020) represents words and topics as vectors in the same space. Its topics can then use words' meanings, learned from word embeddings such as skip-gram's, as well as their co-occurrence in the collection.
  • Clustering document embeddings. BERTopic (Grootendorst, 2022) takes a different route. It encodes each document with a pretrained sentence-embedding model, reduces the dimensionality, and clusters the documents. It then describes each cluster by the words that distinguish it, using a class-based version of TF-IDF. Because the embeddings come from models trained on enormous amounts of text, documents can be grouped by meaning even when they share few words. Each document is assigned to one cluster or left out as an outlier. That is closer to clustering than to a mixture model, though topic distributions can be approximated afterward.
  • Language models as topic modelers. Large language models can read documents, propose topics in plain language, and assign documents to them. TopicGPT (Pham, Hoyle, Sun, Resnik, and Iyyer, 2024) prompts a language model to generate and refine a list of topics with descriptions, then to label each document. The topics are readable sentences rather than word lists. The costs are running a large model over every document, and results that depend on the prompt.

Embedding-based methods are often preferred for short or informal text, where word co-occurrence is sparse. As Hoyle and colleagues (2021) caution, though, claims of better topics need checking with people. LDA remains widely used where its properties matter: a clear probabilistic model, mixed membership, and results that can be reproduced and explained.

The NMF comparison is reuters_nmf.py, and the small examples are beyond_toy.py, in tools/experiments/topics/ in the site repository.

Worked problems

The course had no assignment for this topic, and the course text has no exercises on these models. The three problems below are posed on the six documents, and every number in them is checked by beyond_toy.py. The survey sections of this article have nothing to compute and have no problems.

Problem 1 (a two-word query under topic smoothing). With the two pLSA topics, $\lambda = 0.7$ and the unsmoothed document estimate of the example above, score the six documents for the query boat voyage. A query's likelihood is the product of its words' probabilities.

Only $d_1$ gets a score above zero, $0.0117$. From the table above, $P(\text{boat} \mid d)$ is 0.040 for $d_1$, 0.410 for $d_2$, 0.060 for $d_3$ and 0 for the travel documents. For voyage, the document term is the word's share of the document and the topic term is $0.6$ times the document's travel proportion:

Document $P_{\text{doc}}(\text{voyage} \mid d)$ Topic estimate Mixture $P(\text{boat} \mid d) \times P(\text{voyage} \mid d)$
$d_1$ = ship ocean voyage 0.333 $\tfrac{1}{3} \times 0.6 = 0.200$ 0.293 $0.040 \times 0.293 = 0.0117$
$d_2$ = boat ocean 0 0 0 0
$d_3$ = ship 0 0 0 0
$d_4$ = voyage trip 0.500 0.600 0.530 0
$d_5$ = voyage 1.000 0.600 0.880 0
$d_6$ = trip 0 0.600 0.180 0

For $d_1$ the mixture is $0.7 \times 0.333 + 0.3 \times 0.200 = 0.293$. The sea documents give voyage no probability and the travel documents give boat none, so five products are zero. $d_1$ is the one document whose mixture covers both topics, and the one document the query can reach. The zeros also show why the paper's first term is smoothed with the collection: with $\mu > 0$ every word has some probability in every document, and the other five documents would be ranked instead of tied at zero.

Problem 2 (reading the NMF factors as expected counts). From the KL-divergence factors printed above, compute the entries of the product $WH$ in $d_1$'s column, and compare them with pLSA's fitted model.

The column is $(0.8, 0.4, 0.8, 0.6, 0.4)$ over ship, boat, ocean, voyage, trip, which is the document's length, 3, times pLSA's $P(w \mid d_1)$. Each entry is a term weight times $d_1$'s document weights, 1.078 for component 1 and 0.390 for component 2:

  • ship and ocean: $0.742 \times 1.078 = 0.800$;
  • boat: $0.371 \times 1.078 = 0.400$;
  • voyage: $1.537 \times 0.390 = 0.599$, which is 0.6 before the factors were rounded;
  • trip: $1.025 \times 0.390 = 0.400$.

pLSA's model gives $d_1$ the word distribution $\tfrac{2}{3}(0.4, 0.2, 0.4, 0, 0) + \tfrac{1}{3}(0, 0, 0, 0.6, 0.4) = (0.267, 0.133, 0.267, 0.2, 0.133)$, and three times that is the column above. The entries sum to 3, the number of words in $d_1$. So the product $WH$ is a table of expected counts: it predicts 0.4 occurrences of boat in $d_1$, which has none, and 0.8 of ship, which has one. In this solution every row and column of $WH$ has the same total as the corresponding row or column of the counts.

Problem 3 (when nonnegativity costs nothing). With two components, the best nonnegative factorization found had Frobenius error 1.736, against 1.668 for the SVD. Find the cost of nonnegativity with one component.

It is zero: the best nonnegative rank-1 approximation is the first layer of the SVD, with Frobenius error 2.307. By the LSI article, the first singular vectors $u_1$ and $v_1$ of this matrix have only positive entries. So the first layer $\sigma_1 u_1 v_1^{\mathsf{T}}$ is itself a product of two nonnegative factors, $\sigma_1 u_1$ and $v_1^{\mathsf{T}}$, with smallest entry 0.034. By the Eckart–Young theorem no matrix of rank 1 has a smaller error than its 2.307, so no nonnegative factorization with one component does either, and this one attains it. Multiplicative updates with one component ended at the same error, 2.3073, from five random starts.

With two components the situation differs. $C_2$, the rank-2 matrix that attains the Eckart–Young bound, has negative entries, such as $-0.39$ for trip in $d_2$, so it is not a product of nonnegative factors. That alone does not show a positive cost, because this article does not prove that $C_2$ is the only rank-2 matrix with error 1.668. What the experiment shows is that the best nonnegative factorization found, at 1.736, is 0.068 worse, so the cost is at most 0.068. Whether it is exactly that, or smaller, the local search does not settle.

What we have learned

After LDA, extensions changed one piece of its story at a time, while NMF and neural methods dropped the story altogether. NMF with the KL divergence reproduced pLSA's best fit on the six documents, and on Reuters it scored higher coherence than LDA while leaving subjects out. In retrieval, topic models helped as smoothing beside exact word matching, by 8 to 22 percent of mean average precision in Wei and Croft's experiments, a role dense neural representations have since taken over.

This is the last article of the course. The course began, in what information retrieval is, with six Arctic documents, one of which served the searcher but shared no word with the query. Boolean retrieval matched words exactly, and the vector space and probabilistic models weighted them. Topic models were the course's most direct attack on that gap: a query for boat can now reach a document that says only ship. Yet exact matching still carried most of the weight. The gap between the words a document contains and whether it serves the person asking remains the subject of the field.

References

  • Blei, D. M., and Lafferty, J. D. (2006). Dynamic topic models. In Proceedings of ICML 2006, 113–120. record
  • Blei, D. M., and Lafferty, J. D. (2007). A correlated topic model of Science. The Annals of Applied Statistics, 1(1), 17–35. record
  • Blei, D. M., and McAuliffe, J. D. (2007). Supervised topic models. In Advances in Neural Information Processing Systems 20 (NIPS 2007), 121–128. record
  • Dieng, A. B., Ruiz, F. J. R., and Blei, D. M. (2020). Topic modeling in embedding spaces. Transactions of the Association for Computational Linguistics, 8, 439–453. record
  • Gaussier, E., and Goutte, C. (2005). Relation between PLSA and NMF and implications. In Proceedings of SIGIR 2005, 601–602. https://doi.org/10.1145/1076034.1076148 record · 2 pages
  • Grootendorst, M. (2022). BERTopic: Neural topic modeling with a class-based TF-IDF procedure. arXiv:2203.05794. record
  • Hoyle, A., Goel, P., Hian-Cheong, A., Peskov, D., Boyd-Graber, J., and Resnik, P. (2021). Is automated topic model evaluation broken? The incoherence of coherence. In Advances in Neural Information Processing Systems 34 (NeurIPS 2021), 2018–2033. record · 2 pages
  • Karpukhin, V., Oğuz, B., Min, S., Lewis, P., Wu, L., Edunov, S., Chen, D., and Yih, W. (2020). Dense passage retrieval for open-domain question answering. In Proceedings of EMNLP 2020, 6769–6781. record · 15 pages
  • Lee, D. D., and Seung, H. S. (1999). Learning the parts of objects by non-negative matrix factorization. Nature, 401, 788–791. record
  • Pham, C. M., Hoyle, A., Sun, S., Resnik, P., and Iyyer, M. (2024). TopicGPT: A prompt-based topic modeling framework. In Proceedings of NAACL 2024, 2956–2984. record
  • Ramage, D., Hall, D., Nallapati, R., and Manning, C. D. (2009). Labeled LDA: A supervised topic model for credit attribution in multi-labeled corpora. In Proceedings of EMNLP 2009, 248–256. record
  • Roberts, M. E., Stewart, B. M., Tingley, D., Lucas, C., Leder-Luis, J., Gadarian, S. K., Albertson, B., and Rand, D. G. (2014). Structural topic models for open-ended survey responses. American Journal of Political Science, 58(4), 1064–1082. record
  • Rosen-Zvi, M., Griffiths, T., Steyvers, M., and Smyth, P. (2004). The author-topic model for authors and documents. In Proceedings of UAI 2004, 487–494. record · 2 pages
  • Srivastava, A., and Sutton, C. (2017). Autoencoding variational inference for topic models. In Proceedings of ICLR 2017. record
  • Teh, Y. W., Jordan, M. I., Beal, M. J., and Blei, D. M. (2006). Hierarchical Dirichlet processes. Journal of the American Statistical Association, 101(476), 1566–1581. record
  • Wei, X., and Croft, W. B. (2006). LDA-based document models for ad-hoc retrieval. In Proceedings of SIGIR 2006, 178–185. record · 2 pages

Reviewed: verified, 16 Nov 2026 · checked against sources, 23 Nov 2026 · citations checked, 16 Nov 2026 · editorial review, 23 Nov 2026 · 13 revisions