IN THIS BREAKDOWN · 10 SECTIONS
You can read 24% of this breakdown.
The paper in one minute
Large language model datasets are scraped from the web, and the web repeats itself. Product pages differ only in place names and dates, the same news story is syndicated across sites with different headers, and boilerplate appears on thousands of pages. Datasets like C4 had removed exact duplicates of paragraphs or document prefixes, which misses most of this.
The paper introduces two tools. ExactSubstr concatenates the whole dataset and builds a suffix array, a sorted list of every suffix's starting position, in which repeated strings end up next to each other. Scanning adjacent entries finds every span of at least 50 tokens that occurs more than once, and all but one copy is removed. NearDup represents each document by its set of 5-grams, uses MinHash to find pairs likely to have high Jaccard similarity, confirms them with token edit similarity above 0.8, and groups matches into connected components, keeping one document per cluster.
Applied to C4, RealNews, LM1B and Wiki-40B, NearDup found near-duplicates in 3.04% of C4 training examples and 13.63% of RealNews, and ExactSubstr removed 7.18% of C4's tokens. Validation sets overlapped training: 4.6% of C4's validation examples and 14.35% of RealNews's had a near-duplicate in training. One C4 cluster held 250,933 documents.
The authors trained 1.5B-parameter models on original, NearDup and ExactSubstr versions of C4 for about two epochs. Deduplicated models matched or beat the original on held-out perplexity, scored worse on validation examples that had duplicates in training (evidence the original model had memorized them), and in 100,000 unprompted samples emitted about a tenth as much text copied verbatim from training.
Research notes: the problem, approach and results
copies of one 61-word sentence in C4's training set, plus 61 in validation (Section 1)
of C4 validation examples with a near-duplicate in the training set; 14.35% for RealNews (Table 2)
less copied text in unprompted generations after deduplication: 1.926% to 0.189% (Table 4, one epoch)
Web-scale training sets such as C4 and RealNews were deduplicated only naively, by exact hashes of documents or paragraphs. Templated pages, mirrored articles and boilerplate leave many near-duplicates and long repeated spans, which models memorize and which leak into validation sets.
Two scalable methods. ExactSubstr finds every repeated span of 50 or more tokens with a suffix array in linear time. NearDup finds near-duplicate documents with MinHash over 5-grams plus an edit-similarity check, and clusters them. Train 1.5B models on original and deduplicated C4 and compare.
Near-duplicates were 3% of C4 and 14% of RealNews; 4.6% of C4's validation set had a near-duplicate in training. Models trained on deduplicated data reached the same or better perplexity, and their unprompted output contained about ten times less text copied from training data.
Why it matters to an FDE
Deduplicate before fine-tuning or indexing. Customer corpora are full of repeats: email threads quoting each other, templated tickets, policy documents in several versions. Duplicates overweight some content in training and crowd retrieval results with copies of the same passage.
Decontaminate evaluation sets. If 4.6% of a public validation set overlaps training, a customer's evaluation built from the same document pool will too. Run near-duplicate detection between training data and test data before trusting a score.
Less duplication means less memorized output. Text repeated many times in training is what models reproduce verbatim. When customer data contains personal or confidential text, deduplication lowers the chance that a fine-tuned model echoes it, alongside proper PII removal.
Use both kinds of detector. Exact span matching catches repeated boilerplate inside otherwise different documents; near-duplicate matching catches documents that differ by a few words. They remove overlapping but different content: 77% of what NearDup removed from C4 also had a 50-token exact match.
Tune thresholds on your data. MinHash's candidate probability is a steep S-curve around a similarity threshold. Our calculation shows the paper's own printed C4 example pair is too dissimilar to be a direct candidate at its settings; it can only be joined through other pages in the same cluster.
Understand the mechanism. Try it on a real problem.
Unlock this breakdown and 290 more papers.
Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.
6 months · One payment · No auto-renewal
- ◇1 architecture diagram
- </>1 runnable code experiment
- ▦2 results tables
- ?5 interview questions with answers
- 03Key takeaways
Methods and parameters, how much was found, leakage, perplexity and memorization effects
Free account - 04How it works
Suffix arrays, MinHash parameters and clustering, training and memorization measurement
Premium - 05The numbers that matter
Removal rates, leakage, cluster sizes, perplexity, memorization, and inflated scores
Premium - 06Try it yourself
Score the paper's duplicate pairs, plot the MinHash S-curve, run a suffix array, check Table 4
Premium - 07Where it breaks
Threshold choices, what each detector misses, perplexity as the main measure, and slips
Premium - 08Using it on a deployment
Dedup for fine-tuning, retrieval and evals, with thresholds tuned on labeled pairs
Premium - 09Interview angles
Five questions this paper prepares you for, with answer hints
Premium - 10Read next
Where to go from here on this site
Premium
