Test set

A test set is a portion of data held back from training and tuning, used once at the end to estimate how well a model will perform on new examples.

Machine learning data is traditionally divided into three parts: a training set the model learns from, a validation set used to tune it during development, and a test set kept aside for the final check. Google's machine learning glossary describes the test set as the subset reserved for testing a trained model, and stresses that no example should appear in more than one of the three.

The point is honesty. A model can do well on data it has seen simply by fitting its quirks. Scoring it on examples it never trained on, and that were never used to make design choices, gives a fairer estimate of how it will perform on real inputs. Google notes that because the test set is only indirectly tied to training, loss measured on it is less biased than training or validation loss.

Test sets wear out. Every time developers look at test results and change something, the test set leaks a little information into the model. Google's Machine Learning Crash Course warns that repeated use makes test and validation sets less trustworthy, and suggests a split such as 70% training, 15% validation and 15% test, with the test set large enough to give statistically meaningful results. It also warns about duplicates: in one spam example, a model scored 99% precision on test data because copies of the same emails had landed in both training and test sets.

Public benchmarks are test sets shared by the whole field, which makes the problem bigger. Their questions can end up in the web data used to train large language models, inflating scores. That is why fresh, held-out questions carry more weight than familiar ones.

Common questions

What is the difference between a validation set and a test set?

The validation set is used repeatedly during development to compare versions and tune settings. The test set is held back until the end and used to estimate final performance on unseen data. Using the test set for tuning turns it into a second validation set and makes its scores optimistic.

How big should a test set be?

Big enough for the results to be statistically meaningful for the decisions being made. Google's crash course shows a 70/15/15 split of training, validation and test data as an example but says there are no percentage requirements and that the number needed has to be found by experiment.

What happens if test data leaks into training data?

The model may have memorised the answers, so its test score overstates how well it handles genuinely new examples. For large language models trained on web data, this contamination of public benchmark questions is a known concern.

Finding more

Search for "train validation test split", "held-out test set" or "benchmark contamination". Machine learning course material from established providers and textbooks explain the practice reliably, and benchmark papers on arXiv often describe how they protect their test sets. When a model's score is reported, check whether the test data could have been seen during training.

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.