How it works
Sparse search creates term-focused embeddings where non-zero dimensions correspond to important keywords, enabling precise lexical matching.Search process
- Sparse embedding - Convert query text to sparse vector using SPLADE or BM25
- Keyword matching - Match based on term importance and frequency
- Result ranking - Rank documents by sparse similarity scores
- Optional RAG - Generate answer using retrieved documents
SPLADE vs BM25
SPLADE (Sparse Lexical and Expansion)- Neural sparse encoder with learned term importance
- Expands query with related terms
- Better generalization than traditional BM25
- Requires model inference
- Classic TF-IDF based ranking function
- Fast, no model required
- Purely statistical term weighting
- Native support in Weaviate
Key features
- Supports SPLADE-based or BM25-style sparse encoders
- Weaviate uses native BM25 without external embeddings
- Works alongside dense search or as standalone retrieval method
- Excels at exact terminology and keyword precision
Implementation
Configuration
Required settings
Pinecone API authentication key
Target index name for sparse search
Optional settings
Namespace within the index
Dimension for placeholder dense vector (sparse search only)
Sparse encoder model (e.g., SPLADE)
Example configuration
Search parameters
Search query text to encode with sparse embedder
Number of results to return
Optional metadata filters for pre-filtering
When to use sparse search
Sparse search is ideal when: Exact terminology matters- Legal documents with specific clauses
- Medical records with precise diagnoses
- Technical documentation with exact API names
- Product catalogs with SKUs or model numbers
- Document IDs or reference numbers
- Proper nouns and acronyms
- Version numbers or dates
- Industry-specific jargon
Example scenarios
Sparse vector representation
Sparse embeddings are dictionaries mapping token indices to weights:Database-specific implementations
Pinecone
Usessparse_values field alongside placeholder dense vectors. Requires explicit sparse embedding generation.
Weaviate
Native BM25 support without external sparse embeddings. Uses built-in keyword search:Qdrant
Supports sparse vectors with payload-based filtering and optimized indexing.Milvus
Sparse vector fields with partition-key isolation for multi-tenant scenarios.Chroma
Flexible sparse search with document and collection scoping.Combining with dense search
See Hybrid search for fusion strategies.Performance considerations
- Sparse search is typically faster than dense search (fewer dimensions to compare)
- BM25 requires no model inference, just term statistics
- SPLADE models add inference latency but provide better generalization
- Memory footprint is low due to sparse representation
Evaluation metrics
Sparse search performance metrics:- Precision@k - Fraction of retrieved docs that are relevant
- Recall@k - Fraction of relevant docs that are retrieved
- MRR - Mean reciprocal rank of first relevant result
- NDCG@k - Normalized discounted cumulative gain
Related features
Hybrid search
Combine dense and sparse retrieval
Semantic search
Dense vector similarity search
Reranking
Improve results with cross-encoders
Metadata filtering
Structured filtering on document fields