Data deduplication

Data deduplication is removing exact and near-duplicate copies of text from a training dataset, so a model does not see the same material over and over.

Text scraped from the web is full of repetition: copied articles, mirrored pages, boilerplate legal notices and templates that appear on thousands of sites. A 2021 study by Katherine Lee and colleagues found a single 61-word English sentence repeated more than 60,000 times in C4, a widely used training dataset. Deduplication finds these repeats and removes them before training.

Exact duplicates are easy to catch by comparing documents or long runs of identical text. Near-duplicates, such as the same article with a different header, need fuzzier methods. A standard tool is MinHash, published by Andrei Broder in 1997 and first used at the AltaVista search engine to remove duplicate web pages from results. It estimates how much two documents overlap by comparing small hashed fingerprints rather than the full text.

The payoff is measurable. Lee's team found that over 1% of the unprompted output of models trained on undeduplicated datasets was copied word for word from the training data. Their deduplicated models emitted memorised text ten times less often and needed fewer training steps to reach the same or better accuracy. They also found that overlap between training and test data affected more than 4% of the validation sets of standard datasets, which means scores on those sets partly measured recall rather than skill.

Deduplication also reduces privacy risk. Nikhil Kandpal, Eric Wallace and Colin Raffel showed in 2022 that a sequence appearing ten times in the training data is generated about 1,000 times more often than one appearing once, and that deduplicated models are considerably more resistant to attacks that try to extract training data. It does not eliminate memorisation: earlier work had extracted text that appeared in only one document. In practice, deduplication is now a standard step in preparing training data, and a technical report that skips it invites questions about both memorisation and inflated benchmark scores.

Common questions

Why deduplicate training data?

Repeated text wastes training compute, makes models more likely to reproduce passages word for word, raises privacy risks and can leak test questions into training. Research in 2021 found deduplicated models reached the same or better accuracy in fewer steps and emitted memorised text ten times less often.

What is the difference between exact and near-duplicate removal?

Exact deduplication removes identical documents or identical long passages. Near-duplicate removal also catches copies that differ slightly, such as the same article with different headers, usually by estimating overlap with techniques like MinHash.

Does deduplication stop a model memorising its training data?

It reduces memorisation sharply but does not end it. Text repeated many times is memorised far more often, so removing repeats helps, but researchers have extracted passages that appeared only once in a model's training data.

How does deduplication affect benchmark results?

Removing overlap between training data and test sets makes evaluation more honest. Without it, a model may score well on questions it has effectively seen before, which overstates its real ability.

Finding more

Search for "training data deduplication", "near-duplicate detection MinHash" or "deduplication memorization language models" to see how and why datasets are cleaned. The most reliable sources are research papers on arXiv that measure the effect of deduplication, documentation released with open datasets describing their processing steps, and model technical reports. Look for reports that say which method was used and at what similarity threshold, since "deduplicated" can mean very different levels of cleaning.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.