Sparse Retrieval

intermediate
TechniquesLast updated: 2025-01-15
Also known as: keyword search, lexical search

What is Sparse Retrieval?


Sparse retrieval is a retrieval technique based on keyword or term matching, representing queries and documents as sparse vectors where most values are zero (hence "sparse"). Traditional information retrieval methods like BM25 and TF-IDF are sparse retrieval approaches that identify relevant documents by matching query terms to document terms, with scoring based on term frequency, rarity, and document length normalization. These methods use inverted indexes for efficient lookup.


The term "sparse" refers to the vector representation: in a vocabulary of hundreds of thousands of terms, a typical document contains only hundreds of terms, so its vector representation has mostly zeros with non-zero values only for terms that appear. This sparsity enables efficient storage and lookup using inverted indexes. Sparse retrieval excels at exact keyword matching and handles rare terms, technical terminology, or proper nouns well, as these create strong signals through high term rarity scores.


Despite the rise of dense retrieval methods using embeddings, sparse retrieval remains valuable and is often combined with dense methods in hybrid search systems. Sparse retrieval provides interpretable results (you can see exactly why a document matched), handles out-of-vocabulary terms that embeddings struggle with, and requires less computational resources than embedding-based approaches. Modern RAG systems frequently use hybrid approaches that leverage both sparse retrieval's precision for keyword matching and dense retrieval's semantic understanding.


Related Terms