HNSW
Also called Hierarchical Navigable Small World
The graph trick most vector databases use to find close matches fast without checking every item.
Think of it like
Finding a house by hopping between well-connected neighbors instead of knocking on every door in the city.
Example
When Pinecone or Qdrant returns your top matches in milliseconds over millions of vectors, HNSW is usually the reason.
How it actually works
HNSW builds a layered graph where each vector links to its nearest neighbors, with sparse express lanes on top for big jumps. A search drops in at the top, greedily walks toward the query, and descends layer by layer. It trades a small chance of missing the true nearest neighbor for enormous speed — you tune that trade with parameters like ef and M.
For product teams
It is why semantic search feels instant even at scale, and why more accuracy costs more memory and latency.
For engineers
A multi-layer proximity graph traversed greedily; recall and latency are tuned via ef_search, ef_construction, and M.
Related
- Approximate Nearest Neighbor — The most common way to do approximate nearest neighbor search.
- Vector database — Powers the search inside most vector databases.
Read anything AI without the jargon
Look up any term in plain English, or save terms as you read with the free Chrome extension.
Open DecoderAdd to Chrome