1 min read 49 words Updated Sep 24, 2026 Created Sep 24, 2026
#ml#vector

FAISS is a Python library by Facebook for similarity search and storing vectors.

Installing the CPU-version: pip install faiss-cpu

Use IndexFlatL2 for euclidean distance and IndexFlatIP for cosine similarity.

Searching

Returning the distanaces and indicies of the the k=3 nearest neighbours:

distances, indices = index.search(query, k=3)