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 concatenatingtbits reduces cosine-angle estimation to bit-count Hamming distance. - Compact
O(log^2 n)randomness: Rather than storingdindependent Gaussian floats per hash overnvectors, pseudorandom generators compress the hyperplane family to size2^{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 exactLSHexists for either. O(log n log log n)Earth Mover’s Distance: Applying Kleinberg-Tardos rounding over tree metrics estimatesEMD(P, Q)withinO(log n log log n)distortion (tightening toO(1)on hierarchies) and generalizes MinHash to continuous weights.
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:
- Draw a
d-dimensional vectorrwith each coordinate sampled independently from a standard normal distributionN(0, 1). - Hash any document vector
uto a single bith_r(u) = 1ifr . u >= 0, and0otherwise. - Concatenate
tindependent hyperplane bits to form at-bit fingerprint; the fraction of disagreeing bits estimatestheta(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.75precision and recall). - Finite-bit variance and feature engineering: Because
t-bit Hamming distance is a Monte Carlo estimate oftheta / 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.

