Resources/Model training/Data preparation

Pipeline step

Validation split

A share of conversations is held out of training and used to watch the loss on data the model does not learn from. It is split by whole conversation, so no part of a held-out chat leaks into training — and it is not the same as the test set kept back for evaluation.

Chapter 54 min read3 references

What it is

A validation split sets aside part of your data before training starts. Those conversations are held out: the model never trains on them. The provider uses them to compute the validation loss while training runs. They are not the test set, a second, separate group of conversations kept back for evaluation afterwards.

The reason is simple. A fine-tuned model can memorise. Asked a question it trained on, it may reproduce the reference reply almost word for word, which tells you nothing about how it will handle next week's questions. Only data it has not seen can show whether it learned the pattern or just the examples.

How it works

Training · 90% of conversationsValidation · 10%, never trained on
Whole conversations go to one side or the other. Splitting by message would put the first half of a chat in training and its answer in validation, and the score would flatter the model.

Conversations are assigned at random to one side or the other, as whole conversations. Splitting by message would be a form of data leakage: the first half of a chat could train the model while its answer sits in validation, or the same answer could appear on both sides in two neighbouring records. The validation score would then measure recall, not ability. Leakage is a well-documented trap far beyond language models — Kapoor and Narayanan (2022) found leakage errors affecting 329 papers across 17 scientific fields.

During training, the provider periodically runs the model on the validation records and reports their loss without updating any weights. When training loss keeps falling but validation loss turns up, the model has started to overfit.

Validation is not the test set

Validation records are sent to the provider with the training file and watched throughout the run; people also choose epochs and learning rates by looking at them. That makes them a little less than unseen, so they are not a clean final test. A clean test needs conversations that touch neither training nor validation and never leave your hands: the test set. Evaluation uses it by default, and falls back to the validation questions only when there is no test set.

SetSeen during training?Used for
TrainingYes, learned fromChanging the weights
ValidationSeen by the provider, not learned fromThe validation loss; a second opinion in evaluation when there is no test set
TestNo, never sent to the providerJudging whether the model really improved

How big should it be?

It is a trade-off. Every conversation held out is one the model does not learn from; every conversation trained on is one you cannot test with. The precision of a score depends on the number of held-out examples, not their share, which is why small datasets are the hard case. For a win rate, the uncertainty shrinks roughly with the square root of the number of questions:

how sample size sets precision
standard error of a win rate  ≈  √( p × (1 − p) ÷ n )
95% margin                    ≈  1.96 × standard error
at p = 0.5                    ≈  1 ÷ √n

n = 10   →  ± 31 points
n = 50   →  ± 14 points
n = 100  →  ± 10 points
n = 400  →  ±  5 points
Validation shareTypical 10% (10–20%)#

The fraction of conversations held out for validation. With thousands of conversations even 5% gives a steady validation curve; with a few hundred, 15–20% makes the curve less noisy at a modest cost to training.

Minimum held-out conversationsTypical 10#

Below this number the validation loss would be mostly noise, so no validation split is made and everything outside the test set goes to training instead.

Worked example: three dataset sizes at 10%
  1. 2,000 conversations: 200 go to the test set first, then 10% of the rest (180) to validation, leaving 1,620 to train on. An evaluation on the 200 test conversations measures a win rate to within about ±7 points — good enough to compare runs.
  2. 300 conversations: 30 test and 27 validation conversations. An evaluation on 30 test conversations has a margin of about ±18 points and can't separate a 55% model from a 45% one; only more data narrows it.
  3. 60 conversations: 6 go to the test set. 10% of the remaining 54 is 5, below the minimum of 10, so there is no validation curve and all 54 train. The evaluation still has 6 unseen test conversations: few, so read the result as a hint.
  4. 8 conversations: too few for a test set, which needs a dataset of at least 10. Nothing is held out, and an evaluation can only fall back, with a warning, to questions the model trained on.

Common mistakes

  • Splitting by message or by record, so parts of the same conversation land on both sides.
  • Holding out a share that is too small to measure anything, then reading meaning into a 6-vs-4 result.
  • Adding near-duplicates of validation conversations to a later training set, which quietly turns them into training data.
  • Comparing two models that were evaluated on different held-out sets as if the scores were on the same scale.
  • Skipping the split on a real dataset to “use all the data”, and losing the only honest measurement you had.
  • Treating validation results as a clean final test, although the provider saw those records throughout training.

References and further reading

External sources open in a new tab.

  1. 01Datasets: Dividing the original datasetGoogle Machine Learning Crash Course · developers.google.comA clear introduction to training, validation and test sets.
  2. 02Training, validation, and test data setsWikipedia · en.wikipedia.orgDefinitions and the role of each set.
  3. 03Leakage and the Reproducibility Crisis in ML-based ScienceKapoor & Narayanan, 2022 · arXiv · arxiv.orgA survey of how leakage between training and test data inflates reported results.

Turn weeks of expert work into minutes

See how Scalata fits your team, your data, and your controls.