Skip to main content

Faiss

Faiss is a library for efficient similarity search and clustering of dense vectors. It contains algorithms that search in sets of vectors of any size, up to ones that possibly do not fit in RAM. It also contains supporting code for evaluation and parameter tuning. For clustering, Faiss includes e-means, a replacement for k-means that reaches a lower loss in about one tenth of the epochs, on CPU and GPU, and balanced e-means, which reaches near-perfect balance with very fast training. Faiss is written in C++ with complete wrappers for Python/numpy. Some of the most useful algorithms are implemented on the GPU. It is developed primarily at Meta's Fundamental AI Research group.

News

See CHANGELOG.md for detailed information about latest features.

Introduction

Faiss contains several methods for similarity search. It assumes that the instances are represented as vectors and are identified by an integer, and that the vectors can be compared with L2 (Euclidean) distances or dot products. Vectors that are similar to a query vector are those that have the lowest L2 distance or the highest dot product with the query vector. It also supports cosine similarity, since this is a dot product on normalized vectors.

Some of the methods, like those based on binary vectors and compact quantization codes, solely use a compressed representation of the vectors and do not require to keep the original vectors. This generally comes at the cost of a less precise search but these methods can scale to billions of vectors in main memory on a single server. Other methods, like HNSW and NSG add an indexing structure on top of the raw vectors to make searching more efficient.

The GPU implementation can accept input from either CPU or GPU memory. On a server with GPUs, the GPU indexes can be used a drop-in replacement for the CPU indexes (e.g., replace IndexFlatL2 with GpuIndexFlatL2) and copies to/from GPU memory are handled automatically. Results will be faster however if both input and output remain resident on the GPU. Both single and multi-GPU usage is supported.

Installing

Faiss comes with precompiled libraries for Anaconda in Python, see faiss-cpu, faiss-gpu and faiss-gpu-cuvs. The library is mostly implemented in C++, the only dependency is a BLAS implementation. Optional GPU support is provided via CUDA or AMD ROCm, and the Python interface is also optional. The backend GPU implementations of NVIDIA cuVS can also be enabled optionally. It compiles with cmake. See INSTALL.md for details.

How Faiss works

Faiss is built around an index type that stores a set of vectors, and provides a function to search in them with L2 and/or dot product vector comparison. Some index types are simple baselines, such as exact search. Most of the available indexing structures correspond to various trade-offs with respect to

  • search time
  • search quality
  • memory used per index vector
  • training time
  • adding time
  • need for external data for unsupervised training

The optional GPU implementation provides what is likely (as of March 2017) the fastest exact and approximate (compressed-domain) nearest neighbor search implementation for high-dimensional vectors, fastest Lloyd's k-means, and fastest small k-selection algorithm known. The implementation is detailed here.

Full documentation of Faiss

The following are entry points for documentation:

Authors

The main authors of Faiss are:

  • Hervé Jégou initiated the Faiss project and wrote its first implementation
  • Matthijs Douze implemented most of the CPU Faiss
  • Jeff Johnson implemented all of the GPU Faiss
  • Lucas Hosseini implemented the binary indexes and the build system
  • Chengqi Deng implemented NSG, NNdescent and much of the additive quantization code.
  • Alexandr Guzhva many optimizations: SIMD, memory allocation and layout, fast decoding kernels for vector codecs, etc.
  • Gergely Szilvasy build system, benchmarking framework.

Reference

References to cite when you use Faiss in a research paper:

@article{douze2024faiss,
      title={The Faiss library},
      author={Matthijs Douze and Alexandr Guzhva and Chengqi Deng and Jeff Johnson and Gergely Szilvasy and Pierre-Emmanuel Mazaré and Maria Lomeli and Lucas Hosseini and Hervé Jégou},
      year={2024},
      eprint={2401.08281},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

For the GPU version of Faiss, please cite:

@article{johnson2019billion,
  title={Billion-scale similarity search with {GPUs}},
  author={Johnson, Jeff and Douze, Matthijs and J{\'e}gou, Herv{\'e}},
  journal={IEEE Transactions on Big Data},
  volume={7},
  number={3},
  pages={535--547},
  year={2019},
  publisher={IEEE}
}

Join the Faiss community

For public discussion of Faiss or for questions, visit https://github.com/facebookresearch/faiss/discussions.

We monitor the issues page of the repository. You can report bugs, ask questions, etc.

Faiss is MIT-licensed, refer to the LICENSE file in the top level directory.

Copyright © Meta Platforms, Inc.

Metadata

Release files for faiss-cpu 1.16.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for faiss-cpu 1.16.1
File Actions
faiss_cpu-1.16.1-cp314-cp314-win_arm64.whl CPython 3.14 CPython 3.14 Windows ARM64 Details for faiss_cpu-1.16.1-cp314-cp314-win_arm64.whl
faiss_cpu-1.16.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for faiss_cpu-1.16.1-cp314-cp314-win_amd64.whl
faiss_cpu-1.16.1-cp313-cp313-win_arm64.whl CPython 3.13 CPython 3.13 Windows ARM64 Details for faiss_cpu-1.16.1-cp313-cp313-win_arm64.whl
faiss_cpu-1.16.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for faiss_cpu-1.16.1-cp313-cp313-win_amd64.whl
faiss_cpu-1.16.1-cp312-cp312-win_arm64.whl CPython 3.12 CPython 3.12 Windows ARM64 Details for faiss_cpu-1.16.1-cp312-cp312-win_arm64.whl
faiss_cpu-1.16.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for faiss_cpu-1.16.1-cp312-cp312-win_amd64.whl
faiss_cpu-1.16.1-cp311-cp311-win_arm64.whl CPython 3.11 CPython 3.11 Windows ARM64 Details for faiss_cpu-1.16.1-cp311-cp311-win_arm64.whl
faiss_cpu-1.16.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for faiss_cpu-1.16.1-cp311-cp311-win_amd64.whl
faiss_cpu-1.16.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for faiss_cpu-1.16.1-cp310-cp310-win_amd64.whl
faiss_cpu-1.16.1-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for faiss_cpu-1.16.1-cp310-abi3-musllinux_1_2_x86_64.whl
faiss_cpu-1.16.1-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for faiss_cpu-1.16.1-cp310-abi3-musllinux_1_2_aarch64.whl
faiss_cpu-1.16.1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for faiss_cpu-1.16.1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
faiss_cpu-1.16.1-cp310-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details for faiss_cpu-1.16.1-cp310-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
faiss_cpu-1.16.1-cp310-abi3-macosx_15_0_x86_64.whl CPython 3.10 abi3 macOS 15.0+ x86-64 Details for faiss_cpu-1.16.1-cp310-abi3-macosx_15_0_x86_64.whl
faiss_cpu-1.16.1-cp310-abi3-macosx_15_0_arm64.whl CPython 3.10 abi3 macOS 15.0+ ARM64 Details for faiss_cpu-1.16.1-cp310-abi3-macosx_15_0_arm64.whl

Total release size: 205.4 MB

Release files / faiss_cpu-1.16.1-cp314-cp314-win_arm64.whl

Download URL faiss_cpu-1.16.1-cp314-cp314-win_arm64.whl
Size 10.3 MB
Tags CPython 3.14 Windows ARM64
SHA-256 checksum
How to use checksums
d3695f08d7583fb16f4bfeabae4e7904ab8f20114fbe0af02791497d79cf4b87
BLAKE2b-256 checksum
How to use checksums
3b79c345431094702eef107be25037809b1c57b66e610ec58a92373ef072055f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp314-cp314-win_amd64.whl

Download URL faiss_cpu-1.16.1-cp314-cp314-win_amd64.whl
Size 17.4 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
b3af9ec36712efd25a092ba210b48de055bf4963f702c0ca351d7f748059c087
BLAKE2b-256 checksum
How to use checksums
e85a11470d19d251ba2d2a0baf43f2dfef89554b1518c80f4a2ffb8c60e59179
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp313-cp313-win_arm64.whl

Download URL faiss_cpu-1.16.1-cp313-cp313-win_arm64.whl
Size 10.0 MB
Tags CPython 3.13 Windows ARM64
SHA-256 checksum
How to use checksums
32ba7c3f709e1f6408a8102df4ef4bd4149b0f2f6d4fa6216ba713565239d37b
BLAKE2b-256 checksum
How to use checksums
999aa458c1d965c4507ea1ee755cd3aaf5afd06ce6ebaf820d00213b4a63fef0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp313-cp313-win_amd64.whl

Download URL faiss_cpu-1.16.1-cp313-cp313-win_amd64.whl
Size 17.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
fdf0789840c18eb628cd403b16568c517d8dbd942f2b41cc7eadbc8cf03135e8
BLAKE2b-256 checksum
How to use checksums
5410c53b9466a95eefd94a625abf72ef7bd679ef168df4355c3a35fb1c32370f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp312-cp312-win_arm64.whl

Download URL faiss_cpu-1.16.1-cp312-cp312-win_arm64.whl
Size 10.0 MB
Tags CPython 3.12 Windows ARM64
SHA-256 checksum
How to use checksums
4ca0d4e1f5fe700c0f98d29ba7bb760cb8e20c7e45485ab9094407e3fd7d3530
BLAKE2b-256 checksum
How to use checksums
fc2194b9c59f42724b12476830647ea4b5a34fa1a3502d36cad74a1698dd338c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp312-cp312-win_amd64.whl

Download URL faiss_cpu-1.16.1-cp312-cp312-win_amd64.whl
Size 17.1 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
80a9956fd5831193a68f055b05dca70dd9ef0340827d68dc2e19f73530c64722
BLAKE2b-256 checksum
How to use checksums
660b88143f6dc1754b572cadf850444240011040e823a15e57e023c7b0ab4728
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp311-cp311-win_arm64.whl

Download URL faiss_cpu-1.16.1-cp311-cp311-win_arm64.whl
Size 10.0 MB
Tags CPython 3.11 Windows ARM64
SHA-256 checksum
How to use checksums
371beb22be25b3c51bda362a3d47f0b6fdff69c03b9671eaff7ea332146220f4
BLAKE2b-256 checksum
How to use checksums
356135c9ad3bb6cffb43f954e1a35394349046189617702d26e8c5ffb8236d53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp311-cp311-win_amd64.whl

Download URL faiss_cpu-1.16.1-cp311-cp311-win_amd64.whl
Size 17.1 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
2a0c830f6dcb2183c90ea9fec457a6cf62613dc334959072eeaec0ab1b888e3c
BLAKE2b-256 checksum
How to use checksums
a18c1f37f844edb5f4a52f2c3b0ddbad9b0b2349a7b40e6a85e10bffb9888273
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp310-cp310-win_amd64.whl

Download URL faiss_cpu-1.16.1-cp310-cp310-win_amd64.whl
Size 17.1 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
9fa0afe89959c78d3923974fa9c3f3e72526fc25150bcee043a03e7fbc691b74
BLAKE2b-256 checksum
How to use checksums
b3877dc0eef5075c67535810d80fd994ba063e03842343912fa5cb89ac0a8f17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL faiss_cpu-1.16.1-cp310-abi3-musllinux_1_2_x86_64.whl
Size 20.9 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
00238c9adeda231f46e7614aed94bfe5e5a95ac3bfea83ecb7dadc53b66ad94e
BLAKE2b-256 checksum
How to use checksums
ba7ef6140736973774759405a7a17b82a5d9304dd1717ac0fe4da6bf6e10d277
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL faiss_cpu-1.16.1-cp310-abi3-musllinux_1_2_aarch64.whl
Size 13.0 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
567a814d15731f124af63a8c0df258016cac0a7536b7129b855d7798267a8589
BLAKE2b-256 checksum
How to use checksums
9b40dc6c6c969c43d4e2f5ecdc32922bf19a5873a8a5ea82abd8bf6994077025
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL faiss_cpu-1.16.1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 20.2 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
244e8e0a49a947387df07315d94be3d476f643daa00edcde723815ec8abec8a3
BLAKE2b-256 checksum
How to use checksums
09508575f870e9cda29e17a5a85bc7452d7541dff874c56e13c25eb07150e9cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp310-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL faiss_cpu-1.16.1-cp310-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 11.4 MB
Tags CPython 3.10 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
c655569de413112ca9207a943e8d6941fddae56352ed590586755e17a6bbde36
BLAKE2b-256 checksum
How to use checksums
b944bbfa0224a6c48ed5ed212c1c4e9e625bb854fa2c3394c7b2b6dda7570764
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp310-abi3-macosx_15_0_x86_64.whl

Download URL faiss_cpu-1.16.1-cp310-abi3-macosx_15_0_x86_64.whl
Size 8.5 MB
Tags CPython 3.10 abi3 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
049e98fb5f4c97c2fbce587dbe6d895d572b26e3da4bfaa52a3f525b0c7343b6
BLAKE2b-256 checksum
How to use checksums
42c98d11a88292b3997d4f9ed8719dcf6ad2e38775935feec9640d62ef5c9518
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / faiss_cpu-1.16.1-cp310-abi3-macosx_15_0_arm64.whl

Download URL faiss_cpu-1.16.1-cp310-abi3-macosx_15_0_arm64.whl
Size 5.7 MB
Tags CPython 3.10 abi3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
e4c26bdd7ae15316f6e2a4c5e3d0cb3e2c21d80a037d5a5f92522e052b64b11a
BLAKE2b-256 checksum
How to use checksums
c80a0b27a7fb2352d0b31568f640f2dabd7d81b01e1427a66348ce213710f698
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Security for faiss-cpu 1.16.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.16.1 This release

15 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page