---
name: "faiss-gpu-similarity-search"
description: "Achieve maximum throughput KNN search over hundreds of millions of vectors using FAISS."
metadata:
  author: "Meta Research"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "build faiss ivf pq index"
  - "transfer faiss index to gpu"
  - "tune faiss nprobe"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# FAISS GPU Accelerated Vector Similarity Search

Configures Meta FAISS: IndexFlatL2, IndexIVFFlat, IndexIVFPQ with product quantization, transferring indexes to CUDA GPUs, tuning nprobe search parameters, and measuring recall trade-offs.

## When to Invoke
Invoke this skill whenever you need to:
- build faiss ivf pq index
- transfer faiss index to gpu
- tune faiss nprobe

## Execution SOP & Rules
1. Construct index pipeline: quantizer = faiss.IndexFlatL2(d); index = faiss.IndexIVFPQ(quantizer, d, nlist, m, 8).
2. Train index on representative dataset sample: index.train(training_vectors).
3. Move to GPU: gpu_res = faiss.StandardGpuResources(); gpu_index = faiss.index_cpu_to_gpu(gpu_res, 0, index).
4. Set search accuracy: gpu_index.nprobe = 16 before running gpu_index.search(queries, k).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
