Skip to main content
Sparse vectors provide an efficient way to represent and search high-dimensional data where most values are zero. In Qdrant, sparse vectors enable BM25-like ranking and keyword-based search that complements traditional dense vector embeddings.

What Are Sparse Vectors?

Unlike dense vectors where every dimension has a value, sparse vectors only store non-zero dimensions:
This representation is memory-efficient and enables fast dot product computation for vectors with little overlap.

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

Important Requirements:
  • indices must be unique (no duplicates)
  • indices and values arrays must have the same length
  • Indices should be non-negative integers

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

With Filters

Scoring Method

Sparse vectors in Qdrant use dot product similarity:
Only dimensions present in both vectors contribute to the score. If there’s no overlap, the score is zero.

Implementation Details

From the Qdrant source code:
This efficient algorithm:
  1. Requires both vectors to be sorted by indices
  2. Performs a single pass through both vectors
  3. Returns None if 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

Consider normalizing sparse vector values to a consistent range (e.g., 0-1) for stable scoring across different documents.
While Qdrant handles sorting internally, pre-sorting indices can improve insertion performance.
Use sparse vectors alongside dense embeddings for hybrid search to get both semantic and keyword-based matching.
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