https://github.com/facebookresearch/faiss Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} facebookresearch / faiss Public * Notifications * Fork 2.8k * Star 20.1k A library for efficient similarity search and clustering of dense vectors. faiss.ai License MIT license 20.1k stars 2.8k forks Star Notifications * Code * Issues 284 * Pull requests 26 * Discussions * Actions * Projects 4 * Wiki * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Projects * Wiki * Security * Insights facebookresearch/faiss This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 20 branches 18 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/f] Use Git or checkout with SVN using the web URL. [gh repo clone facebo] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @algoriddle @facebook-github-bot algoriddle and facebook-github-bot GPU builds without Docker (#2803) ... 7bf645e Mar 30, 2023 GPU builds without Docker (#2803) Summary: 1. GPU builds use CircleCI base image, no docker 2. Switched to CUDA 11.4 (used to be 11.3) 3. Merged all build jobs into two parameterized targets: `build_cmake` and `build_conda`. 4. Cleaned up test execution, fixed bug of Python GPU tests not running on PRs Pull Request resolved: #2803 Reviewed By: mlomeli1 Differential Revision: D44541714 Pulled By: algoriddle fbshipit-source-id: aa09ae638ecb6ef556d42f27a4bfaddad7355e50 7bf645e Git stats * 788 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .circleci GPU builds without Docker (#2803) March 30, 2023 10:45 .github Change default branch references from master to main. (#2029) September 1, 2021 09:26 benchs Hamming distance refactoring & ARM version (#2782) March 28, 2023 13:44 c_api Id selector c api (#2755) March 24, 2023 09:25 cmake Move from TravisCI to CircleCI (#1315) August 15, 2020 04:00 conda GPU builds without Docker (#2803) March 30, 2023 10:45 contrib make balanced clusters the default (#2796) March 28, 2023 07:23 demos OSS legal requirements (#2698) February 7, 2023 14:32 faiss enable approx top-k for hamming_kc() and IndexBinaryFlat (#2787) March 28, 2023 18:46 misc Enable clang-format + autofix. February 25, 2021 04:46 tests Additional comparison facilities in simdlib (#2783) March 28, 2023 14:01 tutorial Put idx_t in the faiss namespace (#2582) November 30, 2022 08:25 .clang-format Re-factor factory string parsing (#2134) December 7, 2021 04:35 .dockerignore Add Dockerfile (#55) March 23, 2017 18:25 .gitignore AQ fastscan (#2169) February 22, 2022 15:24 CHANGELOG.md Updated changelog with implemented features for 1.7.3 release (#2564) November 8, 2022 03:44 CMakeLists.txt Prepare for v1.7.3 release (#2560) November 4, 2022 09:48 CODE_OF_CONDUCT.md OSS Automated Fix: Addition of Code of Conduct March 22, 2019 11:13 CONTRIBUTING.md Change default branch references from master to main. (#2029) September 1, 2021 09:26 Doxyfile Remove exclusion from Doxyfile (#2741) March 2, 2023 04:48 INSTALL.md Add info about building C API to INSTALL.md (#2706) March 24, 2023 08:16 LICENSE Facebook sync (May 2019) + relicense (#838) May 28, 2019 16:17 README.md Complete Faiss OSS legal requirements February 6, 2023 12:39 View code [ ] Faiss News Introduction Installing How Faiss works Full documentation of Faiss Authors Reference Join the Faiss community Legal README.md 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 and faiss-gpu. The library is mostly implemented in C++, the only dependency is a BLAS implementation. Optional GPU support is provided via CUDA, and the Python interface is also optional. 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: * the full documentation can be found on the wiki page, including a tutorial, a FAQ and a troubleshooting section * the doxygen documentation gives per-class information extracted from code comments * to reproduce results from our research papers, Polysemous codes and Billion-scale similarity search with GPUs, refer to the benchmarks README. For Link and code: Fast indexing with graphs and compact regression codes, see the link_and_code README Authors The main authors of Faiss are: * Herve Jegou 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. Reference Reference to cite when you use Faiss in a research paper: @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, there is a Facebook group at https://www.facebook.com/groups/faissusers/ We monitor the issues page of the repository. You can report bugs, ask questions, etc. Legal Faiss is MIT-licensed, refer to the LICENSE file in the top level directory. Copyright (c) Meta Platforms, Inc. See the Terms of Use and Privacy Policy for this project. About A library for efficient similarity search and clustering of dense vectors. faiss.ai Resources Readme License MIT license Code of conduct Code of conduct Security policy Security policy Stars 20.1k stars Watchers 449 watching Forks 2.8k forks Releases 14 v1.7.3 Latest Nov 30, 2022 + 13 releases Packages 0 No packages published Used by 926 * @cliuxinxin * @SajithJude * @veracious4 * @tmquan * @rexzhengzhihong * @FilCor * @Rossember * @johntools0727 + 918 Contributors 114 * @mdouze * @beauby * @facebook-github-bot * @wickedfoo * @KinglittleQ * @h-vetinari * @Enet4 * @ava57r * @alexanderguzhva * @vorj * @ailzhang + 103 contributors Languages * C++ 61.4% * Python 18.0% * Cuda 17.1% * C 2.1% * CMake 0.8% * Shell 0.6% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.