IVF — Inverted File index — is a cluster-based approach to approximate-nearest-neighbour search. It first partitions the vector space into regions using k-means clustering, assigns every stored vector to its nearest cluster centroid, and at query time searches only the clusters closest to the query rather than the entire dataset.
The structure works like a coarse table of contents. Each centroid owns a cell of the space and an associated list of the vectors in it. When a query arrives, the database finds the few nearest centroids and scans only their lists, skipping the vast majority of vectors. A parameter controls how many clusters to search — more clusters means higher recall but slower queries.
IVF suits large, disk-friendly workloads where HNSW’s memory demands become costly, since its inverted lists map naturally onto disk storage. It is frequently paired with product quantisation as IVF-PQ to compress vectors and shrink memory further. The main trade-off is that if a true neighbour sits in an unsearched cluster it will be missed, so tuning the number of clusters searched is key to balancing speed and accuracy.