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}")