Optimal lower bounds for locality sensitive hashing (except when q is tiny)

Ryan O'Donnell, Yi Wu, Yuan Zhou

Locality Sensitive Hashing

Locality Sensitive Hashing (LSH) is a widely-used algorithmic tool which brings the classic technique of hashing to geometric settings. It was introduced for general metric spaces in the seminal work of Indyk and Motwani [IM98]. Indyk and Motwani showed that the important problem of (approximate) nearest neighbor search can be reduced to the problem of devising good LSH families. Subsequently, numerous papers demonstrating the practical utility of solving high-dimensional nearest neighbor search problems via the LSH approach [GIM99, Buh01, CDF+01, SVD03, RPH05, DDGR07]. For a survey on LSH, see Andoni and Indyk [AI08].

We recall the basic definition from [IM98]:

As mentioned, the most useful application of LSH is to the approximate near neighbor problem in high dimensions:

Several important problems in computational geometry reduce to the approximate near neighbor problem, including approximate versions of nearest neighbor, furthest neighbor, close pair, minimum spanning tree, and facility location. For a short survey of these topics, see Indyk [Ind04].

Regarding the reduction from (r,c)(r,c)-near neighbor problem to LSH, it is usual (see [Ind01, DIIM04]) to credit roughly the following theorem to [IM98, GIM99]:

The rho parameter of an (r,cr,p,q)(r,cr,p,q)-sensitive LSH family H{\cal H} is

Please note that in Theorem 1.1, it is implicitly assumed [Ind09] that qq is bounded away from . For “subconstant” values of qq, the theorem does not hold. This point is discussed further in Section 4.

Because of Theorem 1.1, there has been significant interest [DIIM04, TT07, AI08, Ney10] in determining the smallest possible ρ\rho that can be obtained for a given metric space and value of cc. Constant factors are important here, especially for the most natural regime of cc close to 11. For example, shrinking ρ\rho by an additive .5.5 leads to time and space savings of Θ(n)\Theta(\sqrt{n}).

Previous work

The original work of Indyk and Motwani [IM98] contains the following simple yet strong result:

There is an LSH family H{\cal H} for {0,1}d\{0,1\}^{d} under the Hamming distance which for each c>1c>1 has rho parameter

In this theorem, the family is simply the uniform distribution over the dd functions hi(x)=xih_{i}(x)=x_{i}. For a given cc and rr, this family is obviously (r,cr,1−r/d,1−cr/d)(r,cr,1-r/d,1-cr/d)-sensitive, whence

(The complexity of evaluating a hash function h∼Ht\bm{h}\sim{\cal H}_{t} also increases as tt increases.)

2 Lower bounds

There is one known result on lower bounds for LSH, due to Motwani, Naor, and Panigrahy [MNP07]:

Fix c>1c>1, 0<q<10<q<1, and consider d→∞d\to\infty. Then there exists some r=r(d)r=r(d) such that for any LSH family H{\cal H} for {0,1}d\{0,1\}^{d} under Hamming distance which is (r,cr,p,q)(r,cr,p,q)-sensitive must satisfy

The metric setting of {0,1}d\{0,1\}^{d} under Hamming distance is the most powerful setting for lower bounds; as Motwani, Naor, and Panigrahy note, one can immediately deduce a lower bound of

As c→∞c\to\infty, the lower bound in Theorem 2.4 approaches 12c\frac{1}{2c}. This is a factor of 22 away from the upper bound of Indyk and Motwani. The gap is slightly larger in the more natural regime of cc close to 11; here one only has that ρ(H)≥e−1e+11c≈.46c\rho({\cal H})\geq\frac{e-1}{e+1}\frac{1}{c}\approx\frac{.46}{c}.

Note that in Theorem 2.4, the parameter qq is fixed before one lets dd tend to ∞\infty; i.e., qq is assumed to be at least a “constant”. Even though this is the same assumption implicitly made in the application of LSH to near-neighbors (Theorem 1.1), we feel it is not completely satisfactory. In fact, as stated in [MNP07], Theorem 2.4 still holds so long as q≥2−o(d)q\geq 2^{-o(d)}. Our new lower bound for LSH also holds for this range of qq. But we believe the most satisfactory lower bound would hold even for “tiny” qq, meaning q=2−Θ(d)q=2^{-\Theta(d)}. This point is discussed further in Section 4.

Our result

In this work, we improve on Theorem 2.4 by obtaining a sharp lower bound of 1c−od(1)\frac{1}{c}-o_{d}(1) for every c>1c>1. This dependence on cc is optimal, by the upper bound of Indyk and Motwani. The precise statement of our result is as follows:

Here, the precise meaning of the O~(⋅)\widetilde{O}(\cdot) expression is

where KK is a universal constant, and we assume d/ln⁡(2/q)≥2d/\ln(2/q)\geq 2, say.

As mentioned, the lower bound is only of the form 1c−od(1)\frac{1}{c}-o_{d}(1) under the assumption that q≥2−o(d)q\geq 2^{-o(d)}. For qq of the form 2−d/B2^{-d/B} for a large constant BB, the bound (1) still gives some useful information.

As with the Motwani–Naor–Panigrahy result, because our lower bound is for {0,1}d\{0,1\}^{d} we may immediately conclude:

This lower bound matches the known upper bounds for Euclidean space s=2s=2 ([AI08]) and 0<s≤10<s\leq 1 ([DIIM04]). It seems reasonable to conjecture that it is also tight at least for 1<s<21<s<2.

Finally, the lower bound in Theorem 3.1 also holds for the Jaccard distance on sets, matching the upper bound of Indyk and Motwani [IM98]. We explain why this is true in Section 3.2, although we omit the very minor necessary changes to the proof details.

Our proof of Theorem 3.1 requires some facts about boolean noise stability. We begin by recalling some basics of the analysis of boolean functions.

For 0<ρ≤10<\rho\leq 1, we say that (x,y)(\bm{x},\bm{y}) are ρ\rho-correlated random strings in {0,1}d\{0,1\}^{d} if x\bm{x} is chosen uniformly at random and y\bm{y} is formed by rerandomizing each coordinate of x\bm{x} independently with probability 1−ρ1-\rho.

where ⟨w,z⟩=∑i∈Uwizi\langle w,z\rangle=\sum_{i\in U}w_{i}z_{i} is the usual inner product.In the case that UU is countably infinite, we require our functions ff to have ∥f(x)∥2<∞\|f(x)\|_{2}<\infty for all x∈{0,1}dx\in\{0,1\}^{d}.

We also extend the notion of noise stability to hash families:

If H{\cal H} is a hash family on {0,1}d\{0,1\}^{d}, we define

By combining this definition with equation (2) and Proposition 3.3, we immediately deduce:

Let H{\cal H} be a hash family on {0,1}d\{0,1\}^{d}. Then

Finally, it is sometimes more natural to express the parameter ρ\rho as ρ=e−t\rho=e^{-t}, where t∈[0,∞)t\in[0,\infty). (For example, we can think of a ρ\rho-correlated pair (x,y)(\bm{x},\bm{y}) by taking x\bm{x} to be uniformly random and y\bm{y} to be the string that results from running the standard continuous-time Markov Chain on {0,1}d\{0,1\}^{d}, starting from x\bm{x}, for time tdtd.) We make the following definition:

2 The proof, modulo some tedious calculations

We now present the essence of our proof of Theorem 3.1. It will be quite simple to see how it gives a lower bound of the form 1c−od(1)\frac{1}{c}-o_{d}(1) (assuming qq is not tiny). Some very tedious calculations (Chernoff bounds, elementary inequalities, etc.) are needed to get the precise statement given in Theorem 3.1; the formal proof is therefore deferred to Section 5.

Let H{\cal H} be a hash family on {0,1}d\{0,1\}^{d}, and let us consider

We then deduce the desired lower bound of 1/c1/c from the following theorem and its corollary:

For any hash family H{\cal H} on {0,1}d\{0,1\}^{d}, t≥0t\geq 0, and c≥1c\geq 1,

As mentioned, we give the careful proof keeping track of approximations in Section 5. But first, we note what we view as a shortcoming of the proof: after deducing KH(ct)≥q−od(1)K_{{\cal H}}(ct)\geq q-o_{d}(1), we wish to “neglect” the additive od(1)o_{d}(1) term. This requires that od(1)o_{d}(1) indeed be negligible compared to qq! Being more careful, the od(1)o_{d}(1) arises from a Chernoff bound applied to a Binomial(d,ct)(d,ct) random variable, where t>0t>0 is very small. So to be more precise, the error term is of the form exp⁡(−ϵd)\exp(-\epsilon d), and hence is only negligible if q≥2−o(d)q\geq 2^{-o(d)}.

Discussion

As described in Section 1, it is normally stated that the quality of an (r,cr,p,q)(r,cr,p,q)-sensitive LSH family H{\cal H} is governed by ρ=ln⁡(1/p)/ln⁡(1/q)\rho=\ln(1/p)/\ln(1/q), and more specifically that H{\cal H} can be used to solve the (r,c)(r,c)-near neighbor problem with roughly O(n1+ρ)O(n^{1+\rho}) space and query time O(nρ)O(n^{\rho}). However, this involves the implicit assumption that qq is bounded away from .

Given an (r,cr,p,q)(r,cr,p,q)-sensitive family H{\cal H} of functions X→UX\to U and a positive integer kk, we define the family H⊗k{\cal H}^{\otimes k} by drawing h1,…,hk\bm{h}_{1},\dots,\bm{h}_{k} independently from H{\cal H} and forming the function h:X→Uk\bm{h}:X\to U^{k}, h(x)=(h1(x),…,hk(x))\bm{h}(x)=(\bm{h}_{1}(x),\dots,\bm{h}_{k}(x)). It is easy to check that H⊗k{\cal H}^{\otimes k} is (r,cr,pk,qk)(r,cr,p^{k},q^{k})-sensitive.

Indyk and Motwani show that if one has an (r,cr,p′,q′)(r,cr,p^{\prime},q^{\prime})-sensitive hash family with q′≤1/nq^{\prime}\leq 1/n, then one can obtain a (r,c)(r,c)-near neighbor data structure with space roughly O(n/p′)O(n/p^{\prime}) and query time roughly O(1/p′)O(1/p^{\prime}). Thus given an arbitrary (r,cr,p,q)(r,cr,p,q)-sensitive family H{\cal H}, Indyk and Motwani suggest using the Powering Construction with k=log⁡1/q(n)k=\log_{1/q}(n). The resulting H⊗k{\cal H}^{\otimes k} is (r,cr,p′,1/n)(r,cr,p^{\prime},1/n)-sensitive, with p′=pk=n−ρp^{\prime}=p^{k}=n^{-\rho}, yielding an O(n1+ρ)O(n^{1+\rho}) space, O(nρ)O(n^{\rho}) time data structure.

However this argument makes sense only if kk is a positive integer. For example, with the trivially “optimal” LSH family, we have q=0q=0 and thus k=−∞k=-\infty. Indeed, whenever q≤1/nq\leq 1/n to begin with, one doesn’t get O(n1+ρ)O(n^{1+\rho}) space and O(nρ)O(n^{\rho}) time, one simply gets O(n/p)O(n/p) space and O(1/p)O(1/p) time. For example, a hypothetical LSH family with p=1/n.5p=1/n^{.5} and q=1/n1.5q=1/n^{1.5} has ρ=1/3\rho=1/3 but only yields an O(n1.5)O(n^{1.5}) space, O(n.5)O(n^{.5}) time near neighbor data structure.

The assumption q>1/nq>1/n is still not enough for the deduction in Theorem 1.1 to hold precisely. The reason is that the Indyk–Motwani choice of kk may not be an integer. For example, suppose we design an (r,cr,p,q)(r,cr,p,q)-sensitive family H{\cal H} with p=1/n.15p=1/n^{.15} and q=1/n.3q=1/n^{.3}. Then ρ=.5\rho=.5. However, we cannot actually get an O(n1.5)O(n^{1.5}) space, O(n.5)O(n^{.5}) time data structure from this H{\cal H}. The reason is that to get qk≤1/nq^{k}\leq 1/n, we need to take k=4k=4. Then pk=1/n.6p^{k}=1/n^{.6}, so we only get an O(n1.6)O(n^{1.6}) space, O(n.6)O(n^{.6}) time data structure.

The effect of rounding kk up to the nearest integer is not completely eliminated unless one makes the assumption, implicit in Theorem 1.1, that q≥Ω(1)q\geq\Omega(1). Under the weaker assumption that q≥n−o(1)q\geq n^{-o(1)}, the conclusion of Theorem 1.1 remains true up to no(1)n^{o(1)} factors. To be completely precise, one should assume q≥1/nq\geq 1/n and take k=⌈log⁡1/q(n)⌉k=\lceil\log_{1/q}(n)\rceil. If we then use k≤log⁡1/q(n)+1k\leq\log_{1/q}(n)+1, the Powering Construction will yield an LSH family with q′≤1/nq^{\prime}\leq 1/n and p′=(n/q)−ρp^{\prime}=(n/q)^{-\rho}. In this way, one obtains a refinement of Theorem 1.1 with no additional assumptions:

2 On assuming q𝑞q is not tiny

Let us return from the near-neighbor problem to the study of locality sensitive hashing itself. Because of the “trivial” LSH family, it is essential to impose some kind of lower bound on how small the parameter qq is allowed to be. Motwani, Naor, and Panigrahy carry out their lower bound for LSH families on {0,1}d\{0,1\}^{d} under the assumption that q≥Ω(1)q\geq\Omega(1), but also note that it goes through assuming q≥2−o(d)q\geq 2^{-o(d)}. Our main result, Theorem 3.1, is also best when q≥2−o(d)q\geq 2^{-o(d)}, and is only nontrivial assuming q≥2−d/Bq\geq 2^{-d/B} for a sufficiently large constant BB.

One may ask what the “correct” lower bound assumed on qq should be. For the Indyk–Motwani application to (r,c)(r,c)-near neighbor data structures, the answer seems obvious: “1/n1/n”. Indeed, since the Indyk–Motwani reduction immediately uses Powering to reduce the qq parameter down to 1/n1/n, the most meaningful LSH lower bounds would simply involve fixing q=1/nq=1/n and trying to lower bound pp.

There is an obvious catch here, though, which is that in the definition of LSH, there is no notion of “nn”! Still, in settings such as {0,1}d\{0,1\}^{d} which have a notion of dimension, dd, it seems reasonable to think that applications will have n=2Θ(d)n=2^{\Theta(d)}. In this case, to maintain the Indyk–Motwani Theorem 4.1 up to no(1)n^{o(1)} factors one would require q≥2−o(d)q\geq 2^{-o(d)}. This is precisely the assumption that this paper and the Motwani–Naor–Panigrahy paper have made. Still, we believe that the most compelling kind of LSH lower bound for {0,1}d\{0,1\}^{d} would be nontrivial even for q=2−d/bq=2^{-d/b} with a “medium” constant bb, say b=10b=10. We currently do not have such a lower bound.

Proof details

We require the following lemma, whose proof follows easily from Proposition 3.4 and the definition of hash family sensitivity:

Let H{\cal H} be an (r,cr,p,q)(r,cr,p,q)-sensitive hash family on {0,1}d\{0,1\}^{d} and suppose (x,y)(\bm{x},\bm{y}) is a pair of e−ue^{-u}-correlated random strings. Then

We now prove Theorem 3.1, which for convenience we slightly rephrase as follows:

Let 0<Δ=Δ(c,d,q)<.0050<\Delta=\Delta(c,d,q)<.005 be a small quantity to be chosen later, and let ϵ=.005Δ\epsilon=.005\Delta. Suppose that H{\cal H} is an ((ϵ/c)d,ϵd,p,q)((\epsilon/c)d,\epsilon d,p,q)-sensitive hash family for {0,1}d\{0,1\}^{d}. Our goal is to lower bound ρ=ln⁡(1/p)/ln⁡(1/q)\rho=\ln(1/p)/\ln(1/q). By the Powering Construction we may assume that q≤1/eq\leq 1/e, and hence will use ln⁡(1/q)≥1\ln(1/q)\geq 1 without further comment. Define also t=2ϵ(1+Δ/2)t=2\epsilon(1+\Delta/2) and c′=c(1+Δ)c^{\prime}=c(1+\Delta).

Let (x1,y1)(\bm{x}_{1},\bm{y}_{1}) be exp⁡(−t/c′)\exp(-t/c^{\prime})-correlated random strings and let (x2,y2)(\bm{x}_{2},\bm{y}_{2}) be exp⁡(−t)\exp(-t)-correlated random strings. Using the two bounds in Lemma 5.1 separately, we have

We will also ensure that the quantity in (7) is positive by making the following

Substituting the three estimates (5)–(7) into (4) we obtain

We now estimate e1e_{1} and e2e_{2} in terms of Δ\Delta (and ϵ\epsilon), after which we will choose Δ\Delta so as to minimize ee. By definition, e1e_{1} is the probability that a Binomial(d,η1)(d,\eta_{1}) random variable exceeds (ϵ/c)d(\epsilon/c)d, where η1=(1−exp⁡(t/c′))/2\eta_{1}=(1-\exp(t/c^{\prime}))/2. Let us select δ1\delta_{1} so that (1+δ1)η1=ϵ/c(1+\delta_{1})\eta_{1}=\epsilon/c. Thus

Here we used the definitions of tt and c′c^{\prime}, and then the assumption Δ<.005\Delta<.005. Using a standard Chernoff bound, we conclude

using the fact that δ2/(2+δ)\delta^{2}/(2+\delta) is increasing in δ\delta, and Δ<.005\Delta<.005 again. We additionally estimate

Here the second inequality used t/2c′≤.01t/2c^{\prime}\leq.01, which certainly holds since t/2c′≤ϵ=.005Δt/2c^{\prime}\leq\epsilon=.005\Delta. The third inequality used Δ≤.005\Delta\leq.005. Substituting this into (11) we obtain our upper bound for e1e_{1},

Our estimation of e2e_{2} is quite similar:

where η2=(1−exp⁡(−t))/2\eta_{2}=(1-\exp(-t))/2 and δ2\delta_{2} is chosen so that (1−δ2)η2=ϵ(1-\delta_{2})\eta_{2}=\epsilon. This entails

This expression is the reason we were forced to take ϵ\epsilon noticeably smaller than Δ\Delta. Using our specific setting ϵ=.005Δ\epsilon=.005\Delta, we conclude

where we used Δ≤.005\Delta\leq.005 again. As for η2\eta_{2}, we can lower bound it similarly to η1\eta_{1}, obtaining

Substituting our lower bounds for δ2\delta_{2} and η2\eta_{2} into (13) yields

Plugging our upper bounds (12), (14) for e1e_{1}, e2e_{2} into (10) gives

where K1K_{1} is an absolute constant. For K1K_{1} sufficiently large, this makes all three terms in the bound (15) at most

It only remains to check whether this is a valid choice for Δ\Delta. First, we note that with this choice, assumptions (8) and (9) follow from (12) and (14) (and increasing K1K_{1} if necessary). Second, we required that Δ≤.005\Delta\leq.005. This may not hold. However, if it fails then we have

We can then trivialize the theorem by taking K=(K1/.005)3K=(K_{1}/.005)^{3}, making the claimed lower bound for ρ\rho smaller than 1/c−1/c1/3≤01/c-1/c^{1/3}\leq 0. ∎

Acknowledgments

The authors would like to thank Alexandr Andoni, Piotr Indyk, Assaf Naor, and Kunal Talwar for helpful discussions.

References