Inverted File with Product Quantization (IVF-PQ) is a two-stage algorithm for approximate nearest neighbor (ANN) search that dramatically reduces memory usage and accelerates retrieval in large-scale vector databases. The Inverted File (IVF) stage first clusters the dataset using an algorithm like k-means, creating a coarse partition. During a query, only vectors in the nearest clusters are examined, vastly reducing the search space. This is followed by the Product Quantization (PQ) stage, which compresses each vector into a compact code by splitting it into subvectors and quantizing each subspace independently, slashing storage requirements.
