
Faiss
A C++ library with Python bindings for fast similarity search over large sets of vectors.
- Stars
- 41.2k
- Forks
- 4.6k
- Licence
- MIT
- Language
- C++
- Last update
- 4 days ago
- Type
- Library
What it is
Faiss is a library for finding vectors that are similar to a query vector, such as searching embeddings for text or images. It can handle collections of vectors large enough that they may not fit in RAM, and it includes tools for evaluation and parameter tuning. It is written in C++ with Python/numpy wrappers, and some algorithms run on GPUs.
- Index a set of embedding vectors and run nearest-neighbor queries against them
- Use compressed indexes to search collections too large to hold in memory on one server
- Run exact or approximate search on GPUs with GPU index classes such as GpuIndexFlatL2
- Perform k-means style clustering on dense vectors
Great for
- Developers building semantic search or recommendation features over embedding vectors
- Teams working with very large vector collections that need compressed indexes
- Python users who want numpy-compatible similarity search
- Researchers comparing approximate nearest neighbor methods
Not ideal for
- People who want a finished search app with a user interface, since this is a library
- Users with small datasets where a simple brute-force search in another tool is enough, because Faiss adds setup complexity
- Projects that need a managed database with storage, filtering, and updates handled for them, since the README describes only the search and clustering library
How to get it
- 1
Install with a package manager
You'll need: BLAS implementation · CMake (for building from source) · Anaconda (for the precompiled Python packages)
Install CPU build from Anaconda (per README link to faiss-cpu)
git clone https://github.com/facebookresearch/faiss.git - 2
Run it
- Install the library using the method in INSTALL.md or the Anaconda packages linked in the README
- Create an index type such as IndexFlatL2 for exact search
- Add your vectors to the index
- Run a search with a query vector to get the nearest matches
- 3
Get the most out of it
- Use the wiki tutorial and FAQ for guided setup and troubleshooting
- Try the benchmarks README to reproduce published results and test index trade-offs
- Move GPU indexes to the GPU and keep input and output there for best speed, per the README
- Use the doxygen documentation at faiss.ai for per-class API details
Downloads
Strengths
- Designed for efficient search over large sets of dense vectors, with options that trade speed, quality, and memory
- Mostly C++ with complete Python/numpy wrappers and optional GPU support via CUDA or AMD ROCm
- Released under the MIT license and developed primarily at Meta's Fundamental AI Research group
Trade-offs
- The README describes many index types and trade-offs, so choosing the right one takes some study
- GPU support requires suitable hardware and drivers, and the README does not detail every setup requirement
- Full documentation is on an external wiki and the README is truncated, so some details could not be verified here
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.