What is overfitting
Last updated: April 1, 2026
Key Facts
- Overfitting manifests as high training accuracy paired with significantly lower validation and test set accuracy, indicating poor generalization
- Common causes include excessive model complexity relative to available training data, insufficient regularization, and training for too many iterations
- Regularization techniques like L1/L2 penalties, dropout, and early stopping help prevent overfitting by constraining model complexity
- Cross-validation is essential for detecting overfitting early by evaluating model performance on multiple data splits
- The bias-variance tradeoff explains overfitting as excessive variance—models that are too flexible capture noise rather than true underlying patterns
Overview
Overfitting is a fundamental problem in machine learning where a model learns the training data too well, including its noise and irrelevant patterns. Rather than capturing the underlying relationship between input features and target outputs, an overfitted model essentially memorizes the training data. This leads to excellent performance on training data but poor performance on new, unseen data, making the model useless for real-world applications.
Causes of Overfitting
Several factors contribute to overfitting:
- Model Complexity: Models with too many parameters relative to training data size have excessive capacity to memorize
- Insufficient Data: Small datasets provide fewer examples to constrain model learning, making memorization easier
- Training Duration: Excessive training iterations allow models to progressively fit noise in the data
- Lack of Regularization: Without constraints on model weights and complexity, overfitting occurs unchecked
- Noisy Data: Training data containing measurement errors or mislabeling encourages models to fit this noise
Detecting Overfitting
Overfitting manifests clearly when comparing training and validation metrics. Training accuracy may reach 95% while validation accuracy stagnates at 70%. This divergence indicates the model has learned training-specific patterns rather than generalizable features. Plotting training and validation loss over epochs typically shows validation loss increasing while training loss continues decreasing—a clear overfitting signal.
Prevention Strategies
Regularization techniques constrain model complexity and prevent overfitting:
- L1/L2 Regularization: Penalizes large model weights, forcing simpler solutions
- Dropout: Randomly disables neurons during training, preventing co-adaptation
- Early Stopping: Terminates training when validation loss stops improving
- Data Augmentation: Artificially expands training data to provide more learning examples
- Cross-Validation: Evaluates models on multiple data splits to ensure generalization
Bias-Variance Tradeoff
Overfitting represents one extreme of the bias-variance tradeoff. High-complexity models exhibit low bias (accurate on training data) but high variance (sensitive to training data fluctuations). Conversely, overly simple models exhibit high bias (inaccurate everywhere) and low variance. Optimal models balance these extremes, achieving reasonable accuracy while maintaining generalization.
Practical Impact
In production environments, overfitted models fail when deployed on real data differing from training conditions. A fraud detection model overfitted to historical patterns won't detect novel fraud schemes. An image classifier overfitted to specific training images will misclassify similar images with different lighting or angles. Preventing overfitting ensures models provide reliable, consistent performance across diverse real-world scenarios.
Related Questions
What is underfitting in machine learning?
Underfitting occurs when a model is too simple to capture the underlying pattern in data, resulting in poor accuracy on both training and test sets. It represents the opposite extreme of overfitting on the bias-variance spectrum.
What is cross-validation?
Cross-validation is a technique that divides data into multiple subsets for training and validation, evaluating model performance across different data splits. This helps detect overfitting and provides more reliable performance estimates than single train-test splits.
What is regularization in machine learning?
Regularization modifies the learning algorithm by adding constraints or penalties that discourage overly complex models. Techniques like L1/L2 regularization, dropout, and early stopping reduce overfitting by limiting model flexibility and capacity to memorize data.
More What Is in Daily Life
Also in Daily Life
More "What Is" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
- Wikipedia - OverfittingCC-BY-SA-4.0
- Britannica - Machine LearningProprietary