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.
Glossary
MinHash

What is MinHash?
A foundational technique for estimating set similarity at scale by compressing large datasets into compact, comparable signatures.
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.
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.
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.
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
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
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.
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
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
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.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
MinHash vs. Related Techniques
Comparing MinHash with other core techniques for estimating set similarity and detecting near-duplicates in high-dimensional data.
| Feature | MinHash | SimHash | Exact 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% |
Related Terms
Understanding MinHash requires familiarity with the core similarity measures, algorithmic optimizations, and data structures that make it efficient for large-scale deduplication and clustering.
Jaccard Similarity
The foundational set similarity metric that MinHash estimates. It measures the size of the intersection divided by the size of the union of two sets.
- Formula: J(A,B) = |A ∩ B| / |A ∪ B|
- Range: 0 (completely disjoint) to 1 (identical)
- MinHash Connection: The probability that two sets have the same minimum hash value equals their Jaccard similarity
- Use Case: Document near-duplicate detection, where each document is represented as a set of shingles (n-grams)
Locality-Sensitive Hashing (LSH)
An algorithmic framework that hashes similar items into the same buckets with high probability. MinHash is a specific LSH family for Jaccard similarity.
- Core Principle: Hash collisions are maximized for similar inputs and minimized for dissimilar ones
- Band Partitioning: MinHash signatures are divided into bands; if any band matches exactly between two documents, they become a candidate pair
- Amplification: Using multiple bands and rows per band allows precise tuning of the similarity threshold
- Efficiency: Reduces pairwise comparisons from O(n²) to sub-linear time
Shingling
The preprocessing step that converts a document into a set of contiguous subsequences (shingles) before MinHash is applied.
- k-Shingles: Typically k=5 to 9 for text documents, representing word or character n-grams
- Tokenization: Documents are normalized (lowercased, punctuation stripped) before shingle extraction
- Set Representation: Each unique shingle becomes an element in the set; ordering is discarded
- Example: The phrase "the cat sat" yields 3-shingles: {"the cat sat", "cat sat on", "sat on the", "on the mat"}
MinHash Signature
A compact, fixed-length vector of minimum hash values that serves as a dimensionality-reduced proxy for the original set.
- Construction: Apply N independent hash functions to each element; keep only the minimum hash value per function
- Length: Typically 100-500 hash functions, balancing accuracy against storage
- Estimation: The fraction of matching positions between two signatures approximates Jaccard similarity
- Storage Efficiency: A 128-signature MinHash using 32-bit integers requires only 512 bytes per document, regardless of original set size
SimHash
A related but distinct dimensionality reduction technique that produces a compact fingerprint where similar documents have a small Hamming distance.
- Mechanism: Uses a single hash function per feature, weighted by term frequency, and aggregates sign bits
- Key Difference: SimHash produces a single fixed-width fingerprint; MinHash produces a vector of minimum values
- Similarity Metric: Hamming distance (bit differences) vs. Jaccard similarity
- Best For: Near-duplicate detection where bitwise XOR comparison speed is critical, such as web crawling at Google's scale
Bloom Filter
A space-efficient probabilistic data structure often used alongside MinHash for rapid set membership testing with controllable false positive rates.
- Guarantee: No false negatives; if the filter says an element is absent, it definitely is
- Integration: Can pre-filter candidate pairs before expensive MinHash signature comparisons
- Trade-off: Memory usage vs. false positive probability, configured via bit array size and number of hash functions
- Example: A Bloom filter with 1% false positive rate requires ~9.6 bits per element

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us