Skip to main content
FAISS is a library for efficient similarity search and clustering of dense vectors. It is designed to work with large-scale datasets and provides a high-performance search engine for vector data. FAISS is optimized for memory usage and search speed, making it an excellent choice for production environments.

Usage

Installation

To use FAISS in your mem0 project, you need to install the appropriate FAISS package for your environment:

Config

Here are the parameters available for configuring FAISS:

Performance Considerations

FAISS offers several advantages for vector search:
  1. Efficiency: FAISS is optimized for memory usage and speed, making it suitable for large-scale applications.
  2. Offline Support: FAISS works entirely locally, with no need for external servers or API calls.
  3. Storage Options: Vectors can be stored in-memory for maximum speed or persisted to disk.
  4. Multiple Index Types: FAISS supports different index types optimized for various use cases (though mem0 currently uses the basic flat index).

Distance Strategies

FAISS in mem0 supports three distance strategies:
  • euclidean: L2 distance, suitable for most embedding models
  • inner_product: Dot product similarity, useful for some specialized embeddings
  • cosine: Cosine similarity, best for comparing semantic similarity regardless of vector magnitude
When using cosine or inner_product with normalized vectors, you may want to set normalize_L2=True for better results.