✎ Edit content·DAY 007 · POST 3 OF 5 · How It Works

How Models Learn (Intuition)

AI Fundamentals · 12 slides
DAY 007 · POST 3 OF 5
(REMINDER)
DAY 007
How the Dials Turn
@saurav_dnj_24github.com/SauravDnj · linkedin.com/in/sauravdnj
1 / 12

Theme

Palette

Download

4K — sharpest, slowest
🎬 Video options
Preparing preview…
Live preview · loops the “none” effect
All rendering runs in your browser. No server, no cost, no upload. MP4/WebM = full motion + effects · GIF = lightweight loop · PNG/PDF = static for the Instagram & LinkedIn carousel.

Caption (tap to copy)

📖 Deep dive (full written explanation)

The slides stay clean and scannable. Here's the in-depth explanation behind each one — great for the blog version, show notes, or studying the topic properly.
Slide 1 · How the Dials Turn

Now we open the hood. The previous posts gave you the loop and the stakes; this one shows the actual mechanism that turns the dials. The reassuring part is that the deep math reduces to a single, vivid picture: walking downhill on a landscape of error until you reach a low valley.

We'll keep every term grounded in that picture — loss, gradient, gradient descent, learning rate, epochs — so the machinery stays intuitive even though it's the literal engine of modern AI.

Slide 2 · Loss = a number to shrink

Loss is the number that makes learning possible. A loss function takes "how wrong was this prediction" and collapses it into one scalar: large when the model is bad, near zero when it's good. Without this single number there'd be nothing concrete to minimize.

The most common starter loss is mean squared error — average the squared gaps between predictions and truth. Squaring punishes big mistakes harder and keeps everything positive. The exact formula matters less than the role: loss is the quantity the entire training process exists to shrink.

Slide 3 · Loss is a landscape

Picturing loss as a landscape is the single most useful mental model in this post. Plot the loss against the model's settings and you get a surface with peaks where the model is terrible and valleys where it's good. The model's current settings are a point on that surface.

Training is the search for a low valley. With two parameters this is a literal 3D terrain you could draw; with millions it's an unimaginable high-dimensional version, but the intuition survives. You're always trying to get to lower ground.

Slide 4 · Walking downhill

This bar chart shows what a healthy training run looks like: loss starts high with random settings and drops, fast at first and then more gently, as the steps carry the model into a valley. The shape — steep then flattening — is the canonical signature of learning working.

When you train real models, this curve is the first thing you watch. A smoothly descending loss means the engine is running; a flat, bouncing, or rising curve is your earliest warning that something — usually the learning rate or the data — is wrong.

Slide 5 · Gradient = the downhill arrow

The gradient is how the model knows which way is downhill without being able to see the whole landscape. At your current point, the gradient is the slope: it points in the direction loss increases fastest. So to reduce loss, you step in the exact opposite direction.

That single move — compute the slope, step against it — is gradient descent. Calculus gives us the gradient cheaply even for billions of parameters at once, which is the only reason training huge models is feasible at all.

Slide 6 · One training step

These five actions are one training step, the atom of the whole process. Predict on a batch of examples; compute the loss; compute the gradient to learn which way is uphill; step the opposite way to go downhill; then repeat with the next batch.

Real training stacks thousands to millions of these steps. Each one is a tiny, local improvement. Learning is the accumulation of an enormous number of small, well-aimed nudges — there is no single moment where the model suddenly "gets it."

Slide 7 · Gradient descent by hand

This code does gradient descent on a single dial w by hand so nothing is hidden. pred is the guess, loss measures the squared error, and grad is the slope of that loss with respect to w. The line w -= lr * grad takes the downhill step.

Run it and w marches toward the value that best fits the data. The same pattern, generalized to many parameters and computed automatically, is exactly what frameworks like PyTorch do — they just calculate grad for you and apply it to millions of dials at once.

Slide 8 · The learning rate is touchy

The learning rate sets how big each downhill step is, and it is one of the touchiest knobs in all of ML. Too large and you leap clear across the valley, overshooting the bottom and possibly bouncing outward until the loss explodes. Too small and you inch along, taking forever and sometimes stalling on flat ground.

There's no universal right value; it depends on the model and data, which is why practitioners sweep over several rates or use schedules that shrink the rate over time. Get it wrong and even a perfect setup won't learn.

Slide 9 · Learning rate extremes

This comparison spells out the two failure modes so you can recognize them from a loss curve. Too high: the loss bounces around or shoots upward because each step overshoots, and the model never settles. Too low: the loss barely moves, training crawls, and it may stall before learning anything useful.

The healthy middle produces the smooth, decelerating descent from earlier. Reading which side you're on from the curve's shape is a core practical skill — and usually the first diagnosis when training misbehaves.

Slide 10 · Epoch vs batch vs step

These three words get mixed up constantly, so pin them down. A step is one update of the dials using one batch of examples. An epoch is one complete pass over the entire training set. An iteration usually means one step.

Real runs use many epochs, and within each epoch the data is chopped into batches, so the model takes many steps per epoch. Saying "trained for 10 epochs" describes how many full passes; the actual number of dial-turns is epochs times batches-per-epoch.

Slide 11 · Stuck spots

Gradient descent isn't guaranteed to reach the lowest point, and this diagram names the traps. A local valley is low but not the lowest; a plateau is flat, offering no slope to follow; a saddle point goes down in one direction and up in another, confusing simple descent.

In practice, tricks help the ball keep rolling: momentum carries it through flat and bumpy spots, adaptive optimizers like Adam adjust step sizes per parameter, and random restarts or noise can knock it out of bad spots. High-dimensional landscapes turn out to be friendlier than this 2D picture suggests, which is part of why deep learning works at all.

Slide 12 · Save this. Follow for Day 8.

You now have the engine. The next post stops describing and starts running: a full, paste-and-watch training loop where you literally see the loss fall from nonsense to a tight fit. Seeing the numbers move makes everything here permanent.

🎨 AI image prompt (matches this theme + palette)

Paste into Midjourney, DALL·E, Ideogram, etc. to generate an on-brand image, then upload it on the Edit content page. The prompt updates automatically with the selected theme + palette.