MinHash › Summary

Michael BrenndoerferJanuary 10, 20262 min read
Language AI HandbookAll chapters
Part 20 of 67Data Curation
Chapter 143MinHash › Summary
Reading section 12 of 13 · Summary · 2 minSection 12 of 13 · 2 min

Book contents

Section 12 of 13 · 2 min read

MinHash › SummaryOne section · Sections in this chapter12 / 13 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

MinHash compresses each document into a compact signature that preserves Jaccard similarity: the probability that two signatures agree at any position equals the true Jaccard similarity of the underlying shingle sets. This probabilistic identity allows you to estimate document similarity without comparing the full texts, reducing per-pair comparison cost from the document size to the signature size.

Key takeaways from this chapter:

  • Jaccard similarity measures set overlap as the ratio of intersection to union, ranging from 0 to 1. It is a natural similarity measure for shingled documents and is robust to length differences between documents.
  • Shingling converts documents into sets of overlapping substrings. Character-level 5-grams are the standard choice for LLM training data deduplication because they are robust to minor paraphrasing and synonym substitution.
  • The MinHash identity states that for a random permutation π\pi, the probability that the minimum elements of two sets agree is exactly the Jaccard similarity: P(min⁡π(A)=min⁡π(B))=J(A,B)P(\min_\pi(A) = \min_\pi(B)) = J(A, B).
  • MinHash signatures of length kk are computed by applying kk independent hash functions and taking the minimum hash value per function. The fraction of matching positions estimates Jaccard similarity with standard deviation J(1−J)/k\sqrt{J(1-J)/k}.
  • LSH banding divides the signature into bb bands of rr rows, bucketing documents by their band values. Documents sharing any bucket become candidate pairs with probability 1−(1−sr)b1 - (1 - s^r)^b, creating a tunable S-curve threshold at approximately t≈(1/b)1/rt \approx (1/b)^{1/r}.
  • Practical tradeoffs include shingle size (character vs. word level), number of hash functions (kk), and LSH threshold (bb, rr). These parameters balance precision, recall, and computational cost for the specific deduplication task.
  • At LLM training scale, MinHash LSH is applied to billions of documents in distributed pipelines, reducing near-duplicate content that would otherwise distort the learned distribution, inflate benchmark scores, and increase memorization of training text.

The next chapter explores quality filtering techniques that complement deduplication by removing documents that are syntactically valid but semantically poor, completing the picture of how raw web crawl data is transformed into a high-quality training corpus.