Introduction to Reinforcement LearningPart 1 · Foundations

Lecture 1Introduction

What reinforcement learning is and why it matters, the agent–environment loop, rewards, returns and values, what an agent can know about its world, and the three parts an agent can have: a policy, a value function and a model. Meet Bit, the little robot who learns by trying.

By the end you should be able to say what an RL agent is trying to do, write down the return and the value, and name the parts an agent can have.

Key ideas, one per episode

  • Ep. 1Learn on the way. Your choices shape your data.
  • Ep. 2Pick the reward well; chase the expected total.
  • Ep. 3Bit acts on the state he builds.
  • Ep. 4Policy picks. Value judges. Model imagines.
  • Ep. 5Predict to judge, control to act.

Based on: Lecture 1: Introduction, DeepMind × UCL Reinforcement Learning Lecture Series (2021), by Hado van Hasselt. The slides follow that order of topics, in our own words, figures and examples; they are not official material of the original course.

The title slide of Lecture 1: Introduction

62 slides, written to be read on your own, with worked examples, “try it” boxes, small simulations and check-yourself questions (answers at the end). PDF, 2.6 MB.

Watch

5 short episodes of ACML Explains for this lecture. Pick one from the list, and open the transcript to read along: each timestamp plays the episode from there. The narration is generated with a voice clone of Teddy, used with his permission.

Episode 1 · 3:14

Bit learns to get the star

How do you learn when nobody hands you the answers? Meet Bit, a tiny robot who learns the way kids do: by trying.

Learn on the way. Your choices shape your data.

TranscriptEpisode 1

Recorded forever

Quick warning: everything here is recorded forever. So think before you speak. Okay. This is Bit, and this is reinforcement learning. Let's start with the simplest part.

What you already know

You know machine learning, right? Supervised: you have X, you have Y, and you look for a function from X to Y. Unsupervised: you only have X, and you look for structure. Clusters, anomalies. What do they have in common? The data was there in advance. And the learning was passive, like a scientist watching nature. With me so far?

How does a kid learn?

Now forget computers. How does a kid learn? Show him a thousand pictures of cats and dogs, and he still doesn't know what's good or bad. He needs feedback. Here's a boiling pot. Bit touches it. Ouch! Pulls back. And never does that again. Did Bit have data in advance? No. Bit started with nothing.

Why learn on the way?

Why learn along the way, and not at the end? If Bit only learned at the end, it would keep touching the pot, over and over, until the statistics kick in. By then, evolutionarily, Bit is toast. So we learn on the way, from rewards and punishments. That's reinforcement learning.

Two differences

Two things make it different. One: the data arrives along the way. Bit acts, the world answers with what Bit sees and a reward, Bit scribbles it down, and tries again. Two, and this is the important one: the learning is active. What Bit learns changes what data Bit gets next. Bit avoids the pot, so it never samples the pot again. Bit just shaped its own future data. Cool?

Isn't that just a loss function?

Isn't that just a loss function? Great question. How many forests do you burn before a supervised model learns that burning forests is bad? Better to catch the signal in the middle, not at the end.

Chase the total

And Bit doesn't chase the next reward. It chases the total. Grab every shiny pebble, and the gate shuts behind you. Skip them, and you reach the big star.

Learn, decide, reach goals

There are many definitions of intelligence. One I like: the ability to learn, make decisions, and reach goals. Supervised and unsupervised learning don't make decisions. Bit does.

A bit of history

A bit of history. The industrial revolution automated our muscles. The digital revolution automated memory and math. My vote for the software that changed humanity the most? Excel. Now we're automating decisions. Every AI wave promises us the Terminator. Let's see if we get there this time.

The big question

So, two things to remember. In reinforcement learning, the data arrives along the way, and your choices shape your data. With me so far? Next time: is every goal really just… stars?

Play

Games that go with this lecture, and what to look for while you play.

Markov’s Maze

A maze where every step is a roll of the dice.

In this lecture: Play a few levels before the lecture: you choose a move, the maze answers, and the outcome is not always the one you chose. That is the agent–environment loop from the inside.

Each rune tile resolves your move with its own five probabilities: where you meant to go, the opposite way, left, right, or stay. Reach the goal seal without falling into traps or lava, while cursed knights patrol.

Echo Heist

Teach a little robot. Steal back a city.

In this lecture: Echo Heist asks you to decide what your robot partner observes, which actions it has and what counts as success: the state, actions and reward of this lecture.

Choose what your partner Echo senses, which actions it can take and what success means, then let a real learner train in your browser: tabular, planning, policy-gradient, deep-RL or imitation. When the door opens, the policy is frozen and Echo runs with what it learned.

Pirates War RL

Code your captain. Read the sea.

In this lecture: Fog battles give each fleet only a partial view of the sea, so a good captain must build its own agent state from what it has seen.

A naval strategy game where every decision belongs to an agent. Write your own captain in sandboxed JavaScript, Dense JSON or a restricted TensorFlow.js package, then raid, defend and capture flags against rival agents, with or without fog of war.