Skip to content

Variants of Beam Search for DiskANN

Viraj Agrawal, Kirankumar Shiragur

cs.DS

Abstract

Graph-based data structures such as DiskANN, HNSW, and NSG constitute the state of the art for large-scale approximate nearest-neighbor (ANN) search. Indyk and Xu introduced the notion of αα-reachable graphs, which include graphs built by DiskANN's slow-preprocessing construction, and proved that greedy search achieves an approximation factor of α+1α−1\tfrac{α+1}{α-1}. Independently, Al-Jazzazi et al. proposed adaptive beam search (ABS) with a relaxation parameter γ>0γ> 0, showing a 2γ\tfrac{2}γ approximation on navigable graphs (α≈1α\approx 1), where greedy search admits no guarantees. In this work, we unify and generalize these results by proving that ABS with parameter γγ on αα-reachable graphs achieves an approximation of α+1α(γ+1)−1\tfrac{α+1}{α(γ+1)-1} for any metric. Moreover, on sorted αα-reachable graphs (introduced by Gollapudi et al.) under the ℓ2\ell_2 metric, we obtain the tighter bound max⁡(αα(γ+1)−1,α2+1α2(γ+1)−1)\max\bigl(\tfracα{α(γ+1)-1}, \tfrac{α^{2}+1}{α^{2}(γ+1)-1}\bigr). Beyond these theoretical results, we design a beam predictor using features inspired by fine-grained analysis of ABS, trained via a constrained objective that minimizes mean distance computations subject to a target recall. On three 100-million-point benchmarks, using graphs built by DiskANN's practical construction, beam predictor lowers mean query latency on SSD-resident indices at matched recall by up to 29.6%29.6\% relative to classical beam search (CBS). Relative to ABS, it is faster in 1111 of 1515 settings, by up to 6.5%6.5\%, and at most 1.4%1.4\% slower in the other 44; at 95%95\% recall, its advantage over ABS grows from 0.80.8--4.2%4.2\% for 100100 neighbors to 4.64.6--5.6%5.6\% for 500500 neighbors. In memory, it needs 1.31.3--23.7%23.7\% fewer distance computations than CBS and 0.00.0--3.9%3.9\% fewer than ABS.

Create a lesson