Neighbors Ivf Pq Module

View as Markdown

Rust module: cuvs::neighbors::ivf_pq

Source: rust/cuvs/src/neighbors/ivf_pq/mod.rs

IVF-PQ: an inverted-file index that product-quantizes the vectors. Like IVF-Flat it partitions the dataset into n_lists clusters and scans the n_probes closest at query time, but compresses each vector into pq_dim codes of pq_bits bits — much smaller, slightly less accurate.

Build an [Index] from a dataset, then search it with device-resident queries and output buffers. Tensors are borrowed through the AsDlTensor / AsDlTensorMut traits; see the dlpack module for the tensor model and examples/cagra.rs for the same build/search workflow.

index::Index

1pub use index::Index;

Source: rust/cuvs/src/neighbors/ivf_pq/mod.rs:19

params::{IndexParams, SearchParams}

1pub use params::{IndexParams, SearchParams};

Source: rust/cuvs/src/neighbors/ivf_pq/mod.rs:20

CodebookGen

1#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2#[non_exhaustive]
3pub enum CodebookGen {
4 /* variants omitted */
5}

Strategy for creating PQ codebooks.

Source: rust/cuvs/src/neighbors/ivf_pq/mod.rs:28

ListLayout

1#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2#[non_exhaustive]
3pub enum ListLayout {
4 /* variants omitted */
5}

Memory layout of the IVF-PQ list data.

Source: rust/cuvs/src/neighbors/ivf_pq/mod.rs:56

LutDType

1#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2#[non_exhaustive]
3pub enum LutDType {
4 /* variants omitted */
5}

Lookup-table dtype used during IVF-PQ search.

Source: rust/cuvs/src/neighbors/ivf_pq/mod.rs:84

InternalDistanceDType

1#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2#[non_exhaustive]
3pub enum InternalDistanceDType {
4 /* variants omitted */
5}

Accumulator dtype used for internal IVF-PQ distance computation.

Source: rust/cuvs/src/neighbors/ivf_pq/mod.rs:106

IvfPqError

1#[derive(Debug, thiserror::Error)]
2#[non_exhaustive]
3pub enum IvfPqError {
4 /* variants omitted */
5}

Error type for IVF-PQ operations.

Source: rust/cuvs/src/neighbors/ivf_pq/mod.rs:125