Skip to content
Quantoros

What is the difference between IVF and HNSW indexing?

NLPLevel: IntermediateIndexing & Search Algorithms

What is the difference between IVF and HNSW indexing?

Hints
  • What does closeness mean in this representation and metric?
  • Check normalization, exact versus approximate search and alignment with the training objective.

Answer

HNSWIVF (Inverted File Index)
StructureNavigable graphVoronoi cell partitioning
Query speedVery fastFast (with IVF-PQ, very fast)
MemoryHighLower (especially with PQ compression)
RecallVery highGood with enough probes
InsertionsIncrementalBatch (requires rebuild)
Best forGeneral use, real-time insertionsBillions of vectors, memory-constrained

IVF-PQ (Product Quantization): compresses vectors by encoding each sub-vector as an index into a learned codebook — reduces 1536×4 bytes → 96 bytes per vector. Enables billions of vectors in RAM.

Source and licence: JustInCache & contributors — Awesome AI Interviews · Apache-2.0

Related questions