Beyond Locality-Sensitive Hashing Huy L. Nguy Alexandr Andoni 1 - - PowerPoint PPT Presentation

beyond locality sensitive hashing
SMART_READER_LITE
LIVE PREVIEW

Beyond Locality-Sensitive Hashing Huy L. Nguy Alexandr Andoni 1 - - PowerPoint PPT Presentation

Beyond Locality-Sensitive Hashing Huy L. Nguy Alexandr Andoni 1 Piotr Indyk 2 n 3 Ilya Razenshteyn 2 1 Microsoft Research SVC 2 MIT, CSAIL 3 Princeton SODA 2014 1 / 16 The Near Neighbor Problem Let P be an n -point subset of a metric ( X , D


slide-1
SLIDE 1

Beyond Locality-Sensitive Hashing

Alexandr Andoni1 Piotr Indyk2 Huy L. Nguy˜ ên3 Ilya Razenshteyn2

1Microsoft Research SVC 2MIT, CSAIL 3Princeton

SODA 2014

1 / 16

slide-2
SLIDE 2

The Near Neighbor Problem

Let P be an n-point subset of a metric (X, D), r > 0 For q ∈ X find any p ∈ P with D(p, q) ≤ r

2 / 16

slide-3
SLIDE 3

The Near Neighbor Problem

Let P be an n-point subset of a metric (X, D), r > 0 For q ∈ X find any p ∈ P with D(p, q) ≤ r

q p r

2 / 16

slide-4
SLIDE 4

The Near Neighbor Problem

Let P be an n-point subset of a metric (X, D), r > 0 For q ∈ X find any p ∈ P with D(p, q) ≤ r

q p r

2 / 16

slide-5
SLIDE 5

The Near Neighbor Problem

Let P be an n-point subset of a metric (X, D), r > 0 For q ∈ X find any p ∈ P with D(p, q) ≤ r Hard, if (X, D) is high-dimensional (space or query time is exponential in the dimension)

q p r

2 / 16

slide-6
SLIDE 6

The Approximate Near Neighbor Problem (ANN)

Let P be an n-point subset of a metric (X, D), r > 0, c > 1 For q ∈ X find any p′ ∈ P with D(p′, q) ≤ cr, provided that there exists p ∈ P with D(p, q) ≤ r

3 / 16

slide-7
SLIDE 7

The Approximate Near Neighbor Problem (ANN)

Let P be an n-point subset of a metric (X, D), r > 0, c > 1 For q ∈ X find any p′ ∈ P with D(p′, q) ≤ cr, provided that there exists p ∈ P with D(p, q) ≤ r

p′ q p r cr

3 / 16

slide-8
SLIDE 8

The Approximate Near Neighbor Problem (ANN)

Let P be an n-point subset of a metric (X, D), r > 0, c > 1 For q ∈ X find any p′ ∈ P with D(p′, q) ≤ cr, provided that there exists p ∈ P with D(p, q) ≤ r

p′ q p r cr

3 / 16

slide-9
SLIDE 9

Literature

Exponential dependence on the dimension: (Arya, Mount 1993), (Meister 1993), (Clarkson 1994), (Arya, Mount, Netanyahu, Silverman, We, 1998), (Kleinberg, 1997), (Har-Peled 2002) Polynomial dependence on the dimension: (Indyk, Motwani 1998), (Kushilevitz, Ostrovsky, Rabani 1998), (Indyk 1998), (Indyk 2001), (Gionis, Indyk, Motwani 1999), (Charikar 2002), (Datar, Immorlica, Indyk, Mirrokni 2004), (Chakrabarti, Regev 2004), (Panigrahy 2006), (Ailon, Chazelle 2006), (Andoni, Indyk 2006), (Indyk, Kapralov 2013), (Nguy˜ ên 2013)

4 / 16

slide-10
SLIDE 10

Locality-Sensitive Hashing (LSH)

The goal: solve ANN with polynomial in the dimension space and query time, near-linear in n space, and sublinear in n query time

5 / 16

slide-11
SLIDE 11

Locality-Sensitive Hashing (LSH)

The goal: solve ANN with polynomial in the dimension space and query time, near-linear in n space, and sublinear in n query time The only known technique: Locality-Sensitive Hashing (LSH) (Indyk, Motwani 1998)

5 / 16

slide-12
SLIDE 12

Locality-Sensitive Hashing (LSH)

The goal: solve ANN with polynomial in the dimension space and query time, near-linear in n space, and sublinear in n query time The only known technique: Locality-Sensitive Hashing (LSH) (Indyk, Motwani 1998) A hash family H on (X, D) is (r, cr, p1, p2)-sensitive, if for every p, q ∈ X:

if D(p, q) ≤ r, then Prh∼H[h(p) = h(q)] ≥ p1; if D(p, q) ≥ cr, then Prh∼H[h(p) = h(q)] ≤ p2

5 / 16

slide-13
SLIDE 13

Locality-Sensitive Hashing (LSH)

The goal: solve ANN with polynomial in the dimension space and query time, near-linear in n space, and sublinear in n query time The only known technique: Locality-Sensitive Hashing (LSH) (Indyk, Motwani 1998) A hash family H on (X, D) is (r, cr, p1, p2)-sensitive, if for every p, q ∈ X:

if D(p, q) ≤ r, then Prh∼H[h(p) = h(q)] ≥ p1; if D(p, q) ≥ cr, then Prh∼H[h(p) = h(q)] ≤ p2

collision probability distance r cr p1 p2 1

5 / 16

slide-14
SLIDE 14

From LSH to ANN

Let H be a “reasonable” (r, cr, p1, p2)-sensitive family

6 / 16

slide-15
SLIDE 15

From LSH to ANN

Let H be a “reasonable” (r, cr, p1, p2)-sensitive family Define “quality” of H as ρ = ln(1/p1) ln(1/p2)

6 / 16

slide-16
SLIDE 16

From LSH to ANN

Let H be a “reasonable” (r, cr, p1, p2)-sensitive family Define “quality” of H as ρ = ln(1/p1) ln(1/p2) Then, can solve ANN with roughly O(n1+ρ + nd) space and O(d · nρ) query time (Indyk, Motwani 1998)

6 / 16

slide-17
SLIDE 17

From LSH to ANN

Let H be a “reasonable” (r, cr, p1, p2)-sensitive family Define “quality” of H as ρ = ln(1/p1) ln(1/p2) Then, can solve ANN with roughly O(n1+ρ + nd) space and O(d · nρ) query time (Indyk, Motwani 1998) Example: {0, 1}d with Hamming distance; Let H = {h1, . . . , hd}, where hi(x) = xi; One can check that ρ ≤ 1/c

6 / 16

slide-18
SLIDE 18

From LSH to ANN

Let H be a “reasonable” (r, cr, p1, p2)-sensitive family Define “quality” of H as ρ = ln(1/p1) ln(1/p2) Then, can solve ANN with roughly O(n1+ρ + nd) space and O(d · nρ) query time (Indyk, Motwani 1998) Example: {0, 1}d with Hamming distance; Let H = {h1, . . . , hd}, where hi(x) = xi; One can check that ρ ≤ 1/c 11101110 10111101

6 / 16

slide-19
SLIDE 19

Known LSH constructions

(Indyk, Motwani 1998), (Andoni, Indyk 2006), (Motwani, Naor, Panigrahy 2007), (O’Donnell, Wu, Zhou 2011), (Indyk, Kapralov 2013), (Nguy˜ ên 2013)

Bounds on ρ = ln(1/p1)/ ln(1/p2) for various spaces: Space Upper bound Lower bound ℓ1 ρ ≤ 1/c ρ ≥ 1/c − o(1) ℓp 1 < p < 2 ρ ≤ O(1/cp) ρ ≥ 1/cp − o(1) ℓ2 ρ ≤ 1/c2 + o(1) ρ ≥ 1/c2 − o(1)

7 / 16

slide-20
SLIDE 20

Known LSH constructions

(Indyk, Motwani 1998), (Andoni, Indyk 2006), (Motwani, Naor, Panigrahy 2007), (O’Donnell, Wu, Zhou 2011), (Indyk, Kapralov 2013), (Nguy˜ ên 2013)

Bounds on ρ = ln(1/p1)/ ln(1/p2) for various spaces: Space Upper bound Lower bound ℓ1 ρ ≤ 1/c ρ ≥ 1/c − o(1) ℓp 1 < p < 2 ρ ≤ O(1/cp) ρ ≥ 1/cp − o(1) ℓ2 ρ ≤ 1/c2 + o(1) ρ ≥ 1/c2 − o(1) This work: ANN in space O(n1+τ + nd) and time O(dnτ), where τ ≤

7 8c + O

  • 1

c3/2

  • + o(1) for ℓ1

τ ≤

7 8c2 + O

  • 1

c3

  • + o(1) for ℓ2

The first improvement upon (Indyk, Motwani 1998) for ℓ1 and (Andoni, Indyk 2006) for ℓ2!

7 / 16

slide-21
SLIDE 21

The main idea

LSH is oblivious, can we construct a hash family that would depend on the data?

8 / 16

slide-22
SLIDE 22

The main idea

LSH is oblivious, can we construct a hash family that would depend on the data? H is (r, cr, p1, p2)-sensitive, if for every p, q ∈ X

if D(p, q) ≤ r, then Prh∼H[h(p) = h(q)] ≥ p1; if D(p, q) ≥ cr, then Prh∼H[h(p) = h(q)] ≤ p2

8 / 16

slide-23
SLIDE 23

The main idea

LSH is oblivious, can we construct a hash family that would depend on the data? H is (r, cr, p1, p2)-sensitive, if for every p, q ∈ X

if D(p, q) ≤ r, then Prh∼H[h(p) = h(q)] ≥ p1; if D(p, q) ≥ cr, then Prh∼H[h(p) = h(q)] ≤ p2

Too strong! Enough to satisfy these for p ∈ P and q ∈ X. Can exploit the geometry of P to construct a better family

8 / 16

slide-24
SLIDE 24

The main idea

LSH is oblivious, can we construct a hash family that would depend on the data? H is (r, cr, p1, p2)-sensitive, if for every p, q ∈ X

if D(p, q) ≤ r, then Prh∼H[h(p) = h(q)] ≥ p1; if D(p, q) ≥ cr, then Prh∼H[h(p) = h(q)] ≤ p2

Too strong! Enough to satisfy these for p ∈ P and q ∈ X. Can exploit the geometry of P to construct a better family Parallels with practice!

PCA trees (Sproull 1991), (McNames 2001), (Verma, Kpotufe, Dasgupta 2009) Spectral Hashing (Weiss, Torralba, Fergus 2008) Semantic Hashing (Salakhutdinov, Hinton 2009) WTA Hashing (Yagnik, Strelow, Ross, Lin 2011)

8 / 16

slide-25
SLIDE 25

The main idea (contd)

From now on, looking at the Euclidean case and trying to improve upon ρ ≤ 1/c2 (Andoni, Indyk 2006)

9 / 16

slide-26
SLIDE 26

The main idea (contd)

From now on, looking at the Euclidean case and trying to improve upon ρ ≤ 1/c2 (Andoni, Indyk 2006) Partition P into low-diameter clusters (of diameter O(cr)) Improve upon 1/c2 for the low-diameter case

9 / 16

slide-27
SLIDE 27

The low-diameter case

All points and queries are on a sphere of radius O(cr)

10 / 16

slide-28
SLIDE 28

The low-diameter case

All points and queries are on a sphere of radius O(cr) Can achieve ρ = ln(1/p1) ln(1/p2) ≤ 1 − Ω(1) c2 using “ball carving” (similar to (Karger, Motwani, Sudan 1998))

10 / 16

slide-29
SLIDE 29

The low-diameter case

All points and queries are on a sphere of radius O(cr) Can achieve ρ = ln(1/p1) ln(1/p2) ≤ 1 − Ω(1) c2 using “ball carving” (similar to (Karger, Motwani, Sudan 1998))

10 / 16

slide-30
SLIDE 30

The low-diameter case

All points and queries are on a sphere of radius O(cr) Can achieve ρ = ln(1/p1) ln(1/p2) ≤ 1 − Ω(1) c2 using “ball carving” (similar to (Karger, Motwani, Sudan 1998))

10 / 16

slide-31
SLIDE 31

The low-diameter case

All points and queries are on a sphere of radius O(cr) Can achieve ρ = ln(1/p1) ln(1/p2) ≤ 1 − Ω(1) c2 using “ball carving” (similar to (Karger, Motwani, Sudan 1998))

10 / 16

slide-32
SLIDE 32

The low-diameter case

All points and queries are on a sphere of radius O(cr) Can achieve ρ = ln(1/p1) ln(1/p2) ≤ 1 − Ω(1) c2 using “ball carving” (similar to (Karger, Motwani, Sudan 1998))

10 / 16

slide-33
SLIDE 33

The low-diameter case

All points and queries are on a sphere of radius O(cr) Can achieve ρ = ln(1/p1) ln(1/p2) ≤ 1 − Ω(1) c2 using “ball carving” (similar to (Karger, Motwani, Sudan 1998))

10 / 16

slide-34
SLIDE 34

The low-diameter case

All points and queries are on a sphere of radius O(cr) Can achieve ρ = ln(1/p1) ln(1/p2) ≤ 1 − Ω(1) c2 using “ball carving” (similar to (Karger, Motwani, Sudan 1998))

10 / 16

slide-35
SLIDE 35

From LSH to ANN: the basic reduction

Let H be a (r, cr, p1, p2)-sensitive family: for every p, q ∈ X

if D(p, q) ≤ r, then Prh∼H[h(p) = h(q)] ≥ p1; if D(p, q) ≥ cr, then Prh∼H[h(p) = h(q)] ≤ p2

11 / 16

slide-36
SLIDE 36

From LSH to ANN: the basic reduction

Let H be a (r, cr, p1, p2)-sensitive family: for every p, q ∈ X

if D(p, q) ≤ r, then Prh∼H[h(p) = h(q)] ≥ p1; if D(p, q) ≥ cr, then Prh∼H[h(p) = h(q)] ≤ p2

Hash the dataset P using a concatenation of k functions from H: x → (h1(x), h2(x), . . . , hk(x))

11 / 16

slide-37
SLIDE 37

From LSH to ANN: the basic reduction

Let H be a (r, cr, p1, p2)-sensitive family: for every p, q ∈ X

if D(p, q) ≤ r, then Prh∼H[h(p) = h(q)] ≥ p1; if D(p, q) ≥ cr, then Prh∼H[h(p) = h(q)] ≤ p2

Hash the dataset P using a concatenation of k functions from H: x → (h1(x), h2(x), . . . , hk(x)) Locate a query q and enumerate all points from the coresponding bucket

11 / 16

slide-38
SLIDE 38

From LSH to ANN: the basic reduction

Let H be a (r, cr, p1, p2)-sensitive family: for every p, q ∈ X

if D(p, q) ≤ r, then Prh∼H[h(p) = h(q)] ≥ p1; if D(p, q) ≥ cr, then Prh∼H[h(p) = h(q)] ≤ p2

Hash the dataset P using a concatenation of k functions from H: x → (h1(x), h2(x), . . . , hk(x)) Locate a query q and enumerate all points from the coresponding bucket The optimal choice of k leads to the need in nρ independent hash tables Overall: n1+ρ space, nρ query time

11 / 16

slide-39
SLIDE 39

From LSH to ANN: two-level hashing

Partition space somewhat coarsely (using smaller k than before)

12 / 16

slide-40
SLIDE 40

From LSH to ANN: two-level hashing

Partition space somewhat coarsely (using smaller k than before) Argue that every part has a low diameter (aim at O(cr))

12 / 16

slide-41
SLIDE 41

From LSH to ANN: two-level hashing

Partition space somewhat coarsely (using smaller k than before) Argue that every part has a low diameter (aim at O(cr)) Use the better family for the low-diameter case to partition space finer

12 / 16

slide-42
SLIDE 42

From LSH to ANN: two-level hashing

Partition space somewhat coarsely (using smaller k than before) Argue that every part has a low diameter (aim at O(cr)) Use the better family for the low-diameter case to partition space finer “Outer” (data-independent, ρ ≤ 1/c2) + “inner” (data-dependent, “low-diameter” family) hash tables

12 / 16

slide-43
SLIDE 43

From LSH to ANN: two-level hashing

Partition space somewhat coarsely (using smaller k than before) Argue that every part has a low diameter (aim at O(cr)) Use the better family for the low-diameter case to partition space finer “Outer” (data-independent, ρ ≤ 1/c2) + “inner” (data-dependent, “low-diameter” family) hash tables

12 / 16

slide-44
SLIDE 44

From LSH to ANN: two-level hashing

Partition space somewhat coarsely (using smaller k than before) Argue that every part has a low diameter (aim at O(cr)) Use the better family for the low-diameter case to partition space finer “Outer” (data-independent, ρ ≤ 1/c2) + “inner” (data-dependent, “low-diameter” family) hash tables

12 / 16

slide-45
SLIDE 45

From LSH to ANN: two-level hashing

Partition space somewhat coarsely (using smaller k than before) Argue that every part has a low diameter (aim at O(cr)) Use the better family for the low-diameter case to partition space finer “Outer” (data-independent, ρ ≤ 1/c2) + “inner” (data-dependent, “low-diameter” family) hash tables

12 / 16

slide-46
SLIDE 46

From LSH to ANN: two-level hashing

Partition space somewhat coarsely (using smaller k than before) Argue that every part has a low diameter (aim at O(cr)) Use the better family for the low-diameter case to partition space finer “Outer” (data-independent, ρ ≤ 1/c2) + “inner” (data-dependent, “low-diameter” family) hash tables Get ρ ≤ (1 − Ω(1))/c2, since in inner tables we get better relation between p1 and p2!

12 / 16

slide-47
SLIDE 47

Reflections

Why is this family data-dependent? Use a point from P as a center for an inner hash table If q ∈ X is far from the center of the outer bin, then we can not handle it (but we do not care about this case)

13 / 16

slide-48
SLIDE 48

Smallest enclosing balls

Jung’s theorem: any set of diameter D lies in a ball of radius D/ √ 2 For each bin find a smallest enclosing ball and hash wrt its center

14 / 16

slide-49
SLIDE 49

Smallest enclosing balls

Jung’s theorem: any set of diameter D lies in a ball of radius D/ √ 2 For each bin find a smallest enclosing ball and hash wrt its center Careful analysis leads to ρ ≤ 7 8c2 + O

1

c3

  • + oc(1)

14 / 16

slide-50
SLIDE 50

Extensions

Can embed ℓ1 into ℓ2-squared, which gives an algorithm with ρ ≤ 7 8c + O

1

c3/2

  • + oc(1)

for ℓ1 (in particular, Hamming distance for binary strings)

15 / 16

slide-51
SLIDE 51

Extensions

Can embed ℓ1 into ℓ2-squared, which gives an algorithm with ρ ≤ 7 8c + O

1

c3/2

  • + oc(1)

for ℓ1 (in particular, Hamming distance for binary strings) Instead of two-level hashing can consider many levels; preliminary computations give ρ ≤ 1 2c2 ln 2 + O

1

c3

  • + oc(1)

for the Euclidean case (and the similar result for ℓ1 and Hamming)

15 / 16

slide-52
SLIDE 52

Extensions

Can embed ℓ1 into ℓ2-squared, which gives an algorithm with ρ ≤ 7 8c + O

1

c3/2

  • + oc(1)

for ℓ1 (in particular, Hamming distance for binary strings) Instead of two-level hashing can consider many levels; preliminary computations give ρ ≤ 1 2c2 ln 2 + O

1

c3

  • + oc(1)

for the Euclidean case (and the similar result for ℓ1 and Hamming) Using this multilevel partitioning can improve known constructions for spanners for subsets of ℓ1 and ℓ2 (upon (Har-Peled, Indyk, Sidiropoulos 2013))

15 / 16

slide-53
SLIDE 53

Conclusions and open problems

Able to overcome the LSH barrier for the case of ℓ1 and ℓ2 using data-dependent hashing Can one improve our bounds?

16 / 16

slide-54
SLIDE 54

Conclusions and open problems

Able to overcome the LSH barrier for the case of ℓ1 and ℓ2 using data-dependent hashing Can one improve our bounds? For a certain random instance can achieve 1/(2c) and 1/(2c2), which is tight for the data-dependent hashing by (Motwani, Naor, Panigrahy 2007)

16 / 16

slide-55
SLIDE 55

Conclusions and open problems

Able to overcome the LSH barrier for the case of ℓ1 and ℓ2 using data-dependent hashing Can one improve our bounds? For a certain random instance can achieve 1/(2c) and 1/(2c2), which is tight for the data-dependent hashing by (Motwani, Naor, Panigrahy 2007) Can one get these exponents for the general case?

16 / 16

slide-56
SLIDE 56

Conclusions and open problems

Able to overcome the LSH barrier for the case of ℓ1 and ℓ2 using data-dependent hashing Can one improve our bounds? For a certain random instance can achieve 1/(2c) and 1/(2c2), which is tight for the data-dependent hashing by (Motwani, Naor, Panigrahy 2007) Can one get these exponents for the general case? Can one improve the bound for this random instance further? (Looks hard!)

Thank you!

16 / 16