Database / Qdrant Vector DB Interview questions
What are sparse vectors in Qdrant?
Sparse vectors represent data using mostly-zero, high-dimensional vectors where only a small subset of dimensions have non-zero values — the format typically produced by keyword-based or learned lexical models like BM25 or SPLADE — stored efficiently as just the non-zero indices and their values rather than a full dense array.
client.create_collection( collection_name="documents", vectors_config={"dense": models.VectorParams(size=384, distance=models.Distance.COSINE)}, sparse_vectors_config={"sparse": models.SparseVectorParams()}, ) client.upsert( collection_name="documents", points=[models.PointStruct( id=1, vector={ "dense": [0.1, 0.2, 0.3], "sparse": models.SparseVector(indices=[3, 41, 812], values=[0.5, 1.2, 0.8]), }, )], )
Unlike dense embeddings (which capture semantic meaning), sparse vectors are typically much closer to traditional keyword matching — each non-zero dimension often corresponds to a specific term or token, and its value reflects that term's relevance, similar in spirit to a TF-IDF or BM25 score, giving sparse search the precise, exact-term matching strengths that pure semantic dense search can sometimes miss.
Storing sparse vectors alongside dense ones in the same collection (via separate named vector configs, as shown above) is exactly what enables hybrid search: a single collection can be queried using dense similarity, sparse keyword matching, or a fused combination of both, depending on what a given query needs.
More Related questions...