Lower Bounds on Near Neighbor Search via Metric Expansion
Rina Panigrahy, Kunal Talwar, Udi Wieder
Introduction
In the Nearest Neighbor Problem we are given a data set of points lying in a metric space . The goal is to preprocess the data set into a data structure such that when given a query point , it is possible to recover the data set point which is closest to by querying the data structure at most times. The goal is to keep both the querying time and the data structure space as small as possible. Nearest Neighbor Search is a fundamental problem in data structures with numerous applications to web algorithms, computational biology, information retrieval, machine learning, etc. As such it has been researched extensively.
There is a substantial body of work on lower bounds covering various metric spaces and parameter settings; we discuss the known bounds in Section 1.3. Traditionally, cell probe lower bounds for data structures have been shown using communication complexity arguments . Pătraşcu and Thorup use a direct sum theorem along with the richness technique to obtain lower bounds for deterministic algorithms. Andoni, Indyk and Pătraşcu showed randomized lower bounds using communication complexity lower bounds for Lopsided Set Disjointness. In a previous work , the authors used a more direct geometric argument to show lower bounds for randomized algorithms for the search version of the problem.
In this work we strengthen and significantly generalize our previous results. We give a common framework that unifies almost all known cell probe lower bounds for near neighbor search. At one extreme, it gives us the communication complexity lower bounds, and implies e.g. the result of . At the other extreme, we get direct data structure lower bounds leading to a strengthening to the decision problem of our results in . Our work in fact shows that all near neighbor lower bounds follow from basic expansion properties of the metric space. Vertex expansion translates to lower bounds for deterministic data structures. Edge expansion can be translated to lower bounds for randomized data structures, and this lets us strengthen . We also identify a new (to our knowledge) graph parameter that interpolates between vertex and edge expansion, that we call robust expansion. We show that robust expansions suffices to prove NNS lower bounds. Additionally, for random inputs in highly symmetric metrics, robust expansion also translates to upper bounds in the cell probe model, that match our lower bounds for constant . Finally, we present a natural conjecture regarding the complexity of approximate near neighbor search and show tight bounds for dynamic low contention data structures.
The Near Neighbor Problem is parameterized by a number . As in the Nearest Neighbor Search Problem the input to the preprocessing phase is a data set of points in a metric space. Given a query point the goal is to determine whether the data set contains a point of distance at most from . In the approximation version (ANNS) the preprocessing phase receives as input also an approximation ratio . Given a query point the goal is to differentiate between the case where the closest data set point is of distance at most from , to the case where the closest data set point is of distance at least from . Clearly a lower bound for these problems holds also for nearest neighbor search.
We prove lower bounds for a generalization we call Graphical Neighbor Search (GNS) which we define shortly. We then show that lower bounds on GNS imply ANNS lower bounds. In the GNS problem we are given an undirected bipartite graph where the data set comes from and queries come from . For a node the set denotes its neighbors in . In the preprocessing phase we are given a set of pairs where is a vertex in and . The goal is to build a data structure such that given a node , if there is a unique such that then it is possible to query the data structure times and output . If there is no such or it is not unique any output is considered correct.
We observe that ANNS reduces to GNS when assuming a query point is at distance at most from some and a least from all other . In this case we have the nodes of and correspond to the points in the metric space, and the set of edges consists of all pairs of nodes at distance at most . A formal reduction is proven in Section 4 where we also show that average instances of ANNS translate to average instances of GNS for which our lower bounds hold. The bounds we show depend only on the expansion properties of . We need the following definitions:
Let be a probability measure over and be a probability measure over . The vertex expansion of the graph with respect to is defined as
The vertex-expansion is defined as the largest such that for all , .
Let , and . Observe that if then . In other words bounds the measure of the sets that cover all the edges incident on a set of measure . The notion of robust expansion relaxes this by requiring to cover at least a -fraction of the edges incident on . This idea is captured in the definition below. For simplicity we assume that and that and are the uniform distribution and that is regular. A more subtle definition which takes into account other measures is presented in Section 3.
has robust-expansion if satisfying , it is the case that . Note that .
2 Our Contributions
In this section we require that the algorithm always output the correct answer. We show time space tradeoffs based on the vertex expansion properties of . Our lower bounds are in the average case. Given a distribution over , a data set is built by sampling data set points independently from .
Note that in order for the problem to be interesting we must have that and are likely to be disjoint. We thus have the following definition:
A distribution over is said to be strongly independent for if
Note that if is strongly independent and are sampled independently by then with probability at least for all . In the following denotes the number of cells in the data structure and denotes the word size in bits, is the number of cell probes used by the algorithm.
For a given , let be probability measures such that is strongly independent, and the vertex expansion with respect to is . Then any deterministic algorithm solving GNS must satisfy the following inequalities
These theorems, combined with known isoperimetric inequalities yield most known cell probe lower bounds for near neighbor problems, and generalize them to general expanding metrics. To see this consider for example the dimensional hypercube equipped with the Hamming distance. It is shown in , that any deterministic solution for ANNS with approximation must satisfy . This bound can be slightly improved by creating the following GNS instance: Let and both equal the set of nodes of the hypercube, and let . Let and be the uniform distribution. Chernoff bounds implies that for , with overwhelming probability, so is a strongly independent instance. A lower bound on this instance of GNS implies a lower bound on ANNS with approximation .
Now we use known isoperimetric properties: Harper’s theorem (see e.g. ) implies that there is a constant such that . Plugging this in (1) we have that . In Section 4 we discuss how to apply these theorems in greater length.
2.2 Bounds for Randomized Algorithms
Assume that is regular. Let and be vertices drawn uniformly at random, and be a random neighbor of . We say has the property of being weakly independent if for a small enough constant .
There exists an absolute constant such that the following holds. Any randomized algorithm for a weakly independent instance of GNS which is correct with probability at least half (where the probability is taken over the sampling of the input and the algorithm), satisfies the following inequalities:
As an example, we show in Section 4 that for the Hypercube with , the robust expansion . For , the weak independence property is easy to verify. Plugging this into Equations 4, we conclude that so that . This result was previously shown by for slightly larger .
Our framework suggests a natural conjecture on the complexity of approximate near neighbor problems.
Any randomized -probe datastructure for a weakly independent GNS instance must satisfy .
We point out that for some interesting metric spaces such as the Hamming cube and Euclidean space, the known upper bound matches the lower bound in the conjecture for a wide range of parameters. We next present some evidence in support of this conjecture.
2.3 An Upper Bound
There are cases where the bounds above are known to be tight when . We show that this is no coincidence: In Section 5 we show that if is symmetric, there is an algorithm in the cell probe model that solves random instances of GNS using space that matches the lower bound in equation (4) for .
2.4 Dynamic Data Structure
In the dynamic version of the problem we want the data structure to support the operation of inserting and deleting a point in the data-set. Let denote the update time. A weaker version of the conjecture is the following:
For any dynamic randomized -probe data-structure for weakly independent GNS on points, it holds that
To see why this conjecture follows from the stronger one, observe that a data structure with update time uses space after inserts. We show that this weaker conjecture holds for a restricted family of algorithms which we call low contention; i.e., on those where no memory location of the data structure is accessed by too many query points (see Section 6 for a formal definition). While this may seem like a severe limitation, we remark that known LSH data structures, and our upper bound in Section 5, are in fact dynamic and low contention under our definition.
For any low contention, dynamic -probe datastructure for GNS on points, the update time is at least .
Plugging in the expansion of the hypercube, we see that for a wide range of parameters Locality Sensitive Hashing is optimal for the class of the low contention dynamic data structures over the hypercube.
3 Related Work
We are aware of only two papers which prove time-space lower bounds for near neighbor problems where both randomization and approximation are allowed.
Andoni, Indyk and Pătraşcu show that for small , any -probe algorithm for -approximate near neighbor problem must use space . This bound is tight for small enough . Panigrahy et al. show that space is needed for any algorithm with queries and approximation, for the search version of the problem. This bound is tight for constant .
With the exception of all previous bounds were proven using communication complexity framework , and in particular the richness lemma.
4 Notation and Preliminaries
A data structure for Graph neighbor search is defined as follows. Given a database of points , and the preprocessing algorithm computes a set of tables , where each table stores words of bits each. We often call each such word a cell of the table. In practice there is only one table, but for notational convenience and with out loss of generality we let the data structure construct a different table for each query.
The query algorithm is specified by lookup functions , where takes in the query point and words of bits each, and outputs an integer in , and function . On a query , the data structure looks up , . Finally it computes . Note that the lookup functions, ’s and are fixed independent of the database, only the tables can depend on . We say the algorithm is non adaptive if the lookup functions are independent of the content of the tables, i.e. of the values.
5 Overview of Techniques
The core idea behind our approach is quite simple. We demonstrate it by showing a simple argument that the vertex expansion of provides a lower bound on the space of -probe data structures for deterministic algorithms. By the definition of vertex expansion, every set of nodes is incident to at least half of the nodes of . Let be a uniformly random sample of a fraction of the cells of the table , and let be the set of nodes in for which the algorithm probes a cell in . Clearly is expected to contain a fraction of the nodes in . Now consider a sample data set where are randomly sampled nodes in the graph and are random bits. With overwhelming probability at least a quarter of the ’s have a neighbor in the set , and thus the random bits associated with these points should be retrievable from the contents of alone. We conclude that the total number of bits in is at least and thus the space of the data structure is at least bits.
This basic sampling approach for -probe data structures can be extended to -probe data structures in two different ways.
Cell Sampling: Here we sample a fraction of the cells in each table. Thus a fraction of is expected to access only the sampled cells. This immediately gives bound (1) for non-adaptive algorithms.
Path Sampling: Here we sample a path as follows: we pick a cell randomly from the first table so that a fraction of the vertices lookup this cell. Then we sample a cell from the second table in such a way that a fraction of looks up this cell in the second read, and so on. This immediately leads to the lower bound in (2) for non-adaptive algorithms.
We remark that the path sampling approach actually leads to communication complexity lower bounds for the 2-player version of the problem where Alice has the query point and Bob has the database. Any -probe data structure with cells of words each implies the existence of a -round communication protocol where Alice sends bits, and Bob sends bits, in each round. A communication protocol has more freedom however; unlike in a data structure, where the same table is used to answer any second query, in a communication protocol, the message Bob sends in the second round may depend not just on the second message from Alice, but also on the first. Path sampling can be immediately translated to a “transcript sampling” technique and thus gives lower bounds for communication protocols. There is no similarly obvious translation for cell sampling.
We can extend these ideas and provide lower bounds for adaptive algorithms by observing the following two facts. Firstly, for a fixed data structure, the probability over a random data set that the data structure succeeds is exponentially small in . On the other hand, the number of bits read by the sampling procedures above is sublinear, thus the number of all possible non-adaptive algorithms is sub exponential. Informally, this allows us to do a union bound over all possible values of the bits read.
In randomized algorithms not all points in are good query points for . In particular, the specific query point that queries the cells that are sampled may be a point on which the algorithm errs. The notion of shattering plays a major role in extending the bound for this case: Given any fixed partitioning of such that each set is of cardinality , a randomly chosen has (with high probability) the property that is at most , for a that depends on the edge expansion. In other words, is shattered by the partitioning. Given that the lookup algorithm is correct for a large fraction of , shattering suffices to show that the algorithm still gives the right answer for a majority of the points in which can be looked up from the cell sample (or the path sample).
In order to prove lower bounds for randomized adaptive algorithms we need to combine the ideas outlined in the two previous paragraphs, which requires more work. Intuitively, for every such the is shattered, and for any fixed subset on which the algorithm succeeds, the sampling is very likely to recover the correct answer. Moreover, for every collection of bits read, almost all points shatter. While it would be tempting to use a union bound at this point, that does not quite work. Informally, there are dependencies everywhere: the part of that the algorithm gets right depends on all the other ’s, the bits that are read depend on the sampled cells, etc. The proof carefully defines a notion of shattering that depends only on the ’s and not on ’s and argues (over the randomness in picking the ’s) that most points get shattered. Separately, we argue that for a point that gets shattered, and for any fixed , the majority answer is correct with high probability (over the sampling procedure alone).
The notion of edge expansion does not quite suffice: for the hypercube when , for fixed partitioning of into cells of size , the largest is likely to be quite large (), whereas we would need it to be to get the correct bound. The definition of robust expansion comes to our rescue here. We can show that while the largest is usually large, the large pieces account for a very small fraction of . In fact, after removing a vanishingly small fraction of , every other piece is only about . We show that our lower bound proofs are robust enough to handle this weaker notion of shattering.
Deterministic Lower bounds
In this section we prove Theorem 1.4. The analysis of deterministic algorithms involves node expansion and does not require shattering. It allows us to demonstrate the techniques of cell sampling and path sampling in a simple setting.
The following theorem is a restatement of inequality (1)
Let be such that is a strongly independent instance, and be the vertex expansion with respect to . Then any deterministic algorithm solving GNS must satisfy .
Recall that represents a table with cells, from which the query reads, and denotes the ’th lookup function. We will state a procedure that obtains a set of at most cells so that at least a fraction of the query points only access these cells. We call this procedure cell sampling. Note that here this procedure is entirely deterministic. A probabilistic variant is used in the next section.
Cell sampling procedure: The cells are obtained iteratively in phases, each phase corresponds to a query of the table. In each phase at most cells are chosen. The first lookup function induces a partition over . The set is chosen to be the cells in that maximize . In other words, the first lookup function partitions according to its image in . We choose to be the cells corresponding to the largest partitions, as measured by . Set to be those vertices; i.e. . The selection process continues iteratively in a similar manner. Let denote the set of cells obtained in the ’th phase and let denote the set of vertices that (if given as a query) access only cells in In the ’th phase we consider and set to be the cells with highest measure, where we restrict to . In other words, when measuring we assign a measure of for vertices outside . It is easy to inductively argue that , so that and thus .
Intuitively, the set of cells in encode half of the bits and therefore must contain bits, which would imply the lower bound. Of course, depends upon the content of the table which depends upon the points in the data set. These dependencies can be handled by using a union bound over all the possible values of : To see this, fix the values written in the cells to some string and sample the data set points from independently according to . Let denote the event that when the value of the cells is , an algorithm reading succeeds in guessing the bits for the data set points that fall in . Note that depends only upon and that since the procedure of obtaining is deterministic, the locations of the cells obtained also depends only on . Vertex expansion implies that . Also, since is strongly independent and the algorithm is assumed to be correct, . By Chernoff’s bound, the probability that less than points fall in is at most . Note that the ’s are chosen independently, therefore, for a fixed table, if points indeed fall in , then the probability that the sampled ’s match the output of the algorithms is . We conclude that . Now, let . There are ways of choosing , so we must have . We conclude that which implies the theorem. ∎
2 Path Sampling
Let be strongly independent, and be the vertex expansion with respect to , then any data structure with a deterministic querying algorithm must satisfy .
The proof is similar to that of Theorem 2.1 with a different choice of parameters. We present it here separately because the two approaches diverge in the next section when we deal with the randomized case. We use the cell sampling technique to select a set of cells from the tables, only this time, each phase we select a single cell from the table (as opposed to selecting cells in Theorem 2.1). We call the approach of sampling a single cell from each table path sampling because we sample a single possible “query path” along the tables. We also observe that lower bounds based on this approach imply communication complexity lower bounds.
Now the contents of are bits, and so that . When fixing the bits of to be the string , the expected number of data set points that fall in is at least . Define as before and recall that we have . Let be the number of data set points falling in . Chernoff’s bound implies that . Since the string now encodes random bits, . There are ways of choosing , so we have which implies the theorem. ∎
Randomized Lower bounds
To prove lower bounds for randomized data structure, we will use Yao’s minimax theorem, and instead show a distribution over instances such that for some constant , any deterministic -probe data structure that succeeds with probability needs large space.
We consider the following randomized version of the Graph Neighbor Search (GNS) problem on a bipartite graph . We are given a set of tuples , where and to preprocess into a data structure. Then given a query , the query algorithm makes probes into the data structure, and is expected to return if is the unique neighbor in of in (if there is no unique neighbor, any output is considered valid).
Let be a bipartite graph and let be a probability distribution over . Let be the induced distribution on , and let be the induced distribution on . For , we denote by the conditional distribution of the endpoints in of edges incident on , i.e. .
Suppose we have a graph , and the distribution on . Then define a distribution over instances of GNS as follows. We select points independently from the distribution uniformly at random and pick independently and uniformly from . This defines the database distribution. To generate the query, we pick an uniformly at random, and sample independently from .
We say the tuple satisfies -weak independence (WI) if . In other words, WI ensures that with probability , for the instance generated as above, is indeed the unique neighbor in of in .
We next define the notion of expansion that we use. Recall that the vertex expansion of a set in an unweighted graph is the ratio , where is the smallest set such that all edges incident on are captured by , i.e. . A relaxation of this definition, which we call -robust expansion, is the ratio where is now the smallest set that captures a fraction of the edges incident on , i.e. . The following definition generalizes this notion to weighted bipartite graphs.
The -robust expansion of a set is defined as .
Let be an auxiliary weight function on with . The -robust expansion with respect to is defined as .
We say that has -robust expansion at least if for every subset such that , we have .
For intuition, consider the setting where is derived naturally from an undirected graph by making two copies of and for each edge , placing the edges and . Formally, , and . Then for any set , we have , which is the vertex expansion of in under , for . Similarly, if a set has conductance at most , then so that . A similar correspondence holds for directed graphs.
A collection of disjoint subsets of is said to be -sparse with respect to if .
We now recall the notion of strong shattering.
Given and a collection of disjoint subsets of , we say the collection -strongly shatters a point if .
We shall in fact show our lower bounds using a weaker notion of shattering, which allows a small probability mass from to be in ’s with measure larger than . For a real number , let denote the positive part of . Note that strong shattering says that each of the ’s is at most so that is zero. We relax this condition.
Given and a collection of disjoint subsets of , we say the collection -weakly shatters a point if .
We say a tuple satisfies the -weak shattering (WS) property if for every -sparse collection of disjoint subsets of ,
We record the following implication of weak shattering.
If satisfies -weak shattering property, then it also satisfies -weak shattering for any .
For , there is nothing to prove since every -sparse collection is also -sparse. For , we can arbitrarily break each set into pieces to derive a -sparse collection; the shattering follows using the identity . ∎
Let be a collection of disjoint subsets of . Then for any , there is a measure such that (a) dominates , i.e. for all , (b) for all , and (c) If is -weakly shattered, then .
Note that is not necessarily a probability measure. Intuitively, is a part of the measure that gets shattered. Such a measure can be obtained by shaving the mass on that fall in clusters with large mass.
For each with , we set for each . is set for the remaining ’s. The dominance is immediate, and the small loss property follows from the fact that for every of the first type so that . ∎
Finally, we shall use the following simple information-theoretic lemma:
Let , and let and be functions such that with probability at least when is drawn at random. Then there exists a constant such that , where .
Let be a binary error correcting code with positive rate and minimum distance . Then for a random , has expected size for an . Since the minimum distance of is , the values are all distinct, leading to the claim bound. ∎
The lemma can be extended to the setting where the encoder and the decoder share some randomness.
2 Main Result
The main result of this section is the following.
There exists an absolute constant such that the following holds. Let satisfy -weak independence (WI). Then for , any deterministic -probe data structure for the distribution over GNS instances defined by that succeeds with probability must satisfy
where is an arbitrary auxiliary weight function, and is .
The theorem will follow from Lemma 3.11, and Theorems 3.12 and 3.22 that we prove next.
3 Expansion to Shattering
Let be a -sparse collection of disjoint subsets of . Then
for
We will show that if , then one of the ’s does not expand enough, thus deriving a contradiction.
Suppose that . Thus for at least fraction of ’s (drawn from ), and yet is not -weakly shattered. Let be the set of such ’s. In other words, the set satisfies
For each , .
For each , .
Construct an weighted graph on , where we put an edge between with weight if . Thus so that .
The (unweighted) degree of each node in is at most , since each edge incident on in contributes at least to . Moreover, by the properties of above the total edge weight in is at least .
Let be the subgraph of formed by deleting all nodes such that the total edge weight incident on is at most . The total edge weight deleted in the process is at most so that the total edge weight in is at least .
Let be the set of nodes on the right surviving in . Since each node in has unweighted degree at most in , . On the other hand, is at least the total weight of edges in which is lower bounded by . It follows by an averaging argument that there is a node such that
Let . Since , we have . Since by assumption,
which contradicts the definition of . ∎
4 Path Sampling
In this section, we show the following theorem
There exists a constant such that the following holds. Let satisfy -weak independence (WI) and -weak shattering property. Then for , any deterministic -probe data structure for the distribution over GNS instances defined by that succeeds with probability must use space at least .
Proof Sketch: Suppose that a datastructure with exists that succeeds with probability . We use it construct a randomized encoding and decoding algorithm for a random binary vector . We sample from , and build the data structure for the database to get tables where each contains cells of bits each.
We show how to sample cells from each table, for a suitable and let be the contents of those cells (where is used as the randomness to pick the ’s and in the sampling process). The decoding algorithm essentially takes the majority answer in , restricted to queries that the data structure can answer based on the sampled cells, as its guess for . The success of the data structure, and the WI property, imply that the answer on is equal to with probability , for most ’s. We show that the weak shattering property is sufficient to guarantee (using Chernoff bounds) that the majority answer on the restriction of is still equal to with high probability. For suitably small , this violates corollary 3.9.
Intuitively, the lookup functions break into pieces. We could sample of these pieces. If all ’s were strongly shattered, each piece has little influence on measure in that can be looked up from the sample. For large enough , Chernoff bounds would then imply that the restricted measure has a large probability of answering as well, completing the proof.
The proof below, while following the above intuition, is made complicated by several factors. The lookup functions are adaptive so that the pieces that breaks into depends on the table contents. Thus the shattering itself depends on the table contents sampled, making a one-shot sampling argument untenable. We instead give an inductive proof, that handles these dependencies. The weaker shattering assumption forces us to slightly change the decoding algorithm, to take a majority under a modified measure. Additionally, the pieces may be of different sizes, and we need to break large pieces to ensure sparseness.
We are now ready to present a detailed proof.
We assume the contrary so that for , there is -probe space data structure that succeeds with probability on the distribution defined by . We use this data structure to construct functions and violating corollary 3.9. We use the auxiliary input as shared randomness between and throughout this proof.
We first sample points from and use as the database. Note that when and are random, are distributed according to , and hence for a random drawn from the appropriate distribution, the data structure will return the right answer for with probability . By Markov’s inequality with probability , it is the case that except for of the ’s, the data structure answers correctly with probability when is drawn from . By WI, except with probability , has a unique neighbor in so that the correct answer is . Thus except for a fraction of the ’s, with probability , the data structure returns on a random from . Thus the tables are a valid, albeit long, encoding that can be decoded appropriately by taking the majority answer on as a guess for . In the rest of the proof, we argue that in fact a random sample of the tables suffices.
Sampling Procedure: We will sample “paths” in the table, where is set to . Further we assume that .
Let , , etc. be adaptive lookup functions that the data structure uses. The th path consists of cells , one from each of the tables sampled sequentially. We will also get a telescoping sequence of subsets where denotes the set of queries that access the sampled cells at locations in the first tables, for some . Observe that the cells accessed in depends on the contents of the cells accessed in the previous table.
We first describe how to sample a single path . To sample from the first table we look at the partition of into parts induced by the value of over all . Let be a -sparse partition of that refines . Such a partitioning can be obtained by starting with and repeatedly splitting parts larger than into smaller pieces. This splitting can be done arbitrarily, and results in a -sparse partitioning containing at most parts; we pad this with empty parts to get exactly sets . This corresponds to a table of size where the cells corresponding the partitions that were split are replicated appropriately. The first cell of the path is simply obtained by picking a random index into this table. Let be the sampled part and let denote the contents of the corresponding cell.
Inductively, suppose that we have defined , cell contents , and set , so that all for points in , the query algorithm looks up in the first lookups, given the contents . Inductively, we ensure that . The th lookup function, given the contents partitions the set into parts, and as above, we can refine this partition to get a sparse partitioning . We sample uniformly from , and denote by the contents of the corresponding cell. We define to be . Clearly has the desired inductive properties. Continuing in this fashion, we get , and .
We repeat the above process times to get such paths. The matrix () denotes the sampled cell locations for the paths, the matrix denotes the contents of these cells, and the sets denotes the telescoping sequence of subsets for each of the paths.
For a technical reason, each entry in the first column of the matrix is drawn independently without replacement from , thus ensuring that this column consists of random distinct values from . For a matrix and sets of indices, let denote the submatrix of indexed by and .
The measure of : We first show that the measure is concentrated around .
is at most , except with probability .
We argue inductively. For , the expected value of is exactly . Moreover, by -sparsity of , and using Chernoff bounds (for negatively correlated r.v.’s), the deviation from the mean is at most , except with probability .
Inductively, the expected value of is exactly by the induction hypothesis. A Chernoff bound argument implies that the deviation from the mean is at most , except with probability . The claim follows. ∎
For the rest of the proof, we will assume that for all , is indeed at most for as long at are .
The Encoder: The encoding is simply set to be the matrix . Note that the matrix , along with , which is part of the shared randomness, is enough to compute the answer computed by the data structure for every .
In the rest of the proof, we argue that there is a good decoding algorithm that recovers most of the ’s. We do so in two steps. We first argue that if shatters at all levels, then the decoding algorithm succeeds with high probability. We then argue that in fact most ’s must shatter at all levels.
If every shatters, the sampled cell contents are sufficient to estimate ’s:
We first argue that the sampling process ensures that the majority vote on the sample agrees with the true majority, if the appropriate shattering happens at each level. For ease of notation, for , let . Note that by Observation 3.6, the -weak shattering implies -weak shattering. We start by defining the shattering event formally.
We will say that occurs if the collection -weakly shatters . We use the notation to denote the event .
When and are obvious from context, we will simply abbreviate these events as and .
Let (resp. ) denote the set of vertices for which the query algorithm, given the table population, outputs (resp. ). So and are the set of queries for which the query algorithm outputs the bits and its complement respectively.
For , we let be the event
For , we let denote the event
By the discussion above, except with probability , occurs for of the ’s. We assume that this is indeed the case.
With the definitions in place, we are now ready to argue that each of these events happens for most ’s. For brevity, we use when the other arguments are obvious from context. It is immediate from the definitions that
If and occur, then the decoding agrees with .
We argue that assuming for each , the events and indeed happen with high probability. The following two lemmas form the base case, and the induction step of such an argument.
An identical Chernoff bound argument suffices to show . ∎
If for most , occurred, this would imply that the decoding algorithm succeeds with high probability. However, the event depends on the contents , which are determined by the table population, which depends on itself.
Proving that weak shattering happens for most ’s:
The weak shattering property implies that for any , for a fixed table population (which determines via ),
Thus for any fixed and , it is the case that
Let be the event that occurs for all but a fraction of the ’s in the instance , i.e. .
First consider a fixed . Since the ’s are drawn independently, Chernoff bounds imply that
Further, note that the event depends on only through the contents . Thus doing a union bound over all possible values of and ,
The claim follows since . ∎
We assume for the rest of the proof that the database indeed has this property; this changes the failure probability by a negligible amount.
Let be the table population built by the data structure. Lemma 3.21 implies that
Since whenever , it follows that
The rare events ignored during the rest of the proof add an additional to this expectation.
For small enough , the size of the encoding is smaller than (since ), contradicting Corollary 3.9. Hence the claim. ∎
5 Cell Sampling
In this section, we show a different sampling technique, which gives a different lower bound. The main theorem is:
There exists a constant such that the following holds. Let satisfy -weak independence (WI) and -weak shattering property. Then for , any deterministic -probe data structure for the distribution over GNS instances defined by that succeeds with probability must use space at least .
The proof is analogous to that for theorem 3.12. We define Encoding and Decoding procedures that compress a random string. The primary difference is in the sampling procedure; instead of sampling “paths” as in the previous section, we sample cells from each table, and argue that the set of points that can be looked up only using paths in the sample is sufficient to recover the bits . Specifically, we define events analogous to and in the previous section, and show that they occur for many points.
We assume the contrary so that for , there is -probe space data structure that succeeds with probability on the distribution defined by . We use this data structure to construct functions and violating corollary 3.9. We use the auxiliary input as shared randomness between and throughout this proof. The database is defined as before.
Cell Sampling Procedure: Let . Let , , etc. be adaptive lookup functions that the data structure uses. The sampling is done in steps one for each table. At each step we will get subsets so that all the queries in only access the sampled cells for the first lookups.
Let and let for be a -sparse partition obtained by refining ; this can be done as before by arbitrarily breaking up cells larger than . Let be a random subset of of size . Let the contents of the respective cells in a table population be denoted by . Thus the sample from the first table consists of rows whose contents are . We set .
Let be a -sparse partitioning obtained by refining as above. We pick a random subset of of size , and let denote the relevant set of contents from . We set be the set of queries that look up one of the sampled cells in the first two tables.
Repeating this process, we get matrices and , and sets . Note that in any execution of the procedure, the set depends only on the samples and the contents read from the table population.
The measure of . We first show that the measure is concentrated around .
is at most , except with probability .
We argue inductively. For , the expected value of is exactly . Moreover, by -sparsity of , and using Chernoff bounds (for negatively correlated r.v.’s), the deviation from the mean is at most , except with probability .
Inductively, the expected value of is exactly by the induction hypothesis. A Chernoff bound argument identical to the one above completes the proof. ∎
For the rest of the proof, we will assume that for all , is indeed at most .
The Encoder: The encoding is set as before to be the matrix . Note that the matrix , along with , which is part of the shared randomness, is enough to compute the answer computed by the data structure for every .
If every shatters, the sampled cell contents are sufficient to estimate ’s:
We argue that the sampling process ensures that the majority vote on the sample agrees with the true majority, if the appropriate shattering happens at each level. We start by defining the shattering event formally.
We will say that occurs if the collection -weakly shatters . We use the notation to denote the event .
When and are obvious from context, we will simply abbreviate these events as and .
Let (resp. ) denote the set of vertices for which the query algorithm, given the table population, outputs (resp. ). So and are the set of queries for which the query algorithm outputs the bits and its complement respectively.
For , we let be the event
For , we let denote the event
As in the path sampling case, except with probability , occurs for of the ’s. We assume that this is indeed the case.
With the definitions in place, we are now ready to argue that each of these events happens for most ’s. For brevity, we use when the other arguments are obvious from context. It is immediate from the definitions that
If and occur, then the decoding agrees with .
We argue that assuming for each , the events and indeed happen with high probability. The following two lemmas form the base case, and the induction step of such an argument.
except with probability . The claim follows by an easy calculation.
An identical Chernoff bound argument suffices to show . ∎
If for most , for all , occurred, this would imply that the decoding algorithm succeeds with high probability.
The rest of the proof is identical to that for Theorem 3.12, since once again, the event depends on the table population only through the contents .
Applications
We show how lower bounds on GNS imply lower bounds for ANNS. We stress that these bounds hold for the average case where the data-set points are sampled randomly from a distribution over . Thus, if with high probability the distance between all pairs of points in the data set is at least , then the bounds above hold also for the approximate nearest neighbor within factor . The following table lists all these bounds and how they follow from our work.
In the decisional version of the -ANNS problem we have a metric space and parameters and . We preprocess points into a data structure. When given a query point the goal is to distinguish between the case where for some , and the case where for all . The query algorithm is required to output in the former case, in the latter case, and may report anything if neither of the two cases hold.
We show that if we have appropriate distributions over , we can derive lower bounds for -ANNS by simply computing the relevant expansion parameter.
Let and let be a distribution over a metric satisfying:
Let . Then GNS on reduces to -approximate GNS on .
Given a GNS instance , we consider the dataset as our input for the -ANNS problem. It is easy to see that when and , this set is a uniformly random dataset from . The -Strong independence implies strong independence for the GNS instance. Whenever , and , we have so that for the -approximate NNS instance, the answer is if and only is in , i.e. if and only if . The claim follows. ∎
Thus to prove deterministic data structure lower bounds for -approximate NNS, it suffices to exhibit and a distribution which satisfies -strong independence and has large expansion.
Let and let be a distribution over pairs of points in a metric . Let and . Suppose that for small enough
Then GNS on reduces to -approximate GNS on .
As before, given a GNS instance , we consider the dataset as our input for the -ANNS problem. It is easy to see that when and , this set is a uniformly random dataset from . The properties above imply weak independence for the GNS instance. Finally, except with small probability, we have for all , so that for the -approximate NNS instance, the answer is if and only is in , i.e. if and only if . The claim follows. ∎
Thus to prove randomized data structure lower bounds for -approximate NNS, it suffices to exhibit and a distribution which satisfies the above properties and has large expansion.
2 Computing Expansion
We will set to be the uniform distribution over the hypercube. For a set , we let . Observe that if we take uniformly random points from a dimensional hypercube then with high probability all pairs of points are at least apart. Using bounds for the expansion for the ( corresponding to the) -dimensional hypercube, we will derive lower bounds for the near neighbor problem on the hypercube.
Let be the boolean hypercube, and let be the graph with the edge set . Let . Then the vertex expansion
For randomized lower bounds, we will use the distribution defined by the noise operator where . I.e. to sample from , we sample from the uniform distribution and sample by flipping each bit of independently with probability . It is easy to check that for any and being , we indeed have . Moreover, since , by the discussion above, . Thus it remains to compute the expansion for appropriate .
It will be convenient to work with the edge expansion.
We define the edge expansion for a as . Thus for any set of size measure , at most mass of edges incident on stay within .
For any , if is uniform, then
First we will argue that for any sets and where , . To see this note that
Now consider any set of measure at most , and let by any other set of measure . We wish to argue that which would imply the claim.
Let be a partition of into pieces of measure each. . The claim follows.
Let be the boolean hypercube, and be as above for . Then the edge expansion .
For sets , it is easy to see that . But by the Hypercontractive inequality,
Also . The claim follows by substituting the value of . ∎
Setting , we get that for constant , . From theorem 1.5 (first inequality) it follows that implying .
Let be the boolean hypercube, and let be as above for Then for any sets and such that , .
As in the proof of lemma 4.6, we use the hypercontractive inequality.
For any , and , setting , for as above.
Setting , we see that from theorem 1.5 that any randomized algorithm must use space .
A Matching Upper Bound
We already know that the lower bound is tight in many specific cases. Here we show that the tightness holds more generally, for highly symmetric graphs. For such graphs, we show that the notion of robust expansion correctly captures the complexity of GNS for the regime with a constant number of queries.
Let be an undirected Cayley graphWe need the graph to be highly symmetric and the symmetries of Cayley graphs are convenient for the claims we need., and assume that it has the weak independence property for the uniform distribution. Let be such that (denoted by for brevity) where . Below we describe a data structure with cells and word size which can solve GNS in a single query with constant probability for the hard distribution of inputs. This matches the lower bound of Theorem 1.5 for the case .
Let be an undirected Cayley graph that has the weak independence property for the uniform distribution. Let be such that (denoted by for brevity) where . Then there is a -probe data structure that uses words of bits each that succeeds with constant probability when the data-set points are drawn randomly and independently, and the query point is a random neighbor of a random .
We observe that this is the distribution for which we show the lower bound.
The main idea is to use the low expanding sets in order to construct something similar to a Locality Sensitive Hashing solution. We stress that the upper bound is in the cell probe model, which allows us to ignore the (practically very important) issue of actually computing the LSH efficiently.
Let be a set of measure for which the robust expansion is and . By the definition of robust expansion, we know that there is a set of measure such that . We take random translations of and , denoted by and , formally, we sample uniformly elements from the group underlying the Cayley graph, and set and similarly . The translation by is an automorphism that maps to and to so for each .
We construct a table with cells as follows: Given a data set point , we check for each whether , and if so we place in . Note that the measure of each is so that the expected number of data set points that fall in is which is . For random data sets, most ’s will contain at most (say) data-set points. In order to keep the word size small we store at most data set points in each table cell , and assuming that bits suffice to represent a data-set point, we have .
Now, given a query point we find an for which and output the data-set point in which is closest to . Note that with constant probability, such an exists and is unique.
Recall that the data set is obtained by sampling points uniformly and independently from . Further, we assume that this distribution is weakly independent; i.e. if and are random nodes and is a random neighbor of , then . Further, the query point is obtained by sampling a random neighbor of a random data set point. Assume that the correct answer is . Now if (which happens with a constant probability), then the lookup succeeds if and there were less than data set points in . The first event occurs with probability and the second event occurs independently with probability at least as well. We conclude that the data structure succeeds with constant probability. ∎
Low Contention Dynamic Data Structures
Let denote the set of queries that read cell from the table.
A data structure is said to have contention if for all .
Say we insert a new point . After the insertion there would be a subset of such that the query algorithm outputs the correct answer for any . We say the insertion is successful if the measure of this set under is at least .
We remark that we look at contention only for the part of the data structure that depends on the database; accesses to any randomness are free.
We prove Theorem 1.8, which states that in such data structures, the update time is at least .
Consider the state of a -probe data structure just before we insert a point. The lookup functions each give a partitioning of such that each part in the partitioning has measure at most under . Let be the th partitioning.
Let be the set of locations in that are updated when one inserts . Thus . Further, note that for the answer for to be correct both before and after the insertion, must intersect with at least one of the locations that are queried on , i.e. for some .
By assumption each of the partitions is -sparse. Lemma 3.11 implies that except with small probability, is shattered where by each of the partitions. Strong shattering would imply that for each , the measure so that changes can account for at most a measure being affected, which would imply the result.
Thus . ∎