IVF SQ
Source header: cuvs/neighbors/ivf_sq.hpp
IVF-SQ index build parameters
kIndexGroupSize
IVF-SQ index build parameters
neighbors::ivf_sq::index_params
IVF-SQ index build parameters.
IVF-SQ currently uses 8-bit scalar quantization, storing one uint8_t code per vector dimension.
Fields
IVF-SQ index search parameters
neighbors::ivf_sq::search_params
IVF-SQ index search parameters
Fields
IVF-SQ list storage spec
neighbors::ivf_sq::list_spec
IVF-SQ list storage spec
Fields
IVF-SQ index
neighbors::ivf_sq::index
IVF-SQ index.
In the IVF-SQ index, a database vector is first assigned to the nearest cluster center using an inverted file (IVF) structure, and then compressed using scalar quantization (SQ).
Scalar quantization independently maps each dimension of the per-cluster residual (the input vector minus its assigned centroid) to a fixed-width integer code. For 8-bit quantization (uint8_t), each residual component is linearly mapped to an integer in [0, 255] using learned per-dimension minimum (sq_vmin) and step-size (sq_delta) values.
For a vector component x_i, centroid component centroid_i, residual minimum vmin_i, and quantization step delta_i, the stored code is:
The corresponding reconstructed component is:
This provides a compact representation (1 byte per dimension) while preserving the relative distances between vectors with high fidelity, offering a good trade-off between index size, search speed, and recall compared to flat (uncompressed) and product-quantized (PQ) representations.
Note: CodeT is the storage type for scalar-quantized residual codes in the inverted lists, not the input dataset type. The public build and search APIs accept float and half input vectors, then store the quantized residual components as CodeT inside the index. Currently, IVF-SQ supports only uint8_t codes, so use CodeT = uint8_t. Each code uses the full 8-bit range [0, 255].
IVF-SQ index build
neighbors::ivf_sq::build
Build the index from the dataset for efficient search.
NB: Currently, the following distance metrics are supported:
- L2Expanded
- L2SqrtExpanded
- InnerProduct
- CosineExpanded
Usage example:
Parameters
Returns
cuvs::neighbors::ivf_sq::index<uint8_t>
Additional overload: neighbors::ivf_sq::build
Build the index from the dataset for efficient search.
Usage example:
Parameters
Returns
cuvs::neighbors::ivf_sq::index<uint8_t>
Additional overload: neighbors::ivf_sq::build
Build the index from the dataset for efficient search.
Usage example:
Parameters
Returns
cuvs::neighbors::ivf_sq::index<uint8_t>
Additional overload: neighbors::ivf_sq::build
Build the index from the dataset for efficient search.
Usage example:
Parameters
Returns
cuvs::neighbors::ivf_sq::index<uint8_t>
IVF-SQ index extend
neighbors::ivf_sq::extend
Extend the index with the new data in-place.
Usage example:
Parameters
Returns
void
Additional overload: neighbors::ivf_sq::extend
Extend the index with the new data in-place.
Usage example:
Parameters
Returns
void
Additional overload: neighbors::ivf_sq::extend
Extend the index with the new data in-place.
Usage example:
Parameters
Returns
void
Additional overload: neighbors::ivf_sq::extend
Extend the index with the new data in-place.
Usage example:
Parameters
Returns
void
IVF-SQ index serialize
neighbors::ivf_sq::serialize
Save the index to file.
Experimental, both the API and the serialization format are subject to change.
Parameters
Returns
void
neighbors::ivf_sq::deserialize
Load index from file.
Experimental, both the API and the serialization format are subject to change.
Parameters
Returns
void