---
title: Overfitting
description: 'A failure to generalize in which performance on development data is better than performance on representative unseen data.'
canonical_url: 'https://darkfactory.dev/glossary/overfitting'
markdown_url: 'https://darkfactory.dev/glossary/overfitting.md'
collection: glossary
date_published: '2026-08-03T00:00:00-04:00'
date_modified: '2026-08-26T00:00:00-04:00'
---

# Overfitting


## Definition

Overfitting occurs when a learned system performs better on the examples used to develop it than on representative new examples. It has learned details that help on the development sample but do not carry to the target distribution. The evidence is a generalization gap, not merely a large model or a low training loss.

The development process can overfit even when model weights never see the test examples. Repeatedly choosing hyperparameters, prompts, tools, or model versions against one benchmark makes that benchmark part of development. Public leaderboards create the same risk when teams can make enough submissions or inspect the cases.

Training and validation curves can reveal one common pattern: training performance keeps improving while validation performance stops improving or worsens. One split is not conclusive. Small samples, label noise, distribution shift, and duplicate examples can create similar gaps. Strong evidence uses clean lineage, representative held-out data, and more than one independent evaluation when the decision warrants it.

Regularization, more representative data, data augmentation, simpler models, and early stopping can reduce overfitting. None is a substitute for a valid test set. A technique that closes one benchmark gap may still fail under temporal, geographic, or operational shift.

In software-agent evaluation, visible tests create an analogous problem. An agent can change code until those tests pass without satisfying the underlying requirement. SpecBench documents this gap between apparent and intended task satisfaction and finds that it widens with codebase size.

## Distinguish it from nearby terms

Memorization is learning particular examples; overfitting is the resulting failure on new data. Data leakage puts information where the procedure says it should not be. Leakage can cause overfitting or inflate an evaluation, but the terms describe different failures.

## Check your understanding

A model gets 99 percent accuracy on a public benchmark after 300 rounds of prompt and hyperparameter changes, then falls to 81 percent on a hidden benchmark drawn the same way. Which result measures development fit, and what evidence is needed before claiming generalization?

## Related terms

- [Generalization](https://darkfactory.dev/glossary/generalization)
- [Regularization](https://darkfactory.dev/glossary/regularization)
- [Evaluation (eval)](https://darkfactory.dev/glossary/evaluation)

## Related factory areas

- [Verification, evaluation & quality truth](https://darkfactory.dev/factory/verification)

## Evidence and further reading

- [Google Machine Learning Glossary](https://developers.google.com/machine-learning/glossary/)
- [SpecBench: the reward-hacking gap grows with codebase size](https://arxiv.org/abs/2605.21384)
- [Deep Learning](https://www.deeplearningbook.org/)
- [Dropout: A Simple Way to Prevent Neural Networks from Overfitting](https://www.jmlr.org/papers/v15/srivastava14a.html)
