What is overfitting?
Overfitting is when a model matches its training examples so closely that it learns their quirks, noise and accidents instead of the pattern that matters. It may look strong while being trained, then fail when it meets new data. That makes overfitting a failure mode of learning from training data: the model has not learned how the world works beyond the examples it was given.
Why overfitting happens
A model learns by finding patterns in training data. Some patterns are real. Others are coincidences created by the particular examples in front of it. Overfitting happens when the model cannot tell the difference and treats both as useful.
This is more likely when the model has too much capacity for the data it sees. Capacity means how flexible the model is: a highly flexible model can represent complicated relationships, but it can also bend itself around noise. A simple model might miss some detail, while an overly flexible model can chase every bump in the training set.
Training for too long can have the same effect. Early in training, the model may learn broad signals that help on new examples. Later, it may start polishing its fit to details that do not generalise. The training result keeps improving, but the model becomes less useful outside the training data.
Poor or narrow data can also cause overfitting. If the examples do not represent the situations where the model will be used, the model may learn shortcuts. For instance, it might rely on a background detail, a formatting habit or a repeated phrase rather than the feature it is meant to understand.
How to spot overfitting
The main warning sign is a gap between training performance and performance on data the model did not train on. If the model does well on familiar examples but poorly on held-out examples, it is probably fitting the training set rather than learning a stable pattern.
Validation data helps reveal this. During development, you compare how the model performs on training data with how it performs on separate validation data. If training performance keeps improving while validation performance gets worse, the model is becoming too specialised.
You can also look at behaviour. An overfit model may react strongly to small, harmless changes in the input. It may make confident decisions for the wrong reasons. It may work on examples that look like the training set, then break when the wording, lighting, format or context changes.
The exact sign depends on the task. In prediction, it may be poor results on held-out cases. In classification, it may be unstable labels. In language or image systems, it may be a model that repeats training-like patterns without handling fresh cases well.
How to reduce overfitting
The basic cure is to make the model learn broader patterns rather than memorise details. You can do that by simplifying the model, shortening training, improving the data, or adding constraints that discourage an overly exact fit.
Regularisation is the name for methods that restrain a model during training. Some methods penalise overly large weights. Others randomly limit parts of a neural network while it trains. The shared aim is to stop the model from depending too heavily on fragile details.
More varied training data can also help, if it reflects the real range of cases the model will face. Diversity matters because it makes shortcuts less reliable. A pattern that survives across varied examples is more likely to be useful than a pattern that appears only in a narrow training set.
Early stopping is another practical guard. You monitor validation performance while training and stop when the model starts getting worse on unseen data. The aim is not to fit the training data perfectly. The aim is to build a model that performs well when the next example is not one it has already seen.