Sparse-dense vectors
Overview
Pinecone supports vectors with sparse and dense values, which allows you to perform hybrid search, or semantic and keyword search over your data in one query and combine the results for more relevant results. This topic describes the sparse-dense vector format in Pinecone.
To see sparse-dense embeddings in action, see the Ecommerce hybrid search example.
This feature is in public preview. Test thoroughly before using it in production.
Sparse-dense vector format
Pinecone represents sparse values as a dictionary of two arrays: indices
and values
. The elements of indices
have type uint32
; the elements of values
have type float32
.
Example
The following example defines two records with sparse and dense values.
Pinecone supports sparse vector values of sizes up to 1000 non-zero values and over 4 billion dimensions.
Assuming a dense vector component with 768 dimensions, Pinecone supports roughly 2.8M sparse vectors per s1
pod or 900k per p1
pod.
Upserting records with sparse-dense values
You can upsert these values inside a vector parameter to upsert a sparse-dense record.
Examples
The following example upserts two vectors with sparse and dense values.
Pinecone only supports upserting sparse-dense vectors to p1
and s1
indexes.
Querying records with sparse-dense values
The following example queries an index using a sparse-dense vector.
In order to query an index using sparse values, the index must use the dotproduct metric. Attempting to query any other index with sparse values returns an error.`
To learn about weighting your sparse and dense vectors in queries, see Weighting sparse and dense vectors.
Was this page helpful?