Algorithm Search⌘K

Proofs: Asymmetric LSH

These are the human proofs of Asymmetric LSH, at full length.

Correctness of asymmetric LSH with the simple transformation full

This proof shows: correctness.

Let X={x1,…,xn}⊂RdX = \{x_1, \dots, x_n\} \subset \mathbb{R}^d, M=max⁡i∥xi∥>0M = \max_i \|x_i\| > 0, q≠0q \ne 0, and s(q,x)=q⋅x/(M∥q∥)s(q, x) = q \cdot x/(M\|q\|).

Lemma 1. ∥P(x)∥=∥Q(q)∥=1\|P(x)\| = \|Q(q)\| = 1 and P(x)⋅Q(q)=s(q,x)P(x) \cdot Q(q) = s(q, x).

Proof. Since ∥x∥≤M\|x\| \le M, the number 1−∥x∥2/M21 - \|x\|^2/M^2 is in [0,1][0, 1] and its root is real. ∥P(x)∥2=∥x∥2/M2+(1−∥x∥2/M2)=1\|P(x)\|^2 = \|x\|^2/M^2 + (1 - \|x\|^2/M^2) = 1, and ∥Q(q)∥2=∥q∥2/∥q∥2+0=1\|Q(q)\|^2 = \|q\|^2/\|q\|^2 + 0 = 1. The last coordinate of Q(q)Q(q) is 0, so P(x)⋅Q(q)=(x/M)⋅(q/∥q∥)=s(q,x)P(x) \cdot Q(q) = (x/M) \cdot (q/\|q\|) = s(q, x). □\square

So by the Cauchy-Schwarz inequality s(q,x)∈[−1,1]s(q, x) \in [-1, 1], and the angle θ(x)=arccos⁡s(q,x)\theta(x) = \arccos s(q, x) between P(x)P(x) and Q(q)Q(q) is a decreasing function of q⋅xq \cdot x.

Lemma 2. Let aa have independent standard normal entries and u,vu, v be unit vectors at angle θ∈[0,π]\theta \in [0, \pi]. Then Pr⁡[sign⁡(a⋅u)=sign⁡(a⋅v)]=1−θ/π\Pr[\operatorname{sign}(a \cdot u) = \operatorname{sign}(a \cdot v)] = 1 - \theta/\pi.

Proof. Let a′a' be the orthogonal projection of aa onto the plane spanned by uu and vv (any plane containing them if u=±vu = \pm v). Then a⋅u=a′⋅ua \cdot u = a' \cdot u and a⋅v=a′⋅va \cdot v = a' \cdot v. The distribution of aa is invariant under rotations, so a′a' is a standard normal vector in the plane, and its direction is uniform on the circle. With probability 1 it is not orthogonal to uu or vv. The signs differ exactly when the line orthogonal to a′a' separates uu from vv; this line has a uniform direction, and it separates them for an arc of directions of total measure 2θ2\theta out of 2π2\pi. So the signs differ with probability θ/π\theta/\pi. □\square

With u=P(x)u = P(x) and v=Q(q)v = Q(q), one bit agrees with probability f(s)=1−arccos⁡(s)/πf(s) = 1 - \arccos(s)/\pi, which is increasing in ss. So when s(q,x)≥Ss(q, x) \ge S a bit agrees with probability at least p1=f(S)p_1 = f(S), and when s(q,x)≤cSs(q, x) \le cS with probability at most p2=f(cS)p_2 = f(cS); p1>p2p_1 > p_2 since S>cSS > cS. The kk bits of a key use independent vectors, so a key agrees with probability f(s)kf(s)^k.

Theorem. Let k=⌈ln⁡n/ln⁡(1/p2)⌉k = \lceil \ln n/\ln(1/p_2) \rceil and L=⌈nρ/p1⌉L = \lceil n^\rho/p_1 \rceil with ρ=ln⁡(1/p1)/ln⁡(1/p2)\rho = \ln(1/p_1)/\ln(1/p_2). If some x∗x^* has s(q,x∗)≥Ss(q, x^*) \ge S, then with probability at least 1−1/e1 - 1/e QUERY returns a point x′x' with s(q,x′)≥Ss(q, x') \ge S. The expected number of candidates xx with s(q,x)≤cSs(q, x) \le cS is at most LL.

Proof. In one table, x∗x^* shares the bucket of qq with probability at least p1kp_1^k. Since k<ln⁡n/ln⁡(1/p2)+1k < \ln n/\ln(1/p_2) + 1,

p1k≥p1⋅p1ln⁡n/ln⁡(1/p2)=p1⋅e−ln⁡n⋅ln⁡(1/p1)/ln⁡(1/p2)=p1n−ρ.p_1^k \ge p_1 \cdot p_1^{\ln n/\ln(1/p_2)} = p_1 \cdot e^{-\ln n \cdot \ln(1/p_1)/\ln(1/p_2)} = p_1 n^{-\rho}.

The LL tables are independent, so x∗x^* is missed by all of them with probability at most (1−p1n−ρ)L≤e−Lp1n−ρ≤e−1(1 - p_1 n^{-\rho})^L \le e^{-L p_1 n^{-\rho}} \le e^{-1}, since Lp1≥nρL p_1 \ge n^\rho. If x∗x^* is a candidate, line L7 returns the candidate x′x' with the largest q⋅xq \cdot x, so q⋅x′≥q⋅x∗q \cdot x' \ge q \cdot x^* and s(q,x′)≥s(q,x∗)≥Ss(q, x') \ge s(q, x^*) \ge S.

For the second claim, a point with s(q,x)≤cSs(q, x) \le cS shares the bucket of qq in one table with probability at most p2k≤p2ln⁡n/ln⁡(1/p2)=1/np_2^k \le p_2^{\ln n/\ln(1/p_2)} = 1/n. By linearity of expectation over at most nn such points and LL tables, the expected number of such candidates, counted with repetition, is at most LL. ■\blacksquare

Back to Asymmetric LSH