An overfit model learned exactly what it was shown, and nothing more.
A model with overfitting in machine learning has adjusted its parameters so precisely to the training data that it picks up patterns specific to that dataset rather than patterns that hold more broadly. Parameters are internal values adjusted during training to make predictions. The number of parameters is determined by how the model is designed. When applied to new data, its predictions become unreliable. The model looked excellent during training. The problem only becomes visible when you test it on data it has never seen.
A model that overfits will score well on every metric you check during training, meaning its error rates look low and its accuracy looks high. The problem is that training metrics only measure performance on data the model has already seen.
The short version: Overfitting happens when a model learns its training data too closely, including noise and quirks that don’t hold up anywhere else. It looks excellent during training and then performs poorly on new data. You catch it by testing on data the model has never seen, and reduce it with simpler models, more data, or regularization.
Table of Contents
ToggleWhy the Training Process Produces Overfitting
Machine learning models are trained by minimizing loss, a measure of how wrong the model’s predictions are on the training data, meaning how far off its predictions are from the correct answers. During training, the model adjusts its parameters to reduce that error as much as possible.
That process has no way to distinguish between patterns that will hold on new data and patterns that exist only in the training set. The model can’t tell them apart. It adjusts whatever reduces error right now.
Given enough flexibility, meaning enough parameters relative to the amount of training data, a model will learn both kinds of patterns. A simple model, one with few parameters, might miss real patterns entirely. A complex model, one with many parameters, might learn everything, including the noise.
The training process is doing exactly what it was designed to do. Minimizing error on training data and learning patterns that generalize are not the same objective, even though they often move together. Overfitting is what happens when those two objectives come apart.
What Overfitting in Machine Learning Looks Like
Imagine a model built to predict which patients will be readmitted to the hospital within thirty days of discharge. It has hundreds of input features but records for only a few thousand patients. On its training data, it looks nearly perfect. On new patients, accuracy drops sharply.
With that much flexibility and that little data, the model found combinations that happened to line up with readmission in the training set: a particular mix of billing codes, a discharge on a certain weekday, a narrow range of one lab value. None of them explain why patients actually come back. The model memorized its examples instead of learning the pattern.
Not every drop in performance is overfitting, though. If physicians change how they document conditions, or a bank trains its default model during an unusually stable economy, a model can fail on new data because the world changed after training. That is called drift, or distribution shift, and the fix is different: monitor the model and retrain it on recent data.
The overfit model learned something true about its training data. It just didn’t learn anything that transferred. That’s what overfitting actually produces. Not a model that fails obviously, but one that looks right until you look closely at what it learned.
When to Address Overfitting and When Not To
The clearest signal is a gap between training performance and performance on new data. That gap tells you the model has learned something it shouldn’t have, and there are a few ways to address it.
Regularization adds a penalty, an additional term in the calculation that increases as parameter values grow, that discourages the model from relying too heavily on any single feature, meaning any input variable it uses to make predictions. The model can still learn that a feature is predictive, but it cannot assign that feature an outsized weight unless the pattern holds consistently across many examples. In the readmission example, it would keep the model from leaning heavily on a coincidental billing code or discharge day.
Cross-validation tests the model across multiple splits of the training data into separate portions rather than a single held-out test set. Training and evaluating across different portions gives a more reliable picture of how the model will perform on data it hasn’t seen, and often surfaces overfitting before it reaches deployment.
More data helps too, for a straightforward reason. A coincidence that appears in five hundred examples is less likely to survive in five thousand.
If a model performs poorly on both training data and new data, the problem is different. This is called high bias, meaning the model is too simple to capture the real patterns in the data. Adding constraints will make that worse. The fix is more flexibility, not less. Poor performance on both points to bias. Strong training performance with poor test performance points to overfitting. They are different problems and they require different solutions.
Overfitting and the Broader ML Problem
Every model is trying to solve the same underlying problem: learn enough to generalize, but not so much that it memorizes. That balance shapes model selection, data collection, and how you measure whether training actually worked. Overfitting in machine learning is what happens when that balance tips too far. The tools for dealing with it (regularization and more data to reduce it, cross-validation to detect it) only make sense once you understand why the training process produces it in the first place.
This post is part of a series on why machine learning models fail in production and how to diagnose them. For more information:
What Regularization Does and Why Your Model Needs It
What Is Cross-Validation in Machine Learning
Bias vs. Variance: Why Your ML Model Can’t Have It All


