Prompts Forms Resume Reports ★ Saved ★ Saved★ + Submit a tool
Techniques

Data Deduplication

About 2566 characters Updated Nov 30, 2026 31 views AI wiki

Data deduplication identifies and removes duplicate or highly similar samples, covering exact duplicates and fuzzy near-duplicates. With pretraining corpora in the trillions of tokens, it has gone from a nice-to-have to a step that must be done right.

Core Principles

Exact deduplication hashes normalized documents (unified whitespace, no punctuation, lowercase) with SHA-256 or MD5 as a unique key. It removes reposts, mirrors and full copies in O(N) time.

Much duplication is near duplication: the same article reposted with navigation, ads and different punctuation hashes completely differently. This needs fuzzy deduplication, in two mainstream forms:

MinHash + LSH: documents become n-gram sets, k hash functions give a MinHash signature that approximates Jaccard similarity, and locality-sensitive hashing buckets signatures so exact comparison happens only within likely buckets, reducing O(N^2) to near linear. It is widely used in C4 and The Pile.

SimHash maps a document to a fixed-length fingerprint and judges similarity by Hamming distance (usually a threshold of 3); Google used it early for web deduplication.

Sentence or paragraph deduplication needs semantics: encode with Sentence-BERT or SimCSE, retrieve neighbors by cosine or Faiss, cluster samples above a threshold (such as 0.9) and keep one per cluster.

Key Points

Granularity decides the effect: document-level dedup cannot remove templates reused across articles; paragraph and sentence dedup (such as SemDeDup) compresses redundancy further and trains better models per unit compute.

Run multiple rounds: exact hashing for coarse filtering, MinHash for document-level fuzzy dedup, then cross-set dedup between training and evaluation.

Train-test dedup is a red line: an evaluation question in the training corpus inflates scores, called benchmark contamination or data leakage, a main threat to evaluation credibility, usually checked with 13-gram overlap.

Balance strength: too aggressive dedup deletes genuine but structurally similar samples and loses long-tail content.

The trend is for dedup to move from post-hoc cleaning to a built-in pipeline stage, chained with quality scoring and toxicity filtering into a data recipe.

Common Misconceptions

Misconception one: exact dedup suffices, ignoring the larger share of near duplicates, often an order of magnitude more. Misconception two: thresholds by guesswork, when 0.8 versus 0.5 on Jaccard can change retention by an order of magnitude; verify on samples first. Misconception three: duplicates are harmless; they waste compute, cause overfitting, amplify bias and toxicity and raise memorization risk. Misconception four: only document-level dedup, missing paragraph-level template reuse, the hardest for document methods to catch.

Application Scenarios

Pretraining corpus cleaning, train-test contamination detection, crawl ingestion, e-commerce title and image normalization, master data management (MDM), and profile merging and entity alignment.