Large Programs

Home / How LLMs Work

How LLMs Work

Overfitting: When a Model Memorises Instead of Learning

A model that matches its training examples too closely can fail on new ones. A simple explanation of overfitting, with a study-for-the-test comparison.

27 November 2026 · 2 min read

Overfitting happens when a model matches its training examples too closely or exactly, and so may fail on new examples or make unreliable predictions. In Wikipedia's words, the model has picked up some of the random noise in the data as if it were the real pattern.

Made-up example: a purple wiggly line through the training dots and a green straight line, with hollow new dots that sit closer to the straight line.

A study-for-the-test comparison

Imagine a student who memorises the exact answers to last year's test and nothing else. On last year's test they score perfectly. On a new test with different questions, they do badly. They memorised instead of understanding. An overfitted model is like that student.

What the picture shows

Wikipedia gives a figure of noisy data that looks roughly like a straight line. A wiggly polynomial curve can pass through every training point exactly, but a straight line is expected to make better predictions on data beyond the examples. A model that fits every dot is not automatically the better one.

Why extra parameters can cause it

An overfitted model, Wikipedia says, is one that contains more parameters than the data can justify. Parameters are the adjustable numbers inside a model (see what parameters are). Too many knobs can fit the noise.

The opposite problem: underfitting

A model can also be too simple. Wikipedia's example is a straight line that can never fit a curved shape (a parabola). That is called underfitting.

Why it matters for AI

The goal of supervised learning is to give good answers on new data, not only on the examples it trained on. So people test a model on examples it did not see while training. A model that does well on training data and poorly on new data may be overfitted.

Try it

Draw ten dots that roughly follow a line. Now draw a curve that goes through every dot, wiggling as needed. Draw a straight line near them. Pretend a new dot appears just beyond the last one. Which drawing predicts it better?

Sources