ultra fast similarity search using ternary content
play

Ultra-Fast Similarity Search Using Ternary Content - PowerPoint PPT Presentation

Ultra-Fast Similarity Search Using Ternary Content Addressable Memory Yotam Harchol The Hebrew University of Jerusalem, Israel Joint work


  1. ¡ ¡Ultra-­‑Fast ¡Similarity ¡Search ¡Using ¡ ¡ ¡ ¡Ternary ¡Content ¡Addressable ¡Memory ¡ Yotam ¡Harchol ¡ The ¡Hebrew ¡University ¡of ¡Jerusalem, ¡Israel ¡ ¡ Joint ¡work ¡with: ¡ Anat ¡Bremler-­‑Barr ¡ David ¡Hay ¡ Yacov ¡Hel-­‑Or ¡ IDC ¡Herzliya, ¡ Hebrew ¡University, ¡ ¡ IDC ¡Herzliya, ¡ Israel ¡ Israel ¡ Israel ¡ DaMoN ¡2015, ¡Melbourne, ¡VIC, ¡Australia ¡ This ¡research ¡was ¡supported ¡by ¡the ¡European ¡Research ¡Council ¡under ¡the ¡European ¡Union’s ¡ Seventh ¡Framework ¡Programme ¡(FP7/2007-­‑2013)/ERC ¡Grant ¡agreement ¡no ¡259085. ¡ ¡

  2. Background ¡

  3. The ¡Nearest ¡Neighbor ¡Problem ¡ • Classic ¡problem ¡in ¡computer ¡science ¡ – Many ¡applica]ons ¡in ¡reality ¡ • Machine ¡learning ¡ • Computer ¡vision ¡ • Image ¡processing ¡ • Spa]al ¡databases ¡ • Network ¡traffic ¡classifica]on ¡and ¡QoS ¡ – Performance ¡boaleneck ¡ 3

  4. The ¡Nearest ¡Neighbor ¡Problem ¡ • Input: ¡ -­‑ ¡A ¡set ¡of ¡data ¡points ¡ -­‑ ¡A ¡query ¡point ¡(or ¡a ¡ ¡ series ¡of ¡those) ¡ ¡ (points ¡are ¡in ¡a ¡discrete ¡space) ¡ • Output: ¡ Data ¡point ¡closest ¡to ¡ ¡ the ¡query ¡point ¡ • The ¡Curse ¡of ¡Dimensionality : ¡Hard ¡problem ¡for ¡high ¡dimensions ¡ (even ¡over ¡10 ¡or ¡so) ¡ 4

  5. Known ¡Solu]ons ¡ Brute ¡force ¡search ¡ Space ¡par]]oning ¡techniques ¡ Too ¡long ¡to ¡compute ¡ Time ¡exponen]al ¡in ¡dimension ¡ 0 00110****110001*** 1 0111*****1100010** 2 00*******110****** 3 01*******11000**** 4 5 Ternary ¡locality ¡sensi]ve ¡hashing ¡ Locality ¡sensi]ve ¡hashing ¡(LSH) ¡ First ¡to ¡show ¡similarity ¡search ¡on ¡TCAM ¡ More ¡efficient, ¡but ¡probabilis]c ¡ Probabilis]c, ¡requires ¡more ¡]me ¡and ¡ and ¡s]ll ¡takes ¡long ¡]me ¡ space ¡than ¡our ¡technique ¡[SIGMOD ¡’10] ¡ 5

  6. Our ¡Contribu]on ¡ • Single ¡TCAM ¡lookup ¡ è è ¡Approximate ¡solu:on ¡ – Four ¡orders ¡of ¡magnitude ¡faster ¡than ¡LSH ¡ • Also ¡faster ¡than ¡Ternary ¡LSH ¡ – Determinis:c ¡ – Smaller ¡ (and ¡prac:cal) ¡TCAM ¡space ¡required ¡ • Ultra-­‑fast ¡algorithms ¡for: ¡ – Exact ¡nearest ¡neighbor ¡search ¡ ¡ – k-­‑nearest ¡neighbors ¡search ¡ – More ¡related ¡problems… ¡ (Not ¡covered ¡in ¡this ¡talk ¡but ¡shown ¡in ¡the ¡paper) ¡ 6

  7. TCAM ¡– ¡Ternary ¡Content ¡Addressable ¡Memory ¡ • TCAM ¡is ¡an ¡associa]ve ¡memory ¡module ¡ – Useful ¡for ¡parallel ¡mul]dimensional ¡prefix ¡lookup ¡ • Each ¡entry ¡may ¡consist ¡of ¡0, ¡1, ¡and ¡* ¡bits ¡ • Widely ¡used ¡in ¡high-­‑speed ¡networking ¡devices ¡ • 360 ¡Million ¡queries ¡per ¡second ¡and ¡higher! ¡ Memory ¡chip ¡ Example: ¡2-­‑dimensional ¡IP ¡lookup: ¡ or ¡ Coprocessor? ¡ Source ¡IP ¡ Dest. ¡IP ¡ 011101001110001011 0 00110****110001*** P1 0 1 0111*****1100010** P2 1 2 00*******110****** Drop 1 ¡ 2 3 01*******11000**** P3 3 4 4 5 5 TCAM ¡ SRAM ¡ 7

  8. General ¡Idea ¡ • Encode ¡cubes ¡on ¡data ¡points ¡ – Given ¡a ¡query ¡point, ¡ single ¡TCAM ¡lookup ¡returns ¡ the ¡smallest ¡cube ¡that ¡contains ¡it ¡ – Goal: ¡no ¡TCAM ¡entry ¡expansion ¡in ¡high ¡dimension ¡ Data ¡ Query ¡ 8

  9. General ¡Idea ¡ • Or ¡instead, ¡save ¡TCAM ¡space ¡ – Encode ¡cubes ¡on ¡the ¡query ¡point ¡ – Query ¡TCAM ¡with ¡growing ¡cubes ¡ – Find ¡first ¡data ¡point ¡to ¡match ¡ Data ¡ Query ¡ 9

  10. Encoding ¡Scheme ¡

  11. Ternary ¡Match ¡ 01*101**1 01*101**1 ≈ ¡ ≈ ¡ 0*11*101* 0011*101* Match ¡ No ¡match ¡ Formally, ¡a={a 1 ,…,a m } ¡matches ¡the ¡word ¡ ¡ b={b 1 ,…,b m }, ¡denoted ¡a≈b, ¡if ¡and ¡only ¡if: ¡ For ¡any ¡i, ¡a i =b i ¡or ¡a i ¡is ¡* ¡or ¡b i ¡is ¡* ¡ 11

  12. Encoding ¡Func]on ¡ • Goal: ¡ Admissible ¡encoding ¡func]on ¡ tcode : ¡ ¡ for ¡points ¡and ¡cubes: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ tcode (p) ¡≈ ¡ tcode (C) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡and ¡only ¡if ¡p ¡is ¡in ¡C ¡ • First ¡step: ¡ Solu]on ¡in ¡a ¡single ¡ ¡ dimensional ¡space: ¡ 0 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡1 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡2 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡3 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡4 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡5 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡6 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡7 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡8 ¡ 12

  13. Encoding ¡Func]on ¡for ¡Intervals ¡ Ternary ¡encoding ¡func]on ¡ tcode ¡for ¡points ¡and ¡intervals: ¡ Binary ¡ encoding ¡ Requires ¡mul]ple ¡TCAM ¡entries: ¡ 001* ¡ 0 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡ 9 ¡ 10 ¡ 11 ¡ 12 ¡ 13 ¡ 14 ¡ 15 ¡ 010* ¡ 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 13

  14. Encoding ¡Func]on ¡for ¡Intervals ¡ Ternary ¡encoding ¡func]on ¡ tcode ¡for ¡points ¡and ¡intervals: ¡ Binary ¡reflected ¡ Gray ¡code ¡ 0 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡ 9 ¡ 10 ¡ 11 ¡ 12 ¡ 13 ¡ 14 ¡ 15 ¡ 0000 0001 0011 0010 0110 0111 0101 0100 1100 1101 1111 1110 1010 1011 1001 1000 00** 01** 11** 10** ???? ¡ ???? ¡ ???? ¡ ???? ¡ ???? ¡ *00** 0*1* *10* 1*1* *00* ???? ¡ ???? ¡ ???? ¡ ???? ¡ ???? ¡ 14

  15. Encoding ¡Func]on ¡for ¡Intervals ¡ Ternary ¡encoding ¡func]on ¡ tcode ¡for ¡points ¡and ¡intervals: ¡ Binary ¡reflected ¡Gray ¡code ¡ + ¡ Extra ¡bits ¡ 0 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡ 9 ¡ 10 ¡ 11 ¡ 12 ¡ 13 ¡ 14 ¡ 15 ¡ 0000|00 ¡ 0011|10 ¡ 0110|11 ¡ 0101|01 ¡ 1100|00 ¡ 1111|10 ¡ 1010|11 ¡ 1001|01 ¡ 0001|10 0010|11 0111|01 0100|00 1101|10 1110|11 1011|01 1000|00 00**|** 01**|** 11**|** 10**|** *0**|0* 0***|1* *1**|0* 1***|1* *0**|0* *00*|** 0*1*|** *10*|** 1*1*|** *00*|** 1***|*1 *0**|*0 *0**|*0 0***|*1 *1**|*0 15

  16. Encoding ¡Func]on ¡for ¡Intervals ¡ Ternary ¡encoding ¡func]on ¡ tcode ¡for ¡points ¡and ¡intervals: ¡ Final ¡code ¡ Awer ¡elimina]ng ¡ redundant ¡bits ¡ 0 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡ 9 ¡ 10 ¡ 11 ¡ 12 ¡ 13 ¡ 14 ¡ 15 ¡ 00000 00010 00110 00111 01111 01101 01001 01000 11000 11010 11110 11111 10111 10101 10001 10000 00*** 01*** 11*** 10*** *0*0* 0**1* *1*0* 1**1* *0*0* 1*1** *00** *00** 0*1** *10** *0**0 0***1 *1**0 1***1 *0**0 Create ¡code ¡for ¡intervals ¡of ¡length ¡ h max ¡ è ¡Encode ¡all ¡intervals ¡of ¡length ¡≤ ¡ h max ¡ (By ¡intersec]ng ¡two ¡intervals ¡of ¡length ¡ h max ) ¡ ¡ * ¡Full ¡details ¡and ¡correc]on ¡proofs ¡are ¡in ¡the ¡paper ¡ 16

  17. Mul]ple ¡Dimensions ¡ Trivial ¡expansion ¡to ¡ d ¡dimensions: ¡ Y=[2,4) ¡ tcode (Y)=001** ¡ Z=[4,6) ¡ tcode (Z)=011** ¡ Cube ¡ C 1 ¡ X=[1,3) ¡ tcode (X)=00*10 ¡ tcode ( C 1 )=00*10001**011** ¡ 17

  18. Mul]ple ¡Dimensions ¡ Trivial ¡expansion ¡to ¡ d ¡dimensions: ¡ Y=[0,4) ¡ tcode (Y)=00*** ¡ Z=[0,4) ¡ tcode (Z)=00*** ¡ X=[4,8) ¡ tcode (X)=01*** ¡ Cube ¡ C 2 ¡ tcode ( C 1 )=00*10001**011** ¡ tcode ( C 2 )=01***00***00*** ¡ 18

  19. Mul]ple ¡Dimensions ¡ Trivial ¡expansion ¡to ¡ d ¡dimensions: ¡ tcode(5)=01101 ¡ Query ¡q=(5,2,3) ¡ tcode(2)=00110 ¡ tcode(3)=00111 ¡ No ¡TCAM ¡entry ¡expansion ¡at ¡all, ¡ Cube ¡ C 1 ¡ even ¡in ¡high ¡dimensions! ¡ Cube ¡ C 2 ¡ ¡tcode ( p )=011010011000111 ¡ tcode ( C 1 )=00*10001**011** ¡ ✖ ¡ ✔ ¡ tcode ( C 2 )=01***00***00*** ¡ 19

  20. Solving ¡Nearest ¡Neighbor ¡Search ¡ ¡ on ¡TCAM ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend