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. 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.0

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.0
File Actions
faiss_cpu-1.16.0-cp314-cp314-win_arm64.whl CPython 3.14 CPython 3.14 Windows ARM64 Details for faiss_cpu-1.16.0-cp314-cp314-win_arm64.whl
faiss_cpu-1.16.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for faiss_cpu-1.16.0-cp314-cp314-win_amd64.whl
faiss_cpu-1.16.0-cp313-cp313-win_arm64.whl CPython 3.13 CPython 3.13 Windows ARM64 Details for faiss_cpu-1.16.0-cp313-cp313-win_arm64.whl
faiss_cpu-1.16.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for faiss_cpu-1.16.0-cp313-cp313-win_amd64.whl
faiss_cpu-1.16.0-cp312-cp312-win_arm64.whl CPython 3.12 CPython 3.12 Windows ARM64 Details for faiss_cpu-1.16.0-cp312-cp312-win_arm64.whl
faiss_cpu-1.16.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for faiss_cpu-1.16.0-cp312-cp312-win_amd64.whl
faiss_cpu-1.16.0-cp311-cp311-win_arm64.whl CPython 3.11 CPython 3.11 Windows ARM64 Details for faiss_cpu-1.16.0-cp311-cp311-win_arm64.whl
faiss_cpu-1.16.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for faiss_cpu-1.16.0-cp311-cp311-win_amd64.whl
faiss_cpu-1.16.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for faiss_cpu-1.16.0-cp310-cp310-win_amd64.whl
faiss_cpu-1.16.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for faiss_cpu-1.16.0-cp310-abi3-musllinux_1_2_x86_64.whl
faiss_cpu-1.16.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for faiss_cpu-1.16.0-cp310-abi3-musllinux_1_2_aarch64.whl
faiss_cpu-1.16.0-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for faiss_cpu-1.16.0-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
faiss_cpu-1.16.0-cp310-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.27+ ARM64, Linux glibc 2.28+ ARM64 Details for faiss_cpu-1.16.0-cp310-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
faiss_cpu-1.16.0-cp310-abi3-macosx_15_0_x86_64.whl CPython 3.10 abi3 macOS 15.0+ x86-64 Details for faiss_cpu-1.16.0-cp310-abi3-macosx_15_0_x86_64.whl
faiss_cpu-1.16.0-cp310-abi3-macosx_15_0_arm64.whl CPython 3.10 abi3 macOS 15.0+ ARM64 Details for faiss_cpu-1.16.0-cp310-abi3-macosx_15_0_arm64.whl

Total release size: 197.7 MB

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

Download URL faiss_cpu-1.16.0-cp314-cp314-win_arm64.whl
Size 9.7 MB
Tags CPython 3.14 Windows ARM64
SHA-256 checksum
How to use checksums
ced04bdc26ced1e7deb3957fd01442952efbf4414ec380c9ce1424a72e52b7f8
BLAKE2b-256 checksum
How to use checksums
f44935a7267b6cdb3d54ba992d41279ff6ef34eb62f9cfd758767ccc666c7d6e
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.0-cp314-cp314-win_amd64.whl

Download URL faiss_cpu-1.16.0-cp314-cp314-win_amd64.whl
Size 16.9 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
0adb10b125ceb17dc1e631f2a692ff0534b7db910aabab1b46ce77ec096b9e40
BLAKE2b-256 checksum
How to use checksums
202519399cb635469beba827d1151a6be19a94f13908e3c365163be6623b167d
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.0-cp313-cp313-win_arm64.whl

Download URL faiss_cpu-1.16.0-cp313-cp313-win_arm64.whl
Size 9.4 MB
Tags CPython 3.13 Windows ARM64
SHA-256 checksum
How to use checksums
82bc1d6c3808f3ecfe1cf2c17aa8dbb861ec55aa725110b115ba180e70078ed1
BLAKE2b-256 checksum
How to use checksums
7f412611b9213f2930610cfe030f9a68850edc12f97dd14403e20ceb43723bc5
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.0-cp313-cp313-win_amd64.whl

Download URL faiss_cpu-1.16.0-cp313-cp313-win_amd64.whl
Size 16.6 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
c4a9073cff30759afc41c95300bb12a1cbfcd9ac955640331938468dc900a74d
BLAKE2b-256 checksum
How to use checksums
e29103f6fac79b99a2a3c9d4aeea502458f8e7b83761fb11429f74b0d0ebea5a
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.0-cp312-cp312-win_arm64.whl

Download URL faiss_cpu-1.16.0-cp312-cp312-win_arm64.whl
Size 9.4 MB
Tags CPython 3.12 Windows ARM64
SHA-256 checksum
How to use checksums
b399cb0cb4fe443063b36522bcc4c86f3f91cbe159986c9d11a7b6a020106f13
BLAKE2b-256 checksum
How to use checksums
c1cb77faf2eff60fe9a2bb149005a77e8ec14c8d5176255abce734fce8567556
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.0-cp312-cp312-win_amd64.whl

Download URL faiss_cpu-1.16.0-cp312-cp312-win_amd64.whl
Size 16.6 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
6b9076b0015f95c9de632bbe291995a45541573b2aca7ae7a038c7a3732948e4
BLAKE2b-256 checksum
How to use checksums
8a41670d72f6ab54495cd3ce1d80d756bd433ae8219b041888eb3312a40d3245
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.0-cp311-cp311-win_arm64.whl

Download URL faiss_cpu-1.16.0-cp311-cp311-win_arm64.whl
Size 9.4 MB
Tags CPython 3.11 Windows ARM64
SHA-256 checksum
How to use checksums
5ecc19a6239477dd7d68a1a33259ac75337f5a2d4eea62b0fa9d7d611673a2ce
BLAKE2b-256 checksum
How to use checksums
37a652a034d9b7982fdcaa3ec402b2ee9d72bc2bdd3d955d4c354f785ea48520
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.0-cp311-cp311-win_amd64.whl

Download URL faiss_cpu-1.16.0-cp311-cp311-win_amd64.whl
Size 16.6 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
556cc8f5f7781f08314ac4723403371cd561a182f974833263b11fa72ca97d4e
BLAKE2b-256 checksum
How to use checksums
56c71e158c621ca0a1a443634877fb5121f15f07aa6b536213b3748bc5f37a58
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.0-cp310-cp310-win_amd64.whl

Download URL faiss_cpu-1.16.0-cp310-cp310-win_amd64.whl
Size 16.6 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
b932c8407fea55b71f7d2ce2f90469c79680231c8ee4c52b319b1e156bc7807e
BLAKE2b-256 checksum
How to use checksums
a204375ee95bc8275f018966f9fb3c472716afde914271903b1a3a5279e2e35e
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.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL faiss_cpu-1.16.0-cp310-abi3-musllinux_1_2_x86_64.whl
Size 20.2 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
f4ba44201cbaa6612df1af35979aee6a972e9e75942f607f3cc90343646fb51a
BLAKE2b-256 checksum
How to use checksums
ea5ec9088fc202e7f765ead1d70c6b3e2e4894cf9a198f77be86fa2fbc480bfe
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.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL faiss_cpu-1.16.0-cp310-abi3-musllinux_1_2_aarch64.whl
Size 12.5 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
13a17fa40f26aad4e6e6d38b406210721b541398ce70091165af5b5c32e5c9ab
BLAKE2b-256 checksum
How to use checksums
80848c47930b4d5b5bb47a99bccb758e739a65913e69dc8046347b45891ef888
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.0-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL faiss_cpu-1.16.0-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 19.5 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
876abdd551465c9a81c27eda6f42cbe76d17592acb582834e9ec53b763ff5724
BLAKE2b-256 checksum
How to use checksums
19a882737cf7c2171287ca38c9e0b07e62607c4ab1cbfaaec5f8919595ca44b5
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.0-cp310-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL faiss_cpu-1.16.0-cp310-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 10.8 MB
Tags CPython 3.10 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
f9c355a466dd9fe0b1e7cc39c57d5d57380754e4facb74c62533b2e9b9b8ee82
BLAKE2b-256 checksum
How to use checksums
fc56ca6813847b5ce85c6281f252c8c09f0d16fedb5640659643f847570e20fd
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.0-cp310-abi3-macosx_15_0_x86_64.whl

Download URL faiss_cpu-1.16.0-cp310-abi3-macosx_15_0_x86_64.whl
Size 7.9 MB
Tags CPython 3.10 abi3 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
67f5072c8cdaaa9950affd12b43e21bde5715bc788ec36831d135c4ecae2d035
BLAKE2b-256 checksum
How to use checksums
76cdc3c8bdbeaad9f608ae35bf542ca6b2d4d9edc8295524fc14c3ffa6d68a79
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.0-cp310-abi3-macosx_15_0_arm64.whl

Download URL faiss_cpu-1.16.0-cp310-abi3-macosx_15_0_arm64.whl
Size 5.3 MB
Tags CPython 3.10 abi3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
fe430200c5b91eff67ebb9fe3958963d3ae7dfb341e3af7c1102ecf6ade4378e
BLAKE2b-256 checksum
How to use checksums
8197071a420d03c6624bfba215b5127f7cd6c6c3f08bdeaef575e079b9355643
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.0

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.0 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