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,000 steps 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.98 points on LAMBADA standard, +3.15 on SQuADv2, +2.65 on 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/22 and 19/22 Pile subsets and all 7/7 SlimPajama test subsets (GitHub perplexity drops from 28.02 to 20.98 on Falcon RW).
  • Negligible CPU cost: training the 4-gram KenLM scorer and scoring 40B tokens takes 7 wall-clock hours on 4 CPU cores (28 CPU core-hours) compared to over 930 V100 GPU hours per pretraining run.
Downstream accuracy on RedPajama CommonCrawl (1.3B model, 40B tokens)
Direct baseline (random sampling)36.78%
LAMBADA openai 46.07% | SQuADv2 11.51% | ARC-easy 57.24%
HardDedup (SlimPajama MinHashLSH)37.38% (+0.60)
Beats baseline on 9/12 tasks; drops on LAMBADA openai (-2.43), Social IQa (-0.10), ARC-c (-0.08)
SoftDedup (20 quantiles, 10x weight ratio)38.55% (+1.77)
Beats baseline on 12/12 tasks: LAMBADA openai 48.52% | SQuADv2 14.66% | ARC-easy 59.89%

Metric: 12-task few-shot accuracy average (higher is better, bars scaled to 50% max). Source: He et al. (2024), Table 1.

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:

  1. Score local predictability: tokenize the corpus with the target model’s tokenizer, fit a 4-gram KenLM language model with Kneser-Ney smoothing (5 hours on 4 CPUs for 40B tokens), and compute each document’s commonness p(x) as the geometric mean of its 4-gram probabilities ((prod P(w_i | w_{i-3..i-1}))^(1/N)), removing document-length bias.
  2. Quantile bucketing: sort documents by p(x) and split them into K equal-count buckets (K = 20 by default) so a web-scale data loader does not need per-document weights.
  3. Inverse temperature sampling: assign bucket k weight W_k = C * (1 / p_k)^T, normalized across buckets, tuning T so the rarest bucket is sampled 2x, 5x, or 10x more often than the most common bucket (10x by default).
SoftDedup CPU preprocessing and quantile reweighting pipeline
1. 4-gram KenLM

Train smoothed 4-gram model using the LLM tokenizer (5h on 4 CPUs for 40B tokens).

2. Commonness p(x)

Score geometric-mean token probability per document (2h on 4 CPUs); length-invariant.

3. K=20 quantile buckets

Sort by p(x) and sample buckets via (1/p_k)^T (10x max-to-min weight ratio).

Source: He et al. (2024), Sections 3.3, 3.4, and 5.6.

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.