Introduction to AI Lesson 17 of 25

Part 2 · Lesson 7 · 5 min

Reinforcement learning: trial, error and reward

How did a computer learn to beat the world's best Go players by playing against itself?

No answer key. Just millions of games, and a point for every win.

So far the machine has learned from examples, with or without answers. There is a third way: let it try things and tell it, afterwards, whether that went well.

This is reinforcement learning. It is exactly how you train a dog with treats.

Try, get rewarded, repeat

Nobody shows the dog the right answer. It just notices which actions bring treats, and does more of those.

From luck to strategy

A machine does the same thing, only much faster. It can play a game or run a simulation thousands of times a minute, keeping score as it goes.

Thousands of tries make a strategy

Early tries are mostly random. Slowly the moves that led to rewards win out, and a strategy appears.

The hard part: choosing the reward

The machine does not understand your goal. It only chases the score you gave it. If the score and the goal differ, it will find the gap.

Be careful what you reward

This is called reward hacking, and it is not a joke from a cartoon. Real systems have found loopholes like this, which is why designing the reward is the real human work.

Go deeper optional

AlphaGo, from DeepMind, beat the Go champion Lee Sedol in 2016. It first studied human games, then improved by playing millions of games against itself. A later version, AlphaGo Zero, skipped the human games entirely and learned from self-play alone.

A form of reinforcement learning also helped shape chatbots like ChatGPT. People rated the chatbot's answers, and those ratings became the reward. This is called learning from human feedback, and Part 6 covers it.

Check yourself

1. In reinforcement learning, what guides the learner?

2. A cleaning robot rewarded per item picked up starts tipping over bins. Why?