Overfitting & Regularization

Why Models Memorize and How to Make Them Generalize

Difficulty
Intermediate
Duration
15-18 minutes
Prerequisites
Neural network training

What You'll Discover

Learn to spot overfitting and fix it with regularization

Spotting Overfitting

Read training vs validation loss curves to diagnose when your model memorizes instead of learns.

Bias-Variance Tradeoff

Understand why model complexity is a balancing act between underfitting and overfitting.

Dropout & Weight Decay

See how randomly disabling neurons and penalizing large weights prevent memorization.

Early Stopping

The simplest trick — stop training at the right moment before overfitting begins.

Key Concepts

Overfitting

Model memorizes training data, fails on new data

Bias-Variance Tradeoff

Balance between too simple and too complex

L2 Regularization

Penalizes large weights to keep them moderate

Dropout

Randomly disables neurons during training

Early Stopping

Stop training when validation loss rises

Generalization

The real goal — perform well on unseen data

Step
1/ 8

What is Overfitting?

Imagine a student who memorizes every answer in the textbook but can't solve new problems on the exam.

That's overfitting! The model learns the training data too well — including its noise and quirks — and fails on new data it hasn't seen.

The goal isn't to memorize. It's to generalize.

The opposite problem is underfitting — like a student who barely studied and can't even answer the textbook questions.

The sweet spot? A model that learns the real patterns without memorizing the noise.

The Fitting Spectrum

ProblemWhat HappensAnalogy
UnderfittingToo simple — misses the patternStudent who didn't study
Good FitCaptures the pattern, ignores noiseStudent who understands concepts
OverfittingMemorizes everything, even noiseStudent who only memorized answers

Key Signs

MetricUnderfittingGood FitOverfitting
Training LossHighLowVery Low
Validation LossHighLowHigh!
GapSmallSmallLarge gap