Hard deduplication treats repetition as binary: pick one document from each MinHash cluster and delete the rest. In a 2024 Tencent AI Lab paper, Nan He and colleagues show that replacing deletion with SoftDedup (downweighting high-commonness documents via a 4-gram language model) matches baseline perplexity in 26% to 39% fewer training steps, even on web corpora that have already passed strict MinHashLSH filtering.
On RedPajama CommonCrawl at matched 40B-token compute, SoftDedup lifts average 12-task downstream accuracy from 36.78% to 38.55% (+1.77 points), outperforming both direct training and SlimPajama’s hard deduplication (37.38%, +0.60 points) while adding only 28 CPU core-hours of preprocessing overhead.
- 26% to 39% step reduction: 1.3B LLaMA-style models reach the 76k-step baseline perplexity in roughly 50k steps on RedPajama CommonCrawl and reach downstream baseline accuracy roughly
20,000steps sooner on SlimPajama and Falcon RefinedWeb. - 12 out of 12 tasks improved on RedPajama CC: SoftDedup beats the raw baseline on every evaluated task (
+3.98points on LAMBADA standard,+3.15on SQuADv2,+2.65on ARC-easy), whereas hard deduplication regresses on 3 of 12 tasks. - Additive over strict deduplication: applied on top of SlimPajama CC and Falcon RefinedWeb, SoftDedup still lowers perplexity on
17/22and19/22Pile subsets and all7/7SlimPajama test subsets (GitHubperplexity drops from28.02to20.98on Falcon RW). - Negligible CPU cost: training the 4-gram KenLM scorer and scoring
40Btokens takes7wall-clock hours on4CPU cores (28CPU core-hours) compared to over930V100 GPU hours per pretraining run.
How SoftDedup works
Standard deduplication pipelines like MinHashLSH cluster near-duplicate documents and keep one arbitrary member per cluster. That creates three blind spots: keeping one document discards minor unique edits inside its neighbors, a hard similarity threshold creates a sharp cliff on a continuous spectrum of overlap, and every surviving document receives identical sampling weight even when one contains rare technical text and another repeats generic web boilerplate.
SoftDedup keeps the entire corpus and adjusts sampling probabilities in three steps:
- Score local predictability: tokenize the corpus with the target model’s tokenizer, fit a
4-gram KenLM language model with Kneser-Ney smoothing (5hours on4CPUs for40Btokens), and compute each document’s commonnessp(x)as the geometric mean of its4-gram probabilities ((prod P(w_i | w_{i-3..i-1}))^(1/N)), removing document-length bias. - Quantile bucketing: sort documents by
p(x)and split them intoKequal-count buckets (K = 20by default) so a web-scale data loader does not need per-document weights. - Inverse temperature sampling: assign bucket
kweightW_k = C * (1 / p_k)^T, normalized across buckets, tuningTso the rarest bucket is sampled2x,5x, or10xmore often than the most common bucket (10xby default).
Key findings across three web corpora
The authors train 1.3B-parameter LLaMA-architecture models from scratch to 40B tokens (1024-token context, batch size 512, cosine decay 2e-4 to 2e-5) across three progressively cleaner CommonCrawl variants: RedPajama CC (CCNet paragraph dedup only), SlimPajama CC (MinHashLSH over RedPajama CC), and Falcon RefinedWeb (exact + MinHashLSH). Training documents with over 50 overlapping tokens against evaluation sets were stripped before training.
Even after MinHashLSH removes cluster duplicates, soft reweighting finds substantial leftover boilerplate and template repetition. On SlimPajama CC, SoftDedup raises SQuADv2 1-shot accuracy from 12.95% to 17.25% and ARC-easy 2-shot from 57.79% to 60.44%. On Falcon RefinedWeb, SQuADv2 jumps from 26.39% to 29.95% and SlimPajama GitHub test perplexity drops from 28.02 to 20.98.
Ablations on Falcon RefinedWeb clarify the two knobs. Increasing partition granularity (K = 10, 20, 50, 100) barely shifts held-out perplexity, yet downstream accuracy rises steadily with finer buckets up to K = 100. Increasing the weight disparity between rarest and commonest buckets (2x, 5x, 10x) monotonically lowers perplexity, with 10x winning overall.
Caveats and builder takeaway
Three constraints bound what the paper proves. First, all runs stop at 1.3B parameters and 40B tokens on single-source CommonCrawl data, leaving multi-epoch behavior (under data-constrained scaling) and multi-domain mixes (web plus code, math, and books, as in FineWeb) untested. Second, downweighting high-probability n-grams is domain-blind: clean encyclopedic or scientific phrasing can look predictable to a 4-gram model, and isolated benchmarks regressed slightly (NQ Open 4.18% to 3.85% on Falcon RW; PubMed Abstracts perplexity 8.85 to 8.99). Third, reweighting does not eliminate verbatim memorization or benchmark contamination, so exact substring filtering remains mandatory.
For pretraining pipelines, SoftDedup is best viewed as a cheap second stage after MinHashLSH rather than a replacement for it. At 28 CPU core-hours per 40B tokens, fitting a 4-gram KenLM scorer and sampling across 20 to 100 commonness quantiles is an inexpensive way to squeeze extra step efficiency out of already-deduplicated web crawls.


