Down with the Hierarchy: The 'H' in HNSW Stands for "Hubs"

Blaise Munyampirwa, Vihan Lakshman, Benjamin Coleman

TL;DR

This paper challenges the necessity of the hierarchical structure in the popular HNSW algorithm for approximate nearest neighbor (ANN) search. Through extensive benchmarking, the authors demonstrate that a flat graph structure achieves comparable performance in terms of latency and recall on high-dimensional datasets, while significantly reducing memory overhead. They propose the "Hub Highway Hypothesis" to explain this phenomenon, suggesting that high-dimensional data naturally forms a "highway" of highly connected "hub" nodes that facilitate efficient traversal, rendering the explicit hierarchy redundant.

What Problem Does This Paper Address?

Approximate Nearest Neighbor (ANN) search is a fundamental problem in modern machine learning, crucial for tasks like recommendation systems and information retrieval. As neural networks generate increasingly high-dimensional vector embeddings, efficient and scalable ANN search becomes critical. The Hierarchical Navigable Small World (HNSW) algorithm has become a dominant paradigm for this task, leveraging a multi-layered graph structure to speed up search. However, the necessity of this hierarchy, especially in the context of high-dimensional data, has been questioned. Prior studies suggested the hierarchy might only be beneficial for low-dimensional data, but a comprehensive, large-scale investigation was lacking. This paper aims to rigorously benchmark HNSW against a flat graph structure to determine if the hierarchy is truly necessary for high-dimensional ANN search and to understand why it might not be.

Methods

The core of this research involves extensive empirical benchmarking. The authors compare the performance of the standard HNSW algorithm against a "flat" Navigable Small World (NSW) graph. They implement a version of HNSW called "FlatNav" which essentially uses only the base layer of the HNSW graph. To ensure a fair comparison, they use the same underlying code for graph construction where possible, and meticulously control experimental parameters.

Beyond benchmarking, the paper introduces and investigates the "Hub Highway Hypothesis." This hypothesis posits that in high-dimensional spaces, proximity graphs naturally develop a structure where a small subset of "hub" nodes become highly connected and frequently traversed, forming a "highway" that guides search queries efficiently. To support this, they analyze:

  • Node Access Distribution: Examining how frequently each node in the graph is visited during search to identify potential hubs.
  • Hub Connectivity: Investigating whether these identified hub nodes are more interconnected among themselves than with non-hub nodes.
  • Query Traversal Patterns: Tracking the sequence of nodes visited by queries to see if they preferentially utilize these hub "highways" early in the search process.

Datasets

The study utilizes a combination of real-world and synthetic datasets to provide a comprehensive evaluation:

  • BigANN Benchmarks: Large-scale datasets (up to 100 million vectors) including BigANN, Microsoft SpaceV, and Yandex DEEP. These are used for evaluating performance on massive datasets.
  • ANN Benchmarks: A suite of datasets from the ANN Benchmarks project (Aumüller et al., 2018), including GloVe, NYTimes, GIST, SIFT, and MNIST. These are used for a broader evaluation across different data types and dimensions.
  • Synthetic Datasets: Datasets generated from standard normal distributions (both angular and L2 distances) across various dimensions (e.g., 16, 32, 64, 128, 256, 1024, 1536). These are crucial for isolating the effect of dimensionality and distance metrics.
  • LLM Embeddings: The MSMARCO dataset, using embeddings from the all-MiniLM-L6-v2 model, is used to test the hypothesis on real-world large language model embeddings.

Key Insights and Ideas

  • Hierarchy is Redundant in High Dimensions: The most striking insight is that for high-dimensional datasets (typically d > 32), the hierarchical layers of HNSW offer no significant advantage in terms of search latency or recall. This directly challenges a core assumption of the HNSW algorithm.
  • The "Hub Highway Hypothesis": The paper proposes that the natural emergence of "hub" nodes in high-dimensional proximity graphs creates an intrinsic "highway" structure. This highway allows for efficient traversal, effectively replacing the role of the explicit hierarchy in guiding search.
  • Hubness Drives Connectivity: The study provides strong evidence that hubness, a phenomenon where a few nodes are disproportionately frequent in nearest neighbor lists, is the underlying cause for the formation of these highway structures.
  • Memory Savings are Significant: Removing the hierarchy not only maintains performance but also leads to substantial reductions in memory usage during index construction, making ANN search more accessible and efficient.
  • Dimensionality is Key: The benefit of the hierarchy appears to be strongly tied to dimensionality. For low-dimensional data (d < 32), the hierarchy does provide a speedup, aligning with previous findings.

Key Results

  • Performance Parity: FlatNav achieved nearly identical P50 and P99 latency and recall performance compared to HNSW on high-dimensional datasets (e.g., BigANN-100M, Yandex-DEEP-100M).
  • Memory Reduction: FlatNav demonstrated significant memory savings during index construction, with reductions of up to 38% for BigANN and 39% for Yandex DEEP compared to hnswlib.
  • Hubs are Highly Connected: Statistical tests (Mann-Whitney U-test and t-test) showed that identified hub nodes are significantly more likely to connect to other hubs than random nodes, supporting the "highway network" idea.
  • Queries Use Highways Early: Analysis of query traversal patterns revealed that queries spend a disproportionately high percentage of their search time in hub nodes early on, indicating they are actively using the highway structure.
  • Hubness is Metric-Dependent: The skewness of node access distribution, indicative of hubness, was more pronounced for L2 distance metrics compared to cosine distance, which is known to have anti-hub properties.

Limitations and Future Work

  • Theoretical Formulation: While strong empirical evidence is presented, a formal theoretical framework for the Hub Highway Hypothesis and its impact on query latency is still lacking. Future work could focus on developing such bounds, though the authors acknowledge the difficulty due to engineering and hardware factors.
  • Engineering Optimizations: The authors note that differences in software implementations (hnswlib vs. FlatNav) might contribute to some of the observed memory savings. Future work could involve further optimizing FlatNav for even greater efficiency.
  • Initialization Strategies: The paper suggests that the Hub Highway Hypothesis explains why modern ANN search doesn't heavily rely on complex initialization strategies, unlike older methods for low-dimensional data. Future research could explore how to best leverage or adapt existing initialization techniques in light of this hypothesis.
  • Link Pruning and Traversal: The authors conjecture that future algorithmic improvements in graph-based ANNS should focus on optimizing connectivity and traversal costs in the base graph, such as through link pruning and novel search algorithm designs.

Summary updated

BibTeX
@inproceedings{munyampirwa2026down,
  author = {Blaise Munyampirwa and Vihan Lakshman and Benjamin Coleman},
  title = {{Down with the Hierarchy: The 'H' in HNSW Stands for "Hubs"}},
  booktitle = {ECIR},
  year = {2026},
  doi = {10.1007/978-3-032-21324-2\_3},
}
Figure