What is the difference between HNSW and IVF for vector search?
RAG & Vector DB Interview: HNSW, IVF, Product Quantization, ANN Search Explained
Audio flashcard · 0:27Nortren·
What is the difference between HNSW and IVF for vector search?
0:27
HNSW builds a layered graph for logarithmic-time greedy search, giving excellent recall and low latency but high memory use, typically 1.5x to 2x the raw vector size. IVF partitions vectors into clusters and searches only the nearest ones, using less memory and indexing faster but with lower recall at the same latency. HNSW dominates for small-to-medium datasets up to a few hundred million vectors, while IVF combined with product quantization wins at billion-plus scale where memory becomes the hard constraint.
github.com