Scalable Nearest Neighbor search library
Maintained. Last release 15 months ago, commits in 26 of the last 26 weeks. Weaker on recent releases and release cadence.
pip install scannScaNN
ScaNN (Scalable Nearest Neighbors) is a method for efficient vector similarity search at scale. This code implements [1, 2], which includes search space pruning and quantization for Maximum Inner Product Search and also supports other distance functions such as Euclidean distance. The implementation is optimized for x86 processors with AVX support. ScaNN achieves state-of-the-art performance on ann-benchmarks.com as shown on the glove-100-angular dataset below:

ScaNN can be configured to fit datasets with different sizes and distributions. It has both TensorFlow and Python APIs. The library shows strong performance with large datasets [1, 2]. The code is released for research purposes. For more details on the academic description of algorithms, please see below.
References:
-
@inproceedings{avq_2020, title={Accelerating Large-Scale Inference with Anisotropic Vector Quantization}, author={Guo, Ruiqi and Sun, Philip and Lindgren, Erik and Geng, Quan and Simcha, David and Chern, Felix and Kumar, Sanjiv}, booktitle={International Conference on Machine Learning}, year={2020}, URL={https://arxiv.org/abs/1908.10396} } -
@inproceedings{soar_2023, title={SOAR: Improved Indexing for Approximate Nearest Neighbor Search}, author={Sun, Philip and Simcha, David and Dopson, Dave and Guo, Ruiqi and Kumar, Sanjiv}, booktitle={Neural Information Processing Systems}, year={2023}, URL={https://arxiv.org/abs/2404.00774} }
Installation
manylinux_2_27-compatible wheels are available on
PyPI:
pip install scann
ScaNN supports Linux environments running Python versions 3.9-3.13. See docs/releases.md for release notes; the page also contains download links for ScaNN wheels prior to version 1.1.0, which were not released on PyPI. The x86 wheels require AVX and FMA instruction set support, while the ARM wheels require NEON.
In accordance with the
manylinux_2_27 specification, ScaNN
requires libstdc++ version 3.4.23 or above from the operating system. See
here for an example of how
to find your system's version; it can generally be upgraded by
installing a newer version of .