How do you detect and handle duplicates in a dataset, from exact matching to NVIDIA NeMo Curator’s GPU-accelerated fuzzy deduplication?
Answer
Duplicate detection has two levels: exact duplicates (identical rows or records) and near-duplicates (small edits, reformatting, or paraphrases). Exact duplicates are found by hashing: compute a hash (MD5, SHA) of each row or document, group by hash, and flag collisions in O(n) time. Near-duplicates are harder and require similarity-based methods: MinHash converts each document into a set of shingles and estimates the Jaccard similarity via shared min-hash signatures, then Locality-Sensitive Hashing (LSH) buckets signatures so that similar documents collide in the same bucket, reducing the O(n^2) all-pairs comparison to near-linear. NVIDIA NeMo Curator provides GPU-accelerated fuzzy deduplication using MinHash and LSH, and the research framework SEDD pushes this further by replacing data shuffling with streaming, reaching 158x over CPU-based SlimPajama tooling and 7.8x over NeMo Curator while deduplicating 1.2 trillion tokens in 3 hours on a 32-GPU cluster. LSHBloom replaced the expensive LSH index with Bloom filters, achieving 12x speedup and 18x less disk space at the same deduplication quality.
(1) Exact Duplicates: hash each row or document, group by hash, flag collisions; O(n) time, zero false positives; handles identical rows, copy-paste records, and repeated data entries.
(2) Near-Duplicates (MinHash + LSH): shingle each document, compute MinHash signatures (k random permutations), bucket via LSH so similar documents collide, then verify candidate pairs by exact Jaccard similarity; reduces O(n^2) all-pairs to near-linear.
(3) Production Scale: NVIDIA NeMo Curator supplies the GPU MinHash LSH baseline, and SEDD deduplicates 1.2 trillion tokens in 3 hours on a 32-GPU cluster (158x over CPU tooling, 7.8x over NeMo Curator) while keeping Jaccard similarity above 0.95; LSHBloom replaces the LSH index with Bloom filters for 12x speedup and 18x less disk space at internet scale.

Figure 1: The two-tier deduplication pipeline: exact duplicates are found by hashing and grouping (O(n), zero false positives), while near-duplicates use shingling, MinHash signatures, and LSH bucketing to reduce the O(n^2) all-pairs comparison to near-linear.
Duplicates matter because they inflate evaluation metrics and bias the model. If the same example appears in both training and test sets, the model memorizes it during training and gets it right at test time, producing an accuracy estimate that will not hold on truly unseen data. Even within the training set alone, duplicates cause the model to over-weight those examples, effectively up-sampling them. The handling strategy depends on the duplicate type: exact duplicates within one split should be removed; cross-split duplicates (train-test contamination) require deduplication before the split; near-duplicates in LLM training corpora are removed at scale to prevent memorization and recitation, which is why NVIDIA NeMo Curator and HuggingFace’s datasets deduplication tools exist. For structured tabular data, pandas’ drop_duplicates() handles exact duplicates, and fuzzy matching libraries (recordlinkage, dedupe) handle near-duplicates via string similarity. For text corpora at scale, MinHash LSH is the standard, and GPU acceleration made it practical for trillion-token pretraining datasets.
Mathematical Formulation:
Where:
is the Jaccard similarity between two sets
and
(e.g., the shingle sets of two documents); near-duplicates have Jaccard similarity above a threshold (typically 0.8-0.9).
is a random permutation of the universe; the MinHash property states that the probability of two sets sharing the same minimum hash value equals their Jaccard similarity, so averaging over
permutations gives an unbiased estimate.
is the MinHash signature of document
: a vector of
minimum hash values. LSH buckets signatures so that similar signatures (and thus similar documents) collide with high probability, reducing candidate pairs from O(n^2) to near-linear.
| Method | Duplicate Type | Complexity | Scale |
|---|---|---|---|
| Hashing (exact) | Exact duplicates | O(n) | Any (pandas drop_duplicates) |
| MinHash + LSH | Near-duplicates (text) | O(nk) + candidate verification | Millions of documents |
| GPU MinHash LSH (NeMo Curator, SEDD) | Near-duplicates (GPU) | GPU-parallelized MinHash LSH | 1.2T tokens in 3 hours (32 GPUs, SEDD) |
| LSHBloom | Near-duplicates (Bloom) | O(nk), 12x faster than LSH | Internet-scale (billions of docs) |













