NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Approximate Similarity Search Under Edit Distance Using Locality-Sensitive Hashing

Samuel McCauley

TL;DR

This paper introduces a novel locality-sensitive hashing (LSH) scheme for approximate similarity search under edit distance. It provides the first LSH with theoretical worst-case guarantees that significantly broadens the range of parameters for which efficient search is possible, outperforming previous methods that either required impractically large approximation factors or were limited to very small search radii.

What Problem Does This Paper Address?

The paper tackles the fundamental problem of "edit distance similarity search," also known as approximate pattern matching. Imagine you have a massive database of strings (like DNA sequences, text documents, or passwords) and you want to find strings that are "close" to a given query string. "Closeness" here is measured by edit distance – the minimum number of insertions, deletions, or substitutions needed to transform one string into another. The challenge is to preprocess the database so that these similarity queries can be answered very quickly, ideally much faster than comparing the query to every single string in the database (a linear scan).

Existing solutions have a significant drawback: they either require a very large "approximation factor" (meaning the returned string might be much less similar than the true closest one) or they only work efficiently for very small search radii (meaning you're only looking for strings that are extremely similar to the query). This leaves a large gap where neither theoretical guarantees nor practical efficiency are met.

Methods

The core contribution is a new locality-sensitive hash function specifically designed for edit distance. Unlike previous approaches that might embed strings into other metric spaces (like Hamming space) and then use standard LSH, this paper proposes a single, integrated LSH function.

Key aspects of their method include:

  • Novel Hash Function: They introduce a hash function that directly operates on strings and their edit distance. This function is designed to have a higher probability of producing the same hash value for strings that are close in edit distance, and a lower probability for strings that are far apart.
  • "Grid Walk" Analogy: The analysis of their hash function uses a concept called a "grid walk," which is inspired by the dynamic programming table used to compute edit distance. This allows them to model the hashing process as a random walk and relate hash collisions to edit operations.
  • Parameter Tuning: The hash function has tunable parameters that are carefully chosen to optimize the trade-off between query time, space, and the approximation factor.
  • Combining Embedding and Hashing: A significant improvement comes from combining the "embedding" (mapping strings to a different space) and the "hashing" steps into a single LSH construction, rather than performing them sequentially.

Datasets

Not discussed in the paper. The paper focuses on theoretical bounds and algorithmic design, rather than empirical evaluation on specific datasets.

Key Insights and Ideas

  • Direct LSH for Edit Distance is Powerful: The paper demonstrates that a direct LSH construction for edit distance can be more effective than indirect methods that rely on embeddings into other spaces. This is particularly true for certain parameter ranges where embeddings into L1 space are known to be problematic.
  • "Grid Walk" as an Analytical Tool: The novel "grid walk" framework provides a more intuitive and powerful way to analyze the collision probabilities of LSH functions for edit distance, connecting it directly to the underlying edit operations.
  • Integrated Hashing and Embedding: Combining the embedding and hashing steps into a single LSH construction is crucial for achieving better theoretical bounds and practical performance compared to sequential approaches.
  • Broadening the Parameter Range: The most significant insight is that their method works efficiently across a much wider range of parameters (query radius r and approximation factor c) than previous theoretical approaches.

Key Results

The paper presents two main theoretical results:

  • Approximate Similarity Search: They provide a data structure that answers approximate similarity search queries (finding a string within cr distance if one exists within r distance) in Õ(d³r n¹/c) time per query, with Õ(d³rn¹+1/c) preprocessing time and space. This significantly improves upon prior bounds, especially for moderate r and c.
  • Approximate Nearest Neighbor Search: For the problem of finding the closest neighbor (without a pre-specified radius), they achieve Õ(d³r n¹/c) query time and Õ(dn²) preprocessing time and space.

These bounds are notable because they offer non-trivial theoretical guarantees for a wide range of parameters, a feat that has been challenging for edit distance similarity search.

Limitations and Future Work

  • Exponential Dependence on r: While the paper significantly improves upon previous theoretical bounds, the query time still has an exponential dependence on the search radius r (specifically, d³r). The authors acknowledge that removing this exponential term entirely remains an open problem, and that a trivial brute-force scan is currently the only algorithm without this exponential cost.
  • Theoretical Focus: The paper primarily focuses on theoretical worst-case guarantees. While they mention that practical results often rely on heuristics or embeddings, their work aims to provide a theoretical foundation for a broader parameter space. Future work could explore practical implementations and optimizations of their LSH scheme.
  • Alphabet Size and String Length Assumptions: The theoretical bounds often assume certain relationships between alphabet size, string length, and the number of strings (e.g., d = O(n) and alphabet size O(n)). Relaxing these assumptions or analyzing performance under different conditions could be a direction for future research.

Summary updated

BibTeX
@inproceedings{mccauley2021approximate,
  author = {Samuel McCauley},
  title = {{Approximate Similarity Search Under Edit Distance Using Locality-Sensitive Hashing}},
  booktitle = {ICDT},
  year = {2021},
  url = {https://openreview.net/forum?id=ZhatKDMSWe1},
}

Loading related content...

Figure