179 questions
No questions match those filters.
What's actually different between HNSW, IVF, and flat search in a vector database?
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansThese three answer the same question — how do you find nearest neighbors without literally comparing against every vector — with different tradeoffs. Flat (brute-force) search does exactly that comparison against every vector in the collection: perfect recall, but linear cost, which makes it fine for a few thousand vectors and completely impractical past that.
IVF (Inverted File Index) clusters the vector space into buckets ahead of time, and at query time only searches the handful of buckets closest to the query — fast, but recall depends on the query’s true nearest neighbor actually being in one of the buckets that got searched; tuning how many buckets to check trades speed for recall directly. HNSW (Hierarchical Navigable Small World) builds a multi-layer graph over the vectors and navigates it from a coarse top layer down to a fine bottom layer, which in practice delivers the best speed-recall balance of the three and is why it’s the default in most production vector databases — the cost is memory, typically around double what an IVF index uses for comparable recall. The practical rule: default to HNSW, and reach for IVF specifically when memory is the tighter constraint than latency.