faiss-gpu
A library for efficient similarity search and clustering of dense vectors (GPU support).
What it is and what it does
Faiss is a C++ library with Python bindings for efficient similarity search and vector clustering. It handles both exact and approximate nearest-neighbor queries on dense vectors, with GPU acceleration for speed-critical operations. The library trades off search quality, memory usage, training time, and query latency depending on the index type chosen—from simple baselines like flat L2 search to compressed quantization codes that scale to billions of vectors.
The GPU implementation accepts input from CPU or GPU memory and handles transfers automatically, making GPU indexes drop-in replacements for CPU equivalents. It supports L2 distance, dot product, and cosine similarity comparisons. The package is production-stable, actively maintained by Meta's AI Research group, and widely used in machine learning and information retrieval pipelines.
Use it for:
- Build a semantic search engine over embeddings from a language model by indexing vectors and querying for nearest matches.
- Cluster high-dimensional data (e.g., image embeddings) using Faiss's k-means or other clustering algorithms.
- Implement approximate nearest-neighbor search for recommendation systems handling large candidate item sets.
- Scale vector search to billions of items by using compressed quantization indexes that fit in GPU memory.
- Benchmark and tune index parameters for production similarity search workloads.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Faiss provides GPU-accelerated similarity search and clustering for dense vectors, supporting exact and approximate nearest-neighbor queries on datasets from memory to billions of vectors.
Yes, if you have an NVIDIA GPU and need fast similarity search or clustering on dense vectors. The library is production-stable, actively maintained, MIT-licensed, and has no known vulnerabilities. Install friction is moderate due to CUDA dependencies, but the performance gains for GPU-accelerated workloads justify the setup. Not suitable for CPU-only environments.
Install
faiss-gpu on PyPI
pip
pip install faiss-gpuuv
uv add faiss-gpupoetry
poetry add faiss-gpuInstalling faiss-gpu
Before you install
Medium install friction due to GPU dependencies: requires nvidia-cuda-runtime-cu12, nvidia-cublas-cu12, and nvidia-curand-cu12. Actively maintained with a recent release and strong community engagement (40741 stars).
License in practice
MIT license permits commercial and private use with minimal restrictions—you may use, modify, and distribute faiss-gpu freely as long as you include the license notice.
Quickstart
pip install faiss-gpu
import faiss
import numpy as np
index = faiss.IndexFlatL2(d)
index.add(vectors)
distances, indices = index.search(query_vectors, k)
Requires NVIDIA GPU with CUDA 12 support and nvidia-cuda-runtime-cu12, nvidia-cublas-cu12, nvidia-curand-cu12 installed; Linux x86_64 only.
Verify before relying
- Whether the package supports AMD ROCm as an alternative to CUDA (mentioned in description but not in runtime deps).
- Specific performance benchmarks or latency expectations for typical workloads.
- Memory overhead per index vector for different index types.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 5 — numpy, packaging, nvidia-cuda-runtime-cu12, nvidia-cublas-cu12, nvidia-curand-cu12 |
| Maintenance | actively maintained — 11 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 384,820/month — #7,065 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: faiss_gpu-1.15.0-cp310-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Keywords: search, nearest-neighbors, clustering, vectors, similarity, gpu, cuda
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
libcuvs-cu12GPU-accelerated vector search and clustering…
permissive · top 15,000 on PyPI
usearchUSearch provides approximate nearest-neighbor…
permissive · top 15,000 on PyPI
cuvs-cu12Provides GPU-accelerated approximate nearest…
permissive · top 15,000 on PyPI
simsimdSimSIMD provides SIMD-optimized kernels for…
permissive · top 5,000 on PyPI
llama-index-vector-stores-faissIntegrates FAISS vector storage with LlamaIndex…
permissive · top 15,000 on PyPI
fastclusterPerforms fast hierarchical agglomerative…
copyleft · top 15,000 on PyPI
annoyAnnoy searches for approximate nearest…
permissive · top 5,000 on PyPI
libcuml-cu12GPU-accelerated machine learning algorithms…
permissive · top 15,000 on PyPI
gensimGensim is a Python library for topic modeling,…
copyleft · top 5,000 on PyPI
pagefind-binPagefind-bin provides a precompiled binary…
permissive · top 5,000 on PyPI