What is data contamination (benchmark contamination) in AI?
By Plety. Updated
Data contamination in AI, also called benchmark contamination, is when examples used to test a model were also in the data it was trained on, so its score partly measures memory rather than skill. Research since 2020 shows it is hard to avoid in models trained on web data. Private records that were never published, and are kept away from training, give a cleaner test.
What is data contamination (benchmark contamination) in AI?
Data contamination is an overlap between a model's training data and the data later used to evaluate it. When a benchmark's questions, and often its answers, sit inside the training corpus, a high score no longer shows that the model can solve new problems. Why test data is kept apart from training is explained at https://plety.net/about/for-buyers/what-is-an-ai-evaluation-dataset. This page covers how contamination happens, how researchers find it and how it is prevented.
Well-resourced labs have struggled with it. In the GPT-3 paper, posted on arXiv on 28 May 2020, Tom Brown and colleagues at OpenAI wrote that they tried to remove any overlap between their training data and the benchmarks they studied, but a bug resulted in only partial removal of the detected overlaps, and the cost of training made retraining unfeasible. They built clean versions of each benchmark instead, removing examples with a 13-gram overlap with the pretraining set.
What forms does data contamination take?
Data contamination takes at least four forms, from test sets copied into web data to test questions sent to a model through its API. The table sets out each form with published evidence.
| Form | How it happens | Published evidence |
|---|---|---|
| Test set in web data | Benchmark examples are posted online and collected in the web crawls used for training | The GPT-3 authors (May 2020) said the large amount of Common Crawl in their data created increased potential for contamination and memorisation |
| Leak through use | Researchers send test data to a closed model's API, and the provider may use it in later training | Simone Balloccu and colleagues (EACL, March 2024) reviewed 255 papers and reported that GPT-3.5 and GPT-4 were exposed to about 4.7 million samples from 263 benchmarks |
| Memorised instances | A model has seen specific examples and can reproduce them when prompted | Shahriar Golchin and Mihai Surdeanu (arXiv, August 2023) reported that GPT-4 was contaminated with the AG News, WNLI and XSum datasets |
| Task contamination | The model has seen examples of the task, not only the test set, before it is tested | Changmao Li and Jeffrey Flanigan (AAAI 2024) found models did surprisingly better on datasets released before their training data was created than on datasets released after |
Does contamination always inflate scores?
No, contamination does not always inflate scores, but it can, and it is hard to know in advance by how much. Inbal Magar and Roy Schwartz, at ACL in May 2022, pretrained BERT models on Wikipedia mixed with labelled downstream data and compared results on seen and unseen examples. They separated memorisation, where a model has seen the data, from exploitation, where it scores better because of it, and found exploitation in some cases but not others, depending on factors such as how often the data was duplicated and the size of the model.
The GPT-3 authors reached a similar view for very large models. They expected contamination to be frequent but its effects not to be as large as feared, because even their largest model did not overfit its training set by a significant amount. A buyer of evaluation data cannot rely on that, because contamination of unknown size makes scores hard to compare between models trained on different data.
How is data contamination detected?
Data contamination is detected in three main ways: by searching training data for overlaps, by prompting a model to finish test examples, and by comparing results on data released before and after a model's training data was gathered. Overlap search needs access to the training data, as with the 13-gram check in the GPT-3 paper. Prompting works on closed models. Golchin and Surdeanu give the model the dataset name, the split and the first part of an example, and treat a close reproduction of the rest as a sign of contamination. They reported accuracy between 92% and 100% against human expert judgements across seven datasets.
Date comparisons need no access to the model's data. Li and Flanigan compared performance on datasets released before and after the creation date of each model's training data, and the gap pointed to contamination. Alon Jacovi and colleagues (EMNLP, December 2023) argue that contamination is hard to detect, especially for closed models, which is why they focus on preventing it.
How do benchmark makers prevent contamination?
Benchmark makers prevent contamination by marking, hiding or regularly replacing their test data. Marking: the BIG-bench repository on GitHub says its task files contain a canary string, which should not be edited, to prevent benchmark tasks from leaking into web-scraped training data. Hiding: Jacovi and colleagues propose publishing test data encrypted with a public key and licensed to disallow derivative distribution, asking closed API providers for training exclusion controls and refusing to evaluate models without them, and avoiding data that appears online next to its solution.
Replacing: LiveBench, posted on arXiv on 27 June 2024 by Colin White and colleagues, adds and updates questions every month from recent maths competitions, arXiv papers, news articles and datasets. It scores answers automatically against objective ground-truth values, without a model acting as judge, and its abstract reported that top models scored below 70% accuracy.
Why do unseen private records help?
Unseen private records help because data that has never been published cannot have been collected in a web crawl, so it gives a cleaner test than a public benchmark. A company's support tickets, internal documents or workflow logs fit that description if they never left its systems. They are also dated, so a buyer can choose records created after a model's training data was gathered, the same logic Li and Flanigan used to expose task contamination.
Private records stay unseen only if the licence keeps them that way. The Balloccu study shows that test data can leak simply by being sent to a closed model, so an evaluation licence can limit use to evaluation, allow records to be sent only to models under terms that exclude them from training, ban publication of records or extracts, and require deletion at the end. A buyer that builds a curated reference set from such records is building a golden dataset, explained at https://plety.net/about/for-buyers/what-is-a-golden-dataset.
Questions
- Is data contamination the same as data leakage?
- They overlap. Data leakage is the wider machine learning term for test information reaching a model during training or tuning, while contamination usually means benchmark or test examples inside a large model's training corpus.
- Can a contaminated model be fixed?
- Not easily. Removing data after training generally means retraining, which the GPT-3 authors said was not feasible for cost reasons, so the usual answer is to evaluate on clean or newer data instead.
- What is a canary string?
- A canary string is a unique marker placed in benchmark files so that documents containing it can be found and kept out of training data. BIG-bench uses one in its task files.
- Who checks a model for contamination?
- Model developers can check their own training data for overlaps, and independent researchers use prompting and date-based tests from outside. Using records that were never public reduces the need for either.
Looking for licensed records from UK companies?
Email Herman or book a 30-minute call with what you license: record types, languages, volume, date range and terms.
Sources
- Brown and others, Language models are few-shot learners (GPT-3, arXiv, 2020)
- Balloccu and others, Leak, cheat, repeat: data contamination and evaluation malpractices in closed-source LLMs (EACL 2024, ACL Anthology)
- Jacovi and others, Stop uploading test data in plain text (EMNLP 2023, ACL Anthology)
- Magar and Schwartz, Data contamination: from memorization to exploitation (ACL 2022, ACL Anthology)
- Golchin and Surdeanu, Time travel in LLMs: tracing data contamination in large language models (arXiv, 2023)
- Li and Flanigan, Task contamination: language models may not be few-shot anymore (AAAI 2024, arXiv)
- White and others, LiveBench: a challenging, contamination-limited LLM benchmark (arXiv, 2024)
- BIG-bench repository README (canary string)
This page is general information, not legal advice. Take advice on your own company's records and contracts.