Skip to content
elevatedevco
GuideLearn AI & Data Science

Overfitting vs Underfitting: How to Spot Each and How to Fix It

How to tell overfitting from underfitting using train/validation gaps, what causes each, and the practical fixes — from regularization to more data.


Overfitting and underfitting are the two ways a model fails to generalize, and they are opposites. An overfit model has memorized its training data — noise, quirks and all — so it aces training and stumbles on anything new. An underfit model never captured the pattern in the first place, so it's mediocre everywhere. Telling them apart takes one comparison; fixing them takes opposite moves — which is why diagnosing first matters so much.

The one diagnostic that settles it

Compare training performance with validation performance (ideally via cross-validation rather than a single split). Good train, bad validation → overfitting. The gap is the memorization. Bad train, bad validation → underfitting. There's nothing to memorize because the model never learned. A student analogy: the overfitter memorized last year's answer key and collapses when the questions change; the underfitter never studied and fails both papers equally.

Fixing overfitting (high variance)

  • More training data — the most reliable fix when it's available; noise averages out.
  • RegularizationL1/L2 penalties that discourage extreme weights, or dropout in neural networks.
  • Simplify the model — fewer parameters, shallower trees, fewer features.
  • Early stopping — halt training when validation error starts rising even as training error keeps falling.
  • Data augmentation — synthetically vary training examples (flips, crops, noise) so exact memorization stops paying.
  • Ensemblingbagging averages away variance.

Fixing underfitting (high bias)

  • Increase model capacity — more layers/parameters, deeper trees, or a more flexible model family.
  • Better features — engineered interactions, domain features, or learned representations.
  • Reduce regularization — a penalty set too high strangles the fit.
  • Train longer — an undertrained network looks exactly like an undersized one.

Fix in the right order

First get the model to overfit a small sample — that proves it has the capacity to learn the pattern at all. Then scale up the data and add regularization to rein it in. Fighting overfitting in a model that can't even fit the training set wastes everyone's time.

Both failures are the bias–variance tradeoff wearing work clothes: underfitting is high bias, overfitting is high variance, and every fix above moves you along that curve. For focused drills, see overfitting explained simply and overfitting and regularization — and **AI Learning** lets you practice the diagnosis-and-fix reasoning through ~10,000 offline questions with explanations, no account required.

AI Learning: AI/ML/DS Q&A

Free · Works offline · Learn to diagnose models like a practitioner, one question at a time.

Coming soon toGoogle Play

Sources

Frequently asked questions

elevatedevco builds private, offline Android apps — your data never leaves your phone. Read more articles.