0Pricing
Deep Learning Academy · Lesson

Read the Train/Val Gap

Spot overfitting from the loss curves.

Read the Train/Val Gap is a free Deep Learning Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Deep Learning Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What Overfitting Means

Overfitting happens when your model memorizes the training data instead of learning patterns that work on new, unseen examples. 🧠

Two Curves to Watch

You track two losses: the training loss on data the model learns from, and the validation loss on data it never updates on.

The Train/Val Gap

The gap is the distance between training loss and validation loss. A small gap means your model generalizes well to fresh data.

A Healthy Fit

When both losses fall together and stay close, you have a good fit. The model is learning real structure, not noise.

Spotting Overfitting

Overfitting shows up as training loss still dropping while validation loss flattens or rises. The gap widens.

Spotting Underfitting

If both losses stay high and never improve much, the model is underfitting. It is too simple to capture the patterns.

Why You Need a Val Set

Training accuracy can lie. A separate validation set is your honest signal for how the model behaves on data it has not seen.

Log Both Losses

Record both losses every epoch so you can plot them. The shape of these curves tells you exactly what is going wrong.

train_losses.append(train_loss)
val_losses.append(val_loss)
print(epoch, train_loss, val_loss)

The Overfitting Elbow

Watch for the elbow: the epoch where validation loss bottoms out and starts climbing. That is the moment overfitting begins.

More Data Helps

One of the simplest cures for a wide gap is more training data, which makes memorization harder and patterns clearer.

Gap Guides Your Fixes

The size of the gap tells you what to try next: regularize a wide gap, or grow the model when both losses stay high.

Quick Check

Read the curves and tell overfitting apart from a healthy fit.

Recap

You learned to read the train/val gap: close curves mean a good fit, a widening gap means overfitting, and both high means underfitting. 📈

Frequently asked questions

Is the “Read the Train/Val Gap” lesson free?

Yes — the full text of “Read the Train/Val Gap” is free to read here on the web, and the Deep Learning Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Deep Learning Academy course, upgrade to CoddyKit PRO.

What will I learn in “Read the Train/Val Gap”?

Spot overfitting from the loss curves. You practise Deep Learning Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Deep Learning Academy?

No prior experience is required. Deep Learning Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Read the Train/Val Gap” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Deep Learning Academy lesson?

Yes. Every Deep Learning Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Read the Train/Val Gap
  2. Dropout: Randomly Drop Neurons
  3. Batch Norm & Layer Norm
  4. Data Augmentation as Free Data
← Back to Deep Learning Academy