What is Overfitting?
Overfitting is when a model fits the particular noise and quirks of its training data so closely that its performance on new, unseen data gets worse rather than better.
The plain definition
A model that has overfitted has learned the training set rather than the pattern behind it. Training error keeps falling. Validation error stops falling and starts to rise. The gap between the two is the signature.
The mechanism is straightforward. Real data contains signal and noise. A model with enough capacity will fit both, because fitting noise also reduces training loss. Noise does not recur in new data, so every unit of noise the model absorbed is a unit of error it carries into production.
How to detect it honestly
You need data the model has never touched. The standard split is three-way: train to fit weights, validation to make choices about architecture and hyperparameters, and test touched exactly once, at the end, to estimate real-world performance.
The discipline that gets violated is the test set. Every time you look at test performance and change something in response, you leak information from it, and its value as an unbiased estimate decays. Teams that tune against the test set for six weeks routinely ship models that underperform their reported numbers by a wide margin. The failure is procedural, not technical.
For time-series and any forward-running process, random splits are invalid — they let the model train on the future. Use forward-chaining validation, where each fold trains on data up to time t and validates on t+1. And for grouped data, split by group: if the same patient, customer, or device appears in both train and validation, you are measuring memorisation of that entity rather than generalisation to new ones.
What actually fixes it
More data is the most reliable fix and usually the least available. Noise averages out as sample size grows; signal does not.
Less capacity. Fewer layers, fewer parameters, shallower trees. Cheap to try and often sufficient — a smaller model that generalises beats a larger one that memorises.
Regularisation. L2 weight decay penalises large weights. L1 pushes weights to exactly zero, which also selects features. Dropout randomly disables units during training so the network cannot rely on any single path. In tree ensembles, limit depth and increase the minimum samples per leaf.
Early stopping. Track validation loss each epoch and keep the weights from the best epoch rather than the last. Nearly free and remarkably effective.
Data augmentation. Generate plausible variants — flips, crops, and colour shifts for images; paraphrase and back-translation for text; jitter and warping for sensor traces. This expands effective dataset size without new labelling.
Cross-validation does not prevent overfitting but gives a far more stable estimate of generalisation on small datasets, which stops you fooling yourself about whether a change helped.
Underfitting, and why the tidy story is incomplete
The opposite failure is underfitting: both training and validation error are high because the model lacks the capacity or training time to capture the pattern. The classic advice is to find the sweet spot on the bias-variance trade-off between the two.
That framing is useful but no longer complete. Very large overparameterised networks exhibit double descent: as capacity grows past the point of interpolating the training data, test error rises as classical theory predicts, and then falls again. This is why models with billions of parameters generalise at all. The practical takeaway is not to abandon regularisation but to stop assuming that a model with more parameters than data points must be overfitting — measure it on held-out data rather than reasoning from parameter counts.
- The signature — training error still falling while validation error rises
- Protect the test set — touch it once; tuning against it destroys its meaning
- Split correctly — temporally for time series, by group for repeated entities
- Fixes, in order — more data, less capacity, regularisation, early stopping, augmentation
More on Overfitting.
How do I know if my model is overfitting?
Plot training and validation loss against training steps. If training loss keeps decreasing while validation loss flattens then climbs, you are overfitting, and the epoch where validation bottomed out is where you should have stopped. A large gap between training and validation accuracy points the same way. If both are poor, the problem is underfitting instead.
Can more data always fix overfitting?
More representative data reliably reduces it, because noise averages out while signal accumulates. More of the same biased data does not — if your training set systematically excludes a segment of real traffic, adding volume from the same skewed source deepens the bias rather than correcting it. Coverage matters more than raw count.
Is a small gap between training and validation accuracy always good?
No. If both numbers are low, a small gap just means you are underfitting consistently. And if your validation set is too small or leaks information from training, the gap can look reassuring while telling you nothing. A trustworthy gap requires a validation set that is large enough, drawn from the same distribution as production, and genuinely disjoint from training.
Related terms.
Supervised Learning
Supervised learning is training a model on examples that already carry the correct answer, so the model learns a mapping it can ap…
ReadHyperparameter Tuning
Hyperparameter tuning is the search for configuration values that are set before training rather than learned during it, such as l…
ReadTraining Data
Training data is the set of examples a model learns from, and its coverage, label quality, and representativeness set a hard ceili…
ReadModel Drift
Model drift is the gradual loss of a deployed model's accuracy because the statistical relationship it learned no longer matches t…
ReadNeed this built?
Applying this to a
real system?
We build and ship production machine learning. If overfitting is part of a problem you are working on, tell us about it.
Start the conversationor write to us at [email protected]