faiss

Perform billion-scale k-NN similarity search with FAISS index types and GPU acceleration.

11.5k|842|Updated Nov 3, 2025
One-click install
npx skills add https://github.com/zechenzhangAGI/AI-research-SKILLs --skill faiss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: faiss
Source: https://github.com/zechenzhangAGI/AI-research-SKILLs/tree/main/15-rag/faiss
Command: npx skills add https://github.com/zechenzhangAGI/AI-research-SKILLs --skill faiss

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires faiss-cpu, faiss-gpu, and includes references (resource) components.

What problem does it solve?

This Skill addresses the critical need for ultra-fast similarity searches on massive datasets of dense vectors, often involving millions or billions of items. It provides a high-performance solution for applications where speed and scale are paramount, without the overhead of a full database.

Core Features & Use Cases

  • Billion-Scale Search: Efficiently search and cluster billions of vectors, enabling large-scale applications like image retrieval, data deduplication, or recommendation systems.
  • GPU Acceleration: Achieve 10-100× faster search speeds with robust GPU support, drastically reducing query latency for demanding workloads.
  • Diverse Index Types: Choose from various index types (Flat for exact, IVF for approximate, HNSW for best quality/speed) to optimize for your specific performance and accuracy needs.
  • High Performance: Ideal for applications demanding high throughput and low latency pure similarity search, without needing metadata filtering capabilities.
  • Use Case: Build a recommendation system that finds similar items from a catalog of millions in milliseconds, or perform large-scale data deduplication across petabytes of data.

Quick Start

Create a NumPy array of 1000 random 128-dimensional vectors. Initialize a faiss.IndexFlatL2 index, add the vectors, then search for the 5 nearest neighbors to a query vector.

Frequently Asked Questions about faiss

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform fast similarity search on millions of vectors?

Similarity search on large vector datasets uses approximate nearest neighbor indexing to find similar items in milliseconds. FAISS provides multiple index types—Flat for exact search, IVF for approximate search on larger scales, and HNSW for balanced quality and speed—enabling billion-scale retrieval without exhaustive comparison.

Can I use GPU acceleration to speed up vector similarity search?

Yes, GPU acceleration in vector search frameworks like FAISS achieves 10–100× faster query speeds by offloading index operations to GPUs. This drastically reduces latency for high-throughput nearest neighbor retrieval on massive datasets, making it practical for real-time recommendation and retrieval workloads.

What's the best way to index and search billions of dense vectors?

Indexing billions of vectors requires choosing an appropriate index type based on accuracy and speed trade-offs: Flat indexes guarantee exact results but are slow; IVF indexes partition vectors into clusters for faster approximate search; HNSW indexes provide hierarchical navigation for quality-speed balance. Train the index on a representative sample, add vectors, then search using your query vector.

Do I need a full database for large-scale embedding retrieval?

No, embedding retrieval at scale doesn't require a database if you only need pure similarity matching without metadata filtering. Specialized vector search libraries handle billion-scale k-NN retrieval efficiently in memory or on disk, reducing operational overhead while maintaining high throughput and low latency.

What index types does a high-performance vector search library support?

High-performance vector search libraries like FAISS support multiple index types optimized for different scenarios: Flat indexes for exact similarity, IVF for approximate search at scale, HNSW for hierarchical navigation, and Product Quantization for memory efficiency. Each trades off accuracy, speed, and memory consumption.

Can vector similarity search handle offline batch embedding processing?

Yes, vector similarity search supports offline batch processing where embeddings are generated, indexed, and stored for later retrieval. This decouples expensive embedding computation from query time, enabling efficient preprocessing of large collections before serving similarity queries.