What is Sparse Retrieval?
Sparse Retrieval is a first-stage search family that represents a query and document with high-dimensional vectors containing relatively few nonzero coordinates, then ranks candidates from overlapping weighted coordinates.
How It Works
Classical and Learned Sparse Signals
Classical sparse retrieval normally uses observed terms, corpus statistics and an inverted index; BM25 is one important member, not the definition of the whole family. Learned sparse models map text into a model vocabulary and learn nonnegative term weights or expansions. The [SPLADE paper](https://arxiv.org/abs/2107.05720) combines explicit sparsity regularization with log-saturated term weights, exposing an effectiveness-efficiency trade-off. Learned expansion can reduce vocabulary mismatch, but the activated terms remain model outputs rather than human-approved synonyms.
Index and Query Execution
An inverted index maps each active coordinate to postings containing document ID, weight and optional field or position data. At query time the engine visits postings for active query coordinates, accumulates weighted contributions and keeps top candidates. WAND-style upper bounds and other pruning methods can reduce work, while field filters and access controls must be applied without leaking unauthorized existence. A vector database's SPARSE_FLOAT_VECTOR field and a text engine's postings may expose similar math but different tokenization, update, filtering and score contracts.
Evaluate Sparsity as a System Trade-off
Measure Recall@K, MRR or nDCG, query p95, index bytes, nonzero coordinates, postings visited, update lag and permission-filter behavior. Slice exact identifiers, paraphrases, multilingual queries, negation and out-of-domain text. [BEIR](https://arxiv.org/abs/2104.08663) shows that lexical, learned sparse, dense, late-interaction and reranking methods trade robustness against computation differently across tasks; no family wins every workload. For learned sparse retrieval, also inspect expansion drift and terms that appear semantically unrelated before trusting explanations.
Key Characteristics
- Represents each item in a large coordinate space with relatively few active values
- Can use corpus-derived lexical weights or weights produced by a learned encoder
- Supports efficient candidate generation through postings lists and dynamic pruning
- Preserves coordinate-level evidence but does not guarantee that learned expansions are intuitive
- Depends on analyzer or tokenizer, vocabulary, model, field, index and pruning revisions
- Requires joint quality, latency, index-size, update and access-control evaluation
Common Use Cases
- Finding exact identifiers, names, legal phrases and domain terminology
- Adding learned vocabulary expansion while retaining inverted-index execution
- Providing a sparse branch for hybrid retrieval with dense candidates
- Building an interpretable first-stage baseline for RAG retrieval experiments
- Serving frequently updated corpora where index and permission behavior must be observable
Example
Loading code...Frequently Asked Questions
Is sparse retrieval the same as keyword search?
Not always. Classical sparse systems usually weight analyzed lexical terms, while learned sparse encoders can activate model-vocabulary terms that were absent from the input. Both representations have few active coordinates, but their evidence and failure modes differ.
Is BM25 a sparse embedding model?
BM25 can be expressed with sparse term coordinates, but most search engines execute it directly over postings and corpus statistics rather than materializing one portable embedding. Calling it a sparse vector must not hide analyzer, field and implementation dependencies.
Does sparse retrieval guarantee exact matches are found?
No. Tokenization, stemming, Unicode normalization, stop-word rules, vocabulary limits, field selection, pruning and permissions can remove or alter the evidence. Test exact-identifier slices and inspect analyzed terms instead of assuming exact recall.
How does learned sparse retrieval differ from dense retrieval?
Learned sparse retrieval scores overlap in a large vocabulary-shaped space and can use postings; dense retrieval compares compact vectors, commonly through nearest-neighbor search. Both are learned signals, and neither is universally more accurate or more interpretable.
What should be versioned for a sparse retrieval index?
Version source corpus, chunk and field schema, analyzer or tokenizer, vocabulary, model and weights, weighting formula, pruning settings, permission filters and index build. A change to any of them can alter candidates even when the query text is unchanged.