arXiv:2611.07579cs.DBNov 2026

Manuscript Offprint

arXiv:2611.07579

Per-Query Recall Guarantees for Approximate Nearest Neighbor Search in Dynamic Vector Databases

Woong-Kee Loh, Suan Lee

Woong-Kee Loh

Gachon University

Seongnam, Republic of Korea

wkloh2@gachon.ac.kr

Suan Lee

Semyung University

Jecheon, Republic of Korea

suanlee@semyung.ac.kr

This is the extended version of the paper submitted to ICDE 2027. It contains the complete proofs, the experiments omitted from the conference version, and supplementary results. This work has been submitted to the IEEE for possible publication. Copyright may be transferred without notice, after which this version may no longer be accessible.

Abstract

Vector search now runs as an operator inside database systems, where a missed neighbor makes the answer of a filter, join, or aggregate over its results wrong, yet approximate nearest neighbor (ANN) indexes are tuned only so that their average recall reaches a target, and the average says nothing about an individual query. In our measurements, indexes tuned to an average recall of 0.99 left 5–19% of in-distribution queries and, tuned without a query log, up to 99.6% of real out-of-distribution queries below this target, and the misses grew under insertions and deletions. Existing guarantees based on conformal prediction bound only a risk averaged over the query distribution. In the spirit of approximate query processing (AQP), which attaches to each answer an error bound that holds with a stated probability, we present PQR-Search (per-query recall search), a k-ANN search method that guarantees Pr⁡[Recall(q)<τ]≤δ\Pr[\text{Recall}(q) < \tau] \leq \delta for every given query. The probability is taken only over a random orthogonal transformation inside the index, drawn independently of data and queries, so no distributional assumption is needed, only that queries and updates do not depend on it (its seed is kept secret from whoever issues them), and for τ<1\tau < 1 the same run also satisfies E[Recall(q)]≥τ\mathbb{E}[\text{Recall}(q)] \geq \tau under a mild condition. When updates are independent of the transformation, the guarantee holds after insertions and deletions without retuning and without splitting δ\delta between old and new parts of the index. To provide the guarantee at low cost, PQR-Search stores 1-bit codes of rotated residuals with respect to IVF centroids and prunes with exact quantiles of their error distribution. We derive a formula that predicts the fraction of vectors passing the code test without data-fitted constants and without reading the transformation, and use it to choose index parameters and maintenance operations without affecting the guarantee. On 20 datasets of up to 100 million vectors, failure rates stayed at most δ\delta in every audit, including all 33 search steps of the official NeurIPS'23 streaming runbook without retuning, whereas CTR, a distribution-level guarantee, left up to 16.4% of queries below the same target recall. The guarantee is affordable. Where HNSW tuned to an average recall of 0.99 met that target, PQR-Search had 2.5×2.5\times its single-query latency and 1.3×1.3\times lower batch throughput (geometric means), yet that HNSW still left 3–29% of queries below 0.99, and indexes tuned to an average recall of 0.99 changed the answer of a top-5-tag aggregate over the results for up to 27% of queries, versus at most 0.04% of trials for PQR-Search. PQR-Search was faster than FAISS exhaustive search on CPU, which also meets the guarantee, in every evaluated static setting (geometric mean 26.4×26.4\times in batch throughput; 69-154×69\text{-}154\times at 100M scale). In all 52 main settings it was also faster than IVF whose nproben_{\text{probe}} was chosen afterwards so that every test query met the target, because a fixed nproben_{\text{probe}} must serve the hardest query while the work of PQR-Search adapts to each query. It was 27-76×27\text{-}76\times faster at one thread than PUFFINN, which also gives per-query guarantees.

1. Introduction

With the advance of deep neural networks, it has become common to represent unstructured data such as text, images, and audio as high-dimensional embedding vectors [1], [2]. Accordingly, k-nearest neighbor (k-NN) search, which finds the vectors close to a query vector in a vector database, has become a core operation of many applications such as information retrieval [3], recommendation [4], and retrieval-augmented generation [5]. However, exact k-NN search on large-scale high-dimensional data is very expensive, and even classical indexes such as pivot-based indexes and metric trees are known to face lower bounds stating that they must examine most of the data in high dimensions [6], [7]. For this reason, practice widely relies on approximate nearest neighbor (ANN) search, which gives up some accuracy in exchange for a large reduction in latency [2], [8]. Graph-based indexes [9], [10], partition-based indexes such as IVF [8], [11], and quantization-based methods [12], [13], [14] have achieved both high recall and low latency on real data. The search accuracy of these methods is usually set by tuning parameters such as nproben_{\text{probe}} or efSearch until the average recall reaches a target, and the chosen value is applied equally to every query [15], [16], [17].

A high average recall does not mean that the result of an individual query is accurate. Benchmark queries tend to be easier than real workloads [18], and since the average is determined by such queries, the target can be met even if some hard queries have low recall. In our measurements, IVF-Flat, HNSW, and IVF-RaBitQ indexes tuned to an average recall of 0.99 met the target average recall on in-distribution queries, yet at k=100k=100, 5.0–19.2% of the queries had recall below 0.99 (Fig. 1(a), Section 2.1). It has also been reported that 4.8% of the queries had recall 0 on DiskANN with an average Recall@10 of 0.9 [19]. When the distribution of queries differs from that of the data, the performance of ANN indexes drops sharply [1], [20], [21]. In the same measurements, when queries that search for images by text or real user questions were sent to indexes tuned with data vectors in the absence of a query log, the fraction of queries with recall below 0.99 was 51.4–99.6% at k=100k=100 (Fig. 1(a), Section 2.1).

How much the recall of an individual query matters depends on the application. In applications where the returned results are interchangeable, such as retrieval-augmented generation and recommendation, missing some neighbors does not significantly degrade downstream quality [4], [22], [23], [24]. In other applications, however, a single missed neighbor is itself an error, and the average recall is not sufficient. For example, in image copy detection, a missed copy keeps circulating. Copy detection is performed by matching learned image descriptors [25], [26] with ANN search, and a large-scale service processing billions of images per day [27] explicitly aims to increase recall while maintaining precision [28]. The same holds for vector databases and vector extensions of relational DBMSs. These systems provide vector search as an operation of query processing [29], [30], [31], [32], and its result set becomes the input of filters, joins, and aggregates, so a missed neighbor leads to an error in the final query result. In our measurements, tag aggregates over the results of indexes tuned to an average recall of 0.99 differed from those over exact results for up to 27% of queries (Section 6.6). However, these systems only let users specify a target accuracy or search parameters and give no guarantee on the result of an individual query [29], [30], [31]. Moreover, in searches where the cost of a missed document is high, such as legal document review and systematic literature reviews, the goal is recall as close to 100% as possible [33]. Approximate query processing (AQP) has met the same need for aggregates by attaching to each answer an error bound that holds with a stated probability over sampling [34], [35], [36]. Vector operators lack such a contract: methods that give per-query guarantees in vector search are rare, and even these are limited to per-neighbor probabilities, that is, the expected recall, or to a single nearest neighbor (Section 2.3).

The problem grows in environments where data are continuously updated. The data are not fixed in the applications mentioned above either. Copy detection systems continuously inspect newly uploaded images, and misinformation newly verified by fact-checking organizations as well as new variants found by the system again become subjects of matching and review [28]. In a DBMS, vector columns are inserted, modified, and deleted like any other column, and Oracle advises checking the accuracy and rebuilding the index because such updates can degrade the accuracy of IVF indexes over time [30]. In applications where documents are constantly added, modified, and deleted, such as Wikipedia search, the distributions of queries and updates also change over time, and such dynamic workloads increase the latency of the index and degrade recall [37]. Accordingly, methods that maintain index quality under updates have been studied, such as graph repair [38], splitting and merging of partitions [37], [39], and local reclustering according to reconstruction error [40]. However, as Quake [37] pointed out, once the index structure changes, the initially chosen parameters cannot maintain the same recall. In our measurements as well, when five steps of 10% insertions and deletions were applied to an index initially tuned to an average recall of 0.99 on yandex, the fraction of queries with recall below 0.99 rose from 13.5% to 22.3% for IVF-Flat, and from 7.9% to 17.5% even for Quake [37], which takes a recall target directly (k=100k=100, Fig. 1(b), Section 2.1). Retuning the parameters is costly because it again requires calibration queries with ground truth [15], [16], [17].

Research on guaranteeing the accuracy of search results has also been conducted. RaBitQ [14] used a random transformation to provide probabilistic error bounds for each individual distance estimate, and this paper starts from this result. ADSampling [41] turns error bounds of random projections into a high-probability guarantee of returning the kk nearest candidates, which becomes a guarantee of exact search when all vectors are candidates. Its upper bound, however, contains a constant of unknown value, and it targets neither recall below exactness nor updates. ConANN [42] and CTR [43] presented distribution-level guarantees on recall using conformal prediction. Their guarantees, however, concern a risk averaged over the query distribution, and, as the authors of ConANN noted, per-query conditional guarantees cannot be obtained by conformal methods [42], [44]. In our measurements, in 27 settings in which CTR was run with its own loss target, up to 16.4% of the queries had recall below the target τ\tau, which its averaged guarantee permits (Fig. 1(c), Section 6.3). Per-query probabilistic guarantees have been given by PUFFINN [45], which scans an LSH index and stops once each true neighbor has been found with probability at least 1−δ1 - \delta; by Confirmation Sampling [46], which repeatedly queries LSH data structures to find the exact nearest neighbor of each query with probability 1−δ1 - \delta; and by TPU-KNN [47], which computes all distances and then meets a target expected recall under an assumption on the placement of the neighbors. Among LSH methods from the database community, SRS [48], VHP [49], and R2LSH [50] also return the exact nearest neighbor of each query with any given probability over data-independent random projections. However, PUFFINN and TPU-KNN bound each true neighbor's miss probability, that is, the per-query expected recall, from which Markov's inequality gives tail bounds on recall. PUFFINN is limited to cosine and Jaccard similarity and does not support deletion, and its public implementation, in the setting covered by its proof, was 27−76×27-76\times slower than our method at one thread (Appendix C.3). Confirmation Sampling, SRS, VHP, and R2LSH address a single nearest neighbor (k=1k=1), and TPU-KNN presupposes computing all distances. Moreover, to the best of our knowledge, none of these guarantees was analyzed under updates (SRS, VHP, and R2LSH support updates through tree indexes but state no guarantee under them), and the dynamic index studies mentioned above [37], [38], [39], [40] were evaluated by average recall (Section 2.3).

This paper addresses the problem of k-ANN search that guarantees per-query recall in dynamic vector databases. Given a target recall τ∈(0,1]\tau \in (0,1] and a failure probability δ\delta, the goal is to guarantee Pr⁡[Recall(q)<τ]≤δ\Pr[\text{Recall}(q) < \tau] \leq \delta for every given query without assumptions on the data or the query distribution, provided only that the queries and updates do not depend on the randomness inside the index, whose seed is kept secret from whoever issues them; we call this the (τ,δ)(\tau, \delta)-recall guarantee. Exact search (τ=1)(\tau = 1) is a special case of it. We also guarantee E[Recall(q)]≥τ\mathbb{E}[\text{Recall}(q)] \geq \tau for every query, which we call the expected-recall guarantee. In both guarantees, the probability and the expectation are taken not over multiple queries but, for a given single query, over the randomness inside the index. Hence the expected-recall guarantee ensures for each individual query the goal of conventional tuning, which brought the average recall over many queries to at least τ\tau. In applications where missing some neighbors is acceptable, such as retrieval-augmented generation and recommendation, it suffices that the recall of each query reaches the target on average, so the expected-recall guarantee meets that requirement at lower cost than the (τ,δ)(\tau, \delta)-recall guarantee. These guarantees must hold without returning while insertions and deletions continue. To give a per-query guarantee, the probability of missing true neighbors remaining in unvisited regions must be bounded, but methods that do not inspect unvisited regions, such as graph traversal, cannot directly count the neighbors remaining in those regions. Re-ranking an HNSW result with exact distances removes false neighbors but cannot reveal missed ones, since finding them requires examining the unvisited vectors.

To solve this problem, we propose PQR-Search (per-query recall search), an index and search method that defines the probability of the guarantee not over the query distribution but over randomness inside the index. Its index applies a random orthogonal transformation to vectors and stores them as 1-bit binary codes. Given a query, it first computes the exact distances to some vectors and uses the k-th of these distances as the pruning radius, progressively tests with codes that the remaining vectors cannot lie within this radius and prunes them, and then re-ranks only the remaining vectors by exact distances. Whenever an exact distance is computed during the test, the radius is shrunk to prune more vectors. Under a random orthogonal transformation, the test error follows a data-independent distribution [14], so an upper bound on the probability of missing a true neighbor can be computed for the given data and query. The premise needed for this guarantee is that the queries, the updates, and the construction of the index are independent of the orthogonal transformation, so the same guarantee holds after updates without returning. What is encoded here is not the vector itself but its residual with respect to the centroid of an IVF partition, and the vectors whose exact distances are computed first are also chosen from partitions whose centroids are close to the query. Since the error of a distance estimated from a 1-bit code is proportional to the magnitude of the residual [14], the smaller the residual, the more accurate the test, and residual norms give deterministic bounds via the triangle inequality [51], [52]. Why this design provides the same guarantee at lower cost than exhaustive search is intuitive. To determine the result, most vectors need not the value of their distance but only a test showing that they cannot lie within the pruning radius; for vectors far from the radius this test is settled by a binary code of tens of bytes, so the original vectors are read to compute distances only for the few vectors that pass the test (Section 3.3). This design also favors high-dimensional data. The cost of testing unvisited vectors, as with scanning compressed codes such as PQ [12], is determined not by the dimension of the data but by the number of bits of the binary code, so for data of higher dimension, such as embedding vectors [1], the gain over exhaustive search, which computes all distances, when queries are processed one at a time actually becomes larger. In our measurements, with the first-stage code length fixed, this speedup grew from 19.9−24.6×19.9-24.6\times when the same data were reduced to 128 dimensions to 40.4−62.6×40.4-62.6\times at the original dimensions (768–1024) (Section 6.6). The design also favors updates. As updates continue, vectors drift away from the centroids to which they are assigned and the search cost increases, so a dynamic index maintains an efficient index, that is, an index with low search cost, by moving centroids or splitting partitions. Since insertion, deletion, and maintenance all take place per partition, an update affects only part of the index, and the conditions under which the guarantee holds during updates are simple.

The main contributions of this paper are as follows.

  • A per-query contract for vector operators (Sections 2.2, 4.3, 5). We show by measurement that average-recall tuning and distribution-level guarantees based on conformal prediction cannot protect individual queries, and, like an AQP error bound, we define as the problem a (τ,δ)(\tau, \delta)-recall guarantee that is stated before execution and holds for every fixed dataset and query. The guarantee covers true neighbors in unvisited regions as well, and since its only randomness is the random orthogonal transformation PP inside the index, it holds for out-of-distribution queries too, and any workload chosen without looking at PP expects at most a δ\delta fraction of failing queries. The principle that keeps this guarantee cheap is to let the guarantee come from PP alone, to make the decisions that affect the guarantee (the stage configuration, maintenance operations, and their timing) by predictions that do not read PP, and to confine the choices that may depend on PP (the test order and early exact computation) to what Theorem 5 permits. Decisions based on values that depend on PP, such as measured pass counts, introduce selection bias; this principle is therefore what keeps the guarantee intact without returning, even under updates.
  • Per-query recall guarantees with exact quantiles (Sections 3.1, 3.2, Appendices A.3, B). For search that tests unvisited vectors with prefix-readable binary codes of rotated residuals, we show that the (τ,δ)(\tau, \delta)-recall guarantee holds for every given query without assumptions on the data or query distribution, for queries and updates that do not depend on the index's internal randomness, and that for τ<1\tau < 1 the same run also satisfies the expected-recall guarantee under a mild condition. The guarantee theorems themselves are short, because they build on the error identity of RaBitQ [14] and the union bound over the kk true neighbors of ADSampling [41]. What is new is the condition under which a radius set from exact distances of visited vectors also applies to unvisited true neighbors; the exact error distributions of prefix codes and 2-bit codes, stated for any code that is a function of P−1oP^{-1}o, which give error-bound parameters from exact Beta quantiles instead of an unspecified constant (with these quantiles alone, even a RaBitQ full scan becomes a guaranteed search, 12.1−20.5×12.1-20.5\times faster than FAISS exhaustive search in geometric mean; Section 6.3); the adaptive radius (Theorem 5), with which we make explicit that the guarantee survives a radius that shrinks during testing although it depends on PP, also with per-thread radii and stale radii; and the soundness of the implementation including floating-point error (Section 4.2, Appendix A.3). ADSampling's per-comparison argument uses only that the distance is within the threshold, so it already tolerates such a dependence, but it does not discuss it, and its verification avoided it with a fixed threshold [41]. Moreover, for analyses that use only per-neighbor probabilities, the Markov step of the bound is tight; it is attained exactly only by a placement of exact duplicates with k=m+1k = m+1 (Proposition 1). Separately from the Markov step, we give lower bounds on cost: in a probe model, a per-query guarantee must probe at least a 1−δ1/(m+1)1-\delta^{1/(m+1)} fraction of the hidden cells in expectation, and a deterministic rule all but mm of them (Theorems 7 and 8), and under randomized SETH no data structure with polynomial preprocessing can give such guarantees in query time n1−ϵn^{1-\epsilon} on worst-case inputs with D=ω(log⁡n)D = \omega(\log n) (Theorem 9 in Appendix B).

  • Guarantees under updates (Section 5). We extend the index and search algorithm of Section 4 to dynamic environments by adding only a delta segment that holds new vectors separately, a bitmap that marks deletions, and merges. An insertion consists of encoding one vector and rearranging the delta region of its partition, and a deletion of marking one bit; unlike graph indexes, no connections need to be repaired. We show that if the updates and the decisions for maintaining an efficient index are independent of the orthogonal transformation, the static guarantee holds for a query at any time without returning and without splitting the failure probability δ\delta among segments. We also show that if the same orthogonal transformation keeps being used, the failure of a query can persist to later times, and that a fresh orthogonal transformation at merge time breaks this persistence, and we analyze the risk of adaptive updates. The same frame covers filtered kk-NN: marking the vectors that fail a predicate in the deletion bitmap keeps the guarantee against the true neighbors among the qualifying vectors for any selectivity (Corollary 2). As a result, the decisions for maintaining an efficient index do not affect the guarantee and change only the search cost, and we determine them with the formula of Section 3.3.

  • Residual cost law (Section 3.3). We derive a formula that predicts the pass rate of the first-stage test, which sets the cost of the same guarantee, without data-fitted constants and without reading the orthogonal transformation. The formula shows that the cost is determined by the residual scale and the test radius; it thus answers quantitatively the normalization (centroid) choice that RaBitQ [14] left as future work, and it grounds the residual codes and the index design. Following the principle above, the formula sets the parameters of the index (Section 4.3) and, in dynamic settings, the operations that keep the index efficient and their timing (Section 5) without returning.

  • Index and search (Section 4). Following the theory, we design an IVF index and a query processing algorithm and implement them with AVX-512. Unlike standard IVF, vectors in unvisited partitions are also tested, so the guarantee holds regardless of nproben_{probe}, and queries are processed fast with SIMD tests and multithreading within what the theorems of Section 3 permit. The parameter selection rule based on the cost law changes only the query processing cost, so the guarantee is unchanged even if the distributions of calibration queries and actual queries differ.

  • Evaluation (Section 6). We validated each contribution on 20 datasets (up to 100M points) reflecting the applications above (copy detection, cross-modal search, document retrieval, and database operators) and on the official NeurIPS'23 streaming runbook [53]. Failure rates of the per-query guarantees stayed at most δ\delta in every audit. In 168 static settings the (τ,δ)(\tau, \delta)-recall guarantee failed 45 times out of 4,176,000 (at most 0.5% of δ\delta in each configuration), and, unlike CTR, which gives a distribution-level guarantee at the same target, no query had an average recall over orthogonal transformations significantly below the target. The price of the guarantee was modest. Where HNSW32 tuned to an average recall of 0.99 met the target on calibration queries, PQR-Search had 2.5×2.5\times its 1-thread latency and HNSW32 had 1.3×1.3\times higher batch throughput (geometric means), yet HNSW32 still left 3.3–29.2% of test queries below recall 0.99. Tuned instead to the tail target (at most 1% of calibration queries below recall 0.99), HNSW32 reached it within its search grid in only 10 of 18 settings and was there 1.1×1.1\times (1-thread) and 1.9×1.9\times (batch) slower than PQR-Search, whereas at a target of 0.9 HNSW32 tuned post hoc on the test queries was 2.0×2.0\times faster at 1 thread. Widening the tail-tuned baselines on out-of-distribution queries to HNSW with MM up to 64 and efSearch up to 16,384, DiskANN, RoarGraph, and multi-bit RaBitQ kept PQR-Search 2.9×2.9\times (1-thread) and 5.3×5.3\times (batch) faster than the fastest baseline reaching 0.99, whereas on two 100M

Figure

(a)

Figure

(b)

Figure

(c)

Figure 1. Per-query failures of average-recall tuning and distribution-level guarantees. (a) Indexes tuned to average recall 0.99 (k=100k=100; the left three datasets have in-distribution queries and the right three datasets have real out-of-distribution queries). (b) An index updated after tuning (yandex, k=100k=100, 10% insertion and 10% deletion per step). (c) CTR (one box contains the 9 settings of one dataset). The datasets are described in Table 9.

datasets with in-distribution queries tail-tuned HNSW32 was 4.8×4.8\times faster at 1 thread. In tag aggregates over the search results, indexes tuned to an average recall of 0.99 answered differently from exact search for up to 27% of queries, and PQR-Search for at most 0.04% of trials. The pass-rate prediction of the cost law agreed well with the measurements across partitioning methods, scales, and updates without data-fitted constants (log correlation of at least 0.999 for static indexes). Our index and search were faster than FAISS exhaustive search, which gives the same guarantee, in all 52 main settings (geometric means of 22.9×22.9\times when queries are processed one at a time and 26.4×26.4\times when 1,000 queries are processed at once) and in every setting on the three 100M-scale datasets, and in all 52 main settings also faster than IVF whose nproben_{probe} was chosen afterwards. They were also 18.3×18.3\times faster at one thread than PDX-BOND [54], an exact scan that prunes with partial distances. The parameter selection rule was 1.18×1.18\times faster than the default configuration in geometric mean without slowing down any setting. The RaBitQ-equivalent configuration (all partitions tested with the full code), which gives the same guarantee, was also 12.1−20.5×12.1-20.5\times faster than FAISS exhaustive search in geometric mean per metric, and our method was faster than it by another 1.64×1.64\times (1-thread), 2.33×2.33\times (32-thread), and 1.24×1.24\times (batch), and 3.07×3.07\times faster than the official RaBitQ implementation run with the same partitions and error-bound parameter (1-thread). It was 27−76×27-76\times faster at one thread than the public implementation of PUFFINN, which also gives per-query guarantees, in the setting covered by its proof. On the streaming runbook, the failure rate stayed at most δ\delta in all 33 search steps without retuning, whereas IVF-Flat tuned at the first time point exceeded its target failure rate by up to 4.2×4.2\times, and residual-based maintenance made search 1.29−8.97×1.29-8.97\times faster than an index without maintenance.

The rest of this paper is organized as follows. Section 2 shows by measurement the per-query failures of indexes tuned by average recall, defines the problem, and reviews related work and the prior theory on which our method is based. Section 3 presents the theory of per-query guarantees and the pass-rate formula that determines the cost. Section 4 describes the index and search algorithm designed from these results, their implementation, and parameter selection based on the cost law. Section 5 addresses guarantees under updates and how to maintain an efficient index based on the formula of Section 3.3. Section 6 presents the experimental results, and Section 7 concludes the paper. Appendix A contains the proofs, Appendix B the lower bound for per-query guarantees, and Appendix C supplementary experiments.

References (100)

Couldn't load all references. Reload the page to try again.