← AI Terminology

Test Set

A test set is a held-out portion of the data that is never shown to the model during training or hyperparameter tuning — reserved exclusively for final evaluation to provide an unbiased estimate of how the trained model will perform on new, unseen data.

It is the gold standard for model performance measurement.
Why It Matters in AI
If you evaluate a model on training data, you're measuring memorisation, not learning. If you tune hyperparameters on the validation set repeatedly, you've indirectly fitted to it too — the test set is the only split that remains untouched throughout the process, providing a reliable estimate of production performance. Contaminating the test set (leaking it into training, using it for model selection) is the most common cause of optimistic performance estimates that fail to replicate in production.
Key Points
Aspect Description
Contamination Train data includes test samples → inflated metrics; benchmark contamination in LLMs is common
Held-out test Kaggle's hidden test set — prevents leaderboard exploitation and measures true generalisation
Never touched Test set must not inform any model or hyperparameter decision — "look once at the end"
Typical split 70/15/15 or 60/20/20 (train/val/test) — proportions depend on dataset size
Multiple tests Using same test set repeatedly for selection degrades its validity — collect new test data
Temporal splits Time series: test set must be chronologically after training set — no future leakage
Simple Analogy
The final exam: study materials (training set) and practice exams (validation set) are used to prepare; the final exam (test set) is seen once and scored — measuring what was actually learned. A student who sees the final exam questions in advance (contamination) will score artificially high, not reflecting true understanding.
Common Usage Examples
  • X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
  • model.evaluate(X_test, y_test) — final evaluation after all training and tuning is complete
  • Kaggle: private leaderboard = test set; public leaderboard = validation — only private counts at deadline
  • Temporal: train = df[df.date < "2024-01-01"]; test = df[df.date >= "2024-01-01"] — time-aware split
  • LLM benchmark contamination: test if training data contains test split via n-gram overlap detection
Summary
In short: The test set is the untouched, held-out data used for one-time final evaluation — the only unbiased estimate of production performance, whose validity depends entirely on never being used in any training or model selection decision.