A guide to best-practices for FAISS Vector DBs

Table of Contents

Introduction

The FAISS (Facebook AI Similarity Search) vector database service built into the HyperFlow core provides high-performance similarity search for embedding vector spaces, the most-common kind of knowledge database for RAG-based AI applications. This guide covers creating and searching FAISS vector databases, with a special focus on using Product Quantization (PQ) for memory-efficient operations with large embedding models.

Overview

FAISS is designed for efficient similarity search on dense vector embeddings, making it ideal for RAG (Retrieval-Augmented Generation) applications. The service in HyperFlow offers:

Creating a FAISS Vector Database

Basic Settings

When creating a FAISS vector database, start with these fundamental parameters:

Parameter Description Recommendation
Index Type Determines the underlying data structure For <100K vectors: “HNSW”For >100K vectors: “Inverted index”
Metric How similarity is measured For most LLM embeddings: “Cosine”
Notes Documentation for this vector DB Include model information and data source
Tags Categorization labels Use consistent naming for easier filtering

Index Types

Inverted Index (IVF)

Best for larger collections (>100K vectors), this index partitions vectors into clusters for faster search.

Parameter Description Recommendation
nlist Number of partitions/clusters Aim for √n where n is vector countStart with ~100 for 10K vectors~1000 for 1M vectors

Hierarchical Navigable Small World (HNSW)