What Are Sparse Vectors?
Unlike dense vectors where every dimension has a value, sparse vectors only store non-zero dimensions:Use Cases
Keyword Matching
Exact term matching with learned importance weights from models like SPLADE.
BM25-Style Ranking
Traditional information retrieval with neural network enhancements.
Hybrid Search
Combine with dense vectors for semantic + keyword search.
Multi-lingual Search
Token-based matching works across languages with appropriate tokenization.
Creating Sparse Vectors
Collection Configuration
Define a sparse vector in your collection schema:The
modifier field is optional. Use "idf" to apply inverse document frequency weighting automatically.With Dense Vectors (Hybrid Setup)
Combine sparse and dense vectors:Inserting Sparse Vectors
Basic Format
Python Example
Generating Sparse Vectors
Using SPLADE Models
SPLADE (Sparse Lexical AnD Expansion) models generate learned sparse representations:Using BM25-Style Encoding
For traditional BM25 approach:Searching with Sparse Vectors
Basic Search
With Filters
Scoring Method
Sparse vectors in Qdrant use dot product similarity:Implementation Details
From the Qdrant source code:- Requires both vectors to be sorted by indices
- Performs a single pass through both vectors
- Returns
Noneif there’s no overlap
Storage and Indexing
Qdrant uses an inverted index for sparse vectors:- Each unique dimension index maps to a posting list of points
- Only points with non-zero values in that dimension are stored
- Enables fast retrieval for high-dimensional sparse data
- Memory-efficient for millions of dimensions
Sparse vectors are particularly efficient when the average number of non-zero dimensions per vector is much smaller than the total dimensionality.
Best Practices
Normalize Your Values
Normalize Your Values
Consider normalizing sparse vector values to a consistent range (e.g., 0-1) for stable scoring across different documents.
Sort Indices
Sort Indices
While Qdrant handles sorting internally, pre-sorting indices can improve insertion performance.
Combine with Dense Vectors
Combine with Dense Vectors
Use sparse vectors alongside dense embeddings for hybrid search to get both semantic and keyword-based matching.
Monitor Sparsity
Monitor Sparsity
Track the average number of non-zero dimensions. Very dense “sparse” vectors may not benefit from sparse representation.
Limitations
- Sparse vectors don’t support quantization
- Distance metric is fixed to dot product
- No HNSW indexing (uses inverted index instead)
- Requires both query and document to share dimensions for non-zero scores
Related Topics
- Hybrid Search - Combine sparse and dense vectors
- Filtering - Use payload filters with sparse vector search