Source header: cuvs/neighbors/ivf_sq.hpp
IVF-SQ index build parameters
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
Fields
IVF-SQ list storage spec
Fields
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:
codei=clamp(round((xi−centroidi−vmini)/deltai),0,255)code_i = clamp(round((x_i - centroid_i - vmin_i) / delta_i), 0, 255)
The corresponding reconstructed component is:
xi≈centroidi+vmini+codei⋅deltaix_i \approx centroid_i + vmin_i + code_i \cdot delta_i
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].
Build the index from the dataset for efficient search.
NB: Currently, the following distance metrics are supported:
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>
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
Save the index to file.
Experimental, both the API and the serialization format are subject to change.
Parameters
Returns
void
Load index from file.
Experimental, both the API and the serialization format are subject to change.
Parameters
Returns
void