Tight Lower Bounds for Data-Dependent Locality-Sensitive Hashing
Alexandr Andoni, Ilya Razenshteyn
Introduction
We study lower bounds for the high-dimensional nearest neighbor search problem, which is a problem of major importance in several areas, such as databases, data mining, information retrieval, computer vision, computational geometry, signal processing, etc. This problem suffers from the “curse of dimensionality” phenomenon: either space or query time are exponential in the dimension . To escape this curse, researchers proposed approximation algorithms for the problem. In the -approximate near neighbor problem, the data structure may return any data point whose distance from the query is at most , for an approximation factor (provided that there exists a data point within distance from the query). Many approximation algorithms are known for this problem: e.g., see surveys [Sam06, AI08, And09, WSSJ14].
An influential algorithmic technique for the approximate near neighbor search (ANN) is the Locality Sensitive Hashing (LSH) [IM98, HPIM12]. The main idea is to hash the points so that the probability of collision is much higher for points that are close to each other (at distance ) than for those which are far apart (at distance ). Given such hash functions, one can retrieve near neighbors by hashing the query point and retrieving elements stored in buckets containing that point. If the probability of collision is at least for the close points and at most for the far points, the algorithm solves the -ANN using essentially extra space and query time, where [HPIM12]. The value of the exponent thus determines the “quality” of the LSH families used.
Here we prove that the exponent from [AR15] is essentially optimal even for data-dependent hashing, and cannot be improved upon. Stating the precise theorem requires introducing the precise model for the lower bound, which we accomplish below. For now, we state our main theorem informally:
as long as the description complexity of the hash functions is sufficiently small.
1 Lower Bound Model
To state the precise theorem, we need to formally describe what is data-dependent hashing. First, we state the definition of (data-independent) LSH, as well as define LSH for a fixed dataset .
We say that a hash family over is -sensitive, if for every one has:
We now refine the notion of data-independent LSH, where we require the distribution to work only for a particular dataset .
A hash family over is said to be -sensitive for a dataset , if:
for every and every with one has
Note that the second definition is less stringent than the first one: in fact, if all the points in a dataset are at distance more than from each other, then an LSH family is also LSH for , but not necessarily vice versa! Furthermore, in the second definition, we require the second property to hold only on average (in contrast to every point as in the first definition). This aspect means that, while Definition 1.3 is certainly necessary for an ANN data structure, it is not obviously sufficient. Indeed, the algorithm from [AR15] requires proving additional properties of their partitioning scheme, and in particular analyzes triples of points. Since here we focus on lower bounds, this aspect will not be important.
We are now ready to introduce data-dependent hashing.
Intuitively, a data-dependent hashing scheme is one where we can pick the family as a function of , and thus be sensitive for . An obvious solution would hence be to choose to consist of a single hash function which is just the Voronoi diagram of the dataset : it will be -sensitive for and hence . However this does not yield a good data strcture for ANN since evaluating such a hash function on a query point is as hard as the original problem!
Hence, ideally, our lower bound model would require that the hash function is computationally efficient to evaluate. We do not know how to formulate such a condition which would not make the question as hard as circuit lower bounds or high cell-probe lower bounds, which would be well beyond the scope of this paper.
Instead, we introduce a condition on the hash family that can be roughly summarized as “hash functions from the family are succinct”. For a precise definition and discussion see below. For now, let us point out that all the known algorithmic results satisfy this condition.
Finally, we are ready to state the main result formally.
Fix the approximation to be a constant. Suppose the dataset lives in the Hamming space , where the dataset size is such that as tends to infinity. There exist distance thresholds and with the following property.
Suppose there exist hash functions over such that for every -point dataset there exists a distribution over ’s such that the corresponding hash family is -sensitive for , where . For any such data-dependent scheme it must either hold that or that .
Interpreting Theorem 1.4
Let us explain the conditions and the conclusions of Theorem 1.4 in more detail.
We start by interpreting the conclusions. As explained above, the bound directly implies the lower bound on the query time for any scheme that is based on data-dependent hashing.
The second bound is a little bit more mysterious. Let us now explain what it means precisely. The quantity can be interpreted as the description complexity of a hash function sampled from the family. At the same time, if we use a family with collision probability for close points, we need at least hash tables to achieve constant probability of success. Since in each hash table we evaluate at least one hash function, the quantity can be interpreted as the lower bound for the total space occupied by hash functions we evaluate during each query. In all known constructions of (data-independent or data-dependent) LSH families [IM98, DIIM04, AI06, TT07, AINR14, AR15] the evaluation time of a single hash function is comparable to the space it occupies (for discussion regarding why is it true for [AR15], see Appendix A), thus, under this assumption, we can not achieve query time , unless . On the other hand, we can achieve by considering a data-dependent hash family that consists only of the Voronoi diagram of a dataset (trivially, and for this case), thus the conclusion can not be omitted in generalFor the Voronoi diagram, , since to specify it, one needs at least bits.. Note that the “Voronoi diagram family” is very slow to evaluate: to locate a point we need to solve an instance of exact Nearest Neighbor Search, that is unlikely to be possible to do in strongly sublinear time. Thus, this family satisfies the above assumption “evaluation time is comparable to the space”.
We now turn to interpreting the conditions. We require that When ANN for the general dimension is being solved, one usually first performs some form of the dimensionality reduction [JL84, KOR00, DG03]. Since at this stage we do not want distances to be distorted by a factor more than , the target dimension is precisely . So, the assumption in Theorem 1.4 in some sense captures a truly high-dimensional case.. We conjecture that this requirement is necessary and for there is an LSH family that gives a better value of (the improvement, of course, would depend on the hidden constant in the expression ). Moreover, if one steps outside the pure data-dependent LSH framework, in a recent paper [BDGL15] an improved data structure for ANN for the case is presented, which achieves an improvement similar to what we conjectured above.
2 Techniques and Related Work
There are two components to our lower bound, i.e., Theorem 1.4.
The first component is a lower bound for data-independent LSH for a random dataset. We show that in this case, we must have . This is in contrast to the lower bound of [OWZ11], who achieve a higher lower bound but for the case when the (far) points are correlated. Our lower bound is closer in spirit to [MNP07], who also consider the case when the far points are random uncorrelated. In fact, this component is a strengthening of the lower bound from [MNP07], and is based crucially on an inequality proved there.
We mention that, in [Dub10], Dubiner has also considered the setting of a random dataset for a related problem—finding the closest pair in a given dataset . Dubiner sets up a certain related “bucketing” model, in which he conjectures the lower bound, which would imply a lower bound for data-independent LSH for a random set. Dubiner verifies the conjecture computationally and claims it is proved in a different manuscript.This manuscript does not appear to be available at the moment of writing of the present paper.
Our second component focuses on the data-dependent aspect of the lower bound. In particular, we prove that if there exists a data-dependent hashing scheme for a random dataset with a better , then in fact there is also a data-independent such hashing scheme. To accomplish this, we consider the “empirical” average and for a random dataset, and prove it is close to the average and , for which we can deduce a lower bound from the first component.
In terms of related work, we also must mention the papers of [PTW08, PTW10], who prove cell-probe lower bounds for the same problem of ANN. In particular, their work utilizes the lower bound of [MNP07] as well. Their results are however incomparable to our results: while their results are unconditional, our model allows us to prove a much higher lower bound, in particular matching the best algorithms.
Data-independent Lower Bound
In this section we prove the first component of Theorem 1.4. Overall we show a lower bound of for data-independent hash families for random datasets. Our proof is a strengthening of [MNP07]. The final statement appears as Corollary 2.7. In the second component, we will use a somewhat stronger statement, Lemma 2.6).
For and non-negative integer define a random variable distributed over to be the resulting point of the standard random walk of length that starts in (at each step we flip a random coordinate).
We build on the following inequality from [MNP07] that is proved using Fourier analysis on .
The above inequality can be thought of as a lower bound on already. In particular, the left-hand-side quantity is probability of collision of a point and a point generated via a random walk of length from it. The right-hand side corresponds to collision of random independent points, which are usually at distance . One already obtain a lower bound on by considering .
To strengthen the lower bound of [MNP07], we analyze carefully the distance between the endpoints of a random walk in the hypercube. In particular the next (somewhat folklore) lemmas show that this distance is somewhat smaller than the (trivial) upper bound of . Denote the distance . Note that the distribution of does not depend on a particular starting point .
We can now prove that the value of indeed concentrates well around the expectation, using concentration inequalities.
For define to be the index of the coordinate that got flipped at time . Obviously, we have that is a (deterministic) function of . Furthermore, changing one changes by at most 2. Hence we can apply the McDiarmid’s inequality to :
Let be independent random variables and such that changing variable only changes the value by at most . Then we have that
Substituting , we get the result. ∎
Note that choosing will mean that distance is now around , i.e., we can actually use random walks longer than the ones considered in [MNP07]. Indeed, from Lemma 2.2 and Lemma 2.3 one can immediately conclude the following corollary.
Let be a fixed constant. Suppose that is such that as . Then, there exists such that
We are now ready to prove the main lemma of this section, which will be used in the later section on data-dependent hashing. We need to introduce two more definitions. We define “average ” as:
Let be a fixed constant. Suppose that is such that as . Then, there exist , and such that:
We use Lemma 2.5 to choose such that is an odd integer and
We can choose so that
(This follows from the standard Chernoff-type bounds.)
Finally, we combine (3), (1) and (2), and get the desired inequality. ∎
The following corollary shows how the above lemma implies a lower bound on data-independent LSH.
For every and such that there exists with such that if is a data-independent -sensitive family, then
We observe that for every :
Now we apply Lemma 2.6 together with the following application of Jensen’s inequality:
Data-Dependent Hashing
We now prove the second component of the main Theorem 1.4 proof. In particular we show that a very good data-dependent hashing scheme would refute Lemma 2.6 from the previous section.
For a particular dataset , we will be interested in empirical probabilities — i.e., the equivalents of for a given set — defined as follows. Let be some function. Let be a random set of points from of size . The empirical versions of and with respect to are:
We now what to prove that, for a random dataset , the empirical are close to the true averages. For this we will need the following auxiliary lemma.
Let be an symmetric matrix with entries from and average . Let be a principal submatrix of sampled uniformly with replacement. Then, for every , the probability that the maximum of the average over and does not lie in is at most .
We need the following version of Bernstein’s inequality.
We just apply Lemma 3.2 and take union bound over the rows of . ∎
The following two lemmas are immediate corollaries of Lemma 3.2 and Lemma 3.1, respectively.
2 Proof of Theorem 1.4
We are finally ready to complete the proof of the main result, Theorem 1.4.
Let us first assume that and then show how to handle the general case. Suppose that . By the assumption of Theorem 1.4, . Let be a set of hash functions. We can assume that , since otherwise we are done. Let us fix such that and . We can do this, since if , then , and the desired statement is true. Then, by Lemma 2.6, there is and such that for every
and . We can do it since, by the above assumption, .
Then, from Lemma 3.3 and Lemma 3.4 we get that, with high probability over the choice of , one has for every :
;
.
Suppose these conditions hold and assume there exist a distribution over such that the corresponding hash family is -sensitive for . Then,
Averaging (4) and applying Jensen’s inequality, we have
which proves the theorem, since , , and .
Now let us deal with the case . This can be reduced to the case by choosing a slowly-growing super constant and replacing the set of functions with the set of tuples of length . This replaces and with and , respectively. In the same time, we choose so that still satisfy the hypothesis of the theorem. Then, we just apply the above proof.
References
Appendix A Upper Bounds Are in the Model
In this section, we show how the data-dependent hash family from [AR15] fits into the model of the lower bound from Section 1.1.
Let us briefly recall the hash family construction from [AR15]. For simplicity, assume that all points and queries lie on a sphere of radius . First, consider a data-independent hash family from [AINR14, AR15], called Spherical LSH. It gives a good exponent for distance thresholds vs (the latter corresponds to a typical distance between a pair of points from the sphere). The main challenge that arises is how to handle distance thresholds vs , where the latter may be much smaller than . Here comes the main insight of [AR15].
We would like to process the dataset so that the distance between a typical pair of data points is around , so to apply Spherical LSH. To accomplish this, we remove all the clusters of radius that contain lots of points (think of being barely sub-constant). We will treat these clusters separately, and will focus on the remainder of the pointset for now. So for the remainder of the pointset, we just apply the Spherical LSH to it. This scheme turns out to satisfy the definition of the data-dependent hash family for the remaining points and for distance thresholds vs. ; in particular, the hash function is sensitive for the remaining set only! The intuition is that, for any potential query point, there is only a small number of data points within distance — otherwise, they would have formed yet another cluster, which we would have removed — and the larger distances are handled well by the Spherical LSH. Thus, for a typical pair of data points, Spherical LSH is sensitive for (see Definition 1.3).
How does [AR15] deal with the clusters? The main observation is that one can enclose such a cluster in a ball of radius , which intuitively makes our problem a little bit simpler (after we reduce the radius enough times, the problem becomes trivial). To answer a query, we query every cluster, as well as one part of the remainder (partitioned by the Spherical LSH). This can be shown to work overall, in particular, we can control the overall branching and depth of the recursion (see [AR15] for the details).
For both the clusters, as well as the parts obtained from the Spherical LSH, the algorithm recurses on the obtained point subsets. The overall partitioning scheme from [AR15] can be seen as a tree, where the root corresponds to the whole dataset, and every node either corresponds to a cluster or to an application of the Spherical LSH. One nuance is that, in different parts of the tree the Spherical LSH partitioning obtains different (depending on ). Nonetheless, each time it holds that for . Hence, a node terminates as a leaf once its accumulated (product of ’s of “Spherical LSH” nodes along the path from the root) drops below .
We now want to argue that the above algorithm can be recast in the framework of data-dependent hashing as per Definition 1.3. We consider a subtree of the overall tree that contains the root and is defined as follows. Fix a parameter (it is essentially the target of the partition). We perform DFS of the tree and cut the tree at any “Spherical LSH” node where the cumulative drops below . This subtree gives a partial partition of the dataset as follows: for “Spherical LSH” nodes we just apply the corresponding partition, and for cluster nodes we “carve” them in the random order. It turns out that if we choose carefully, the partition will satisfy Definition 1.3 and the preconditions of Theorem 1.4. In particular, the description complexity of the resulting hash function is .
Let us emphasize that, while Definition 1.3 is certainly necessary for an ANN data structure based on data-dependent hashing, it is not sufficient. In fact, [AR15] prove additional properties of the above partitioning scheme, essentially because the “ property” is “on average” one (thus, we end up having to understand how this partitioning scheme treats triples of points).