From one knob to attentionChapter 3 of 9

Chapter 3

Which way to turn

Learning means finding the bottom of the valley. But a machine cannot see the valley. This chapter shows how it finds the bottom anyway, and then lets it set knobs with no help from you.

By the end of this chapter, you will be able to

Walking in fog

Here is the valley from chapter 2, with one change. It is covered in fog. This is how a machine sees it. It knows how wrong it is right now, and nothing else.

Try itThe valley is hidden in fog. Step left or right to find the lowest point. All you can see is your own wrongness.
012wrongness (up is worse)0.20.30.40.50.6where the speed knob is setfogfogfogfogfogfog
wrongness1.49

You are at wrongness 1.49. Which way is down? You cannot tell yet. Try a step.

You got there by trying. Take a step. If the wrongness goes up, come back. You even had to walk past the lowest point and see the wrongness rise, just to be sure it was the lowest. It works, but it wastes steps. And with many knobs it gets much worse, because there are many more wrong ways to go.

It would be far better to know which way is down before taking the step.

Feel the ground

Think about real fog on a real hill. You cannot see the bottom. But you can feel the ground under your feet. If it tilts down to the right, you walk right.

The tilt of the ground has a name you already know from chapter 1: steepness. There, the steepness of a line was the speed of the ghost. Here, it is the steepness of the valley floor. We will call it the slope.

Try itThe fog is off for now. Move along the valley and watch the dark line under the point. It shows which way the ground tilts.
012wrongness (up is worse)0.20.30.40.50.6where the speed knob is set
slope heredownhill is to the right →−13.2

Slope −13.2. A minus sign means the ground goes down to the right, so the bottom is to the right. The slope is big, so you are far from the bottom.

The slope is one number, and it tells you two things.

Its sign tells you which way is down. Minus means down is to the right. Plus means down is to the left.

Its size tells you how far you are from the bottom. A big slope means you are high on the valley wall. A small slope means you are nearly there. A slope of zero means you have arrived.

How does a machine feel the slope without seeing the valley? It works out its wrongness where it stands. Then it nudges the knob a tiny bit and works out the wrongness again. If the number went down, that way is downhill. How much it went down tells it how steep the ground is. Two checks, and it knows the slope.

The slope under your feet tells you which way to turn the knob, and how much.

Take a step

Now we can write the rule for a step. It is short:

step = step size × slope, taken downhill

The step size is a small number we choose. For now it is 0.004. Because the step is multiplied by the slope, steep ground gives a long step and flat ground gives a short one.

Try itThe fog is back, but now you can feel the slope under the point. The orange arrow shows the next step. Press the button to take it.
012wrongness (up is worse)0.20.30.40.50.6where the speed knob is setfogfogfogfogfogfogthis stepslope here−17.6× step size0.004move knob0.070 →
wrongness1.82
speed knob: 0.220

Step 1. The steeper the ground, the longer the arrow. Watch it shrink as the point gets close.

Compare this with your walk in the fog. No step was wasted. And the steps slowed down by themselves near the bottom, because the ground there is nearly flat.

Feel the slope. Take a step downhill. Repeat. That is how a machine learns.

How big a step?

We chose a step size of 0.004. Was that a good choice? Try some others.

Try itPick a step size and watch twelve steps. Try all four.
012wrongness (up is worse)0.20.30.40.50.6where the speed knob is set
step size
step = 0.004 × slope

Pick a step size to start.

If the step size is too small, learning is slow. If it is too big, each step jumps over the bottom. If it is much too big, the machine jumps further away every time and never learns at all.

The step size has to be chosen with care. It is one of the first things people set when they train a machine.

Two knobs, no hands

Remember the rider with a head start, at the end of chapter 1? It needed two knobs, and they were fiddly to set by hand. Fixing one spoiled the other.

A machine does not mind. It feels a slope for each knob: “if I turn only this knob, does the wrongness go up or down?” Then it turns every knob a little, each one downhill. Then it does it again.

Try itHands off. Press the button and watch the machine turn both knobs by itself. On the right, the same steps are a ball rolling down a valley. Drag the valley to turn it.
0 km1 km2 km3 km4 km5 km6 km7 km0246810minutes since the clock startedthe rule’s linewrongness for every pair of settingsdrag to turn itspeed knobhead start knob00.603lowest point
speed0.08
head start0.3
wrongness5.85
distance = 0.08 × minutes + 0.3

The knobs are set badly, and the wrongness is 5.85. In chapter 1 you fixed this by hand. Let the machine do it.

Look at what you just watched. Nobody told the machine the speed or the head start. It found them. All it had was the dots, a way to measure its wrongness, and the habit of stepping downhill.

With one knob, the valley was a curve. With two knobs it is a real valley, with a floor and two walls, like the one in the picture. Every spot on it is one pair of settings. With a billion knobs, it is a shape nobody can picture. It does not matter. The method is the same: one slope for each knob, one small step for each knob, again and again.

This is the engine of the whole article. Every machine from here on, up to attention, learns in exactly this way.

What is missing

So far the rule has had one thing going in: time. Most things in life depend on more than one thing. The price of a house depends on its size, its age and where it is. The next word in a sentence depends on all the words before it.

The next chapter gives the rule many things to look at at once, and a knob for each.

You can now