SESK: Stuff Everyone Should Know · sesk.info/ai-hnsw-approximate-search
To search millions of embeddings fast, what do vector indexes like HNSW usually trade away?
Exactness. They find approximate nearest neighbors.
- The ability to store numbers
- Support for text
- 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.
Approximate nearest neighbor is how I find my car in a parking lot. Close enough, then I press the beeper.
Like this card?
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.
- 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.
More stuff everyone should know
That's stuff everyone should know.