Skip to content

ML Models & Algorithms

LDA (Latent Dirichlet Allocation)

In shortA classic probabilistic topic model that treats each document as a mix of topics and each topic as a mix of words; you set the number of topics.

Updated 24 Oct 2026· 2 min read

Latent Dirichlet Allocation (LDA) is an unsupervised probabilistic model for topic modelling, introduced by Blei, Ng and Jordan in 2003. It assumes every document is a mixture of several topics and every topic is a mixture of words, then works backwards from the words alone to estimate both. Because a document can belong to several topics at once, it is a soft (fuzzy) clustering method.

How it works

  • Text is cleaned (lower-cased, stop words removed, frequent bigrams joined) and turned into a bag of words: word order is ignored.
  • You choose the number of topics, K.
  • LDA imagines each document was generated by picking a topic mix, then picking each word from one of those topics. It does not actually generate documents; this story is just the model it fits.
  • Through repeated sampling or optimisation, it estimates which words define each topic and what share of each topic each document contains.
  • You judge the result by reading the top words per topic and by a coherence score, and you re-run with different K and settings.

How it’s used in SEO and marketing

  • Clustering site content into themes to check topical coverage and structure.
  • Finding internal link candidates between pages with similar topic mixes.
  • Comparing your topics with a competitor’s to find gaps.
  • Exploring large sets of reviews, forum threads or survey answers.

Example

MLforSEO’s LDA guide runs the model on a site crawl with Gensim, visualises topics with pyLDAvis, and compares the output with NMF. It also runs the same model on titles only and on full text to show why LDA struggles on short text. For a no-code route, the free jsLDA web app (originally developed at Cornell) lets you upload documents and a stop word list, set the number of topics and export results into a Google Sheets organiser.

Limitations and things to watch

  • You must set the number of topics in advance, and results are sensitive to it.
  • Bag-of-words ignores context and meaning, so synonyms are separate words and polysemy confuses it.
  • Short texts (titles, queries, reviews) give too few word co-occurrences, which is why MLforSEO recommends BERTopic for most short-text SEO work.
  • Pre-processing choices change the topics heavily, and topic words still need human labelling.
  • Do not confuse it with Linear Discriminant Analysis, a supervised method that shares the acronym.

Learn it on MLforSEO

Where LDA (Latent Dirichlet Allocation) shows up on MLforSEO

Sources and further reading

Other terms from ML Models & Algorithms

See all 55 ML Models & Algorithms terms →