FAISS
Software library for similarity search
From Wikipedia, the free encyclopedia
FAISS (Facebook AI Similarity Search[3]) is an open-source library for similarity search and clustering of 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.
Matthijs Douze
Jeff Johnson
| FAISS | |
|---|---|
| Original authors | Hervé Jégou Matthijs Douze Jeff Johnson |
| Developer | Meta Platforms (Meta AI) |
| Initial release | February 22, 2017[1] |
| Stable release | v1.12.0
/ August 12, 2025.:[2] |
| Written in | C++, Python, CUDA |
| Operating system | Various, including Windows, macOS, and Linux |
| Platform | x86, ARM, PowerPC |
| Type | Similarity search library |
| License | MIT License |
| Website | faiss |
| Repository | github |
FAISS is written in C++ with complete wrappers for Python and C. Some of the most useful algorithms are implemented on the GPU using CUDA.[4]
Features
FAISS is organized as a toolbox that contains a variety of indexing methods that commonly involve a chain of components (preprocessing, compression, non-exhaustive search, etc.). The scope of the library is intentionally limited to focus on ANNS algorithmic implementation and to avoid facilities related to database functionality, distributed computing or feature extraction algorithms.[5]
FAISS is designed with the following assumptions:[5]
- Primary data type for vector representation is FP32. The support of other floating-point formats, such as BF16 and FP16, is provided.
- Prefer batches of input queries over a single input query for the search.
- Emphasize on allowing users to write a fast prototyping code using its Python wrappers.
- The code should be as open as possible, so that users can access all the implementation details of the indexes.
The following major categories of indexing methods are supported:
- Brute-force search
- Inverted-lists based indices[6]
- Graph indices, including (Hierarchical navigable small world) HNSW and Navigating Spread-out Graph (NSG)[7]
- Locality-sensitive hashing (LSH)
The following families of vector quantization methods are supported:
- Binary Quantization
- Scalar Quantization (SQ)
- Product Quantization[8] (PQ), including Polysemous Codes,[9] Optimized Product Quantization[10] (OPQ) and Quicker ADC[11] (PQFastScan)
- Additive Quantization[12] (AQ), including Residual Quantization[13] (RQ) and Local Search Quantization[14] (LSQ)
- Neural Quantization, including QINCO[15]
FAISS focuses on euclidean distance and inner product distance for floating-point data. The limited support of other distances (manhattan distance, Lp distance, etc.) is also available.
FAISS code supports multithreading via OpenMP, utilizes BLAS via OpenBLAS or Intel MKL, and also uses custom SIMD kernels for x86 and ARM Neon CPUs.
Besides the similarity search, FAISS provides the following useful facilities:
- k-means clustering
- Random-matrix rotations[16] for spreading the variance over all the dimensions without changing the measured distances
- Principal component analysis
- Data deduplication, which is especially useful for image datasets.
FAISS has a standalone Vector Codec functionality for the lossy compression of vectors, allowing to trade the representation accuracy for the binary size.[17]
Applications
Typical FAISS applications[5] include recommender systems, data mining,[18] text retrieval and content moderation.[19]
FAISS was reported to index 1.5 trillion 144-dimensional vectors for internal Meta Platforms applications.[5][20]
FAISS is used in vector databases as a core component of a search engine (OpenSearch,[21][22] Milvus,[23] Vearch[24]).
FAISS is often considered as a baseline in similarity search benchmarks.[25][26][27][28]
FAISS has an integration with Haystack,[29] LangChain[30] frameworks.
Various advanced code snippets for FAISS can be found on its snippets wiki page and case studies wiki page.