Naru News日本語

Home › Glossary › AI

What is overfitting in machine learning?

Also called: Overfit, Over-fitting

Term explainer · Checked November 10, 2026 · 12 min read

In one minute

Overfitting is when an AI in machine learning fits the data it was trained on so closely that it does well on that data but gets new data it has never seen wrong.

An AI learns by finding patterns in many examples. But examples also contain chance quirks and wrongly labeled answers (together called noise). When there are few examples, or the AI’s design is too complex and free, it learns not only the real pattern but those chance quirks too. So even a near-perfect score on the training data doesn’t tell you whether the AI is any good.

That is why it is checked on data kept out of training. To prevent overfitting, you can collect more data, make the design simpler or stop training at the right moment.

A common mix-up

“Overfitting means an AI has learned from too much data.”

Only partly right. Training on the same data for too many rounds can lead to overfitting, and stopping training once the error (the size of the mistakes) on data not used for training starts to rise is called “early stopping.” But having too much data is not the cause. In fact, the less data there is, the easier it is to mistake chance quirks for real patterns, and the more likely overfitting becomes. Collecting more varied examples is usually one way to prevent it. As the name “over-fitting” says, what goes too far is not the amount of data but how closely the model fits the training data.

Explained in pictures

A figure comparing two ways to fit a line to points (points and lines made up for this page). Title: “A line fit too closely misses new points.” Key at the top: navy dots = training data, white diamonds = new data, orange line = the AI’s line. Left graph, “Just right”: a smooth arch-shaped line runs among the navy dots and passes close to the white diamonds. Below: “Close to new points too.” Right graph, “Overfit”: a line that wiggles up and down passes exactly through every navy dot. The white diamonds are far from the line, joined to it by dotted lines, one labeled “miss.” Below: “Misses new points badly.” Band at the bottom: Overfitting: memorizing even the chance quirks.
This figure compares two ways of fitting a line to the training data (navy dots). The line is the way of answering that the AI has found. The dots sit where chance quirks (noise) have been added to the real pattern. The smooth line on the left captures the overall shape without being thrown off by the quirks, so it also lands close to new data (white diamonds). The wiggly line on the right passes exactly through every training point, but because it has also memorized the chance quirks, it misses new data badly. That is overfitting.
A figure comparing how the error (the size of the mistakes) changes on two sets of data as training goes on (curve shapes made up for this page). Title: “Train too long, and held-out error rises.” Up is “Error (size of mistakes),” across is “Training rounds.” A solid navy line, “Training data,” keeps falling. A dotted orange line, “Held-out data,” falls together with the solid line at first, reaches its lowest point partway, and then climbs. At the lowest point there is a white circle and a vertical dotted line labeled “Early stopping: stop here.” The area to its right is shaded pale orange and labeled “Overfitting.” Band at the bottom: When held-out error starts to rise, it’s overfitting.
This figure compares how an AI’s error (the size of its mistakes) changes on two sets of data as training goes on. The solid line is the error on the training data, and the dotted line is the error on data kept out of training. At first both fall, but partway through, the solid line keeps falling while the dotted line starts to rise. That is a sign the AI has begun memorizing the chance quirks of the training data, and from here on it is overfitting. Stopping training where the dotted line is lowest is early stopping.
A bar chart of the numbers in Table 1 of a 2017 paper (Zhang et al.). Title: “It memorized even random names and scored 100%.” Subtitle: 2017 paper: sorting photos into 10 kinds, 50,000 training photos. Left pair, “Trained on true names” (a cat photo labeled “cat”), with the tag “Learned the pattern”: training photos 100% (navy bar), new photos about 86% (orange striped bar; 85.75% in the paper). Right pair, “Trained on random names” (e.g. a cat photo labeled “airplane”), with the tag “Overfitting at its most extreme”: training photos 100% (navy bar), new photos about 10% (striped bar; 9.78% in the paper). Above the right striped bar, an arrow points down from a dotted line at the 100% level, labeled “about 90 points lower,” and just above the bar is “same as guessing.” Both are the same AI (a small version of Inception), without image augmentation (adding copies of photos turned or shifted a little) or regularization. Band at the bottom: Same 100% in training. New photos show the difference.
This experiment shows overfitting in its most extreme form (a 2017 paper). An AI that sorts photos into 10 kinds was trained in two ways. On the left is ordinary training, with each photo given its true name. On the right, the names were swapped at random, like labeling a cat photo “airplane.” On the right there is no pattern linking photos and names, so the only way to get them right is to memorize the photos one by one. Even so, the AI memorized them and scored 100% on the training photos, the same as on the left. But on new photos it got only about 10% right, the same as guessing (1 in 10). It fits the training data yet misses new data: that is overfitting itself. The training scores (navy bars) are 100% on both sides, so they alone can’t tell you whether the AI learned a pattern or just memorized.

Think of it like this

A student who memorized the workbook’s answers

Imagine two students studying for a test with a workbook. One practices by thinking through how to solve each problem; the other memorizes the workbook’s answers. If the test uses the workbook’s questions, both get full marks. But when new questions with different numbers appear, the one who learned how to solve them can do it, and the one who memorized can’t. That memorizing is overfitting.

That is why teachers check real skill with questions not used for practice. It is the same as checking an AI on data kept out of training. Looking only at workbook scores, you can’t tell the two students apart.

But the comparison has limits. A student knows they memorized, but an AI doesn’t notice on its own. As an AI adjusts its numbers (parameters) to reduce its mistakes, it can pick up the real pattern and, at the same time, simply memorize the chance quirks as they are. And a big AI can train until it fits its training data exactly and still do well on new data, which is not the same as a person’s rote memorizing.

Key points

How do you spot it?

Measuring results only on the data used for training won’t reveal overfitting, because the more an AI overfits, the better it does on that data. So the data is split. Apart from the data used for learning (the training set), some is kept to check results during training (the validation set) and some for a final check at the end (the test set). One example split is 70% training, 15% validation and 15% test. The validation set is looked at again and again during training to choose where to stop and which settings to use, so with repeated use the choices come to fit that data. That is why the final check uses the test set, which hasn’t been used until then.

During training, the error (the size of the mistakes) is measured on both the training and validation sets and plotted against the number of rounds. At first both fall in the same way. If at some point the training error keeps falling while the validation error starts to rise, that is a sign of overfitting.

If the checking data contains the same examples as the training data, overfitting can be missed, so duplicates are removed from the validation and test sets. For example, if the data for an AI that spots spam email is split without removing emails with the same text, the AI effectively sees many of the test emails during training, and its test score looks better than it really is. Only new examples give a fair check.

Why does it happen?

Besides the real pattern, data contains chance quirks and wrong answers (noise). With little data, there are more shapes that happen to appear in the training data but not in new data. Overfitting is when the AI learns those as if they were the real pattern. It also happens when the training data doesn’t represent well the data the AI will meet in real use (for example, an AI trained only on daytime photos that is also used on night photos).

A design that is too complex can also cause it. For example, take 30 points: values on a smooth curve with noise added. Try fitting a straight line, a moderately curved line and a line that curves in fine detail. The straight line doesn’t fit even the training points. The moderately curved line matched the original curve almost exactly. The finely curving line memorized the noise too, and its error on the checking data became larger by orders of magnitude.

The opposite, where the AI is too simple to do well even on its training data, is called underfitting. A good AI aims for the right spot in between. The ability to get data it has never seen right is called generalization.

How can it be prevented?

First, by getting more data. With many varied examples, the chance quirks differ from example to example, so the real pattern stands out. Other ways are to make the AI’s design simpler, and to make training aim not only for small mistakes but also for “not too complex.” The latter is called regularization. In L2 regularization, for example, the numbers inside the AI (its weights) are penalized for their size too, so that none grows too big (the sum of the squares of the weights is added to the size of the mistakes, and training tries to make both small). This pulls the weights toward zero, which helps avoid overly complex ways of answering, because bigger weights are taken to mean a more complex way of answering. The strength of regularization is one of the hyperparameters (settings people choose before training) and is chosen on the validation set.

Early stopping means stopping training where the error on the validation set starts to rise. It is quick, since nothing about complexity has to be calculated. But it is said to be very unlikely to do as well as an AI trained thoroughly with regularization of just the right strength.

A 2014 paper (Srivastava et al., University of Toronto) studied and described in detail a method for neural networks (computing systems modeled loosely on the brain’s nerve connections) called “dropout.” During training, units (artificial neurons) in the network are picked at random and temporarily removed. For the layers between the input and the output (hidden layers), the paper says, keeping each unit with a probability of one half seems close to the best value for a wide range of networks and tasks. This stops units from relying on each other too much, and has an effect close to averaging the answers of many different networks. On a task of reading handwritten digits (MNIST), the error rate fell from 1.60% to 1.35% (about 16% fewer mistakes). The paper says dropout prevented overfitting even when a big network with more than 65 million numbers inside (parameters) was trained on 60,000 examples.

If an AI scores 100% on its training data, is it good?

Not necessarily. A 2017 paper (Zhang et al., Google Brain and others) took a task of sorting photos into 10 kinds, such as airplanes, cars, birds and cats (CIFAR10, with 50,000 training photos), replaced all the photos’ answers (the names of what they show) at random, and then trained an AI on them. There was no pattern at all linking photos and answers. Even so, the AI memorized the answers for the training photos and came to get 100% of them right. On new photos it got about 10% right, the same as guessing.

The same AI trained on the true answers also scored 100% on the training photos, and about 86% on new photos. On the training photos, both scored the same 100%. Whether an AI learned a pattern or just memorized can only be told by checking it on held-out data.

Memorizing the random answers took only a little longer than learning the true ones. This AI had about 1.65 million numbers inside (parameters), far more than the number of training photos. In other words, it had plenty of room to memorize. The paper says neural networks have enough capacity to memorize the whole dataset. Regularization can also improve results on new data. But the paper says an AI can do well on new data even without regularization, and regularization alone can’t fully prevent overfitting.

Are bigger AIs more likely to overfit?

The traditional view was that as an AI is made more complex, its error on new data first falls and then, past some point, rises (a U shape). Textbooks have said that a model (a trained AI) with zero error on its training data is overfit and will typically do poorly on new data. Yet today’s big neural networks often fit their training data exactly and still do well on new data.

A 2019 paper (Belkin et al., Ohio State University and Columbia University) showed, across many kinds of AI and data, that as an AI is made bigger (with more numbers inside), the error on new data peaks around the size where the AI first becomes able to fit its training data exactly (where it has just enough numbers inside), and falls again as the AI gets bigger still. It says the error often ends up lower than the bottom of the U. Because the error falls twice, this is called “double descent.”

A study the same year (Nakkiran et al., Harvard University and OpenAI) showed that double descent happens in a variety of today’s deep learning tasks (deep learning means learning with neural networks of many stacked layers), such as AIs that recognize photos and AIs that translate. It also happened when the number of training rounds was increased. And in a translation task, for AIs of a size near the peak, there were cases where making the training data 4.5 times larger made the results worse. That is because more data changes the size at which the AI becomes able to fit it exactly, shifting where the peak falls. The peak showed most clearly when the data had wrong answers mixed in. With data that had no wrong answers, sometimes there was no peak, only a stretch where the error stayed flat for a while.

So it is not true that bigger AIs always overfit, nor that bigger is always better. What matters is not how exactly an AI fits its training data, but whether it gets new data right. That is why, at any size, checking on held-out data is what matters.

Check yourself

  1. Q1While training an AI, you measure the error (the size of its mistakes) after each round on both the training data and data kept out of training. With “early stopping,” a way to prevent overfitting, where do you stop training?

    Answer and explanation

    Answer: C Where the held-out data’s error is smallest

    Early stopping stops training where the error on the held-out data (the validation set) reaches its lowest point and starts to rise. The error on the training data keeps falling after that, but only because the AI has begun memorizing chance quirks, and it starts missing more on new data. A small gap between the two errors can also mean both are still large (the AI hasn’t learned enough yet), so the gap alone can’t tell you where to stop.

    More on this → Key points: How can it be prevented?

  2. Q2In a 2017 paper, an AI that sorts photos into 10 kinds was trained on photos whose names had been swapped at random (a cat photo labeled “airplane,” for example). It got 100% of the training photos right, but only about 10% of new photos (the same as guessing). Why could it get the training photos 100% right?

    Answer and explanation

    Answer: B It memorized the name given to each photo, one by one

    With the names swapped at random, there is no pattern linking photos and names. If the AI had found real clues in the photos, it would also get new photos right, but it got only about 10%. If it had noticed the true names, they wouldn’t match the random names, so it wouldn’t get even the training photos right. The AI memorized the names of all 50,000 training photos one by one. Right on the training data, wrong on new data: this is overfitting in its most extreme form.

    More on this → Explained in pictures

  3. Q3In a study published in 2019, AIs were made bigger step by step (with more numbers inside), each was trained, and their errors on new data were compared. How did the error change, across several kinds of AI and data?

    Answer and explanation

    Answer: A It fell, then rose, then fell again

    As the AI was made bigger, the error on new data first fell, peaked around the size where the AI first became able to fit its training data exactly, and fell again as it got bigger still. Because it falls twice, this is called “double descent.” In the traditional view (the U shape), once it started rising, it should have kept rising. But how clearly the peak shows up depends on things such as whether the data has wrong answers mixed in. It also doesn’t mean bigger is always better.

    More on this → Key points: Are bigger AIs more likely to overfit?

Sources and how we checked

AI wrote this page from the sources above, and a different AI checked it against the text of those sources (November 10, 2026). A person with a master’s degree in science and a Japanese high-school science teaching license also read and checked it before publishing. Numbers are as of that date. If anything was hard to follow, you spot a mistake, or there’s a term you’d like explained, please write to [email protected].

AI terms

All 26 AI terms →