vindex

DuckDB Vector Search Extension

ScaNN weights quantization errors parallel to the query-vector direction more heavily than orthogonal ones — producing more accurate inner-product estimates than classical PQ.

GitHub
Quick Install
Version v0.1.0
← Back to overview
Quantizer

ScaNN

ScaNN weights quantization errors parallel to the query-vector direction more heavily than orthogonal ones — producing more accurate inner-product estimates than classical PQ.

Reference Paper — Credits

Accelerating Large-Scale Inference with Anisotropic Vector Quantization

Guo, R.; Sun, P.; Lindgren, E.; Geng, Q.; Simcha, D.; Chern, F.; Kumar, S.

ICML 2020

Anisotropic quantization loss that weights parallel errors more heavily than orthogonal — the core of the ScaNN library.

Read paper at official venue →

At a glance

ScaNN's anisotropic loss re-weights quantization error along the direction of the query-data inner product. In classical PQ, k-means minimizes isotropic L2 error — treating every direction equally. ScaNN instead biases the Lloyd loop to place centroids that preserve the component of each vector parallel to the expected query direction (eta = η = h_parallel / h_perpendicular). This yields significantly more accurate inner-product estimates than classical PQ at matched memory.

Parameters

OptionDefaultNotes
m / bitsdim/4 / 8Same shape as PQ — ScaNN re-uses the PQ code layout.
eta4.0Anisotropy strength. η=1 collapses to classical PQ; η→∞ maximizes parallel-direction fidelity.
metricl2sq / ipCosine is not supported directly — normalize vectors and use ip.

Example

CREATE INDEX docs_idx ON docs USING IVF (embedding)
    WITH (metric='ip', quantizer='scann', m=16, bits=8, eta=4.0, rerank=10,
          nlist=1024, nprobe=32);