arXiv(opens in a new tab)cs.DBSep 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2609.02143

A Power Law in Logarithm's Clothing: On the Scalability of Graph-Based Vector Search

Sajad Faghfoor Maghrebi, Navid Eslami, Niv Dayan

Abstract

Most vector databases rely on graph-based indexes, notably HNSW and Vamana, for approximate nearest neighbor search. With the recent widespread adoption of embedding models, the datasets these databases store have grown rapidly. This growth raises a natural question: at a fixed accuracy, how does search cost scale with dataset size? The prevailing answer is that search cost grows poly-logarithmically. Yet this claim is formally proven only under special conditions; for the indexes used in practice, it is asserted without proof. The claim is also largely untested: standard benchmarks measure search cost at a single dataset size, not across sizes.

We put this claim to the test and measure how search cost scales across dataset sizes. The answer turns out to depend on the scale itself. (1) As long as the dataset size NN is small relative to the data's intrinsic dimensionality, search cost grows in step with NcN^c for a constant 0<c<10 < c < 1. We call this scaling a Sublinear Power Law. (2) Once NN is large enough, the growth slows to subpolynomial, consistent with the prevailing poly-logarithmic claim. Empirically, the Sublinear Power Law appears on every dataset, mostly up to its full size, and at every recall target, query hardness level, and index configuration we test. Still, the transition to subpolynomial growth does appear on the two datasets that grow large enough relative to their intrinsic dimensionality. Underlying both behaviors is a single mechanism: the intrinsic dimensionality a dataset exhibits grows with its size, until the data resolves its underlying distribution. Higher intrinsic dimensionality packs more vectors into the small neighborhood around the query that the search must examine.

We present a unifying theory that formalizes beam-search cost and explains all of our observations. For both exact and bounded-degree constructions, we prove the Sublinear Power Law and the eventual transition to poly-logarithmic scaling, and derive the scale at which the transition occurs. We also develop models that predict the power-law exponents for any recall target and index configuration. These models provide a principled way to navigate trade-offs among search cost, insertion cost, and recall as data grows.

1 Introduction

Unstructured data, spanning documents, images, videos, and audio, has grown rapidly [111]. Querying such datasets using traditional approaches based on attribute values and keywords fails to capture semantic similarity [105]. Meanwhile, advances in learning-based methods, especially deep neural networks, have enabled models that transform unstructured data into dense vector representations suitable for semantic search [91]. These embedding models are trained so that semantic similarity corresponds to geometric proximity: the vectors closest to a query usually represent the most relevant data items.

Vector Search. Together, these trends have driven the rise of vector databases, which index the embeddings produced by these models [7, 105]. Their core retrieval primitive is nearest neighbor search. However, computing the exact nearest neighbors is prohibitively expensive at scale [12, 14, 41]. Vector databases instead accept a small loss in accuracy and perform approximate nearest neighbor (ANN) search. To do so, they use an index that narrows the search to a small set of promising candidates [32, 64, 97].

Graph-based Indexes. The ANN indexes that perform best in practice are graph-based [61, 107]. A graph-based index represents each vector as a node, connected to a subset of its nearby vectors, with a few longer-range edges that keep distant regions reachable in a few hops. To answer a query, the index runs beam search, a generalization of greedy search that walks the graph toward the query and returns the closest vectors encountered [64, 97]. Some graph constructions provide guarantees on accuracy and on reaching a query's neighborhood, but are often too expensive to build exactly [2, 97]. Practical graph-based indexes draw on these exact constructions but build them with cheaper heuristics [64, 97]. The two most widely used such indexes, HNSW [64] and Vamana [97], power vector search across databases [51, 69, 87, 99, 102, 109], search engines [77, 103], and libraries [26, 68, 72].

Sustaining Accuracy As Data Grows. The data stored in vector databases grows continuously [9, 94, 112]. As the data grows, however, search accuracy—typically measured by recall, the fraction of true nearest neighbors returned by the search—deteriorates [19, 27, 101]. Maintaining stable recall therefore requires adjusting the index parameters in response [27, 65, 115]. A common practice is to periodically measure recall using exact search [28, 86, 104] and adjust parameters accordingly [19, 65, 101]. If the measured recall falls short of the user's recall target, the user raises the search effort, remeasures, and repeats until the target is reached. Recent work in academia as well as in industry [101, 116] improves upon this practice by using statistical or learned models of the search effort required to achieve a recall target [19, 56, 114]. Underlying all these approaches is a natural research question: At a fixed level of accuracy, how does search cost scale as the dataset grows?

The Logarithmic Folklore. The literature answers this question with poly-logarithmic scaling. For exact graph constructions, the claim is sometimes backed by proof [2, 42]. For the heuristic indexes used in practice, it is asserted and left unproven. In particular, the paper introducing HNSW claims logarithmic search cost, but the scaling experiments supporting this claim use only low-dimensional synthetic vectors (d≤8d \leq 8), and its largest experiment deviates from logarithmic scaling [64]. The paper introducing Vamana argues that greedy search on its exact construction takes logarithmically many steps, but reports no measurement of search cost across dataset sizes [97]. The claim has nonetheless propagated into industry documentation [26, 69, 77, 83, 90, 109] and surveys [78, 79, 107], which restate it as a settled property of these indexes. It also remains largely untested: benchmarks commonly measure the recall-cost trade-off at a single dataset size, not the scaling of cost across sizes at fixed recall [4, 43, 93, 107].

Observations. We put the folklore to the test and make two observations: (1) When the dataset size NN is small relative to the data's intrinsic dimensionality, the average search cost of a graph-based index at fixed recall grows in step with NcN^c for a constant 0<c<10 < c < 1. We call this scaling a Sublinear Power Law. (2) Once NN is large enough, the growth slows to subpolynomial, consistent with the prevailing poly-logarithmic claim. We verify these observations through extensive experiments: the Sublinear Power Law appears on all eight of our datasets, at recall targets between 90% and 99%, under many index configurations, and for hard and easy queries alike (Section 3.2). On two datasets, the data grows past the transition point and search cost begins to slow below the power law (Sections 3.2 and 3.3).

Core Contribution: Unifying Theory. By analyzing the anatomy of query cost, we find the mechanism behind these scaling behaviors: search cost is governed by the number of vectors in a small neighborhood around the query. The size of that neighborhood grows exponentially with the intrinsic dimensionality the dataset exhibits at its current size. As long as the dataset sparsely samples its underlying distribution, that dimensionality grows in step with log⁡N\log N. An exponential in log⁡N\log N is a power of NN, so the neighborhood, and hence the cost, grows as a power law. Once the dataset samples the distribution densely, intrinsic dimensionality growth slows and cost growth approaches poly-logarithmic (Section 4.1). Our unifying theory formalizes this claim. For both exact and bounded-degree constructions1^1 of HNSW and Vamana, we prove the Sublinear Power Law and the eventual transition to poly-logarithmic scaling, derive the scale at which that transition occurs, and extend the results to other graph-based indexes (Section 4.2).

Additional Contribution: Cost Models. Under the Sublinear Power Law, we model the query cost as a function of the recall target and the construction parameters, across datasets, for both HNSW and Vamana (Section 5.1). For insertions, we model the cost analogously (Section 5.2). Combined, the models help users navigate the trade-offs between query cost, insertion cost, and recall.

References (28)