Agent skill

FAISS Similarity Search

by Orchestra-Research in Orchestra-Research/AI-Research-SKILLs

Sets up FAISS for fast nearest-neighbor search over large collections of dense vectors, choosing between Flat, IVF, HNSW and product quantization indexes.

MITAuto-check passedDatabases

Install FAISS Similarity Search

skills CLI
$ npx skills add Orchestra-Research/AI-Research-SKILLs --skill faiss -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Orchestra-Research/AI-Research-SKILLs faiss --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Orchestra-Research/AI-Research-SKILLs.git skills-src && mkdir -p .claude/skills && cp -r skills-src/15-rag/faiss .claude/skills/faiss && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
faiss
GitHub stars
13k
Used in
6 other repos
Token cost
~1.3k tokens
SKILL.md length
210 words
Files
2 (incl. references)
Skills in repo
96
Repo updated
First seen
Licence
MIT

At a glance

Sets up FAISS for fast nearest-neighbor search over large collections of dense vectors, choosing between Flat, IVF, HNSW and product quantization indexes.

  • Works in 4 steps: Flat (exact search) → IVF (inverted file) - Fast approximate → HNSW (Hierarchical NSW) - Best… → …
  • Building fast k-nearest-neighbor search over millions of embeddings
  • SKILL.md covers When to use FAISS, Quick start, Index types and Save and load, plus 6 more sections
  • Calls pip

What it does

FAISS is Facebook AI Research's C++ library, with Python bindings, for similarity search and clustering of dense vectors at the scale of millions or billions. The skill says when it fits: large vector sets, GPU acceleration, pure vector similarity with no metadata filtering, high throughput, or offline batch work on embeddings. For filtering or full database features it points to Chroma, Pinecone or Weaviate, and to Annoy for something simpler.

It walks through installing `faiss-cpu`, basic usage with NumPy arrays, and four index families: Flat for exact search, IVF for fast approximate search, HNSW for quality, and product quantization to cut memory. It also covers saving and loading trained indexes, moving an index onto a GPU, and plugging FAISS into LangChain and LlamaIndex vector stores. Practical tips include normalizing vectors for cosine similarity, tuning `nprobe` and `ef_search`, batching queries, and picking an index by dataset size. A reference file details the index types.

When your agent uses it

  • Building fast k-nearest-neighbor search over millions of embeddings
  • Choosing between Flat, IVF and HNSW indexes for a dataset size
  • Cutting the memory use of a large vector index with product quantization
  • Moving a vector index to the GPU for faster queries

Example prompts

  • “Build a FAISS index over these few million sentence embeddings and fetch the ten nearest neighbors for a query.”
  • “Switch my Flat index to IVF and tell me how to set nprobe.”
  • “Save the trained FAISS index to disk and load it again in the search service.”
  • “Use FAISS as the vector store in my LlamaIndex pipeline.”

Requirements

  • Python with `faiss-cpu` installed
  • NumPy

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Flat (exact search)
  2. IVF (inverted file) - Fast approximate
  3. HNSW (Hierarchical NSW) - Best quality/speed
  4. Product Quantization - Memory efficient

What it can do on your machine

Read from SKILL.md and the folder at commit 773a529. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

FAISS Similarity Search loads about 1.3k tokens when it runs, and up to ~2.8k if it reads all its reference files. Until then it costs about 84 tokens; SKILL.md has 210 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~84
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Orchestra-Research/AI-Research-SKILLs at commit 773a529, republished under its MIT licence (© Orchestra-Research). 210 words, ~1,261 tokens.

Download SKILL.mdSave it as .claude/skills/faiss/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
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
tags
RAG, FAISS, Similarity Search, Vector Search, Facebook AI, GPU Acceleration, Billion-Scale, K-NN, HNSW, High Performance, Large Scale
dependencies
faiss-cpu, faiss-gpu, numpy

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

python
# L2 (Euclidean) distance
index = faiss.IndexFlatL2(d)

# Inner product (cosine similarity if normalized)
index = faiss.IndexFlatIP(d)

# Slowest, most accurate
2. IVF (inverted file) - Fast approximate
python
# Create quantizer
quantizer = faiss.IndexFlatL2(d)

# IVF index with 100 clusters
nlist = 100
index = faiss.IndexIVFFlat(quantizer, d, nlist)

# Train on data
index.train(vectors)

# Add vectors
index.add(vectors)

# Search (nprobe = clusters to search)
index.nprobe = 10
distances, indices = index.search(query, k)
3. HNSW (Hierarchical NSW) - Best quality/speed
python
# HNSW index
M = 32  # Number of connections per layer
index = faiss.IndexHNSWFlat(d, M)

# No training needed
index.add(vectors)

# Search
distances, indices = index.search(query, k)
4. Product Quantization - Memory efficient
python
# PQ reduces memory by 16-32×
m = 8   # Number of subquantizers
nbits = 8
index = faiss.IndexPQ(d, m, nbits)

# Train and add
index.train(vectors)
index.add(vectors)

Save and load

python
# Save index
faiss.write_index(index, "large.index")

# Load index
index = faiss.read_index("large.index")

# Continue using
distances, indices = index.search(query, k)

GPU acceleration

python
# Single GPU
res = faiss.StandardGpuResources()
index_cpu = faiss.IndexFlatL2(d)
index_gpu = faiss.index_cpu_to_gpu(res, 0, index_cpu)  # GPU 0

# Multi-GPU
index_gpu = faiss.index_cpu_to_all_gpus(index_cpu)

# 10-100× faster than CPU

LangChain integration

python
from langchain_community.vectorstores import FAISS
from langchain_openai import OpenAIEmbeddings

# Create FAISS vector store
vectorstore = FAISS.from_documents(docs, OpenAIEmbeddings())

# Save
vectorstore.save_local("faiss_index")

# Load
vectorstore = FAISS.load_local(
    "faiss_index",
    OpenAIEmbeddings(),
    allow_dangerous_deserialization=True
)

# Search
results = vectorstore.similarity_search("query", k=5)

LlamaIndex integration

python
from llama_index.vector_stores.faiss import FaissVectorStore
import faiss

# Create FAISS index
d = 1536
faiss_index = faiss.IndexFlatL2(d)

vector_store = FaissVectorStore(faiss_index=faiss_index)

Best practices

  1. Choose right index type - Flat for <10K, IVF for 10K-1M, HNSW for quality
  2. Normalize for cosine - Use IndexFlatIP with normalized vectors
  3. Use GPU for large datasets - 10-100× faster
  4. Save trained indices - Training is expensive
  5. Tune nprobe/ef_search - Balance speed/accuracy
  6. Monitor memory - PQ for large datasets
  7. Batch queries - Better GPU utilization

Performance

Index TypeBuild TimeSearch TimeMemoryAccuracy
FlatFastSlowHigh100%
IVFMediumFastMedium95-99%
HNSWSlowFastestHigh99%
PQMediumFastLow90-95%

Resources

© Orchestra-Research, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in 15-rag/faiss of Orchestra-Research/AI-Research-SKILLs.

  • SKILL.md
  • references/index_types.md

Open the folder on GitHubat commit 773a529

Used in 6 other repositories

We found 6 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 6 other GitHub owners. This page covers the copy in Orchestra-Research/AI-Research-SKILLs, which our catalogue first saw on October 7, 2026.

Compare with similar skills

FAISS Similarity Search next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

FAISS Similarity Search compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
FAISS Similarity Search this skillOrchestra-Research/AI-Research-SKILLs13k6 repos~1.3kAutomated safety check: PassMIT
DBoracle/skills876—~1.4kAutomated safety check: PassUPL-1.0
Langchain RAGlangchain-ai/langchain-skills1.3k—~3.9kAutomated safety check: PassMIT
Neo4j Graphrag Skillneo4j-contrib/neo4j-skills114—~4.2kAutomated safety check: NotesMIT
Retail Product Search Agentgoogle/adk-recipes10k—~3kAutomated safety check: PassApache-2.0
RAG Company Knowledge AssistantHermes-brasil/hermes-brasil153—~1.1kAutomated safety check: PassMIT

Similar skills

  • DB

    oracle/skills

    Official

    Oracle Database guidance for SQL, PL/SQL, SQLcl, ORDS, Oracle Vector SDK, administration, app development, performance, security, migrations, and agent-safe database workflows.

    876 GitHub stars~1.4k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • Langchain RAG

    langchain-ai/langchain-skills

    Official

    INVOKE THIS SKILL when building ANY retrieval-augmented generation (RAG) system.

    1.3k GitHub stars~3.9k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Neo4j Graphrag Skill

    neo4j-contrib/neo4j-skills

    Build GraphRAG retrieval pipelines on Neo4j using the neo4j-graphrag Python package (v1.22.0+).

    114 GitHub stars~4.2k tokensUpdated 2 days ago
    Knowledge ManagementAuto-check: notes
  • Retail Product Search Agent

    google/adk-recipes

    Official

    Builds a retail product search agent on Google Cloud, from catalog ingestion into BigQuery and Vector Search to ADK scaffolding, evaluation and Cloud Run deployment.

    10k GitHub stars~3k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • RAG Company Knowledge Assistant

    Hermes-brasil/hermes-brasil

    Portuguese guide to building a retrieval-augmented generation assistant over a company's documents, with embeddings, section-based chunking, retrieval and a client workflow.

    153 GitHub stars~1.1k tokensUpdated 4 days ago
    AI & LLM EngineeringAuto-check passed
  • RAG Architect

    Jeffallan/claude-skills

    Designs retrieval-augmented generation systems: document chunking, embeddings, vector store setup, hybrid search, reranking and retrieval evaluation, with checks at each step.

    12k GitHub stars~2k tokensUpdated 5 days ago
    AI & LLM EngineeringAuto-check passed

More from Orchestra-Research/AI-Research-SKILLs

All 96 skills in this repo
  • AudioCraft Audio Generation

    Orchestra-Research/AI-Research-SKILLs

    Generates music from text descriptions with MusicGen and sound effects with AudioGen, using Meta's AudioCraft PyTorch library with melody and style conditioning.

    13k GitHub starsUsed in 8 repos~3.9k tokens
    Auto-check passed
  • LLM Benchmarking with lm-evaluation-harness

    Orchestra-Research/AI-Research-SKILLs

    Runs lm-evaluation-harness to benchmark language models on academic suites such as MMLU, GSM8K and HumanEval, compare models and track training checkpoints.

    13k GitHub starsUsed in 8 repos~3k tokens
    Auto-check passed
  • Segment Anything Model Guide

    Orchestra-Research/AI-Research-SKILLs

    Guide to using Meta's Segment Anything Model for zero-shot image segmentation with point, box or mask prompts, or automatic mask generation.

    13k GitHub starsUsed in 8 repos~3.3k tokens
    Auto-check passed
  • Chroma Vector Database

    Orchestra-Research/AI-Research-SKILLs

    Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.

    13k GitHub starsUsed in 7 repos~2.3k tokens
    Auto-check passed
  • CLIP Image-Text Matching

    Orchestra-Research/AI-Research-SKILLs

    Explains OpenAI's CLIP model for zero-shot image classification, image-text similarity, semantic image search and content moderation, with install steps and code patterns.

    13k GitHub starsUsed in 7 repos~1.7k tokens
    Auto-check passed
  • Whisper Speech Recognition

    Orchestra-Research/AI-Research-SKILLs

    Transcribes audio with OpenAI's Whisper: 99 languages, translation to English, language detection, six model sizes and word-level timestamps, from Python or the CLI.

    13k GitHub starsUsed in 7 repos~1.9k tokens
    Auto-check: notes

Questions about FAISS Similarity Search

What does FAISS Similarity Search do?

Sets up FAISS for fast nearest-neighbor search over large collections of dense vectors, choosing between Flat, IVF, HNSW and product quantization indexes. FAISS is Facebook AI Research's C++ library, with Python bindings, for similarity search and clustering of dense vectors at the scale of millions or billions. The skill says when it fits: large vector sets, GPU acceleration, pure vector similarity with no metadata filtering, high throughput, or offline batch work on embeddings.

When should I use FAISS Similarity Search?

FAISS Similarity Search fits situations like: building fast k-nearest-neighbor search over millions of embeddings; choosing between Flat, IVF and HNSW indexes for a dataset size; cutting the memory use of a large vector index with product quantization; moving a vector index to the GPU for faster queries.

How do I install FAISS Similarity Search in Claude Code?

Run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill faiss -a claude-code`. Or copy the skill folder (15-rag/faiss in Orchestra-Research/AI-Research-SKILLs) into .claude/skills/faiss in your project. Claude Code loads it when a task matches its description.

How do I install FAISS Similarity Search in Codex?

Run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill faiss -a codex`. Or copy the skill folder (15-rag/faiss in Orchestra-Research/AI-Research-SKILLs) into .agents/skills/faiss in your project. Codex loads it when a task matches its description.

Can I use FAISS Similarity Search in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill faiss -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/faiss, .gemini/skills/faiss, .github/skills/faiss and .opencode/skills/faiss in your project.

What does FAISS Similarity Search need to run?

Going by SKILL.md and its folder, FAISS Similarity Search needs the command-line tools its instructions call (pip). Our summary lists: Python with `faiss-cpu` installed; NumPy.

Does FAISS Similarity Search access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is FAISS Similarity Search safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does FAISS Similarity Search use?

FAISS Similarity Search is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does FAISS Similarity Search use?

About 1.3k tokens (SKILL.md is roughly 5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.5k tokens, read only when the agent opens those files.

What are the alternatives to FAISS Similarity Search?

Skills that share tags, products or a category with FAISS Similarity Search: DB (oracle/skills, 876 stars), Langchain RAG (langchain-ai/langchain-skills, 1.3k stars), Neo4j Graphrag Skill (neo4j-contrib/neo4j-skills, 114 stars) and Retail Product Search Agent (google/adk-recipes, 10k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains FAISS Similarity Search?

Orchestra-Research (a GitHub organization) maintains it in Orchestra-Research/AI-Research-SKILLs, which has 13,374 GitHub stars. The repository holds 96 skills in this directory. The repository was last updated on June 16, 2026.

Source: Orchestra-Research/AI-Research-SKILLs on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.