Saraswati Stitch needle-and-thread markSaraswati Stitch®
contact@saraswatistitch.comBook a call
← Glossary

Definition

Overfitting

Overfitting is when a machine learning model learns its training data too closely, including its noise and quirks, so it performs well on the examples it has seen but poorly on new data.

In simple terms, the model memorised the answers instead of learning the lesson. A student who memorises past exam papers word for word may score perfectly on those papers and fail a new one. An overfit sales forecasting model might match past months exactly because it learned one-off events, then miss badly next quarter.

Underfitting is the opposite: the model is too simple to capture the real pattern and does badly on both training and new data. The goal is a model that generalises, which Google machine learning course describes as making good predictions on new data rather than only on the data it trained on.

How do you know you are overfitting? Hold back part of your data the model never trains on. If accuracy is high on training data and much lower on that held out set, the model is overfit. Is 99 percent accuracy overfitting? Not by itself. It depends on the held out score, and on the data: if 99 percent of cases belong to one class, a model that always guesses that class scores 99 percent and is useless. Common fixes are more and more varied data, a simpler model, regularisation, stopping training earlier, and cross validation. The same idea applies to prompts and AI agents: a prompt tuned only on five hand picked examples can fail on the sixth, which is why we evaluate on a wider set of real cases before launch.

Related terms

  • Machine learning: Machine learning is a branch of AI where a system learns patterns from data and improves at a task through examples, instead of being programmed with explicit rules.
  • Model training: Model training is the process of teaching an AI model by showing it data and adjusting its internal parameters until it performs the task well, which is done once up front and is computationally expensive.
  • Evaluation (evals): An evaluation, or eval, is a repeatable test that measures how well an AI system does its job on real examples, so you can tell whether a change made it better or worse.
  • Supervised learning: Supervised learning is a machine learning method where a model learns from labelled examples, pairs of inputs and correct answers, so it can predict the answer for new inputs it has not seen before.