ML//RAG//HNSW
HNSW (Hierarchical Navigable Small World) is the dominant algorithm for approximate nearest neighbor (ANN) search. It builds a multi-layer graph: the upper layers have long-range connections (fast, coarse search) and the lower layers short-range ones (precise, local search).
HNSW (Hierarchical Navigable Small World) is the dominant algorithm for approximate nearest neighbor (ANN) search. It builds a multi-layer graph: the upper layers have long-range connections (fast, coarse search) and the lower layers short-range ones (precise, local search).
It is the core search algorithm inside most vector databases, where a vector search is a walk through its graph: Pinecone, Weaviate, Qdrant and pgvector all use HNSW or a variant of it. It is orders of magnitude faster than exact search, at the price of being approximate: a recall of 95 to 99% is typical.