esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

Overfitting vs Underfitting

Overfitting vs underfitting: what each one looks like, how to spot it with two scores, and how to fix it, for your AI interview.

In short

Overfitting is when a model memorises its training data, noise included, so it fails on new data. Underfitting is when a model is too simple to learn the pattern, so it fails even on the data it trained on.

10 min readBeginnerVery common · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Overfitting means a model learned its training examples too closely, random quirks included, so it looks great on old data and poor on new data. Underfitting means the model is too simple to learn the pattern, so it is weak on both. I spot the difference by comparing two scores: the training score and the check set score. A big gap points to overfitting. Low on both points to underfitting. The fixes pull in opposite directions, so I never fix one by reflex.

What are overfitting and underfitting, in plain words?

An AI model learns patterns from examples, then has to work on cases it has never seen. Overfitting and underfitting are two common ways that goes wrong. Both describe how well the model learned the real pattern.

Think of a new credit analyst at a bank who studies last year's loan files. The first analyst memorises every file, names and exact amounts included. Give them a new applicant and they freeze, because nothing matches word for word. That is overfitting. The second analyst learns one rule, that big loans are risky, and gets even the old files wrong. That is underfitting.

AI works the same way. A bank trains a model on last year's loan files to flag applicants likely to default, which means stop repaying. A model that memorised those files misses new kinds of risk. A model with one rule misses risk even in the old files. What the bank wants is a model that generalises, meaning it does well on applicants it never learned from.

Key words

Training data
The examples the model learns from.
Check set
Examples held back to check the model while you tune it. Also called validation data.
Generalise
Do well on new data the model never learned from.
Noise
Random quirks in the data that will not repeat in new data.

How do you tell which one a model has?

Compare two scores: how the model does on its training data, and how it does on a check set it never trained on. The gap between them, and whether both are low, tells you which problem you have. The table uses made-up numbers from a loan model, on a balanced sample of half defaults and half repayments. Old means the training files the model learned from. New means the check set it never saw.

  • Underfitting

    66% old, 64% new

    Weak on both. The model is too simple, so it misses the pattern even in the files it learned from.

  • Overfitting

    99% old, 71% new

    A 28-point gap. The model memorised last year's files, so it falls apart on new applicants.

  • Good fit

    88% old, 85% new

    Both scores high and close. It learned the pattern, and it holds up on new applicants.

scikit-learn's official example makes the same points. A straight line that cannot fit the training points is underfitting. A high training score with a low check score is overfitting.

Where a model can land

Your model

learns from past loan files

Too simple

no room for the real pattern

Too complex

memorises random quirks too

Underfitting

weak on old and new files

Overfitting

strong on old files, weak on new

Adjust and re-check

match the model to the data

Good fit

strong on old and new files

  1. 1Too little room to learn the pattern.
  2. 2So much room that it learns every quirk.
  3. 3It stays weak on the training files too.
  4. 4Its old-file score is high and its new-file score low.
  5. 5Both scores are low, so it needs more to work with.
  6. 6The gap says to limit complexity and add data.
  7. 7Re-check: the two scores move close and high.
All three start from one model choice. Too little room leaves the model weak everywhere. Too much room lets it memorise random quirks, so only the old files look good. Both need adjusting, and the check score tells you when the adjustment worked.
  • “Overfitting means creating a model that matches (memorizes) the training set so closely that the model fails to make correct predictions on new data.”

    Google's machine learning course

  • “An underfit model doesn't even make good predictions on the training data.”

    Google's machine learning course

  • “However, for higher degrees the model will overfit the training data, i.e. it learns the noise of the training data.”

    scikit-learn

What do you do about each one?

Overfitting comes from causes such as unrepresentative training data and overly complex models. The fixes point in opposite directions, so never fix a model by reflex. Adding complexity helps underfitting and makes overfitting worse.

Fixes depend on the symptom

Underfitting: low on both

Better inputs

facts that really predict default

More room to learn

a model able to learn the shape

Overfitting: big gap

More varied examples

harder to memorise one year

Limit complexity

regularisation penalises extra rules

Stop training early

halt when the check score stalls

Close and high on both

a good fit on new files too

  1. 1Give it better inputs or more room, then re-score.
  2. 2Use more varied cases, simpler rules and an early stop, then re-score.
Underfitting needs the model to see the pattern: better inputs or more room to learn. Overfitting needs it to ignore noise: more varied data, simpler rules and an early stop. Both are done when the training and check scores come out close and high.
  1. 1

    Check the split first

    Make sure the check set was really held back and looks like the cases the model will face. If some check cases also sat in the training files, every score looks better than it is.

  2. 2

    Add more varied examples

    Cases from more months, branches and customer types make it harder to memorise one year's quirks.

  3. 3

    Limit complexity

    Regularisation adds a cost for extra complexity, so the model keeps simpler rules. Google's course says a simpler model often generalises better on new data.

  4. 4

    Stop training early

    Stop when the check score stops improving, before the model starts memorising. Watch the gap between the two scores.

  5. 5

    Give underfitting models more to work with

    Add inputs that really predict default, such as income stability and repayment history, or use a model with more room to learn.

How would you handle a loan model that is right on old files but not new ones?

Your team has shipped a loan model. It scored 99 percent on last year's files and 71 percent on this month's applicants. What do you do first?

  1. 1

    Check the gap is real

    Confirm the check set was held back and matches this month's applicants. If some check cases also sat in the training files, the check score is inflated and the real gap may be wider. Defaults can take months to show, and a shift in who applies can open a gap too.

  2. 2

    Compare with a simpler model

    If a simpler model does nearly as well on new applicants, the complex one is probably memorising. Keep the simpler one.

  3. 3

    Retrain on recent cases

    Add the last few months of applicants, including new kinds of risk, and keep a test set from the newest months.

  4. 4

    Re-check before trusting it

    Measure the gap again on fresh data. Only a small gap and a good score earn the model a place back in use.

I would not keep adding complexity to lift the old score. That only widens the gap.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: a model that memorises its training data, or one too simple to learn it.
  • The two-score check: training score against a check set it never saw.
  • A big gap means overfitting. Low on both means underfitting.
  • The fixes conflict: more complexity helps one and hurts the other.
  • Fixes for each: varied data, simpler rules and early stopping for overfitting; better inputs and more room to learn for underfitting.
  • Honest testing: tune on the check set, then score a final test set you never tuned on.

Common traps

  • Trap"A model that scores 99 percent is the best one."

    BetterA high training score alone proves little. Check the score on new data before trusting it.

  • Trap"More complexity always gives a more accurate model."

    BetterPast a point, extra complexity memorises noise. Watch the gap between the two scores.

  • Trap"Tune the model until the check score is highest."

    BetterTuning against the check set makes that score biased, as scikit-learn notes. Keep a separate final test set.

Can you spot the overfitting?

Spot the overfitting

A churn model at a phone company shows these scores on two samples. Which row shows overfitting?

Quick check

Your loan model scores 99 percent on training data and 71 percent on the check set. What do you change first?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q412Bias vs variance?12 min
  2. Q414L1, L2 and dropout regularisation?13 min
  3. Q422Train/validation/test splits?11 min
  4. Q423What is cross-validation?Coming soon
  5. Q424What is data leakage?Coming soon
  6. Q297How do you spot overfitting during fine-tuning?11 min

Last updated on 26 November 2026

Building a model that has to work on new data?

I design and build AI products and agents, including the screens and the system behind them. Book a short call and tell me what yours needs to do.