Overfitting and underfitting describe two common ways a machine-learning model can fail to generalize. Overfitting occurs when a model learns the training data too closely, including noise and accidental patterns. Underfitting occurs when the model is too simple or insufficiently trained to capture the real relationships in the data.

Overfitting: memorizing instead of generalizing

An overfit model performs very well on its training data but noticeably worse on unseen validation or test data. It may have learned noise, outliers, or details that do not repeat in new examples. A classic clue is a large gap between training performance and validation performance.

Underfitting: the model has not learned enough

An underfit model performs poorly on both training and validation data. It may be too simple, have insufficiently informative features, be trained for too few steps, or use an unsuitable learning setup. Both training and validation errors remain high.

How to diagnose the difference

PatternTraining errorValidation errorLikely diagnosis
ALowHighOverfitting
BHighHighUnderfitting
CLowLow and similarGood generalization, subject to test-set confirmation

Ways to reduce overfitting

Ways to address underfitting

Why the validation set matters

Use separate training, validation, and test data. Train on the training set, use the validation set to compare models and tune hyperparameters, and reserve the test set for a final, unbiased estimate after choices are complete. Repeatedly tuning against the test set leaks information from the test data into model selection.

Exam traps

Test yourself

Question 1

A model achieves 99% accuracy on training data but only 72% on validation data. What is the most likely issue?

  1. Underfitting
  2. Overfitting
  3. Perfect generalization
  4. Insufficient model capacity only
Reveal answer

Correct answer: B. The large training-validation gap suggests the model has learned training-specific patterns that do not generalize.

Question 2

A model performs poorly on both training and validation data. Which diagnosis is most likely?

  1. Overfitting
  2. Underfitting
  3. Data leakage from the test set
  4. High precision only
Reveal answer

Correct answer: B. Poor performance on both sets indicates the model has not captured the underlying patterns.

Key takeaway

Overfitting means the model fits training data too closely and fails on new data; underfitting means it fails to learn the training patterns in the first place. Compare training and validation performance before choosing a fix.

Related AWS topics

Precision, Recall, F1 and AUC · SageMaker Clarify · Amazon SageMaker

✦ CloudExamPro Premium

Ready for the AWS Certified AI Practitioner (AIF-C01)?

Move beyond memorizing terms. Practice with realistic, scenario-based questions and detailed explanations that help you understand the AWS AI services and concepts behind each answer.

6 Full-Length Exams390 practice questions
Detailed ExplanationsLearn why answers are right or wrong
Scenario-Based PracticeOriginal questions, not dumps
6 Months of AccessReview at your own pace
Get the AIF-C01 Practice Exams →Try the free AIF-C01 exam first ↗

Original practice questions. No dumps. No shortcuts.

COMING SOON • BLACK FRIDAY MEETS CYBER MONDAY
Something BIG Is Coming! Get ready for an exclusive offer on AWS certification exam preparation. November 27–30, 2026
Starts in--d --h --m --sView Pricing Plans