faiss

Provides efficient nearest-neighbor search and vector indexing for ML workflows.

1|1|Updated May 9, 2026
One-click install
npx skills add https://github.com/ldzhhxx/Hermes_offline_v2 --skill faiss-ldzhhxx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: faiss
Source: https://github.com/ldzhhxx/Hermes_offline_v2/tree/main/hermes-agent/optional-skills/mlops/faiss
Command: npx skills add https://github.com/ldzhhxx/Hermes_offline_v2 --skill faiss-ldzhhxx

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill provides the FAISS library, a powerful tool for efficient similarity search and clustering of dense vectors. It addresses the need for fast, large-scale vector retrieval and k-NN search, ideal for high-performance applications with billions of vectors.

Core Features & Use Cases

  • Efficient Similarity Search: Offers fast k-NN search on large vector datasets, supporting billions of vectors.
  • GPU Acceleration: Supports GPU acceleration for high throughput and low latency.
  • Index Types: Includes various index types (Flat, IVF, HNSW) for different search needs and performance characteristics.
  • Use Case: Ideal for high-performance applications requiring fast k-NN search, large-scale vector retrieval, or pure similarity search without metadata.

Quick Start

Install the faiss skill and use it to search for the k-nearest neighbors of a vector:

pip install faiss-cpu
import faiss
import numpy as np
d = 128  # Dimension
nb = 1000  # Number of vectors
vectors = np.random.random((nb, d)).astype('float32')
index = faiss.IndexFlatL2(d)
index.add(vectors)
k = 5  # Number of neighbors
query = np.random.random((1, d)).astype('float32')
distances, indices = index.search(query, k)
print(f"Nearest neighbors: {indices}")
print(f"Distances: {distances}")

Frequently Asked Questions about faiss

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

FAQPage Schema
How do I perform fast vector similarity search on large datasets?

Vector similarity search on large datasets is handled by indexing dense vectors with FAISS, enabling fast k-NN retrieval across billions of vectors. It supports various index types like Flat, IVF, and HNSW for different performance needs.

Can I use GPU acceleration for large-scale k-NN search?

Yes, large-scale k-NN search supports GPU acceleration using faiss-gpu. This provides high throughput and low latency when querying dense vectors, significantly speeding up retrieval compared to CPU-based processing.

What is the best way to find k-nearest neighbors for dense vectors?

The best way to find k-nearest neighbors for dense vectors is using an indexed FAISS structure like IndexFlatL2. You add your numpy float32 vectors to the index and execute a search query to retrieve distances and indices.

Do I need numpy to perform similarity search without metadata?

Yes, you need numpy to perform similarity search without metadata because vector operations require numpy arrays formatted as float32. The FAISS library relies on numpy to structure dense vectors before indexing and searching.

Does FAISS support different index types for vector retrieval?

FAISS supports different index types for vector retrieval, including Flat, IVF, and HNSW. These index index types allow you to balance search speed, accuracy, and memory usage based on your specific similarity search requirements.