Data & Retrieval

HNSW

also: approximate nearest neighbor · ANN index

The graph index behind most vector databases — approximate nearest-neighbor search in milliseconds.

Hierarchical Navigable Small World builds layered proximity graphs: sparse top layers for coarse navigation, dense bottom layers for precision. A query greedily descends toward its neighborhood, finding near-nearest neighbors in logarithmic hops instead of scanning every vector. The trade: excellent speed/recall, at the cost of memory and slower inserts — the default index in most vector stores.