Faiss: Billion-Scale Vector Similarity Search from Meta AI Research
A library for efficient similarity search and clustering of dense vectors.
At a glance
- What is it?
- Faiss is a C++ library for similarity search and clustering of dense vectors, developed at Meta's Fundamental AI Research group. It provides multiple index types covering the tradeoff between search speed, search quality, and memory use, with GPU acceleration available via CUDA and AMD ROCm.
- Who is it for?
- Teams building retrieval-augmented generation pipelines, nearest-neighbor search, or large-scale clustering in Python should evaluate Faiss when they need a library that scales beyond what in-memory brute force allows and provides GPU acceleration as a drop-in option. The MIT license permits commercial use without restriction.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 4 days ago.
- What is it written in?
- Mainly C++, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 25, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What Faiss Solves and Who Uses It
Faiss addresses a specific bottleneck in machine learning systems: given a large collection of dense vectors, find the ones most similar to a query vector quickly. The straightforward approach, computing the exact distance from the query to every vector, becomes impractical when the collection contains hundreds of millions of entries or when latency constraints are tight. Faiss provides algorithms that search in sets of vectors of any size, including collections that may not fit entirely in RAM.
The library is developed primarily at Meta's Fundamental AI Research group and is written in C++ with complete wrappers for Python and NumPy. The use cases described in the README and research papers include nearest-neighbor search, approximate nearest-neighbor search, and clustering. Engineers building retrieval-augmented generation systems, recommendation engines, and semantic search pipelines use it as the search core, since those workloads require finding similar items from large embedding collections efficiently.
Index Types and the Search Quality Tradeoff
Faiss is built around an index type that stores a set of vectors and provides a search function. The README describes the design as offering various tradeoffs across six dimensions: search time, search quality, memory per index vector, training time, time to add new vectors, and whether external data is needed for unsupervised training.
Some index types use exact search as a baseline (IndexFlatL2 is one example given in the README). Others apply compression: binary vector indexes and compact quantization codes store only a compressed representation of the vectors without keeping the originals, which allows scaling to billions of vectors in main memory on a single server at the cost of some search precision. Additional index structures, including HNSW and NSG, add a graph-based indexing layer on top of the raw vectors to make search faster without full compression. The GPU implementation cited in the README is described as providing, as of March 2017, the fastest exact and approximate nearest-neighbor search for high-dimensional vectors, and the fastest small k-selection algorithm known at that time.
Installing Faiss via Conda
The README states that Faiss comes with precompiled libraries for Anaconda in Python. Three packages are available: faiss-cpu at anaconda.org/pytorch/faiss-cpu, faiss-gpu at anaconda.org/pytorch/faiss-gpu, and faiss-gpu-cuvs at anaconda.org/pytorch/faiss-gpu-cuvs for installations that use NVIDIA's cuVS backend.
The pyproject.toml in the repository uses scikit-build-core and SWIG as the build system, requiring Python 3.10 or higher. The only mandatory dependency is a BLAS implementation; GPU support is optional and provided through CUDA, AMD ROCm, or the cuVS backend. The build system is cmake, and the README points to INSTALL.md in the repository for source compilation details. The conda packages are the recommended starting point for users who do not need to modify the C++ layer. The pyproject.toml package name is faiss-cpu, and it lists NumPy 1.25 or higher as a runtime dependency.
GPU Acceleration and Multi-GPU Usage
Faiss provides a GPU implementation for its most commonly used indexes. The README describes the GPU support as a drop-in replacement for CPU indexes: replacing IndexFlatL2 with GpuIndexFlatL2, for example, switches to the GPU implementation, and copies to and from GPU memory are handled automatically. Results are faster when both input and output remain resident on the GPU, avoiding the transfer overhead.
Both single-GPU and multi-GPU usage are supported. The faiss-gpu conda package enables CUDA-based acceleration, and the faiss-gpu-cuvs package enables NVIDIA's cuVS backend for GPU implementations. The AMD ROCm GPU path is noted in the README as optional and requires a separate build configuration. The research paper describing the GPU implementation is at arxiv.org/abs/1702.08734 and documents benchmark methodology; teams who need to understand the performance model at a technical level can consult it. The GPU indexes do not change the API surface visible to Python users, which means GPU experiments can be run by changing a single class name in existing Python code.
Similarity Metrics: L2, Dot Product, and Cosine
Faiss identifies similar vectors using L2 (Euclidean) distance or dot product comparison. Vectors that are similar to a query are those with the lowest L2 distance or the highest dot product with the query, depending on the index configuration. Cosine similarity is supported as a special case: the README states it is equivalent to a dot product on normalized vectors, so cosine search is achieved by normalizing the stored vectors before indexing.
This metric support covers the embedding types produced by most neural encoders. Text embedding models typically produce vectors where cosine similarity is the correct metric; image retrieval systems often use L2 distance. Faiss integers use vector IDs to identify each stored vector, and search results return the IDs of the nearest neighbors along with their distances. The choice of metric is fixed at index creation time and cannot be changed without rebuilding the index.
Where Faiss Falls Short
Faiss is a library, not a server. It does not provide persistence, replication, a REST API, or query logging out of the box. Teams who need those capabilities must build the surrounding infrastructure themselves or use a vector database that wraps Faiss internally. Pinecone is a managed vector database frequently compared to Faiss in search queries. The difference in approach is fundamental: Pinecone is a hosted service with its own API, access controls, and persistence layer, while Faiss is a C++ library that the consuming application manages directly.
Faiss also requires index training for most non-exact index types. The README lists training time as one of the six tradeoff dimensions. An index that uses quantization codes must be trained on a representative sample of the vector population before vectors can be added, which adds a step that brute-force search does not require. The index types that do not require training (such as flat indexes) do not scale to billions of vectors in memory. The c_api/ directory in the repository provides a C interface for languages without a dedicated wrapper, but the community support for those bindings is not documented in the README.
License, Research References, and Maintenance
Faiss is licensed under MIT, which permits commercial use and modification without requiring source disclosure. Copyright is held by Meta Platforms, Inc. The repository has received releases consistently through 2026, with v1.15.1 on 2026-09-16 and v1.15.0 on 2026-08-03, and the last push was on 2026-09-25. The project is not archived.
The README provides BibTeX citations for two research papers: the primary Faiss library paper (arxiv eprint 2401.08281) and the GPU billion-scale paper (IEEE Transactions on Big Data, 2019, arxiv.org/abs/1702.08734). A third paper covering Polysemous codes is at arxiv.org/abs/1609.01882. Teams using Faiss in academic or audited production settings have explicit citation guidance. The community discussion channel is at github.com/facebookresearch/faiss/discussions.
Editorial conclusion
Teams building retrieval-augmented generation pipelines, nearest-neighbor search, or large-scale clustering in Python should evaluate Faiss when they need a library that scales beyond what in-memory brute force allows and provides GPU acceleration as a drop-in option. The MIT license permits commercial use without restriction. Developers who need a managed vector database with persistence, replication, or a REST API should treat Faiss as a building block rather than a complete solution, since it is a library rather than a server. Before adopting, confirm that the target Python version is 3.10 or higher as required by pyproject.toml, and decide whether the CPU-only or GPU-enabled package fits the infrastructure.
Frequently asked questions
What is FAISS used for?
Faiss is used for similarity search and clustering of dense vectors. The README describes it as searching in sets of vectors of any size, including ones that may not fit in RAM, and as providing the fastest exact and approximate nearest-neighbor search for high-dimensional vectors on GPU.
Why is FAISS so fast?
Faiss uses multiple index types that compress or index vectors to avoid exhaustive comparison with every stored vector. The GPU implementation handles search on NVIDIA hardware. The README attributes speed on GPU to what it describes as the fastest known exact and approximate nearest-neighbor implementation as of March 2017, described in arxiv.org/abs/1702.08734.
How do you install FAISS?
The recommended installation is via Anaconda: faiss-cpu, faiss-gpu, and faiss-gpu-cuvs packages are available at anaconda.org/pytorch/. Compiling from source requires cmake and a BLAS implementation; details are in INSTALL.md in the repository. Python 3.10 or higher is required.
How do you use FAISS for similarity search in Python?
Faiss provides C++ index types with Python wrappers. You create an index (for example IndexFlatL2 for exact L2 search), add vectors to it, then call its search method with a query vector and a count of neighbors to return. The documentation wiki at github.com/facebookresearch/faiss/wiki includes a getting-started tutorial.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/facebookresearch-faiss)
Community notes