Skip to content
The Plain Paper

Method

Hierarchical Navigable Small World (HNSW)

Hierarchical Navigable Small World (HNSW) is a graph index for approximate nearest-neighbor search. It organizes data points into layers so search can move quickly across long distances, then refine its results among closer points.

What it is

HNSW is a graph-based index for finding data points close to a query under a distance function. Each point is a vertex, and edges connect points selected for their proximity. Its layers contain nested subsets of the points, with sparser upper layers and all points in the bottom layer.123

How it works

To build the index, HNSW inserts points one at a time. It randomly assigns each point a highest layer, with the probability of appearing in a layer decreasing exponentially at higher layers; the point is then included in that layer and the layers below it. At each layer, the new point is linked to selected neighbors, using a heuristic to choose links.14

To search, HNSW starts at an entry point in the top layer and follows edges toward points closer to the query. When it reaches a local minimum at that layer, it descends to the next layer from the current point and searches again. It repeats this process down to the bottom layer, where it refines the nearest-neighbor results.43

Where it came from

Yu. A. Malkov and D. A. Yashunin introduced Hierarchical NSW in their 2016 paper, “Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs.” It extends Navigable Small World graphs by adding layers that separate links by distance scale. The layered design also draws on the probability skip list, introduced by William Pugh in 1990; NSW work preceded HNSW.14

Versions and relatives

AQR-HNSW is a framework that adds density-aware adaptive quantization, multi-stage reranking, and quantization-optimized SIMD implementations to HNSW. MESS uses a multi-graph HNSW index over perturbed binary codes as part of a private semantic-search system.56

Strengths and limits

HNSW uses a fully graph-based index and does not need a separate search structure for coarse search. Its layered search and distance-scale separation are intended to improve performance over a Navigable Small World graph; the original description says this allows logarithmic complexity scaling.1

The graph can require substantial memory. Increasing the number of connections can improve recall and accuracy, but uses more memory and can slow index building and search; considering more candidates during construction can improve graph quality but takes longer. Considering more candidates at search time can improve accuracy while increasing search time.3

How recent papers use it

In Thetis++, HNSW is used for approximate nearest-neighbor search over entity embeddings to prefilter tables for semantic search.7

SIMQ uses HNSW as its default graph-based approximate nearest-neighbor index.8

UniGraph uses HNSW as its dense index and as a dense candidate generator.9

Papers that mention Hierarchical Navigable Small World (HNSW)

  1. 19 Nov 2026Introduced here

    Exploring Semantic Table Search in Data Lakes

    HNSW is used for approximate nearest-neighbor search over entity embeddings to prefilter tables.

  2. 17 Nov 2026Used

    SIMQ: A Single Graph-based Index for Multi-Vector Query

    HNSW is the default graph-based approximate nearest-neighbor index used by SIMQ.

  3. 16 Nov 2026Used

    UniGraph: A Unified Graph-based Index for Dynamic Hybrid Dense-Sparse Vector Retrieval

    It is used as the dense index and as a dense candidate generator.

Sources

  1. 1Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphsPaper abstract on arXiv
  2. 2A Comprehensive Survey and Experimental Comparison of Graph-Based Approximate Nearest Neighbor Searcharxiv.org
  3. 3HNSW | Milvus Documentationmilvus.io
  4. 4Hierarchical Navigable Small Worlds (HNSW) | Pineconepinecone.io
  5. 5AQR-HNSW: Accelerating Approximate Nearest Neighbor Search via Density-aware Quantization and Multi-stage Re-rankingPaper abstract on arXiv
  6. 6MESS: Fast and Private Semantic Search on Multi-Graph HNSWPaper abstract on arXiv
  7. 7Exploring Semantic Table Search in Data LakesPaper explained on this site
  8. 8SIMQ: A Single Graph-based Index for Multi-Vector QueryPaper explained on this site
  9. 9UniGraph: A Unified Graph-based Index for Dynamic Hybrid Dense-Sparse Vector RetrievalPaper explained on this site

Every paragraph above was checked against the sources it cites before it was published.