Abstract 1 Introduction 2 Preliminaries 3 Overview of Algorithms from [14, 23] 4 (𝟐𝑶~⁢(𝐥𝐨𝐠⁡𝒑),𝒓)-ANN with 𝐩𝐨𝐥𝐲⁡(𝒅⁢𝒏) Space References

Fast Nearest Neighbor Search for ℓ𝒑 Metrics

Robert Krauthgamer ORCID The Harry Weinrebe Professorial Chair of Computer Science, Weizmann Institute of Science, Rehovot, Israel    Nir Petruschka ORCID Weizmann Institute of Science, Rehovot, Israel
Abstract

The Nearest Neighbor Search (NNS) problem asks to design a data structure that preprocesses an n-point dataset X lying in a metric space ℳ, so that given a query point q∈ℳ, one can quickly return a point of X minimizing the distance to q. The efficiency of such a data structure is evaluated primarily by the amount of space it uses and the time required to answer a query. We focus on the fast query-time regime, which is crucial for modern large-scale applications, where datasets are massive and queries must be processed online, and is often modeled by query time poly⁡(d⁢log⁡n) when ℳ is a d-dimensional normed space. Our main result is such a randomized data structure for NNS in ℓpd spaces, p>2, that achieves pO⁢(1)+log⁡log⁡p approximation with fast query time and poly⁡(d⁢n) space. Our data structure improves, or is incomparable to, the state-of-the-art for the fast query-time regime from [Bartal and Gottlieb, TCS 2019] and [Krauthgamer, Petruschka and Sapir, FOCS 2025].

Keywords and phrases:
Nearest neighbor search, metric embeddings, ℓp norm
Funding:
Robert Krauthgamer: Work partially supported by the Israel Science Foundation grant #1336/23.
Copyright and License:
[Uncaptioned image] © Robert Krauthgamer and Nir Petruschka; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation → Computational geometry
; Theory of computation → Nearest neighbor algorithms
Related Version:
arXiv Version: https://arxiv.org/abs/2603.21148
Acknowledgements:
We thank Shay Sapir and Asaf Petruschka for helpful discussions.
Editors:
Hee-Kap Ahn, Michael Hoffmann, and Amir Nayyeri

1 Introduction

The Nearest Neighbor Search (NNS) problem asks to design a data structure (also called a scheme) that preprocesses an n-point dataset X lying in a metric space ℳ, so that given a query point q∈ℳ, one can quickly return a point of X minimizing the distance to q (or approximately minimizing it in the approximate version). The efficiency of such a data structure is evaluated primarily by the amount of space it uses and the time required to answer a query. The preprocessing time is a secondary measure and is usually comparable to the space usage. Because of its central role in areas such as machine learning, data analysis, and information retrieval, NNS has been the subject of extensive research, both practical and theoretical (see, e.g., the surveys [1, 6]).

It is well known that approximate NNS can be reduced to solving polylog⁡(n) instances of the approximate near neighbor problem [18]. For this reason, we restrict attention to the latter.

Definition 1.1.

The Approximate Near Neighbor problem for a metric space (ℳ,dℳ) and parameters c≥1, r>0, abbreviated (c,r)-ANN, is the following. Design a data structure that preprocesses an n-point subset X⊆ℳ, so that given a query q∈ℳ with dℳ⁢(q,X)≤r,111If dℳ⁢(q,X)>r, it may report anything, where as usual, dℳ⁢(q,X)≔minx∗∈X⁡dℳ⁢(x∗,q). it reports x∈X such that

dℳ⁢(q,x)≤c⁢r.

In a randomized data structure, the reported x∈X satisfies this with probability at least 2/3.

We focus on the fast query-time regime, which is crucial for modern large-scale applications where datasets are massive and queries must be processed online, and is often modeled by query time poly⁡(d⁢log⁡n) when ℳ is a d-dimensional normed space. We study the metric spaces ℓpd, which refer to ℝd with distances defined by the ℓp norm, and we may omit the dimension d when it is clear from the context. In ℓp spaces, ANN in this regime is well understood for 1≤p≤2 [19, 25, 18] and for p=∞ [20, 4, 21]. For 2<p<∞, the situation is less clear: there exists a handful of data structures, each suitable for a different range of p, as detailed in Table 1. We present a new scheme for ANN in ℓp, p>2, with fast query time, that offers an improved tradeoff between approximation and space, as follows.

Theorem 1.2.

Let p>2, d≥1. Then for every r>0, there is a randomized data structure for (c,r)-ANN in ℓpd, where c=pO⁢(1)+log⁡log⁡p, that has query time poly⁡(d⁢log⁡n) and preprocessing (both space and time) poly⁡(d⁢n).222The time and space bounds are independent of p.

Studying ANN in ℓp, p>2, is important both practically and theoretically. Real-world data and applications may motivate norms that emphasize outliers, e.g., for anomaly detection, or alter the presence of “hubs”, e.g., to affect classification; such data structures were indeed used for time-series classification [28], see [14] for additional references. From a theoretical perspective, the geometry of ℓp spaces undermines existing algorithmic techniques and requires developing new ones. A key challenge is to bridge between p=2 and p=∞. In the fast query-time regime, this means interpolating between the classical (O⁢(1),r)-ANN in ℓ2 [18] and the (O⁢(log⁡log⁡d),r)-ANN in ℓ∞ [20], which both use only poly⁡(d⁢n) space. It is natural to conjecture that 2<p<∞ exhibits an interpolation between these two guarantees, and since ℓ∞d is O⁢(1)-equivalent to ℓlog⁡dd by Hölder’s inequality, this interpolated data structure is conjectured to achieve O⁢(log⁡p) approximation using poly⁡(n⁢d) space. The first step towards this conjecture, in [2, 3], devised a reduction from ℓp to ℓ∞, and obtained a data structure with O⁢(log1/p⁡n⁢log⁡log⁡d)-approximation, which is mainly suited for large values of p. A nontrivial reduction, devised in [14], reduced ℓp to ℓ2 and obtains 2O⁢(p)-approximation, which is a major improvement for small values of p, although it is doubly-exponentially worse than the conjecture. A more sophisticated reduction, that was devised recently in [23], achieves approximation poly⁡(p), which is an exponential improvement. However, it goes through multiple intermediate ℓt spaces (2≤t<p) via a recursive argument that increases the space to nO⁢(log⁡p), much higher than conjectured. Our Theorem 1.2 essentially completes the improvement of [23], by decreasing the space complexity back to the conjectured poly⁡(d⁢n), albeit slightly increasing the approximation to plog⁡log⁡p. In particular, it resolves a question posed in [23], of whether the recursion can avoid this higher space complexity.

Table 1: Known data structures for ANN in ℓp, p>2, in the fast query time regime.
Approximation Space Reference
O⁢(log1/p⁡n⁢log⁡log⁡d) poly⁡(n⁢d) [2, 3]
2O⁢((log⁡d)2/3⁢(log⁡log⁡d)1/3) poly⁡(n⁢d) [8]
2O⁢(p) poly⁡(n⁢d) [14]
pO⁢(1) nO⁢(log⁡p) [23]
c nO⁢(p/c)⋅log⁡log⁡n [13]
pO⁢(1)+log⁡log⁡p poly⁡(n⁢d) Theorem 1.2

The proof of Theorem 1.2 is based on a simple yet powerful enhancement of the known NNS schemes from [14, 23], which utilizes classical results from [11, 12] about sparse covers. We provide an overview of the algorithms of [14, 23] in Section 3, along with an intuitive explanation of our approach at the beginning of Section 4.

Related Work

Many of the existing results on approximate nearest neighbor search in ℓp spaces focus on the case 1≤p≤2 [25, 19, 18, 17, 5, 3, 27]. In this setting, O⁢(1)-approximation can be achieved with poly⁡(d⁢n) preprocessing (space and time), and query time polynomial in d⁢log⁡n [25, 18].

In recent years, significant progress has been made for the case p∈(2,∞), and current results can be broadly divided into three regimes. The first regime consists of data structures that achieve moderate approximation and query time using near-linear space [3, 7, 8, 9, 24, 10]. The second regime has small approximation factor, say O⁢(1) or even 1+ε, in which case both the query time and the preprocessing requirements (space and time) are typically very large [14, 13]. The third regime, which is the focus of our work, has fast query time, namely, poly⁡(d⁢log⁡n), and existing results either achieve 2O⁢(p)-approximation with poly⁡(d⁢n) space [14], or better approximation o⁢(2p) at the cost of a much bigger nω⁢(1) space [13, 23]. Our result is the first to obtain both o⁢(2p) approximation and poly⁡(d⁢n) space. Table 1 provides a comparison of all known data structures in this regime.

We point out that the recursive embedding technique from [23], which is used here, has been applied successfully also to other problems involving ℓp spaces, such as the construction of Lipschitz decompositions [22, 23, 26], geometric spanners [22, 23], and low-distortion embeddings [23, 26].

2 Preliminaries

Given a metric space ℳ=(X,dℳ), we denote by Bdℳ⁢(x,r)≔{y∈X:dℳ⁢(x,y)≤r} the ball of radius r>0 centered at a point x∈ℳ.

For every p,q∈[1,∞), the Mazur map Mp,q:ℓpd→ℓqd is computed by taking, in each coordinate, the absolute value raised to power p/q, but keeping the original sign. Our algorithm crucially relies on the following property of this map.

Theorem 2.1 ([15, 14]).

Let 1≤q<p<∞ and C0>0, and let M be the Mazur map Mp,q scaled down by factor pq⁢C0p/q−1. Then for all x,y∈ℓpd such that x,y∈Bℓp⁢(0,C0),

qp⁢(2⁢C0)1−p/q⁢‖x−y‖pp/q≤‖M⁢(x)−M⁢(y)‖q≤‖x−y‖p.

3 Overview of Algorithms from [14, 23]

In this section, we review the algorithms of [14] and [23] for ANN in ℓp, p>2. For the rest of the section, fix a dataset X⊂ℓpd with |X|=n for some p>2.

3.1 (𝟐𝑶⁢(𝒑),𝒓)-ANN with 𝐩𝐨𝐥𝐲⁡(𝒅⁢𝒏) Space [14]

In the preprocessing stage, consider a set of k=p2⋅O⁢(log⁡log⁡d) possible approximation factors 𝒞^={c^i}i=0k, where poly⁡(d)=c^0≥c^1≥⋯≥c^k=2O⁢(p). First, compute for X an initial NNS data structure Ainit using [16], which provides approximation c^0=poly⁡(d) using query time poly⁡(d⁢log⁡n) and space poly⁡(d)⁢O~⁢(n).333Throughout, the notation O~⁢(f) hides factors that are logarithmic in f. Then, for every data point x∈X and every approximation c^∈𝒞^, compute a (scaled) Mazur map Mx,c^:ℓpd→ℓ2d for the points in the set Bℓp⁢(0,c^⁢r)∩(X−x). Finally, compute for the image points in ℓ2d the (2,r)-ANN data structure Ax,c^ from [18], which uses poly⁡(d⁢log⁡n) query time and poly⁡(d⁢n) space. We have this data structure for each point x∈X and each approximation factor c^∈𝒞^, and clearly |Bℓp⁢(x,c^⁢r)|≤n, hence the total space requirement is O⁢(p⋅log⁡log⁡d)⁢n⋅poly⁡(d⁢n)=poly⁡(d⁢n).

At query time, given a query point q∈ℓpd, find a c^0-approximate solution x0 using Ainit. The crucial observation is that since the Mazur map ensures a distortion that depends on the diameter of the point set (Theorem 2.1), the answer from Ax0.c^0 is a c^1-approximate solution x1. Applying this procedure iteratively, the approximation factor decreases even faster than geometrically, roughly as c^i=c^i−11−2/p. Hence, after k=O⁢(p⁢log⁡log⁡c0) iterations we obtain an approximate solution xk with c^k=2O⁢(p), where the approximation factor does not improve further.

3.2 (𝐩𝐨𝐥𝐲⁡(𝒑),𝒓)-ANN with 𝐩𝐨𝐥𝐲⁡(𝒅)⁢𝒏𝑶⁢(𝐥𝐨𝐠⁡𝒑) Space [23]

In [23], the image space of the Mazur map is changed from ℓ2 to ℓt for general 1≤t<p. Generalizing the results from [14], a (ct,r)-ANN data structure in ℓtd with query time Q⁢(n) and space S⁢(n) is used to construct a (2O⁢(p/t)⋅ct,r)-ANN data structure for ℓpd with query time O⁢(d)+pt⁢O⁢(log⁡log⁡d)⁢Q⁢(n) and space pt⁢O⁢(log⁡log⁡d)⁢n⋅S⁢(n). Using the above result with t=p/2, and applying it recursively to decrease p to 2 (which is actually a double recursion, because we also iterate over the c^i’s), yields a (poly⁡(p),r)-ANN data structure with query time poly⁡(d⁢log⁡n). The caveat is that every application of the recursive step multiplies the space of the data structure by factor n, which yields a data structure with space poly⁡(d)⁢nO⁢(log⁡p).

4 (𝟐𝑶~⁢(𝐥𝐨𝐠⁡𝒑),𝒓)-ANN with 𝐩𝐨𝐥𝐲⁡(𝒅⁢𝒏) Space

In this section, we give the proof of Theorem 1.2. We first explain the intuition, and for simplicity we restrict this discussion to reducing the space requirement of [14]; reducing the space requirements of [23] is similar in spirit, although more technical.

Revisiting Section 3.1, the final solution xk is obtained by finding iteratively a sequence of intermediate solutions x0,x1,…,xk−1. Each iteration i<k makes progress by finding a point xi and restricting the search region to Bℓp⁢(xi,c^i⁢r), which has bounded diameter, and thus applying a Mazur map on this region has distortion guarantees. It follows that querying the data structure Axi,c^i (computed over Bℓp⁢(xi,c^i⁢r)∩X) finds a point xi+1 and we can restrict the search region even further, to diameter c^i+1⁢r.

The preprocessing phase prepares for the possibility that each point x∈X will serve (at query time) the c^i-approximate solution, i.e., the search region will be restricted to Bℓp⁢(x,c^i⁢r). To make progress and restrict the search region even further, a data structure Ax,c^i is constructed for (the points in) this region. Our key idea in Theorem 1.2 is that, rather than preparing a separate data structure for each search region, the algorithm constructs one global collection of data structures that together cover all the possible search regions. For every c^i, the algorithm constructs a set of ANN data structures computed on a collection of subsets 𝒮⊆2X, such that for every point x∈X there is some S∈𝒮 that contains the search region Bℓp⁢(x,c^i⁢r)∩X. In addition, every S∈𝒮 has diameter at most β⁢c^i⁢r for some β>1. We also want the total number of points in 𝒮 (counting repetitions) to be small. The preprocessing algorithm simply stores for every x∈X a reference to a set Sx∈𝒮 with Bℓp⁢(x,c^i⁢r)∩X⊆Sx, and at query time, if x serves as a c^i-approximate solution, the algorithm queries the ANN data structure constructed for Sx. Since Sx has a diameter at most β⁢c^i⁢r, this will still cause the search region’s diameter to shrink in the next iteration (although by a slightly smaller factor). Since the total number of points in 𝒮 is small, the total memory used by all the ANN data structures will be small too.

It remains to show that the preprocessing phase can indeed find efficiently a collection of subsets of X with the above properties. Fortunately, this was shown to be possible in [11, 12], and has become a fundamental algorithmic tool with numerous applications in distributed computing, network design, routing, graph algorithms, and metric embeddings.

Definition 4.1 (Sparse Neighborhood Cover [11, 12]).

A (β,r)-sparse cover of a metric space ℳ=(X,dℳ) is a collection of subsets (called clusters) 𝒮⊆2X, each of diameter at most β⁢r, such that for every x∈X there exists S∈𝒮 with Bdℳ⁢(x,r)⊆S. The total number of points ∑S∈𝒮|S| is called the sparsity of 𝒮.

Theorem 4.2 ([12]).

There is an algorithm that, given an n-point metric space ℳ and parameters β>1 and r>0, outputs a (β,r)-sparse cover of ℳ of sparsity O⁢(n1+1/β), and runs in O⁢(β⁢n2+2/β) time.

We are now ready to prove Theorem 1.2, largely following the proof structure of [23, Theorem 1.8].

Proof of Theorem 1.2.

Let X⊂ℓpd be an n-point dataset for some p∈(2,∞). For clarity of exposition, we assume that p is a power of 2, which can be easily resolved, see [23, Theorem 1.2]. Also, by an application of Hölder’s inequality, we may assume that p≤log⁡d.

We construct the ANN scheme using a doubly-recursive procedure. The first recursion assumes access to an ANN scheme for ℓpd that achieves approximation factor cbase, and provides a new ANN scheme for ℓpd that achieves improved (smaller) approximation cnew. This step crucially relies on access to yet another ANN data structure, for ℓtd, for t=p/2, that is actually constructed by the same method. This leads to a second recursion, of constructing ANN data structures for intermediate spaces ℓpd,ℓp/2d,…,ℓ2d, where the space ℓ2d is known to have ANN data structures with O⁢(1) approximation.

We next describe the first recursion, i.e., how to construct an improved (cnew,r)-ANN scheme for ℓpd given a (cbase,r)-ANN scheme for ℓpd and a (ct,r)-ANN scheme for ℓtd, where t<p. In the preprocessing phase, use Theorem 4.2 to construct for X a (β,2⁢cbase⁢r)-cover 𝒮 with sparsity O~⁢(n1+1/β) for β=log⁡p. During the construction of 𝒮, store for every x∈X a reference to a set Sx∈𝒮 that “covers” it, i.e., Bℓp⁢(x,2⁢cbase⁢r)∩X⊆Sx, which is guaranteed to exist in a sparse cover. In addition, for every S∈𝒮 designate (arbitrarily) a center point y∈S, apply a Mazur map My:ℓpd→ℓtd scaled down by factor pt⋅(2⁢β⁢cbase⁢r)p/t−1 on Bℓp⁢(0,2⁢β⁢cbase⁢r)∩(X−y), and construct for these image points a (ct,r)-ANN scheme AS. Finally, construct a (cbase,r)-ANN scheme Abase for X, and amplify the success probabilities of both data structures to 5/6 by the standard method of independent repetitions. Given a query q∈ℓpd that is guaranteed to have x∗∈X with ‖x∗−q‖p≤r, query Abase for the point q and obtain an answer xbase∈X. Then find its cluster Sxbase and this cluster’s designated center y, query ASxbase for the point My⁢(q−y)∈ℓtd, and use its answer My⁢(zout−y)∈My⁢(X−y) to output the corresponding zout∈X.

The next claim is analogous to [23, Claim 4.1], and the main difference is using the sparse cover.

⊳ Claim 4.3.

With probability at least 2/3, we have ‖zout−q‖p≤cnew⁢r, where cnew=(pt)t/p⁢ctt/p⁢(4⁢β⁢cbase)1−t/p.

Proof.

With probability at least 56, the data structure Ab⁢a⁢s⁢e outputs a point xbase with ‖xbase−q‖p≤cbase⁢r. Let Sxbase be the set in the cover referenced by xbase, and let y∈Sxbase be its designated center point. Since

‖x∗−xbase‖p≤‖x∗−q‖p+‖q−xbase‖p≤2⁢cbase⁢r,

we get that x∗∈Bℓp⁢(xbase,2⁢cbase⁢r)∩X⊆Sxbase. Observe that by Theorem 2.1, ‖My⁢(x∗)−My⁢(q)‖t≤r, and thus with probability at least 56, querying ASxbase finds a point My⁢(zout)∈My⁢(Sxbase)⊆My⁢(X) with ‖My⁢(zout)−My⁢(q)‖t≤ct⁢r. Applying a union bound, we see that with probability at least 2/3, both events hold. In this case, we have by Theorem 2.1, that

tp⋅(4⁢β⁢cbase⁢r)1−p/t⋅‖zout−q‖pp/t≤‖My⁢(zout)−My⁢(q)‖t≤ct⁢r,

and by rearranging, we obtain ‖zout−q‖p≤(pt)t/p⁢ctt/p⁢(4⁢β⁢cbase)1−t/p⁢r=cnew⁢r. ⊲

Denote by c^i the approximation of the ANN scheme obtained by i applications of ˜4.3, where the initial ANN scheme is the one from [16], with approximation c^0=poly⁡(d). We also denote by ct the approximation of an ANN scheme for ℓt, that is constructed by the same method (i.e., recursively), except that for ℓ2d we use a (2,r)-ANN scheme from [18] with poly⁡(d⁢log⁡n) query time and poly⁡(d⁢n) space and preprocessing time. Using ˜4.3 with t=p/2, and furthermore applying this recursively k=⌈log⁡(log⁡c^0)⌉=O⁢(log⁡log⁡d) times, we obtain

c^k≤8⁢β⁢cp/2⁢c^k−1≤8⁢β⁢cp/2⁢8⁢β⁢cp/2⁢c^k−2≤…≤8⁢β⁢cp/2⋅c^01/2k≤16⁢β⁢cp/2,

i.e., this scheme has approximation cp=c^k≤16⁢β⁢cp/2. We can amplify the success probability of this scheme to 1−13⁢log⁡p by the standard method of O⁢(log⁡log⁡p)=O⁢(log⁡log⁡log⁡d) independent repetitions. Now by recursion over p for log⁡p levels, we get that

cp≤(16⁢β)log⁡p=(16⁢log⁡p)log⁡p=p4+log⁡log⁡p,

and the overall success probability is at least 23 by a union bound.

We are left to analyze the query time of the algorithm, and its space and preprocessing time. Each level of the second recursion makes a total of k⋅O⁢(log⁡log⁡p)=O~⁢(log⁡log⁡d) calls to an ANN scheme for ℓt, for different intermediate values of t. Since the (2,r)-ANN for ℓ2 from [18] has query time poly⁡(d⁢log⁡n), and recalling that p≤log⁡d, the overall query time is O~⁢(log⁡log⁡d)log⁡p⋅poly⁡(d⁢log⁡n)=poly⁡(d⁢log⁡n).

To analyze the space and preprocessing time, we prove the following claim.

⊳ Claim 4.4.

There exists an absolute constant D>2 such that when the data structure for ℓtd, t=2i, is computed on m points, it uses total space and preprocessing time O~⁢(log⁡log⁡d)i⁢poly⁡(d)⁢O⁢(m)D+i/log⁡p.

Proof.

We only analyze the space usage of the data structure; the analysis of the preprocessing time follows similarly, as it takes O⁢(d) time to compute a Mazur map and O⁢(log⁡p⋅m2⁢(1+1/log⁡p))≤O⁢(log⁡log⁡d⋅m2⁢(1+1/log⁡p)) time to compute a sparse cover.

The proof proceeds by induction on i≥0. For i=0, the claim follows because the (2,r)-ANN from [18], when computed on m points, uses at most poly⁡(d)⁢mD space for some absolute constant D>1. Now, assume the claim holds for i−1≥0. The ANN scheme at level i of the recursion consists of two types of ANN schemes. The first type is an ANN scheme from [16] computed on all m points, which uses poly⁡(d)⁢O~⁢(m)≤poly⁡(d)⁢O⁢(m)D⁢(1+1/log⁡p) space. The second type are multiple ANN schemes at level i−1 that are computed on different subsets of the m points. For every j=0,1,…,k=O~⁢(log⁡log⁡d), let 𝒮j be the sparse cover of sparsity O⁢(m1+1/log⁡p) computed for the points at the j-th level of the first recursion. For every level j of the first recursion and cluster S∈𝒮j, the algorithm computes a data structure of level i−1 on S. By the induction hypothesis, the space of this data structure is bounded by O~⁢(log⁡log⁡d)i⁢poly⁡(d)⁢O⁢(m)D+i/log⁡p. Observe that the function f:x↦O~⁢(log⁡log⁡d)i⁢poly⁡(d)⁢xD+i/log⁡p satisfies that f⁢(a)+f⁢(b)≤f⁢(a+b) for all a,b≥1, and, since every data structure is constructed over some S∈𝒮j containing at most m points, we can bound the contribution of every point p∈S to the total space usage of the data structure by f⁢(m)m. Since for every j the sparsity of 𝒮j is at most O⁢(m1+1/log⁡p), the total space usage of all ANN schemes computed over all clusters of 𝒮j is at most

O⁢(m1+1/log⁡p)⁢f⁢(m)m≤O~⁢(log⁡log⁡d)i⁢poly⁡(d)⁢O⁢(m)D+(i+1)/log⁡p.

Hence, the total space usage is

O~⁢(log⁡log⁡d)⋅(O~⁢(log⁡log⁡d)i⋅poly⁡(d)⋅O⁢(m)D+(i+1)/log⁡p)+poly⁡(d)⋅O~⁢(m)
≤O~⁢(log⁡log⁡d)i+1⋅poly⁡(d)⋅O⁢(m)D+(i+1)/log⁡p,

completing the proof. ⊲ Finally, we use ˜4.4 for m=n and i=log⁡p, and obtain that the space usage of the entire ANN data structure is bounded by

O~⁢(log⁡log⁡d)log⁡p⁢poly⁡(d)⋅nD+log⁡p/log⁡p≤poly⁡(d)⋅nD+1≤poly⁡(d⁢n),

which completes the proof of Theorem 1.2. ◀

▶ Remark 4.5.

Modifying the parameter β of the sparse cover in the proof of Theorem 1.2 from log⁡p to log⁡pδ for 0<δ<1 yields a data structure with a slightly larger approximation factor pO⁢(1)+log⁡(1/δ)+log⁡log⁡p, but space requirement that matches that of [18] up to subpolynomial factors in d and an additional nδ term.

▶ Remark 4.6.

The same technique used in the proof of Theorem 1.2, namely applying Theorem 4.2 to construct covers in the preprocessing phase, can also be used to improve the space requirement of ANN for general normed spaces from [8, Theorem 3]. More specifically, for every 0<δ<1, one can shave an Ω⁢(n1−δ) factor from the space of their data structure, at the cost of an additional O⁢(δ−1) factor in the approximation.

References

  • [1] A. Andoni and P. Indyk. Nearest neighbors in high-dimensional spaces. In Handbook of Discrete and Computational Geometry, chapter 43, pages 1135–1150. CRC Press, 3rd edition, 2017. doi:10.1201/9781315119601.
  • [2] A. Andoni, P. Indyk, and R. Krauthgamer. Overcoming the l1 non-embeddability barrier: algorithms for product metrics. In 19th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 865–874. SIAM, 2009. doi:10.1137/1.9781611973068.94.
  • [3] Alexandr Andoni. NN search: the old, the new, and the impossible. PhD thesis, Massachusetts Institute of Technology, 2009. URL: https://hdl.handle.net/1721.1/55090.
  • [4] Alexandr Andoni, Dorian Croitoru, and Mihai Pătraşcu. Hardness of nearest neighbor under l-infinity. In 49th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2008, pages 424–433. IEEE Computer Society, 2008. doi:10.1109/FOCS.2008.89.
  • [5] Alexandr Andoni and Piotr Indyk. Near-optimal hashing algorithms for approximate nearest neighbor in high dimensions. In 47th Annual IEEE Symposium on Foundations of Computer Science, pages 459–468. IEEE, 2006. doi:10.1109/FOCS.2006.49.
  • [6] Alexandr Andoni, Piotr Indyk, and Ilya Razenshteyn. Approximate nearest neighbor search in high dimensions. In Proceedings of the International Congress of Mathematicians (ICM 2018), pages 3287–3318, 2019. doi:10.1142/9789813272880_0182.
  • [7] Alexandr Andoni, Assaf Naor, Aleksandar Nikolov, Ilya P. Razenshteyn, and Erik Waingarten. Data-dependent hashing via nonlinear spectral gaps. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, pages 787–800. ACM, 2018. doi:10.1145/3188745.3188846.
  • [8] Alexandr Andoni, Assaf Naor, Aleksandar Nikolov, Ilya P. Razenshteyn, and Erik Waingarten. Hölder homeomorphisms and approximate nearest neighbors. In 59th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2018, pages 159–169. IEEE Computer Society, 2018. doi:10.1109/FOCS.2018.00024.
  • [9] Alexandr Andoni, Aleksandar Nikolov, Ilya P. Razenshteyn, and Erik Waingarten. Approximate nearest neighbors beyond space partitions. In Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms, SODA 2021, pages 1171–1190. SIAM, 2021. doi:10.1137/1.9781611976465.72.
  • [10] Alexandr Andoni and Negev Shekel Nosatzki. Embeddings into similarity measures for nearest neighbor search. In 66th IEEE Annual Symposium on Foundations of Computer Science, FOCS, pages 864–893. IEEE, 2025. doi:10.1109/FOCS63196.2025.00045.
  • [11] B. Awerbuch and D. Peleg. Sparse partitions. In 31st Annual IEEE Symposium on Foundations of Computer Science, pages 503–513, 1990. doi:10.1109/FSCS.1990.89571.
  • [12] Baruch Awerbuch, Bonnie Berger, Lenore Cowen, and David Peleg. Near-linear time construction of sparse neighborhood covers. SIAM Journal on Computing, 28(1):263–277, 1998. doi:10.1137/S0097539794271898.
  • [13] Yiqiao Bao, Anubhav Baweja, Nicolas Menand, Erik Waingarten, Nathan White, and Tian Zhang. Average distortion sketching. In 66th IEEE Annual Symposium on Foundations of Computer Science, FOCS, pages 277–302. IEEE, 2025. doi:10.1109/FOCS63196.2025.00019.
  • [14] Yair Bartal and Lee-Ad Gottlieb. Approximate nearest neighbor search for ℓp-spaces (2<p<∞) via embeddings. Theoretical Computer Science, 757:27–35, 2019. doi:10.1016/j.tcs.2018.07.011.
  • [15] Yoav Benyamini and Joram Lindenstrauss. Geometric nonlinear functional analysis, volume 48. American Mathematical Soc., 1998.
  • [16] Timothy M. Chan. Approximate nearest neighbor queries revisited. Discret. Comput. Geom., 20(3):359–373, 1998. doi:10.1007/PL00009390.
  • [17] Mayur Datar, Nicole Immorlica, Piotr Indyk, and Vahab S. Mirrokni. Locality-sensitive hashing scheme based on p-stable distributions. In 20th annual symposium on Computational geometry, pages 253–262. ACM, 2004. doi:10.1145/997817.997857.
  • [18] Sariel Har-Peled, Piotr Indyk, and Rajeev Motwani. Approximate nearest neighbor: Towards removing the curse of dimensionality. Theory Comput., 8(1):321–350, 2012. doi:10.4086/TOC.2012.V008A014.
  • [19] P. Indyk and R. Motwani. Approximate nearest neighbors: towards removing the curse of dimensionality. In 30th Annual ACM Symposium on Theory of Computing, pages 604–613, 1998. doi:10.1145/276698.276876.
  • [20] Piotr Indyk. On approximate nearest neighbors under ℓ∞ norm. J. Comput. Syst. Sci., 63(4):627–638, 2001. doi:10.1006/JCSS.2001.1781.
  • [21] Michael Kapralov and Rina Panigrahy. NNS lower bounds via metric expansion for ℓ∞ and EMD. In 39th International Colloquium on Automata, Languages and Programming, ICALP 2012, volume 7391 of Lecture Notes in Computer Science, pages 545–556. Springer, 2012. doi:10.1007/978-3-642-31594-7_46.
  • [22] Robert Krauthgamer and Nir Petruschka. Lipschitz Decompositions of Finite ℓp Metrics. In 41st International Symposium on Computational Geometry (SoCG 2025), volume 332 of Leibniz International Proceedings in Informatics (LIPIcs), pages 66:1–66:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2025. doi:10.4230/LIPIcs.SoCG.2025.66.
  • [23] Robert Krauthgamer, Nir Petruschka, and Shay Sapir. The power of recursive embeddings for ℓp metrics. In 66th IEEE Annual Symposium on Foundations of Computer Science, FOCS, pages 2546–2554. IEEE, 2025. doi:10.1109/FOCS63196.2025.00132.
  • [24] Deepanshu Kush, Aleksandar Nikolov, and Haohua Tang. Near neighbor search via efficient average distortion embeddings. In 37th International Symposium on Computational Geometry, SoCG 2021, volume 189 of LIPIcs, pages 50:1–50:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPIcs.SOCG.2021.50.
  • [25] E. Kushilevitz, R. Ostrovsky, and Y. Rabani. Efficient search for approximate nearest neighbor in high dimensional spaces. SIAM J. Comput., 30(2):457–474, 2000. doi:10.1137/S0097539798347177.
  • [26] Assaf Naor and Kevin Ren. Optimal randomized clustering for subsets of Lp when p>2. In Proceedings of the 2026 Annual ACM-SIAM Symposium on Discrete Algorithms, SODA, pages 984–995. SIAM, 2026. doi:10.1137/1.9781611978971.40.
  • [27] Huy L. Nguyen. Approximate nearest neighbor search in ℓp. CoRR, abs/1306.3601, 2013. arXiv:1306.3601.
  • [28] Daren Yu, Xiao Yu, and Anqi Wu. Making the nearest neighbor meaningful for time series classification. Proceedings of the 4th International Congress on Image and Signal Processing, CISP 2011, 5:2481–2485, October 2011. doi:10.1109/CISP.2011.6100672.