Moses Charikar showed in his 2002 STOC paper that rounding procedures from linear and semidefinite programming double as Locality-Sensitive Hashing (LSH) families, turning high-dimensional vectors into compact binary sketches whose Hamming distance estimates angular separation. Drawing a random Gaussian hyperplane r and emitting 1 if r . u >= 0 (else 0) guarantees a collision probability of 1 - theta(u, v) / pi, a quantity Charikar notes stays within a 0.878 factor of cos(theta). The same paper establishes a sharp impossibility boundary: any similarity function admitting exact LSH must satisfy the metric triangle inequality on 1 - sim(x, y), ruling out Dice and Overlap coefficients altogether.

  • Exact angular collision law: Random hyperplane bits match with probability 1 - theta(u, v) / pi, so concatenating t bits reduces cosine-angle estimation to bit-count Hamming distance.
  • Compact O(log^2 n) randomness: Rather than storing d independent Gaussian floats per hash over n vectors, pseudorandom generators compress the hyperplane family to size 2^{O(log^2 n)}.
  • Impossibility proof for Dice and Overlap: Lemma 1 proves 1 - sim(x, y) must obey the triangle inequality; on {a}, {b}, and {a, b}, Dice (2/3 < 1) and Overlap (0 < 1) both fail, so no exact LSH exists for either.
  • O(log n log log n) Earth Mover’s Distance: Applying Kleinberg-Tardos rounding over tree metrics estimates EMD(P, Q) within O(log n log log n) distortion (tightening to O(1) on hierarchies) and generalizes MinHash to continuous weights.
Which similarity metrics admit Locality-Sensitive Hashing (Charikar 2002)
Angular / Cosine (1 - theta/pi)
LSH exists: Goemans-Williamson random hyperplane sgn(r . u) yields 1-bit sketches for weighted vectors.
Weighted MinHash & EMD
LSH / bounded distortion: Kleinberg-Tardos rounding gives sum min / sum max for weights and O(log n log log n) for EMD.
Dice, Overlap, KL-div
Impossible under Eq. 1: Dice and Overlap break the triangle inequality on {a}, {b}, {a,b}; KL is asymmetric.

Triangle-inequality test in Lemma 1 and rounding constructions in Sections 3 through 4.1. Source: Charikar (2002), Sections 2 to 4.

How random hyperplanes and rounding build sketches

Charikar defines an LSH family F cleanly via Pr[h(x) = h(y)] = sim(x, y). Earlier web deduplication relied on Broder’s min-wise independent permutations (MinHash) over unweighted sets under Jaccard similarity |A cap B| / |A cup B|. To support real-valued feature weights, such as TF-IDF terms or dense embeddings, Charikar adapts Goemans and Williamson’s semidefinite rounding for MAX-CUT:

  1. Draw a d-dimensional vector r with each coordinate sampled independently from a standard normal distribution N(0, 1).
  2. Hash any document vector u to a single bit h_r(u) = 1 if r . u >= 0, and 0 otherwise.
  3. Concatenate t independent hyperplane bits to form a t-bit fingerprint; the fraction of disagreeing bits estimates theta(u, v) / pi.

Because sgn(r . u) is scale-invariant for positive scalars, multiplying all weights in a vector by a constant never flips a bit. When applied to unweighted binary set vectors, the scheme estimates 1 - (1 / pi) * arccos(|A cap B| / sqrt(|A| * |B|)), directly incorporating feature weights when coordinates become continuous.

The paper pairs this construction with three supporting results. First, Lemma 2 converts any multi-valued LSH scheme into binary {0, 1} bits via a pairwise-independent hash (sim' = (1 + sim) / 2), and Lemma 3 proves 1 - sim(x, y) embeds isometrically into the Hamming cube. Second, Section 4 extends rounding to Earth Mover’s Distance (EMD) via Kleinberg-Tardos LP rounding on tree metrics, which in the uniform-metric limit (Section 4.1) yields a weighted MinHash for non-negative vectors with exact collision sum_i min(a_i, b_i) / sum_i max(a_i, b_i). Third, Section 5 introduces a simple Hamming nearest-neighbor index: sort d-bit sketches under N = O(n^{1 / (1 + epsilon)}) random bit permutations, binary-search the query, and walk 2N neighbors by longest matching prefix, matching Indyk-Motwani’s (1 + epsilon) bounds without building separate structures per radius r.

Why Dice and Overlap fail

Before constructing new hashes, Section 2 answers which similarity functions can ever be sketched under Pr[h(x) = h(y)] = sim(x, y). The indicator Delta_h(x, y) for h(x) != h(y) takes values in {0, 1} and always satisfies Delta_h(x, y) + Delta_h(y, z) >= Delta_h(x, z). Taking expectations proves 1 - sim(x, y) must satisfy the triangle inequality.

Testing three tiny sets, A = {a}, B = {b}, and C = {a, b}, immediately eliminates two IR staples. Under Dice’s coefficient (2|X cap Y| / (|X| + |Y|)), sim(A, C) = 2/3 and sim(C, B) = 2/3, while sim(A, B) = 0, giving 1/3 + 1/3 < 1. Under the Overlap coefficient (|X cap Y| / min(|X|, |Y|)), sim(A, C) = 1 and sim(C, B) = 1, giving 0 + 0 < 1. No distribution over hash functions can match either metric exactly.

Caveats and builder takeaway

  • Pure theory, zero empirical benchmarks: Charikar (2002) proves asymptotic bounds and collision identities without running precision, recall, or latency experiments on real text or image corpora. Those empirical tradeoffs arrived later when Google scaled 64-bit SimHash to 8 billion web pages at Hamming threshold k = 3 (~0.75 precision and recall).
  • Finite-bit variance and feature engineering: Because t-bit Hamming distance is a Monte Carlo estimate of theta / pi, pairs near a threshold swap places across random draws, and boilerplate HTML or navigation tokens with large weights will dominate the vector angle unless down-weighted or stripped first (unlike exact substring filters used when deduplicating LLM pretraining corpora).
  • Symmetric metric assumption: As Section 6 notes, asymmetric divergences like KL-divergence violate symmetry and triangle inequality and remain outside this framework.

Reach for Charikar’s hyperplane SimHash when you have weighted sparse features or dense embeddings and need ultra-compact fixed-bit fingerprints for bit-wise deduplication or Hamming-table lookup; use weighted MinHash (sum min / sum max) if your similarity is inherently L1 overlap rather than angular.