Skip to main content
A sparse vector query executes search using sparse vector representations, typically generated by learned sparse retrieval models. You must provide precalculated token-weight pairs as your query vectors, where each pair represents a term and its corresponding relevance score.
Currently, LambdaDB does not support built-in natural language processing models for automatic sparse vector generation.

Parameters

Scoring and limits

Sparse retrieval uses linear scoring over shared terms: each matching term contributes the stored document weight multiplied by the query weight, and the contributions are added. Terms present in only one vector contribute nothing. This is separate from BM25 text scoring and dense-vector cosine similarity; sparse weights do not need to sum to one or have unit length. Query vectors must fit the entry-count and weight limits. Keys must use the same token or index representation as the stored vectors; numeric index keys are strings in JSON. LambdaDB does not generate these vectors or translate between vocabularies. The returned retrieval score is not a relevance probability and is not constrained to [0,1]. Hybrid fusion normalizes the retrieval scores, while applied native reranking replaces the final score and retains the sparse or fused value in retrievalScore.

Examples

The examples are query objects. Place them under the request body’s top-level query, alongside size and other search options. Sparse retrieval has no knn.k parameter; see reranking candidate counts when adding native reranking.

Token-based sparse vector query

Index-based sparse vector query

If you prefer to use the index-based format with separate values and index arrays, you can specify index positions as keys in the queryVector object: