facebookresearch/faiss
Embeddable C++ vector search with exact and approximate indexes and optional GPU support
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Faiss is an embeddable C++ library, not a standalone vector database server. The index is the main abstraction: an application supplies vectors, searches with query vectors using the chosen similarity metric, and gets back integer IDs. In a RAG pipeline, the application must map those IDs to documents and metadata; embedding generation and document retrieval sit outside the index.
The native build uses CMake and BLAS. Optional Python bindings expose the index APIs to NumPy workloads; the CPU package manifest uses scikit-build-core with SWIG >=4.2,<5 and NumPy >=2.0 as build requirements. CPU and GPU implementations share the index-oriented interface for supported types, as illustrated by IndexFlatL2 and GpuIndexFlatL2. Check backend support for the specific index before switching a deployment.
Key Capabilities & Differentiators
Faiss supports exact and approximate dense-vector search as well as clustering. It compares vectors using L2 distance or inner product; cosine retrieval uses inner product after normalizing both stored and query vectors. Flat search provides an exact reference for measuring recall. Graph methods such as HNSW and NSG add a structure over raw vectors, while binary and compact-code approaches can, depending on the index, search without retaining the original vectors.
Supported GPU indexes can take buffers from host or device memory and handle transfers automatically when needed. Both single- and multi-GPU use are supported, but end-to-end gains depend on where embeddings are produced and where results are consumed. Use the evaluation and tuning utilities to compare recall, search time, memory per vector, training time, and insertion cost on representative data.
Trade-offs & Limitations
Flat search gives exact neighbors without approximate-index tuning but scans the stored vectors at query time. Graph indexes spend additional memory on links to reduce search work. Compact codes can lower the memory cost substantially, but the savings may come with a recall penalty and, depending on the index, a separate training step. Compare candidates with the same corpus and queries, measuring recall against Flat as well as build and insertion costs.
Compared with a standalone vector database, Faiss removes the need for a separate search service when embedded in the application, but the library does not provide a managed database layer for document storage, filtering workflows, replication, or failover. The MIT license permits commercial integration; keep the required notices when redistributing and review the terms of optional dependencies separately.
Hardware & Deployment Guide
Start with faiss-cpu on representative vectors to establish an exact baseline and profile the retrieval process. The CPU Python package manifest requires Python >=3.10. Anaconda provides faiss-cpu, faiss-gpu, and faiss-gpu-cuvs builds; for a source build, plan for CMake and BLAS, then add the CUDA or ROCm toolchain for the GPU path you intend to use. NVIDIA cuVS is optional. Faiss can run locally without a hosted API.
Size RAM or VRAM for the selected index representation and search workspace, then measure at realistic batch sizes and concurrency. Test host-to-device transfers in the full pipeline before committing to GPU deployment. The v1.16.0 changes include e-means benchmarks, a max_points_per_centroid option for e-means, and a regression test for flat search in a nested OpenMP region.
RAG or recommendation teams that already own their embedding and document pipelines and need direct control over in-process vector retrieval, recall, and memory use.
You need a ready-to-run networked database that owns document and metadata storage, filtering workflows, replication, and failover.
Quick Start & Installation
@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}
}Comparison vs. Top RAG, Data & Memory Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| faiss ★ | 42k | +90 | C++ | MIT | Embeddable C++ vector search with exact and approximate indexes and optional GPU |
| firecrawl | 216.5k | +4.6k | TypeScript | AGPL-3.0 | Local and hosted web ingestion that turns sites into RAG-ready Markdown |
| markitdown | 199.7k | +909 | Python | MIT | Python library and CLI that turn mixed-format documents into Markdown for RAG in |
| claude-mem | 121.7k | +1.4k | TypeScript | Apache-2.0 | Hook-driven memory and hybrid search for coding agents that need cross-session r |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/facebookresearch/faiss.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about faiss
How do I integrate Faiss into a RAG pipeline?
Do I need a GPU, and how should I estimate VRAM usage?
Can I self-host Faiss in a commercial product?
When is a vector database a better choice than Faiss?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy