Inferensys

Glossary

MinHash

MinHash is a technique for quickly estimating the Jaccard similarity between two sets by comparing the minimum hash values of their elements, used in PPRL for efficient private blocking.
Developer demonstrating multi-agent tool use, agent tool selection interface on laptop, casual tech demo moment.
ESTIMATING SET SIMILARITY

What is MinHash?

MinHash is a technique for rapidly estimating the Jaccard similarity between two sets by comparing the minimum hash values of their elements, enabling efficient private blocking in privacy-preserving record linkage.

MinHash is a locality-sensitive hashing (LSH) scheme that compresses large sets into compact signatures called sketches. By applying multiple hash functions to each element of a set and retaining only the minimum hash value for each function, MinHash generates a fixed-size fingerprint. The probability that two sets share an identical minimum hash value is exactly equal to their Jaccard similarity coefficient, making it a statistically sound estimator for set overlap without requiring element-by-element comparison.

In privacy-preserving record linkage (PPRL), MinHash enables efficient private blocking by grouping records with similar sketches into candidate blocks. This drastically reduces the quadratic computational complexity of pairwise comparison while operating on encoded or hashed identifiers, ensuring that plaintext similarity is never exposed. The technique is particularly effective for fuzzy matching of names and addresses where exact deterministic matching fails due to typographical variations.

CORE MECHANISMS

Key Features of MinHash

MinHash is a foundational technique for efficient similarity estimation and private blocking. These cards break down its core properties, algorithmic steps, and role in privacy-preserving record linkage.

01

Jaccard Similarity Estimation

MinHash provides an unbiased estimator of the Jaccard similarity coefficient between two sets. The probability that the minimum hash value of a random permutation is identical for two sets equals their Jaccard index.

  • Jaccard Formula: J(A, B) = |A ∩ B| / |A ∪ B|
  • MinHash Property: P[min(h(A)) = min(h(B))] = J(A, B)
  • By comparing hundreds of independent minimum hashes, the exact Jaccard similarity is approximated with high accuracy.
  • This transforms an O(n) set comparison into a fixed-size signature comparison.
02

Signature Matrix Construction

A MinHash signature compresses a large set into a compact, fixed-length vector of integers. The signature length k determines the trade-off between accuracy and storage.

  • Process: Apply k independent hash functions to each element of a set. For each hash function, keep only the minimum hash value observed.
  • Result: A set of any size is reduced to a signature vector of length k.
  • Example: A document shingled into 500 n-grams becomes a signature of just 100 integers.
  • Storage Efficiency: Comparing two signatures of length k requires O(k) time instead of O(|A| + |B|) for exact Jaccard.
03

Locality-Sensitive Hashing (LSH) for Blocking

MinHash signatures are used directly within Locality-Sensitive Hashing (LSH) to perform private blocking. LSH bands the signature vector to ensure similar sets hash to the same bucket with high probability.

  • Banding Technique: A signature of length k is divided into b bands of r rows each (where k = b * r).
  • Collision Probability: The probability that two sets with Jaccard similarity s become a candidate pair is 1 - (1 - s^r)^b.
  • Threshold Tuning: Adjusting b and r creates a sharp S-curve that approximates a similarity threshold, drastically reducing the number of pairwise comparisons.
  • This is the core mechanism enabling private blocking in PPRL without revealing plaintext similarity.
04

Efficient Hash Function Families

MinHash relies on a family of independent, uniformly distributed hash functions. Cryptographic hash functions like SHA-256 are too slow for generating hundreds of permutations, so faster alternatives are used.

  • Universal Hashing: Functions of the form h(x) = (ax + b) mod p where p is a large prime provide sufficient independence for MinHash.
  • One-Permutation Hashing: A memory-efficient variant that uses a single permutation and partitions the hash space, reducing computational cost for large k.
  • Densified One Permutation Hashing: Handles empty bins in one-permutation hashing by borrowing values from neighboring bins, maintaining unbiased estimation.
  • These optimizations make MinHash practical for datasets with billions of elements.
05

MinHash in Privacy-Preserving Record Linkage

In PPRL, MinHash is applied to encoded identifiers like Bloom filters or CLKs to enable private blocking. The technique reveals only the block assignment, not the raw similarity.

  • Workflow: 1) Encode identifiers into a privacy-preserving representation (e.g., hardened Bloom filter). 2) Generate MinHash signatures from the encoded bit-vectors. 3) Apply LSH banding to assign records to blocks.
  • Privacy Guarantee: The blocking process operates on already-encoded data, so even if an adversary observes the blocks, they learn only that certain encoded records are likely similar.
  • Efficiency Gain: Reduces the quadratic comparison space of all-pairs linkage to linear or near-linear complexity by comparing only records within the same LSH bucket.
  • This makes PPRL scalable to national-scale health data linkage projects.
06

Shingling for Document Similarity

Before MinHash can be applied to text, documents must be converted into sets of shingles (contiguous subsequences of tokens or characters).

  • Word Shingling: A document becomes a set of overlapping word n-grams (e.g., 'the quick brown' for 3-word shingles).
  • Character Shingling: More robust to spelling variations; uses character-level n-grams (e.g., 4-grams).
  • Hashing Shingles: Large shingle sets are often compacted by hashing each shingle to a 32-bit or 64-bit integer to reduce memory.
  • Example: The phrase 'privacy preserving record linkage' yields 3-word shingles: {'privacy preserving record', 'preserving record linkage'}.
  • Shingling is the critical preprocessing step that bridges raw text and MinHash-based similarity estimation.
MINHASH DEEP DIVE

Frequently Asked Questions

Clear, technical answers to the most common questions about the MinHash algorithm and its critical role in efficient, privacy-preserving record linkage.

MinHash is a locality-sensitive hashing (LSH) technique for quickly estimating the Jaccard similarity between two sets. It works by applying multiple, independent hash functions to the elements of a set and, for each hash function, recording only the minimum hash value produced. This collection of minimum values forms a compact digital signature of the set. The core insight is that the probability that two sets share the same minimum hash value for a given hash function is exactly equal to their Jaccard index. By comparing the fraction of matching positions in two MinHash signatures, you can estimate the true Jaccard similarity without comparing the original, potentially massive sets element-by-element. This provides a massive computational speedup, reducing the comparison cost from O(n) for the original sets to O(k) for the fixed-length signatures, where k is the number of hash functions used.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.