To search millions of embeddings fast, what do vector indexes like HNSW usually trade away?

Exactness. They find approximate nearest neighbors.

Start playing free

  1. The ability to store numbers
  2. Support for text
  3. A guarantee of the exact nearest match ✔

Why: Comparing a query to every stored vector is slow. HNSW builds layered graphs of nearby points and hops through them, finding very close matches quickly but not always the exact closest one.

Huh, didn't know that: HNSW stands for Hierarchical Navigable Small World, and its search time scales roughly logarithmically.

The dad joke
Approximate nearest neighbor is how I find my car in a parking lot. Close enough, then I press the beeper.
Like this card?
Play the game

References

Answer: A guarantee of the exact nearest match. Comparing a query to every stored vector is slow. HNSW builds layered graphs of nearby points and hops through them, finding very close matches quickly but not always the exact closest one.

  1. Malkov and Yashunin, Efficient and robust approximate nearest neighbor search using HNSW graphs (arXiv 1603.09320) arxiv.org/abs/1603.09320
    approximate K-nearest neighbor search based on navigable small world graphs with controllable hierarchy
    Checked 2026-10-10.

Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.

Test yourself in the game