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.

Release files for faiss-cpu 1.15.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.15.1
File
faiss_cpu-1.15.1-cp314-cp314-win_arm64.whl CPython 3.14 CPython 3.14 Windows ARM64 Details
faiss_cpu-1.15.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
faiss_cpu-1.15.1-cp313-cp313-win_arm64.whl CPython 3.13 CPython 3.13 Windows ARM64 Details
faiss_cpu-1.15.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
faiss_cpu-1.15.1-cp312-cp312-win_arm64.whl CPython 3.12 CPython 3.12 Windows ARM64 Details
faiss_cpu-1.15.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
faiss_cpu-1.15.1-cp311-cp311-win_arm64.whl CPython 3.11 CPython 3.11 Windows ARM64 Details
faiss_cpu-1.15.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
faiss_cpu-1.15.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
faiss_cpu-1.15.1-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
faiss_cpu-1.15.1-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
faiss_cpu-1.15.1-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
faiss_cpu-1.15.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
faiss_cpu-1.15.1-cp310-abi3-macosx_15_0_x86_64.whl CPython 3.10 abi3 macOS 15.0+ x86-64 Details
faiss_cpu-1.15.1-cp310-abi3-macosx_14_0_arm64.whl CPython 3.10 abi3 macOS 14.0+ ARM64 Details

Total release size: 190.2 MB

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

Download URL faiss_cpu-1.15.1-cp314-cp314-win_arm64.whl
Size 9.3 MB
Tags CPython 3.14 Windows ARM64
SHA-256 checksum
How to use checksums
dc1cd974cd5477ca5d01d9f9ecba6a7fc555b6ef2eda7b16c97e20903431dc6b
BLAKE2b-256 checksum
How to use checksums
61238da811ff180c8f4f96f23bed84a1a235fad371f6b21ae5395d3e42d4ca95
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.15.1-cp314-cp314-win_amd64.whl

Download URL faiss_cpu-1.15.1-cp314-cp314-win_amd64.whl
Size 16.6 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
c18b569ec5d5e79f2156f0059fdb3ea79976f365d79291252ab6b45d40523c2c
BLAKE2b-256 checksum
How to use checksums
98824b1866e93b85247774dbd67afc95fbe5d02097ee125cf4ed11c90515717b
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.15.1-cp313-cp313-win_arm64.whl

Download URL faiss_cpu-1.15.1-cp313-cp313-win_arm64.whl
Size 9.0 MB
Tags CPython 3.13 Windows ARM64
SHA-256 checksum
How to use checksums
a26acb421037b030c1e9eea342adff5a0e1b6faab9e626be64b5f598241e5592
BLAKE2b-256 checksum
How to use checksums
dc4996bfac5586cc84bad3dae85dd29595512883327789573e6e81541646b5ef
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.15.1-cp313-cp313-win_amd64.whl

Download URL faiss_cpu-1.15.1-cp313-cp313-win_amd64.whl
Size 16.3 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
8a577dd6d52f685326570105c3d18feb3776799d080534e329a191740d6362b6
BLAKE2b-256 checksum
How to use checksums
98aee31e9c30f686681b78bd089edbefd3675602132612ce5dd187275be8b773
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.15.1-cp312-cp312-win_arm64.whl

Download URL faiss_cpu-1.15.1-cp312-cp312-win_arm64.whl
Size 9.0 MB
Tags CPython 3.12 Windows ARM64
SHA-256 checksum
How to use checksums
4fd6623ed931d16256b268ac2984f672cdf1929702e24b3e741798d0bb08804f
BLAKE2b-256 checksum
How to use checksums
5635c79cd7321c6d8af277691e7a7ca1dd362e0fff24a9697aa944781cdb8c75
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.15.1-cp312-cp312-win_amd64.whl

Download URL faiss_cpu-1.15.1-cp312-cp312-win_amd64.whl
Size 16.3 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
38d192695210a51ff72449d8802ff62601568fcfc6372222a64a069da0ecdb10
BLAKE2b-256 checksum
How to use checksums
6919a4bd07c73f17556eff1599e27918b8a97eaab468aea7b143bd49ca0535eb
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.15.1-cp311-cp311-win_arm64.whl

Download URL faiss_cpu-1.15.1-cp311-cp311-win_arm64.whl
Size 9.0 MB
Tags CPython 3.11 Windows ARM64
SHA-256 checksum
How to use checksums
ad05c3f169b4d02f2805f42c1caa29370b4a2dd1e99c7ee7b66591085ed20b30
BLAKE2b-256 checksum
How to use checksums
6470ae64e5acff270117e6cae4e41efc73440a70d9b502ca51b023aa28674233
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.15.1-cp311-cp311-win_amd64.whl

Download URL faiss_cpu-1.15.1-cp311-cp311-win_amd64.whl
Size 16.3 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
455d7cf9ecd595bba46c92f5b1c43b55afc84fc797aaa0c12d5df1cbc9174b00
BLAKE2b-256 checksum
How to use checksums
6e39711a720e75e57d0075f71fcc4e839b1b532ef471c5f007904be2f3d5fe8e
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.15.1-cp310-cp310-win_amd64.whl

Download URL faiss_cpu-1.15.1-cp310-cp310-win_amd64.whl
Size 16.3 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
424f7e634f806ca9a925eebf8469e764f3288773e9b9dd2608352de8287b852f
BLAKE2b-256 checksum
How to use checksums
a3a47ff626ba54b37506110e19c35b34451aa44211d8d5bed5bf33d422e026e4
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.15.1-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL faiss_cpu-1.15.1-cp310-abi3-musllinux_1_2_x86_64.whl
Size 19.6 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
d4a250000112ac26ae79530e67a18fa986c8b7b0329154aefeb7692b270ed366
BLAKE2b-256 checksum
How to use checksums
01280855b161a081556a1df0ff14d5e7e73db23bd24ed85505009387fb61762e
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.15.1-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL faiss_cpu-1.15.1-cp310-abi3-musllinux_1_2_aarch64.whl
Size 11.4 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
2d0a59d8ee9ffcac34608f591d16b617d9056e12a26a8b8cf0015b6b334e33e1
BLAKE2b-256 checksum
How to use checksums
3ca7d9e88b337f9636e0e80b651bfd27dbff533820d26c250bb60d2122de18a9
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.15.1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL faiss_cpu-1.15.1-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 18.8 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
f2c31b7f2f6647eb76829a5cfe3c398fb9346df9f26b1d4db35269c91eb58c33
BLAKE2b-256 checksum
How to use checksums
6cf4098bd9d178ae36fa078c66068d3264e27fff4308d5131655e5e743153d4c
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.15.1-cp310-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL faiss_cpu-1.15.1-cp310-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 9.9 MB
Tags CPython 3.10 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
ffa71b14b3090bc076f8b026554178868fdbfe2f26fe644da629405836369039
BLAKE2b-256 checksum
How to use checksums
a390695eeab44921bb475611fc71ec0a74af82080f496cb7586c6490e4f322d2
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.15.1-cp310-abi3-macosx_15_0_x86_64.whl

Download URL faiss_cpu-1.15.1-cp310-abi3-macosx_15_0_x86_64.whl
Size 7.2 MB
Tags CPython 3.10 abi3 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
f52e727992ce86a783f61657f0c4f3498a235883083b982ba1be49d05f924450
BLAKE2b-256 checksum
How to use checksums
ef75eb2f36334a58b343a87a2c1feaa747655fde7efdaad9c5d9eb367da89f15
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.15.1-cp310-abi3-macosx_14_0_arm64.whl

Download URL faiss_cpu-1.15.1-cp310-abi3-macosx_14_0_arm64.whl
Size 5.0 MB
Tags CPython 3.10 abi3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
ea9e12d540ca8ac0347b831d034c0f6d7ff5eed20523a247db44b3543ad2aad4
BLAKE2b-256 checksum
How to use checksums
9bedd1b8e6720e9947469cab45dbfbf1b82e1d5acf9fe063dc97a6e82db83094
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9
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