Quick answer: Overfitting is what happens when a machine learning model learns its training data too well, picking up the noise and one-off quirks of that specific dataset instead of the general pattern behind it. The model then scores well on the data it trained on but performs noticeably worse on new examples it has never seen. It is one of the most common reasons a model that looks great during testing disappoints once it meets real data.
You run into overfitting anywhere a model is judged on data it did not train on, which is essentially every real deployment. This entry covers why it happens, how teams catch it before it ships, how it differs from the opposite problem, underfitting, and where it still trips up systems today.
What Is Overfitting?
A model’s job is pattern recognition: finding the rule connecting inputs to outputs and applying that rule to new cases. Overfitting is what happens when the model instead memorizes the training data itself, including the random noise, mislabeled entries, and coincidental details that do not actually generalize.
The clearest sign is a gap between how a model performs on data it trained on versus data it did not. A model that gets every training example right but does noticeably worse on a held-out test set has, by definition, overfit to some degree. Machine learning practitioners call that gap the generalization gap.
Overfitting is not an occasional glitch. It is a structural risk in any model with enough capacity to fit its training set closely, which describes most modern neural networks, so managing it is a routine part of training rather than an edge case.
The same idea applies outside deep learning too. A decision tree grown deep enough to place every training row in its own leaf, or a regression fit with enough polynomial terms to pass through every data point, is overfitting in exactly the same sense: it has traded a general rule for a perfect memory of one dataset.
How Does Overfitting Happen?
Two conditions make overfitting more likely, and they usually show up together. The first is a model with more capacity, meaning more parameters or more flexibility, than the training data can responsibly support. The second is a training set that is small, unrepresentative, or contains noise the model has no way to distinguish from a real signal.
Given enough capacity, a model can effectively draw a boundary around every training point rather than learning the smoother, simpler rule that would actually hold on new data.
A 2016 paper by Ribeiro, Singh, and Guestrin made the point with an image classifier trained to tell huskies from wolves. The model turned out to key mostly on snow in the background rather than on any feature of the animal, because snow happened to correlate with the wolf photos in its training set. The classifier looked accurate until it met a wolf without snow.
That example is really about a model fitting a coincidental pattern in its training data rather than the underlying task, which is the essence of overfitting even when it shows up as a shortcut instead of pure memorization. Training for too many passes over the same data pushes a model further in this direction, since each additional pass gives it more opportunity to fit noise it has already seen rather than learn anything new.
How Do You Spot and Prevent Overfitting?
The standard way to catch overfitting is to hold out a validation set the model never trains on and watch both curves during training. Training loss keeps falling as a model fits its training data more closely, but validation loss falls only up to a point and then starts climbing back up once the model starts fitting noise instead of signal. That divergence is the practical definition of overfitting in action.
Several techniques push back against it, and teams typically combine more than one:
- Regularization, such as L1 or L2 penalties, discourages a model from relying too heavily on any single weight.
- Dropout randomly disables a portion of a neural network’s neurons during each training step, forcing the rest of the network to not depend on any one path.
- Early stopping halts training once validation performance stops improving, before the model has a chance to overfit further.
- Data augmentation expands the effective size and variety of the training set, which gives the model less room to memorize any single example.
- Simply collecting more representative training data, or simplifying the model, addresses the root imbalance between data and capacity directly.
None of these techniques is a complete fix on its own. In practice, teams watch the validation curve and adjust whichever combination brings training and validation performance back in line.
Overfitting vs Underfitting: What’s the Difference?
Underfitting is the opposite failure. It happens when a model is too simple to capture the real pattern in the data, so it performs poorly on both the training set and new data, rather than doing well on one and poorly on the other. A straight line fit to data that actually curves is a textbook case of underfitting.
The practical difference is where you look for a fix. An overfitting model needs less capacity, more or better data, or regularization to keep it from memorizing noise. An underfitting model needs more capacity, more training time, or better features so it can actually represent the pattern in the first place.
Between those two extremes sits the fit a team is actually after: a model whose training and validation performance stay close together at a good level, evidence that it learned the underlying pattern rather than the noise or the shortcut sitting alongside it.
Why Overfitting Still Matters
Overfitting has not gone away as models have grown. Large models still overfit to a narrow fine-tuning set, since a small specialized dataset carries the same generalization risk a from-scratch training set always did, just at a later stage of the pipeline.
It also matters more, not less, once a model leaves the lab. A model that overfits to one hospital’s scanner, one company’s support tickets, or one country’s driving conditions can look excellent on paper and still fail the moment it meets a slightly different version of the world.
That risk is part of why held-out test data and ongoing monitoring after launch have become standard practice rather than a formality. A model checked only against the data it trained on has no real evidence it generalizes at all.
The gap also tends to surface at the worst possible moment, once real users are already relying on the thing. Watching for it stays one of the more reliable habits in building anything that has to work outside the dataset it came from.