Skip to content
Preptima
hardConceptDesignMidSeniorStaff

How do you choose between a flat index, IVF and HNSW for vector search?

6 min readUpdated 2026-08-15

Answer

Short answer

Flat search is exact and scales linearly, so it suits small collections and supplies ground truth for the rest.IVF trades recall for speed by probing a subset of clusters, HNSW does it with a graph at higher memory and build cost, and in both recall is a parameter you set rather than inherit.

Keep vector index explicit in the answer because that is the concept the interviewer is actually trying to test. A good vector index explanation names the trade-off, the failure mode, and the evidence you would use before choosing. Use vector index once more at the decision point so the answer reads as judgement rather than a detached example.

Keep vector index explicit in the answer because that is the concept the interviewer is actually trying to test. A good vector index explanation names the trade-off, the failure mode, and the evidence you would use before choosing.

Was this answer helpful?

Likely follow-ups

  • Which of these parameters can you change without rebuilding the index?
  • Where does product quantisation fit, and what does it cost you?
  • How does a high rate of deletions change your choice?
  • You need a metadata filter that removes 99 per cent of the corpus. Does approximate search still help?

Related questions

Further reading

Related Topics