Lai Learns Neural Networks

Lesson 08·The morning shower·4 min read

Turn Not the Tap Too Boldly, Lest Thou Be Scalded

The learning rate: how big each correcting step should be

“Every morning I’d wrench that hot tap like it owed me money, and every morning I’d jump out of there yelling. Then one day I just turned it a little, and waited, and turned it a little more. I don’t know. It felt like the first smart thing I’d done all year.”

Invented, in the spirit of J.D. Salinger

Welcome back

Last time, we were lost in the fog. We learned about gradient descent: the network feels the slope of the loss under its feet and takes a small step downhill, over and over, until it reaches a valley.

But we skipped over one quiet little word: small. How small should each step be? It turns out this choice matters enormously. To feel why, let’s step into the shower.

The shower that’s never right

You know this moment. You step into the shower and the water’s freezing. You reach for the hot tap.

If you turn it a tiny fraction, you wait. And wait. The water creeps from freezing to merely cold, then to cool. You’ll get there eventually, but you might be late for work.

If you crank it all the way, a moment later you’re scalded. You lunge for the tap and twist it back hard, and now it’s freezing again. Back and forth you go, overshooting each time, never quite settling.

If you turn it a sensible amount, then wait and adjust, you’re standing in warm water within a few seconds.

You’ve been solving the learning-rate problem every morning of your life.

The learning rate

In gradient descent, the gradient tells the network which direction to move each weight. The learning rate decides how far to move it. It’s a single number, chosen by the person training the network, that sets the size of every step.

Each weight changes by roughly:

learning rate × the slope for that weight

So a bigger learning rate means bolder steps, and a smaller one means more cautious steps.

Too small, too large, just right

Let’s go back to the foggy hillside from last time, now with the shower in mind.

There is no single perfect value that works for every network. People usually try a few and watch how the loss behaves. If it creeps down slowly, they try a bigger value. If it leaps around, they try a smaller one.

A clever compromise

Many people use a gentle trick: start with a larger learning rate and gradually make it smaller as training goes on. It’s like turning the tap generously at first, while the water is still freezing, and then making finer and finer adjustments as you get close to the perfect temperature.

This idea, changing the learning rate as training goes on, is often called a learning rate schedule.

What to carry with you

In one line

The learning rate sets how big each step of gradient descent is. Too small is slow, too large overshoots, and a good one settles gently into the valley.

Next time

We’ll put on a detective’s coat. We know the network went wrong, and we know which way is downhill. But with millions of weights spread across many layers, how do we work out which ones were to blame? Next time: backpropagation, tracing the blame backward through every door.