Inferensys

Glossary

MinHash

A locality-sensitive hashing scheme for estimating the Jaccard similarity between two sets by comparing the minimum hash values of their elements under multiple hash functions.
Developer reviewing multi-agent chat interface on laptop, agent conversation logs visible, casual coding session at WeWork desk.
LOCALITY-SENSITIVE HASHING

What is MinHash?

A foundational technique for estimating set similarity at scale by compressing large datasets into compact, comparable signatures.

MinHash is a locality-sensitive hashing (LSH) scheme that efficiently estimates the Jaccard similarity between two sets by comparing the minimum hash values of their elements under multiple independent hash functions. It enables rapid near-duplicate detection and clustering without requiring pairwise comparison of all original elements.

The algorithm works by applying k different hash functions to each element in a set and recording only the minimum hash value produced by each function. The resulting MinHash signature is a compact vector of these k minima. The probability that two sets share the same minimum hash for a given function equals their Jaccard index, making the signature a statistically sound proxy for true set similarity.

ESTIMATING SET SIMILARITY

Key Features of MinHash

MinHash is a locality-sensitive hashing (LSH) scheme that efficiently estimates the Jaccard similarity between two sets by comparing their minimum hash values under multiple independent hash functions.

01

Jaccard Similarity Estimation

MinHash provides an unbiased estimator of the Jaccard index between two sets. The probability that the minimum hash value of set A equals the minimum hash value of set B is exactly equal to their Jaccard similarity. By using k independent hash functions, the fraction of matching minimum values converges to the true Jaccard coefficient, with the estimation error decreasing proportionally to 1/√k.

1/√k
Estimation Error Rate
02

MinHash Signature Generation

A compact signature matrix is constructed by applying multiple hash functions to each element of a set and recording only the minimum hash value per function. Key properties:

  • Dimensionality reduction: A set of arbitrary size is compressed into a fixed-length vector of k integers
  • Linearity: The signature size is independent of the original set cardinality
  • Streaming compatibility: Signatures can be updated incrementally as new elements arrive
03

Band Partitioning for LSH

To efficiently find similar pairs without comparing all signatures, the signature vector is partitioned into b bands of r rows each. Two sets become a candidate pair if they share identical values in at least one band. This creates a tunable trade-off:

  • Larger b (more bands): Increases recall, finds more candidate pairs
  • Larger r (more rows per band): Increases precision, reduces false positives
  • The probability of becoming a candidate pair follows an S-curve that steepens with more bands
04

Permutation-Based Implementation

The classic MinHash algorithm uses random permutations of the element universe. For each permutation, the element with the smallest permuted index becomes the signature value. In practice, universal hash functions of the form h(x) = (ax + b) mod p approximate random permutations efficiently without materializing the full permutation array, enabling processing of massive datasets with minimal memory overhead.

05

Duplicate & Near-Duplicate Detection

MinHash is the foundational algorithm behind large-scale document deduplication and plagiarism detection systems. By representing documents as sets of n-grams or shingles, MinHash signatures enable:

  • Web crawl deduplication: Removing identical pages from search indexes
  • Code clone detection: Identifying similar source code fragments
  • Content moderation: Finding near-duplicate user-generated content across platforms
06

MinHash vs. SimHash

While both are LSH techniques for similarity detection, they serve different distance metrics:

  • MinHash: Estimates Jaccard similarity (set overlap), ideal for document shingle comparison
  • SimHash: Produces a fixed-width binary fingerprint where Hamming distance correlates with cosine similarity, better for near-duplicate detection with bitwise operations
  • MinHash signatures are typically larger but provide a direct probabilistic guarantee on Jaccard estimation
MINHASH EXPLAINED

Frequently Asked Questions

Clear, technically precise answers to the most common questions about the MinHash algorithm, its inner workings, and its role in modern digital fingerprinting and deduplication systems.

MinHash is a locality-sensitive hashing (LSH) scheme that efficiently estimates the Jaccard similarity between two sets by comparing the minimum hash values of their elements under multiple independent hash functions.

Instead of comparing every element in two massive sets—a computationally expensive O(n) operation—MinHash creates a compact, fixed-size signature (or sketch) for each set. It works by applying a series of hash functions to each element in a set and recording only the minimum hash value produced by each function. The resulting vector of minimum values is the MinHash signature. The probability that two sets produce the same minimum hash value for a given hash function is exactly equal to their Jaccard index. By using 100-200 hash functions, the Jaccard similarity can be estimated with high accuracy by simply calculating the fraction of matching minimum values between the two signatures.

SIMILARITY ESTIMATION COMPARISON

MinHash vs. Related Techniques

Comparing MinHash with other core techniques for estimating set similarity and detecting near-duplicates in high-dimensional data.

FeatureMinHashSimHashExact Jaccard

Core Metric

Jaccard Similarity

Cosine Similarity

Jaccard Similarity

Output Type

Integer array (signature)

Fixed-size bit string

Floating-point scalar

Query Speed

Sub-linear (LSH)

Sub-linear (Hamming)

Linear O(n)

Memory per Item

Low (e.g., 100 integers)

Very Low (e.g., 64 bits)

High (full set)

Suitable for Sets

Suitable for Vectors

Probabilistic

Error Rate

Controllable via signature size

Controllable via bit length

0%

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.