Skip to main content
QUICK REVIEW

[Paper Review] Similarity Search and Locality Sensitive Hashing using TCAMs

Rajendra Shinde, Ashish Goel|arXiv (Cornell University)|Jun 17, 2010
Advanced Image and Video Retrieval TechniquesComputer Science31 references4 citations
TL;DR

This paper proposes Ternary Locality Sensitive Hashing (TLSH), a novel method that leverages Ternary Content Addressable Memories (TCAMs) to perform approximate nearest neighbor search in Euclidean space with O(1) query time and near-linear storage. By encoding vectors using ternary values {0, 1, *}, TLSH enables a single TCAM lookup to retrieve high-accuracy approximate nearest neighbors, achieving 1.5 million queries per second on commodity hardware, thus circumventing theoretical lower bounds in standard models.

ABSTRACT

Similarity search methods are widely used as kernels in various machine learning applications. Nearest neighbor search (NNS) algorithms are often used to retrieve similar entries, given a query. While there exist efficient techniques for exact query lookup using hashing, similarity search using exact nearest neighbors is known to be a hard problem and in high dimensions, best known solutions offer little improvement over a linear scan. Fast solutions to the approximate NNS problem include Locality Sensitive Hashing (LSH) based techniques, which need storage polynomial in $n$ with exponent greater than $1$, and query time sublinear, but still polynomial in $n$, where $n$ is the size of the database. In this work we present a new technique of solving the approximate NNS problem in Euclidean space using a Ternary Content Addressable Memory (TCAM), which needs near linear space and has O(1) query time. In fact, this method also works around the best known lower bounds in the cell probe model for the query time using a data structure near linear in the size of the data base. TCAMs are high performance associative memories widely used in networking applications such as access control lists. A TCAM can query for a bit vector within a database of ternary vectors, where every bit position represents $0$, $1$ or $*$. The $*$ is a wild card representing either a $0$ or a $1$. We leverage TCAMs to design a variant of LSH, called Ternary Locality Sensitive Hashing (TLSH) wherein we hash database entries represented by vectors in the Euclidean space into $\{0,1,*\}$. By using the added functionality of a TLSH scheme with respect to the $*$ character, we solve an instance of the approximate nearest neighbor problem with 1 TCAM access and storage nearly linear in the size of the database. We believe that this work can open new avenues in very high speed data mining.

Motivation & Objective

  • To address the scalability limitations of exact and approximate nearest neighbor search in high-dimensional Euclidean spaces.
  • To overcome the 'curse of dimensionality' that degrades performance of traditional hashing and indexing techniques.
  • To leverage TCAM hardware—commonly used in networking—for high-speed similarity search in data mining and machine learning.
  • To design a hashing scheme that bypasses known lower bounds in the cell probe model by exploiting TCAM's parallel associative search capability.
  • To demonstrate practical feasibility through simulations and real-world experiments on enterprise-grade TCAM hardware.

Proposed method

  • Proposes Ternary Locality Sensitive Hashing (TLSH), a variant of LSH that maps Euclidean space vectors into ternary vectors using {0, 1, *} symbols.
  • Uses TCAMs to perform associative lookup on ternary hash codes, where '*' acts as a wildcard matching both 0 and 1.
  • Maps database entries to ternary hash codes such that similar vectors are more likely to collide in the TCAM.
  • Employs a preprocessing step to generate multiple ternary hash functions that preserve locality in the Euclidean space.
  • Designs a query procedure that hashes the query vector using the same TLSH functions and performs a single TCAM lookup to retrieve candidate neighbors.
  • Leverages the inherent parallelism of TCAMs to achieve constant-time query resolution, independent of database size.

Experimental results

Research questions

  • RQ1Can TCAM-based associative memory be used to achieve O(1) query time for approximate nearest neighbor search in high-dimensional Euclidean space?
  • RQ2Can a ternary hashing scheme (TLSH) outperform standard LSH in terms of space efficiency and query speed while maintaining high accuracy?
  • RQ3To what extent can existing TCAM hardware in enterprise switches support real-time similarity search at scale?
  • RQ4Does the use of wildcards in ternary hashing allow the method to circumvent known lower bounds in the cell probe model?
  • RQ5How does TLSH perform on real-world datasets such as Wikipedia text embeddings in high-dimensional space?

Key findings

  • Using a 288-bit TCAM, the method achieves high-accuracy approximate nearest neighbor search on a 1-million-point database in 64-dimensional Euclidean space.
  • The system sustains a query rate of 1.5 million approximate nearest neighbor queries per second per 1 Gbps port on a Cisco Catalyst 4500 switch.
  • TLSH reduces query time to O(1) with near-linear storage, significantly outperforming traditional LSH methods that require polynomial query time.
  • The method successfully bypasses known lower bounds in the cell probe model by exploiting the parallel associative capabilities of TCAMs.
  • Simulations on both synthetic and real-world (Wikipedia) datasets confirm high retrieval accuracy and robustness across varying data distributions.
  • The approach demonstrates practical viability for streaming and real-time data mining applications requiring ultra-low latency similarity search.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.