HNSW Index Explainer
An HNSW index is a graph-based structure for approximate nearest neighbor search. Its name stands for hierarchical navigable small world. Each stored vector becomes a node connected to selected nearby nodes.
Upper layers contain fewer nodes and longer-range connections, allowing a query to cross the space quickly. Search descends through denser layers, repeatedly moving toward closer candidates until it explores a neighborhood in the bottom graph.
HNSW is widely used for vector retrieval because it can provide strong recall with low query latency. Construction and search parameters control connection density, build effort, and the number of candidates examined.
The graph can require substantial memory, and deletions or heavy filtering complicate traversal. Performance varies with dimension and clustering. Fair tests should include build time, update behavior, recall, latency percentiles, memory, and filtered queries.
An HNSW index connects vectors in layered proximity graphs so search can move quickly from broad regions to close neighbors.
Key terms include HNSW, proximity graph, hierarchy, node, edge, candidate list, recall, build parameter and search parameter.
Sparse upper layers provide long jumps across the vector space.
Dense lower layers refine the route among nearby candidates.
More connections and larger candidate lists can improve recall while increasing memory and work.
Updates, deletions, and metadata filters need production-specific testing.
Explore more "Explainers"
Discover additional explainers across politics, science, business, technology, and other fields. Each explainer breaks down a complex idea into clear, everyday language—helping you better understand how major concepts, systems, and debates shape the world around us.
