Deduplicating web-scraped training corpora cuts unprompted verbatim memorization by roughly 10x while reaching equal or better validation perplexity in fewer training steps. Auditing C4, RealNews, LM1B, and Wiki-40B, Katherine Lee, Daphne Ippolito, Nicholas Carlini, and colleagues show that prior URL and exact-hash filters still miss massive boilerplate templates and train-validation leaks, including a single 61-word sentence repeated 61,036 times in C4.

Even though a 1.5B-parameter model is tiny compared with 350GB of C4 text, over 1% of tokens generated with no prompt by a standard model are copied verbatim from training data, rising past 5% in existing public models like GPT-Neo 1.3B on The Pile. The paper introduces two linear-time, CPU-only deduplication tools (ExactSubstr and NearDup) to eliminate both copied spans and near-identical pages.

  • 10x drop in unprompted copying: across 100k unprompted 512-token samples from 1.5B decoder-only models (top-k = 50), memorized 50-token training spans drop from 1.93% on C4-Original (epoch 1) to 0.19% (NearDup) and 0.14% (ExactSubstr).
  • 40%+ prompted recall collapses: given 32-token prompts from duplicated C4 examples, the baseline reproduces ground-truth continuations 35.88% of the time (over 40% under edit-similarity matching), falling to 3.34% (NearDup) and 5.71% (ExactSubstr).
  • Hidden train-valid leakage: NearDup flags 4.60% of C4 validation docs, 14.35% of RealNews validation, and 4.92% of LM1B validation as having training-set matches; Transformer-XL scores 10.11 perplexity on leaked LM1B validation items versus 23.58 on unique ones.
  • Smaller, faster runs with no accuracy tax: NearDup trims C4 training time from 131 hours to 126 hours (5.86 to 5.63 MWh), while ExactSubstr removes 7.18% of C4 tokens and cuts Wiki-40B perplexity by nearly 3 points.
Memorized 50-token emission rates on 1.5B C4 models (lower is better)
Unprompted generation (100k samples, Ep. 1)
C4-Original1.93%
C4-NearDup (MinHash)0.19%
C4-ExactSubstr (Suffix array)0.14%
Duplicate train prompts (Ep. 1)
C4-Original35.88%
C4-NearDup (MinHash)3.34%
C4-ExactSubstr (Suffix array)5.71%

Share of generated tokens matching a 50-token training substring. Source: Lee et al. (2022), Table 4 and Appendix Table 12.

Why document hashes miss web-scale repetition

C4 already hashed individual paragraphs to drop collisions, and RealNews already hashed each article’s first 100 characters into a Bloom filter. Yet both still leak heavily for two structural reasons: templated pages swap just a few entity tokens (city pairs on travel sites, store names in parking ads, or AP wire headers), and unique articles frequently embed identical multi-sentence disclaimers or ad blocks.

To catch both failure modes without quadratic pairwise scans, the authors pair two complementary algorithms:

  • NearDup (Document-level MinHash): computes 9,000 MinHash signatures over 5-grams (b = 20 hashes across r = 450 buckets), verifies exact Jaccard and token edit similarity above 0.8, and clusters connected components to drop all but one document per group. In C4, NearDup finds 280 clusters exceeding 5,000 pages each, topped by a single 250,933-document cluster.
  • ExactSubstr (Span-level Suffix Array): concatenates the entire BPE-tokenized corpus into one byte stream, builds a disk-streamed Rust suffix array (8 bytes per token; 1.5TB for 350GB C4, built in under 12 wall-clock hours on a 96-core VM), and scans adjacent entries for shared prefixes of at least 50 BPE tokens (twice the 25-token manual false-positive threshold). Unlike NearDup, it deletes only repeated spans inside otherwise unique pages, removing 7.18% of C4 tokens and 19.4% of RealNews tokens, though only 0.76% of LM1B because 90% of LM1B sentences are shorter than 50 tokens.
Duplicate rates and validation leakage across four standard NLP corpora
DatasetNearDup train examplesExactSubstr train tokensValid examples in train
C4 (177.3B tokens)3.04%7.18%4.60%
RealNews (24.7B tokens)13.63%19.40%14.35%
LM1B (1.0B tokens)4.86%0.76%4.92%
Wiki-40B (2.25B tokens)0.39%2.76%0.72%

Source: Lee et al. (2022), Tables 2, 3, and 13.

Caveats and builder takeaway

Four caveats bound how far deduplication carries. First, the authors measure validation perplexity and verbatim copying, not downstream QA or reasoning tasks (where later studies like data-constrained scaling found deduplicating clean C4 yielded mixed downstream shifts). Second, deleting exact 50-token spans can strip repeated copyright notices, citations, or legal attribution while keeping the underlying text, creating attribution gaps. Third, deduplication does not make training data private: secrets that appear once, like personal phone numbers or medical notes, remain memorizable. Fourth, suffix arrays require holding the raw corpus in RAM plus 8x disk overhead, which pushed modern pipelines like DCLM toward sharded Bloom filters or soft reweighting.

For pretraining and eval teams today, combine document-level near-duplicate hashing with substring checks, and always deduplicate evaluation splits against training data first so model selection rewards generalization rather than memorization.