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.

Bias vs Variance

What bias and variance mean, how each one causes errors on new data, and how to tell them apart and fix each, for your AI interview.

In short

Bias is error from a model that is too simple to learn the real pattern. Variance is error from a model so sensitive to its training data that its predictions swing when the data changes. Good models keep both low.

12 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.

Bias is error from a model that is too simple to learn the real pattern. Variance is error from a model that is too sensitive to its training data, so its answers swing when the data changes. In a loan-risk model I'd check both scores: if both are poor, that's usually bias; if training is great and new data is poor, that's variance. The fixes are different, so I diagnose before I change anything.

What are bias and variance, in plain words?

Every model makes errors on new data. For squared error, which is typical for regression, the scikit-learn library, a standard Python toolkit for machine learning, splits that error into three parts: bias, variance and noise.

Bias is error from wrong assumptions. Variance is error from being too sensitive to the training data. Noise is random variation in the data itself, which no model can remove.

Picture a new claims assessor at an insurer. One follows a rigid checklist, so they miss anything the checklist was never built to catch. That is bias. Another memorises last month's claims and freezes at anything new. That is variance. Both get new claims wrong, for different reasons.

The same two problems hit AI models. A loan-risk model at a mid-size bank can be too simple to spot risky applicants, or so tuned to its training loans that it fails on loans it has not seen.

Key words

Bias
Error from a model that is too simple or has the wrong assumptions, so it misses the real pattern.
Variance
Error from a model so sensitive to its training data that its predictions swing when the data changes.
Noise
Random variation in the data itself. No model can predict it.
Underfitting
The model is too simple and does badly even on the data it learned from.
Overfitting
The model learns its training data too closely, quirks included, and does badly on new data.

What does high bias look like, and high variance?

Take the loan-risk model. Plot each applicant's debt ratio against their true risk, and the pattern is a gentle curve. A straight line is too simple for that curve, so the model underfits. It does badly even on the loans it trained on, which is why scikit-learn's guide calls it high bias.

A very wiggly curve does the opposite. It passes through every past loan, then drifts badly on new applicants. Scikit-learn's underfitting example says that, for higher degrees, the model overfits: it learns the noise in the training data.

Loan risk, three models

Too simple

Straight line

misses the curve: high bias

Balanced

Gentle curve

follows the trend, ignores the noise

Too flexible

Wiggly curve

hits every point: high variance

  1. 1More flexibility lets the model follow the real trend, so bias falls.
  2. 2Too much flexibility makes it follow the noise, so variance grows.
The same loan-risk curve, fitted three ways, left to right. Each step adds flexibility. The straight line misses the trend, the gentle curve follows it, and the wiggly curve follows the noise too. The middle one is the balance to look for.
  • High bias

    Bad on training data too

    The model never learns the pattern, so both of its scores are poor.

  • High variance

    Great on training, poor on new

    The model memorised its training set. Its score drops sharply on data it has not seen.

  • Healthy

    Close scores, both good

    Training and new-data scores are close and high. This is the target.

Google defines overfitting, the usual sign of high variance, and scikit-learn defines high variance directly.

  • “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 machine learning course

  • “it is very sensitive to varying training data (high variance)”

    Scikit-learn validation curves guide (section 3.5)

How do you tell which problem you have?

Hold back some data the model never trained on. This is the validation set. Then compare two scores: the training score and the validation score.

If the two sets come from different periods, the world may have changed. That is a data problem, and you should check that the new data matches the training data first.

Scikit-learn's learning curve is a common tool for this. It shows both scores as the training set grows, so you can see whether the model suffers more from variance or from bias.

Here is a worked example with made-up numbers. A mid-size bank trains a model to flag small-business loans that may default. Three attempts look like this:

  1. 1

    Both scores low

    Training 71%, new data 70%, measured as recall (the share of real defaults it flags). The model cannot learn even its own training loans. That usually means high bias: add better features or a richer model, unless the data is so noisy that no model could do much better.

  2. 2

    Training high, new data low

    Training 99%, new data 78%, both measured as recall. It may have memorised the training loans. That usually means high variance: add more loans, add a penalty, or simplify.

  3. 3

    Both scores high and close

    Training 84%, new data 83%, both measured as recall. The gap is small and the level is good. Check it on a later month of loans before you ship.

Tip

Asked what to do next? Check the scores before you ask for more data. Scikit-learn's learning curve guide makes the point with a naive Bayes example: when both scores settle low, more training data helps little.

How do you reduce bias and variance?

The fixes pull in opposite directions, which is why this is called a trade-off. More flexibility lowers bias and raises variance. Less flexibility does the reverse, so the job is finding the balance point. A penalty is one way to get there: the training step charges the model for extra complexity, so it prefers simpler settings.

Which fix for which problem

The problem

High bias

too simple, misses the pattern

High variance

memorises, swings on new data

The fix

Richer model, features

gives it the detail the pattern needs

More data or a penalty

leaves less room to memorise noise

Lowest total error

the goal for any model

  1. 1High bias is treated with more detail, so both scores rise.
  2. 2High variance is treated with more data or a penalty, so the gap closes.
  3. 3A richer model cuts the bias part of the error.
  4. 4More data or a penalty cuts the variance part of the error.
Each problem has its own fix. More detail reduces bias, while more data or a penalty reduces variance. Both paths aim at the lowest total error the model can reach.

Averaging is another classic fix for variance. Scikit-learn's bagging example averages many trees trained on different samples, and it measures the effect directly. The first card is that example. The second is the paper behind the exception below.

  • “averaging several decision trees fit on bootstrap copies of the dataset slightly increases the bias term but allows for a larger reduction of the variance”

    Scikit-learn bagging example

  • “The bias-variance trade-off implies that a model should balance under-fitting and over-fitting”

    Belkin and colleagues, arXiv paper

The classic U-shaped curve has an exception. Belkin and colleagues found that very large modern models can get better again past the point of fitting every training example (researchers call that point interpolation), a pattern they call double descent. Treat the balance as the everyday rule, and check the scores.

Here is a small, made-up check in plain Python. It draws 300 random training sets of 30 customers from one loan pattern, then asks two models for the same new applicant. The flat average misses the true risk and barely moves, which is high bias. The nearest-customer copier lands near it on average but jumps around, which is high variance.

Python
# A made-up loan-risk pattern: the true risk rises with the applicant's debt ratio (x from 0 to 1).
# Each model sees 300 random training sets of 30 customers, then predicts for the same new applicant.
import random
import statistics

def true_risk(x):
    return 0.2 + 0.5 * x

def sample(rng, n):
    xs = [rng.random() for _ in range(n)]
    return [(x, true_risk(x) + rng.gauss(0, 0.1)) for x in xs]

def fit_flat(data):
    # Too simple: always predicts the average risk of its training customers.
    avg = statistics.fmean(y for _, y in data)
    return lambda x: avg

def fit_nearest(data):
    # Too flexible: copies the closest training customer.
    return lambda x: min(data, key=lambda p: abs(p[0] - x))[1]

rng = random.Random(7)
new_applicant = 0.8
for name, fit in [("flat average", fit_flat), ("nearest customer", fit_nearest)]:
    preds = [fit(sample(rng, 30))(new_applicant) for _ in range(300)]
    bias = statistics.fmean(preds) - true_risk(new_applicant)
    spread = statistics.pstdev(preds)
    print(f"{name}: bias {bias:+.3f}, spread {spread:.3f}")

Output

flat average: bias -0.149, spread 0.035
nearest customer: bias +0.003, spread 0.095

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: bias is error from a model too simple for the pattern; variance is error from one too sensitive to its data.
  • Both sit inside the error on new data, next to noise.
  • Diagnose with the two scores: both poor usually means bias, a big gap usually means variance.
  • The fixes differ: a richer model for bias; more data, a penalty or averaging for variance.
  • The trade-off: more flexibility lowers bias and raises variance, so you look for the balance point.
  • An honest exception: very large modern models can improve again (double descent).

Common traps

  • Trap"More data always fixes it."

    BetterMore data mainly reduces variance. A model that is too simple stays too simple however many rows you add.

  • Trap"Lower training error means a better model."

    BetterTraining error can fall while new-data error rises. Judge the model on data it has not seen.

  • Trap"Bias is always bad, so use the most complex model."

    BetterSome bias buys stable predictions. The aim is the lowest total error, which usually means accepting a little bias.

Can you spot the problem?

Spot the problem

A claims-triage model scores 98% on its training claims and 71% on a held-out set of claims from the same months. Which review note is right?

Quick check

A linear model for card fraud, scored by recall (the share of real fraud it catches), gets 62% on training data and 61% on new data. What is the most likely fix?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q413Overfitting vs underfitting?10 min
  2. Q414L1, L2 and dropout regularisation?13 min
  3. Q417What does the learning rate do?Coming soon
  4. Q415What is gradient descent?12 min
  5. Q422Train/validation/test splits?11 min

Learn it in depth

Last updated on 26 November 2026

Building a model that makes real decisions for your team?

I design and build AI products and agents, including the interface and the system behind them. Book a short call and tell me what the model needs to decide.