faiss

Solid

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.

AI & Automation 9,021 stars 689 forks Updated 1 months ago MIT

Install

View on GitHub

Quality Score: 94/100

Stars 20%
100
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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 ```bash # CPU only pip install faiss-cpu # GPU support pip install faiss-gpu ``` ### Basic usage ```python import faiss import numpy as np # Create sample data (1000 vectors, 128 dimensions) d = 128 nb = 1000 vectors = np.random.random((nb, d)).astype('float32') # Create index index = faiss.IndexFlatL2(d) # L2 distance index.add(vectors) # Add vectors # Search k = 5 # Find 5 nearest neighbors 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) ```python # L2 (Euclidean) distance index = faiss.IndexFlatL2(d) # Inner product (cosine similarity if normalized) index = faiss.IndexFlatIP(d) # Slo...

Details

Author
Orchestra-Research
Repository
Orchestra-Research/AI-Research-SKILLs
Created
6 months ago
Last Updated
1 months ago
Language
TeX
License
MIT

Integrates with

Related Skills