EasyDeepLearn

What is IVF-PQ and when do you use it?

hard

Answer

  • IVF (Inverted File): cluster all vectors with k-means into ncoarse buckets; at query time, search only the top-nprobe closest buckets.
  • PQ (Product Quantization): split each vector into m subvectors, quantize each into 256 codes → each vector stored as m bytes.
  • Combined IVF-PQ: dramatic memory savings (~64x vs raw fp32), fast search, some recall loss.
  • Use it when you have 100M+ vectors and can't afford HNSW's memory.
  • Faiss's IVF-PQ is the workhorse for billion-scale retrieval at Meta, Spotify, etc.
Check yourself — multiple choice
  • IVF = HNSW
  • IVF: cluster + search top buckets; PQ: quantize subvectors to bytes → ~64× memory reduction; combined for billion-scale ANN
  • Only for exact search
  • No memory savings

IVF-PQ: coarse buckets + product quantization → billion-scale ANN with tight memory.

#vector-db#retrieval

Practise LLMs & GenAI

214 interview questions in this topic.

Related questions