Latent semantic analysis (LSA) is a statistical method that represents words and documents as points in a shared "meaning space," built by analyzing which words appear together in a large collection of text. Two documents can end up close together even when they share few exact words, because the words they do use tend to appear in the same kinds of contexts.
"Latent" means hidden: the method looks for structure that isn't visible in raw word counts. When LSA is used to find documents for a search, it's usually called latent semantic indexing (LSI); the math is the same.
LSA was developed at Bell Communications Research (Bellcore) by Scott Deerwester, Susan Dumais, George Furnas, Thomas Landauer and colleagues. Their US patent was filed in 1988 and granted in 1989, and the method was published in 1990 in the paper "Indexing by latent semantic analysis."
The problem LSA solves
Plain keyword matching has two weaknesses:
- Different words, same meaning. A search for "car" misses a page that only says "automobile."
- Same word, different meanings. "Bank" can be a riverbank or a financial institution.
LSA tackles the first problem well and the second only partly: each word gets one position, a blend of all its senses.
How LSA works
- Count words per passage. Build a large table: one row per word, one column per passage (a paragraph or a document), and in each cell how often that word appears there.
- Weight the counts. Dampen repeated words (typically with a logarithm) and give less weight to words that appear everywhere, using inverse document frequency or an entropy measure. See TF-IDF for the same idea.
- Compress the table. A matrix method called singular value decomposition (SVD) reduces thousands of word dimensions to a few hundred. The authors report that around 300 dimensions is most often best, with roughly 50 to 1,000 working for most language tasks, but there's no formula for the right number Scholarpedia (Landauer and Dumais).
- Compare by angle. Each word and each passage is now a vector. The cosine of the angle between two vectors measures how similar they are, so you can compare word with word, passage with passage, or a search query with documents.
New documents can be added without redoing the whole calculation, a step called folding in.
The compression in step 3 does the interesting work. To fit thousands of words into a few hundred dimensions, words used in similar contexts get pushed close together. That's how LSA learns that two words are related even if they never appear in the same document.
An example: two sentences with no words in common
In the authors' own example, the sentences "Cardiac surgeries are quite safe these days" and "Nowadays, it is not at all risky to operate on the heart" scored a cosine similarity of 0.76, which is very high, even though they share almost no words. That's the kind of match keyword search can't make.
What LSA can't do
- It ignores word order. "Dog bites man" and "man bites dog" get the same vector.
- Each word gets one point. A word's vector is a mix of all its senses, weighted by how often each is used. So "bank" sits somewhere between rivers and money.
- It needs a lot of text. As a rough rule from the authors, fewer than about 20,000 distinct words in fewer than about 20,000 passages is likely to give poor results.
- The dimensions have no labels. A dimension is a mathematical combination of many words, not a tidy topic like "vehicles."
One common tip doesn't apply here: stemming and stop-word removal. LSA's authors say these are rarely used and usually not appropriate, since every word form gets its own vector and contributes to meaning.
Where LSA is used today
LSA has been used for search in smaller document collections, for automated essay scoring, and for comparing texts across languages. It works in many languages because it uses only statistics, not dictionaries.
Newer methods followed it: neural word embeddings such as word2vec, and contextual models such as BERT, which give a word a different vector depending on the sentence around it. LSA remains an easy-to-explain baseline and a workable choice for small projects. For how the idea evolved, see vector space model and vector search.
LSA and SEO
Google doesn't use LSA to rank pages, and the "LSI keywords" sold by some SEO tools have nothing to do with the method. The latent semantic indexing article explains where that idea came from and what to do instead.