For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
GitHubCUDA-X
    • Home
    • Installation
  • Getting Started
    • Introduction
    • Integrations
    • Use-cases
  • User Guide
    • API Guide
    • Benchmarking Guide
    • Integration Patterns
    • Field Guide
    • References
  • Developer Guide
    • Coding Guidelines
    • Contributing
  • API Reference
    • C API Documentation
      • Cluster Kmeans
      • Core C API
      • Distance Distance
      • Distance Pairwise Distance
      • Neighbors Multi GPU Cagra
      • Neighbors Multi GPU Common
      • Neighbors Multi GPU IVF Flat
      • Neighbors Multi GPU IVF PQ
      • Neighbors All Neighbors
      • Neighbors Brute Force
      • Neighbors Cagra
      • Neighbors Common
      • Neighbors HNSW
      • Neighbors IVF Flat
      • Neighbors IVF PQ
      • Neighbors IVF SQ
      • Neighbors NN Descent
      • Neighbors Refine
      • Neighbors Tiered Index
      • Neighbors Vamana
      • Preprocessing Quantize Binary
      • Preprocessing PCA
      • Preprocessing Quantize PQ
      • Preprocessing Quantize Scalar
    • Cpp API Documentation
    • Python API Documentation
    • Java API Documentation
    • Rust API Documentation
    • Go API Documentation
NVIDIANVIDIA
Developer-friendly docs for your API
Privacy Policy | Manage My Privacy | Do Not Sell or Share My Data | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2026, NVIDIA Corporation.

LogoLogocuVS
GitHubCUDA-X
On this page
  • IVF-SQ index build parameters
  • cuvsIvfSqIndexParams
  • cuvsIvfSqIndexParamsCreate
  • cuvsIvfSqIndexParamsDestroy
  • IVF-SQ index search parameters
  • cuvsIvfSqSearchParams
  • cuvsIvfSqSearchParamsCreate
  • cuvsIvfSqSearchParamsDestroy
  • IVF-SQ index
  • cuvsIvfSqIndex
  • cuvsIvfSqIndexCreate
  • cuvsIvfSqIndexDestroy
  • cuvsIvfSqIndexGetNLists
  • cuvsIvfSqIndexGetDim
  • cuvsIvfSqIndexGetSize
  • cuvsIvfSqIndexGetCenters
  • IVF-SQ index build
  • cuvsIvfSqBuild
  • IVF-SQ index search
  • cuvsIvfSqSearch
  • IVF-SQ C-API serialize functions
  • cuvsIvfSqSerialize
  • cuvsIvfSqDeserialize
  • IVF-SQ index extend
  • cuvsIvfSqExtend
API ReferenceC API Documentation

IVF SQ

||View as Markdown|
Previous

Neighbors IVF PQ

Next

Neighbors NN Descent

Source header: cuvs/neighbors/ivf_sq.h

IVF-SQ index build parameters

cuvsIvfSqIndexParams

Supplemental parameters to build IVF-SQ Index

1struct cuvsIvfSqIndexParams {
2 cuvsDistanceType metric;
3 float metric_arg;
4 bool add_data_on_build;
5 uint32_t n_lists;
6 uint32_t kmeans_n_iters;
7 uint32_t max_train_points_per_cluster;
8 bool conservative_memory_allocation;
9};

Fields

NameTypeDescription
metriccuvsDistanceTypeDistance type.
metric_argfloatThe argument used by some distance metrics.
add_data_on_buildboolWhether to add the dataset content to the index, i.e.:

- true means the index is filled with the dataset vectors and ready to search after calling build.
- false means build only trains the underlying model (e.g. quantizer or clustering), but the index is left empty; you’d need to call extend on the index afterwards to populate it.
n_listsuint32_tThe number of inverted lists (clusters)
kmeans_n_itersuint32_tThe number of iterations searching for kmeans centers (index building).
max_train_points_per_clusteruint32_tThe number of data vectors per cluster to use during iterative kmeans building. The index uses at most n_lists * max_train_points_per_cluster rows for training.
conservative_memory_allocationboolBy default, the algorithm allocates more space than necessary for individual clusters (list_data). This allows to amortize the cost of memory allocation and reduce the number of data copies during repeated calls to extend (extending the database).

The alternative is the conservative allocation behavior; when enabled, the algorithm always allocates the minimum amount of memory required to store the given number of records. Set this flag to true if you prefer to use as little GPU memory for the database as possible.

cuvsIvfSqIndexParamsCreate

Allocate IVF-SQ Index params, and populate with default values

1CUVS_EXPORT cuvsError_t cuvsIvfSqIndexParamsCreate(cuvsIvfSqIndexParams_t* index_params);

Parameters

NameDirectionTypeDescription
index_paramsincuvsIvfSqIndexParams_t*cuvsIvfSqIndexParams_t to allocate

Returns

CUVS_EXPORT cuvsError_t

cuvsIvfSqIndexParamsDestroy

De-allocate IVF-SQ Index params

1CUVS_EXPORT cuvsError_t cuvsIvfSqIndexParamsDestroy(cuvsIvfSqIndexParams_t index_params);

Parameters

NameDirectionTypeDescription
index_paramsincuvsIvfSqIndexParams_t

Returns

CUVS_EXPORT cuvsError_t

IVF-SQ index search parameters

cuvsIvfSqSearchParams

Supplemental parameters to search IVF-SQ index

1struct cuvsIvfSqSearchParams {
2 uint32_t n_probes;
3};

Fields

NameTypeDescription
n_probesuint32_tThe number of clusters to search.

cuvsIvfSqSearchParamsCreate

Allocate IVF-SQ search params, and populate with default values

1CUVS_EXPORT cuvsError_t cuvsIvfSqSearchParamsCreate(cuvsIvfSqSearchParams_t* params);

Parameters

NameDirectionTypeDescription
paramsincuvsIvfSqSearchParams_t*cuvsIvfSqSearchParams_t to allocate

Returns

CUVS_EXPORT cuvsError_t

cuvsIvfSqSearchParamsDestroy

De-allocate IVF-SQ search params

1CUVS_EXPORT cuvsError_t cuvsIvfSqSearchParamsDestroy(cuvsIvfSqSearchParams_t params);

Parameters

NameDirectionTypeDescription
paramsincuvsIvfSqSearchParams_t

Returns

CUVS_EXPORT cuvsError_t

IVF-SQ index

cuvsIvfSqIndex

Struct to hold address of cuvs::neighbors::ivf_sq::index and its active trained dtype

1typedef struct {
2 uintptr_t addr;
3 DLDataType dtype;
4} cuvsIvfSqIndex;

Fields

NameTypeDescription
addruintptr_t
dtypeDLDataType

cuvsIvfSqIndexCreate

Allocate IVF-SQ index

1CUVS_EXPORT cuvsError_t cuvsIvfSqIndexCreate(cuvsIvfSqIndex_t* index);

Parameters

NameDirectionTypeDescription
indexincuvsIvfSqIndex_t*cuvsIvfSqIndex_t to allocate

Returns

CUVS_EXPORT cuvsError_t

cuvsIvfSqIndexDestroy

De-allocate IVF-SQ index

1CUVS_EXPORT cuvsError_t cuvsIvfSqIndexDestroy(cuvsIvfSqIndex_t index);

Parameters

NameDirectionTypeDescription
indexincuvsIvfSqIndex_tcuvsIvfSqIndex_t to de-allocate

Returns

CUVS_EXPORT cuvsError_t

cuvsIvfSqIndexGetNLists

Get the number of clusters/inverted lists

1CUVS_EXPORT cuvsError_t cuvsIvfSqIndexGetNLists(cuvsIvfSqIndex_t index, int64_t* n_lists);

Parameters

NameDirectionTypeDescription
indexcuvsIvfSqIndex_t
n_listsint64_t*

Returns

CUVS_EXPORT cuvsError_t

cuvsIvfSqIndexGetDim

Get the dimensionality of the data

1CUVS_EXPORT cuvsError_t cuvsIvfSqIndexGetDim(cuvsIvfSqIndex_t index, int64_t* dim);

Parameters

NameDirectionTypeDescription
indexcuvsIvfSqIndex_t
dimint64_t*

Returns

CUVS_EXPORT cuvsError_t

cuvsIvfSqIndexGetSize

Get the size of the index

1CUVS_EXPORT cuvsError_t cuvsIvfSqIndexGetSize(cuvsIvfSqIndex_t index, int64_t* size);

Parameters

NameDirectionTypeDescription
indexcuvsIvfSqIndex_t
sizeint64_t*

Returns

CUVS_EXPORT cuvsError_t

cuvsIvfSqIndexGetCenters

Get the cluster centers corresponding to the lists [n_lists, dim]

1CUVS_EXPORT cuvsError_t cuvsIvfSqIndexGetCenters(cuvsIvfSqIndex_t index, DLManagedTensor* centers);

Parameters

NameDirectionTypeDescription
indexincuvsIvfSqIndex_tcuvsIvfSqIndex_t Built Ivf-SQ Index
centersoutDLManagedTensor*Preallocated array on host or device memory to store output, [n_lists, dim]

Returns

CUVS_EXPORT cuvsError_t

IVF-SQ index build

cuvsIvfSqBuild

Build an IVF-SQ index with a DLManagedTensor which has underlying DLDeviceType equal to kDLCUDA, kDLCUDAHost, kDLCUDAManaged, or kDLCPU. Also, acceptable underlying types are: 1. kDLDataType.code == kDLFloat and kDLDataType.bits = 32 2. kDLDataType.code == kDLFloat and kDLDataType.bits = 16

1CUVS_EXPORT cuvsError_t cuvsIvfSqBuild(cuvsResources_t res,
2cuvsIvfSqIndexParams_t index_params,
3DLManagedTensor* dataset,
4cuvsIvfSqIndex_t index);

Parameters

NameDirectionTypeDescription
resincuvsResources_tcuvsResources_t opaque C handle
index_paramsincuvsIvfSqIndexParams_tcuvsIvfSqIndexParams_t used to build IVF-SQ index
datasetinDLManagedTensor*DLManagedTensor* training dataset
indexoutcuvsIvfSqIndex_tcuvsIvfSqIndex_t Newly built IVF-SQ index

Returns

CUVS_EXPORT cuvsError_t

IVF-SQ index search

cuvsIvfSqSearch

Search an IVF-SQ index with a DLManagedTensor which has underlying DLDeviceType equal to kDLCUDA, kDLCUDAHost, kDLCUDAManaged. Types for input are: 1. queries: kDLDataType.code == kDLFloat and kDLDataType.bits = 32 or 16 2. neighbors: kDLDataType.code == kDLInt and kDLDataType.bits = 64 3. distances: kDLDataType.code == kDLFloat and kDLDataType.bits = 32

1CUVS_EXPORT cuvsError_t cuvsIvfSqSearch(cuvsResources_t res,
2cuvsIvfSqSearchParams_t search_params,
3cuvsIvfSqIndex_t index,
4DLManagedTensor* queries,
5DLManagedTensor* neighbors,
6DLManagedTensor* distances,
7cuvsFilter filter);

Parameters

NameDirectionTypeDescription
resincuvsResources_tcuvsResources_t opaque C handle
search_paramsincuvsIvfSqSearchParams_tcuvsIvfSqSearchParams_t used to search IVF-SQ index
indexincuvsIvfSqIndex_tivfSqIndex which has been returned by cuvsIvfSqBuild
queriesinDLManagedTensor*DLManagedTensor* queries dataset to search
neighborsoutDLManagedTensor*DLManagedTensor* output k neighbors for queries
distancesoutDLManagedTensor*DLManagedTensor* output k distances for queries
filterincuvsFiltercuvsFilter input filter that can be used to filter queries and neighbors based on the given bitset.

Returns

CUVS_EXPORT cuvsError_t

IVF-SQ C-API serialize functions

cuvsIvfSqSerialize

Save the index to file.

1CUVS_EXPORT cuvsError_t cuvsIvfSqSerialize(cuvsResources_t res, const char* filename, cuvsIvfSqIndex_t index);

Experimental, both the API and the serialization format are subject to change.

Parameters

NameDirectionTypeDescription
resincuvsResources_tcuvsResources_t opaque C handle
filenameinconst char*the file name for saving the index
indexincuvsIvfSqIndex_tIVF-SQ index

Returns

CUVS_EXPORT cuvsError_t

cuvsIvfSqDeserialize

Load index from file.

1CUVS_EXPORT cuvsError_t cuvsIvfSqDeserialize(cuvsResources_t res,
2const char* filename,
3cuvsIvfSqIndex_t index);

Experimental, both the API and the serialization format are subject to change.

Parameters

NameDirectionTypeDescription
resincuvsResources_tcuvsResources_t opaque C handle
filenameinconst char*the name of the file that stores the index
indexoutcuvsIvfSqIndex_tIVF-SQ index loaded from disk

Returns

CUVS_EXPORT cuvsError_t

IVF-SQ index extend

cuvsIvfSqExtend

Extend the index with the new data.

1CUVS_EXPORT cuvsError_t cuvsIvfSqExtend(cuvsResources_t res,
2DLManagedTensor* new_vectors,
3DLManagedTensor* new_indices,
4cuvsIvfSqIndex_t index);

Parameters

NameDirectionTypeDescription
resincuvsResources_tcuvsResources_t opaque C handle
new_vectorsinDLManagedTensor*DLManagedTensor* the new vectors to add to the index
new_indicesinDLManagedTensor*DLManagedTensor* vector of new indices for the new vectors. If the index is empty, this can be NULL to imply a continuous range [0...n_rows).
indexinoutcuvsIvfSqIndex_tIVF-SQ index to be extended

Returns

CUVS_EXPORT cuvsError_t