HNSW with Accuracy Guarantees Using Graph Spanners

Minghao Li, Raghav Mittal, Sanjivni Rana, Suraj Shetiya, Gautam Das +1 more
7/2/2026
cs.DBcs.CLcs.IR

No confident code implementation found for this paper.

Abstract

Hierarchical Navigable Small World (HNSW) graphs serve as the industry standard due to their logarithmic complexity and strong empirical performance. However, HNSW relies on greedy graph traversal, a heuristic that provides no theoretical guarantees of correctness.

Show full abstract

In this paper, we propose a novel "Certify-then-Rectify" framework that bridges the gap between the speed of heuristic search and the rigor of exact retrieval. Rather than discarding HNSW, our approach first employs a distribution-free statistical certifier to dynamically evaluate the quality of a standard HNSW search with minimal overhead. If certification indicates that the retrieved neighbors are of low quality, the framework safely escalates to a rigorous exact recovery algorithm. To make this exact recovery computationally feasible, we reinterpret the HNSW graph as a geometric spanner and utilize Extreme Value Theory to stochastically estimate its maximum empirical stretch factor. This allows us to mathematically bound the maximum distance of true nearest neighbors. Extensive evaluations on benchmark datasets demonstrate that our tiered framework delivers the average-case speed of HNSW while ensuring the worst-case correctness of exact search and outperforming other applicable approaches.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{li2026hnsw,
  title  = {HNSW with Accuracy Guarantees Using Graph Spanners},
  author = {Minghao Li and Raghav Mittal and Sanjivni Rana and Suraj Shetiya and Gautam Das and Nick Koudas},
  year   = {2026},
  eprint = {2607.02338},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2607.02338v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2607.02338.svg)](https://codeofpaper.com/paper/2607.02338)

Discussion