faiss

Perform k-NN similarity search over dense float32 vectors using FAISS index structures.

Updated May 4, 2026
One-click install
npx skills add https://github.com/JamesFincher/gengar --skill faiss-jamesfincher
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: faiss
Source: https://github.com/JamesFincher/gengar/tree/main/optional-skills/mlops/faiss
Command: npx skills add https://github.com/JamesFincher/gengar --skill faiss-jamesfincher

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

FAISS solves the problem of finding nearest neighbors in large-scale dense vector datasets quickly, enabling fast similarity search and clustering for embedding-based applications.

Core Features & Use Cases

  • Efficient similarity search: Retrieve the most similar vectors using multiple index types (exact and approximate) for low-latency k-NN.
  • Scales to very large corpora: Supports large vector counts with CPU or GPU acceleration and memory-efficient compression.
  • Widely usable in RAG and vector pipelines: Works for embeddings retrieval, offline/batch indexing, and integration with common Python AI frameworks.

Use case example: Build a semantic search for a massive document collection by embedding passages, indexing them with FAISS (e.g., HNSW for quality or IVF/PQ for memory), and then retrieving top-k relevant passages for each query.

Quick Start

Install the library with pip install faiss-cpu, then create an IndexFlatL2 (or IndexFlatIP after normalization) to add your float32 vectors and run search to get nearest neighbors for a query embedding.

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 over large dense vector datasets?

Fast similarity search over large dense vector datasets is achieved by building FAISS index structures like Flat, IVF, HNSW, or PQ for k-NN retrieval. You add float32 vectors to a chosen index and execute a search query to retrieve the nearest neighbors with low latency.

What is the best way to choose between HNSW and IVF/PQ indices for vector search?

Choosing between HNSW and IVF/PQ indices for vector search depends on your resource constraints: HNSW provides higher retrieval quality, while IVF and PQ offer memory-efficient compression for scaling to very large corpora. Both support tunable accuracy-speed parameters.

Can I use FAISS for semantic search retrieval in a RAG pipeline?

Yes, you can use FAISS for semantic search retrieval in a RAG pipeline. By embedding passages and indexing them with FAISS, you can efficiently retrieve the top-k relevant passages for each query embedding to feed into your generation model.

Does FAISS support GPU acceleration for nearest neighbor serving?

Yes, FAISS supports GPU acceleration for nearest neighbor serving to achieve high throughput. It utilizes the faiss-gpu dependency alongside faiss-cpu and numpy to process large-scale vector datasets significantly faster than CPU-only configurations.

Do I need to train IVF and PQ indices before adding my float32 vectors?

Yes, you need to train IVF and PQ indices before adding float32 vectors. Unlike Flat or HNSW indices, IVF and PQ require an optional training step to learn the vector clustering or quantization parameters for approximate nearest neighbor search.

Why does my FAISS similarity search return approximate instead of exact results?

FAISS similarity search returns approximate results when using IVF, PQ, or HNSW index structures to optimize speed and memory. For exact k-NN retrieval, you must use IndexFlatL2 or IndexFlatIP, though this sacrifices performance on large vector datasets.