What is training data deduplication?
Training data deduplication is the removal of exact or near-duplicate examples and long repetitive substrings from a training dataset before training. Existing language modelling datasets contain many such repetitions.
Related to data contamination but distinct, deduplication first cleans repetition within the training set. The same methods also find overlap between training and validation sets; reducing it makes evaluation more accurate.
- Topic
- Infrastructure and runtime
- Also known as
- Data deduplication, dedup
- Origin
- 2021 preprint, 2022 ACL (for language model training data)
How training data deduplication works
- Exact string matching across all example pairs is the simplest technique but is insufficient alone.
- A suffix array finds long substrings occurring verbatim in more than one example; one study used 50 tokens as the minimum match.
- Approximate methods such as MinHash estimate n-gram similarity and remove near-duplicate documents entirely.
- Semantic deduplication uses embeddings from pre-trained models to remove examples similar in meaning but not identical.
In more detail
Semantic deduplication
A 2023 study proposed a method that uses embeddings from pre-trained models to find data pairs that are semantically similar but not exactly identical. On a subset of a web-scale dataset it removed 50% of the data with minimal performance loss, effectively halving training time, while out-of-distribution performance increased. It also improved over prior approaches for language models trained on a partially curated text dataset.
Commonly confused terms
| Term | How it differs |
|---|---|
| AI memorisation | Memorisation is a model reproducing sequences from its training data verbatim. Deduplication is a data preparation step that reduces this risk: the fewer times a sequence appears in the training data, the less often the model regenerates it. |
Why training data deduplication matters for on-premises AI
A 2022 study found that over 1% of unprompted output from language models trained on common datasets is copied verbatim from training data; deduplication cut memorised output tenfold and reached the same or better accuracy in fewer training steps. Another 2022 study found that sequences seen 10 times in training data were on average generated about 1000 times more often than those seen once; deduplicated models were considerably more secure against privacy attacks that exploit memorisation.
Before fine-tuning an in-house model on customer correspondence, a bank deduplicates template emails and signature blocks and checks that the evaluation set does not overlap the training data.
Common questions
Does deduplication hurt performance?
In the 2022 study models trained on deduplicated data reached the same or better accuracy in fewer training steps. A study of semantic deduplication removed half of a web-scale dataset with minimal performance loss, effectively halving training time.
Is exact matching enough?
No. Web-scale datasets are often only searched for exact duplicates, which can leave much redundancy. Approximate and semantic methods handle near-duplicate and meaning-level repetition.
Related terms
Sources
- Deduplicating Training Data Makes Language Models Better, ACL, 2022
- Deduplicating Training Data Mitigates Privacy Risks in Language Models, ICML, 2022
- SemDeDup: Data-efficient learning at web-scale through semantic deduplication, arXiv, 2023
In the glossary: Glossary, R to Z