Database / Milvus Vector database Interview questions
What is a sparse vector in Milvus?
A sparse vector is a vector representation where the vast majority of dimensions are zero, typically representing something like term frequency across a very large vocabulary (tens of thousands of possible terms), with only the terms actually present in a given piece of text having non-zero values. This contrasts with a dense vector, where every dimension of a much smaller, fixed size typically holds a meaningful non-zero value.
schema.add_field("sparse_embedding", DataType.SPARSE_FLOAT_VECTOR) client.insert(collection_name="documents", data=[ {"id": 1, "sparse_embedding": {102: 0.8, 5091: 0.3, 88342: 0.5}} ])
Milvus natively supports a sparse vector field type and can build specialized indexes over it efficiently, since a sparse representation would be extremely wasteful to store and search as if it were a fully dense vector. Sparse vectors are commonly paired with functions like BM25 (a classic term-weighting scheme from information retrieval) to give a keyword-style relevance signal that complements dense semantic embeddings in a hybrid search setup.
More Related questions...