| name | faiss |
| description | Facebook's library for efficient similarity search and clustering of dense vectors. Supports billions of vectors, GPU acceleration, and various index types (Flat, IVF, HNSW). Use for fast k-NN search, large-scale vector retrieval, or when you need pure similarity search without metadata. Best for high-performance applications. |
| version | 1.0.0 |
| author | Orchestra Research |
| license | MIT |
| dependencies | ["faiss-cpu","faiss-gpu","numpy"] |
| platforms | ["linux","macos"] |
| metadata | {"sonic":{"tags":["RAG","FAISS","Similarity Search","Vector Search","Facebook AI","GPU Acceleration","Billion-Scale","K-NN","HNSW","High Performance","Large Scale"]}} |
FAISS - Efficient Similarity Search
Facebook AI's library for billion-scale vector similarity search.
When to use FAISS
Use FAISS when:
- Need fast similarity search on large vector datasets (millions/billions)
- GPU acceleration required
- Pure vector similarity (no metadata filtering needed)
- High throughput, low latency critical
- Offline/batch processing of embeddings
Metrics:
- 31,700+ GitHub stars
- Meta/Facebook AI Research
- Handles billions of vectors
- C++ with Python bindings
Use alternatives instead:
- Chroma/Pinecone: Need metadata filtering
- Weaviate: Need full database features
- Annoy: Simpler, fewer features
Quick start
Installation
pip install faiss-cpu
pip install faiss-gpu
Basic usage
import faiss
import numpy as np
d = 128
nb = 1000
vectors = np.random.random((nb, d)).astype('float32')
index = faiss.IndexFlatL2(d)
index.add(vectors)
k = 5
query = np.random.random((1, d)).astype('float32')
distances, indices = index.search(query, k)
print(f"Nearest neighbors: {indices}")
print(f"Distances: {distances}")
Index types
1. Flat (exact search)