On the LSH Distortion of Ulam and Cayley Similarities

Flavio Chierichetti, Mirko Giacchini, Ravi Kumar, Erasmo Tani

TL;DR

This paper investigates how well popular permutation similarity measures—specifically Ulam and Cayley similarities—can be approximated using Locality-Sensitive Hashing (LSH). The authors prove a surprising dichotomy: while the Ulam similarity allows for a sublinear LSH distortion of $O(n/\sqrt{\log n})$, the Cayley similarity is fundamentally resistant to efficient hashing, suffering from a maximum possible linear distortion of $\Theta(n)$.

What Problem Does This Paper Address?

Nearest neighbor search on permutations (such as rankings, text strings, or genetic sequences) is a fundamental problem in data science. Locality-Sensitive Hashing (LSH) is the standard tool to accelerate this task by ensuring that similar items hash to the same bucket with high probability.

However, an exact LSH scheme requires the underlying similarity function to satisfy strict mathematical constraints (like being isometrically embeddable into the $\ell_1$ metric). Many natural similarity measures fail these constraints. To bypass this limitation, researchers use the concept of LSH distortion, which measures how closely a non-LSHable similarity function can be multiplicatively "sandwiched" by a valid LSH scheme.

This paper establishes the theoretical limits of LSH distortion for two of the most widely used permutation similarities:

  1. Ulam Similarity: Based on the Longest Common Subsequence (LCS) between two permutations.
  2. Cayley Similarity: Based on the minimum number of transpositions needed to turn one permutation into another.

Methods

The authors employ a mix of algorithmic design, abstract algebra, and representation theory to prove their bounds:

  • Ulam Upper Bound: The authors construct a novel randomized hashing scheme. It computes a measure of correlation between the input permutations and a uniformly random permutation by scanning for "record maxima" sequentially.
  • Ulam Lower Bound: To prove the impossibility of a low-distortion hash, the authors first use a computer search to find a small, concrete set of permutations (on an 8-element universe) that exhibits a distortion of at least $9/7$. They then use the algebraic wreath product of permutations to quadratically amplify this small counterexample into an arbitrarily large universe.
  • Cayley Lower Bound: Because the Cayley metric is highly symmetric (bi-invariant), the authors turn to the representation theory of the symmetric group ($S_n$). They exploit the fact that any bi-invariant positive semidefinite kernel can be written as a convex combination of normalized characters. By applying Roichman’s character-ratio estimates to derangements (permutations with no fixed points), they prove that any LSH scheme forces vastly different Cayley similarities to have nearly identical collision probabilities.

Datasets

None used. This is a purely theoretical paper focused on mathematical proofs and algorithmic complexity bounds.

Key Insights and Ideas

  • The Sublinear vs. Linear Dichotomy: The most striking takeaway is how differently these two metrics behave under the lens of LSH. Ulam similarity admits a sublinear distortion, meaning that as the permutation size $n$ grows, the relative quality of the LSH approximation actually improves. Cayley similarity, despite its clean algebraic structure, behaves as poorly as possible, hitting a linear distortion barrier.
  • Algebraic Amplification: The use of the wreath product to scale up a tiny, 8-element counterexample into an infinite family of lower bounds highlights a powerful technique for proving hardness in permutation spaces.
  • Human-AI Collaboration: In an insightful acknowledgment section, the authors note that Large Language Models (LLMs) were heavily involved in the research process—helping to discover the Ulam upper bound proof structure and suggesting the representation theory approach after standard methods failed for the Cayley metric.

Key Results

  • Ulam Similarity Distortion:
  • Upper Bound: $O(n / \sqrt{\log n})$, proving for the first time that a sublinear LSH distortion is achievable.
  • Lower Bound: $\Omega(n^{0.12})$.
  • Cayley Similarity Distortion:
  • Tight Bound: $\Theta(n)$. This matches a trivial $O(n)$ upper bound, proving that Cayley similarity cannot be efficiently approximated via LSH.

Limitations and Future Work

  • The Ulam Gap: There remains a wide gap between the Ulam lower bound ($\Omega(n^{0.12})$) and the upper bound ($O(n / \sqrt{\log n})$). The authors conjecture that the true distortion is likely around $\Theta(\tilde{\sqrt{n}})$.
  • Computational Search Limits: The lower bound for Ulam is bottlenecked by the size of the base case ($n=8$) found via brute-force solver. Finding a larger, worse base case would immediately lift the global lower bound.
  • Other Permutation Metrics: The techniques developed here do not easily transfer to other common metrics like block reversal similarity, where the authors conjecture an $\Omega(n)$ lower bound but currently lack the mathematical machinery to prove it.

Summary updated

Abstract

Locality-sensitive hashing (LSH) has found widespread use as a fundamental primitive, particularly to accelerate nearest neighbor search. An LSH scheme for a similarity function $S:\mathcal{X} \times \mathcal{X} \to [0,1]$ is a distribution over hash functions on $\mathcal{X}$ with the property that the probability of collision of any two elements $x,y\in \mathcal{X}$ is exactly equal to $S(x,y)$. However, not all similarity functions admit exact LSH schemes. The notion of LSH distortion measures how multiplicatively close a similarity function is to having an LSH scheme. In this work, we study the LSH distortion of the Ulam and Cayley similarities, which are popular similarity measures on permutations of $n$ elements. We show that the Ulam similarity admits a sublinear LSH distortion of $O(n / \sqrt{\log n})$; we also prove a lower bound of $Ω(n^{0.12})$ on the best LSH distortion achievable. On the other hand, we show that the LSH distortion of the Cayley similarity is $Θ(n)$.
BibTeX
@article{chierichetti2026lsh,
  author = {Flavio Chierichetti and Mirko Giacchini and Ravi Kumar and Erasmo Tani},
  title = {{On the LSH Distortion of Ulam and Cayley Similarities}},
  journal = {Electron. Colloquium Comput. Complex.},
  year = {2026},
}

Loading related content...

Figure