Overview
TheIVFQueryParam class controls query-time parameters for IVF (Inverted File Index) searches. It allows you to control how many clusters (inverted lists) are searched, trading off between speed and accuracy.
Constructor
Parameters
Number of closest clusters (inverted lists) to search. Higher values improve recall (accuracy) but increase search latency. This is the primary tuning parameter for IVF query performance.Typical range: 1-50. Higher values approach the accuracy of exhaustive search.
Search radius for range queries. When set to a value greater than 0, only results within this distance threshold will be returned. Default is 0.0 (disabled).
Force linear (brute-force) search instead of using the IVF index. Useful for debugging or verifying index accuracy.
Properties
nprobe
Number of inverted lists to search during IVF query. Type:int
Examples
Basic IVF query
High accuracy search
Fast search with lower accuracy
Range query
Force linear search
Performance Tuning
Rule of thumb: Set
nprobe to approximately 5-10% of your n_list value for a good balance between speed and accuracy.How IVF Search Works
IVF indexes partition the vector space into clusters during index construction:- The query vector is compared against cluster centroids
- The
nprobeclosest clusters are selected - Only vectors in those clusters are searched
- This reduces the search space and improves performance
See Also
- IVFIndexParam - Index construction parameters for IVF
- VectorQuery - Vector query class that uses these parameters