Definition
Sparse retrieval ranks items for a query using a large feature space. For text, the features usually correspond to terms or tokens in a vocabulary, and each query or item activates only a small subset.
Classic methods such as TF-IDF and BM25 use term statistics to weight matches. Learned sparse models use trained parameters to assign weights to terms or tokens and may activate expansion tokens absent from the original text. Both approaches can use shared dimensions to find candidates, though their scoring rules differ.
Simple example
A support assistant searches deployment notes for MaxRetryCount. Suppose its sparse query gives that identifier a high weight. A passage containing the setting can rank above a general article about retry policies, even if the general article is on the same broad topic.
Why it matters
Error codes, API names, and configuration keys often decide which passage an engineer needs. Sparse retrieval can give these terms weight when selecting context for a RAG system. An inverted index can then find candidates through the query’s nonzero dimensions without scanning every item.
If the search system exposes scoring details, you can inspect which dimensions matched and how they contributed to a passage’s score.
One important nuance
Sparse retrieval does not always require a literal query term in the passage. A learned model may assign both texts an expansion token they share. It still needs overlap in the resulting representations. If there is none, that sparse retriever cannot find the passage through this scoring step. Test real queries with synonyms and unusual identifiers. The model’s vocabulary and the system’s tokenization affect what can match.