Chapter 1 · Sutton & Barto

What reinforcement learning is

Reinforcement learning is learning what to do by trying things and seeing what happens. Nobody tells the learner which action is right. It acts, receives a number saying how well things are going, and has to work out for itself which actions lead to more of that number over time, often long after the action was taken.

01Two features that define it

Trial-and-error search. The learner discovers good actions by trying them. There is no teacher with correct answers, only an evaluation of the action actually taken.

Delayed reward. An action can affect not just the next reward but the situation that follows and every reward after that. A chess move may look neutral now and decide the game twenty moves later. Assigning credit for an outcome to the decisions that caused it is the central difficulty.

This sets reinforcement learning apart from supervised learning, which learns from labelled examples of correct behaviour, and from unsupervised learning, which looks for structure in unlabelled data. A reinforcement learner is trying to maximise a reward signal, not to find hidden structure, and in interactive problems it is usually impossible to supply examples of correct behaviour for every situation the agent will meet.

It also brings a trade-off the other settings lack: exploration versus exploitation. To earn reward the agent should repeat actions that worked; to find such actions it must try ones it hasn't. Neither can be pursued alone without failing at the task. Chapter 2 studies this trade-off in its simplest form.

02The elements of a reinforcement learning system

Besides the agent and its environment, four elements recur throughout the book:

PolicyThe agent's way of behaving: a mapping from the situations it perceives to the actions it takes. It can be a lookup table, a simple rule, or a search process, and it may be random.
Reward signalThe goal. At each step the environment sends a single number, and the agent's objective is to maximise the total it receives in the long run. Reward defines what is good immediately.
Value functionWhat is good in the long run: the total reward an agent can expect to collect starting from a state. A state can have low immediate reward but high value because good states usually follow it. Choices are made on values, and estimating them well is the core of most methods here.
Model (optional)Something that imitates the environment, predicting the next state and reward for a given action. Methods that use one for planning are model-based; methods that learn purely by trial and error are model-free.

Rewards are given directly by the environment. Values must be estimated, and re-estimated, from the sequences of observations an agent makes over its whole lifetime. That is why value estimation sits at the centre of almost every algorithm in this series.

03Worked example: learning tic-tac-toe

Suppose you want a player that beats an imperfect opponent at tic-tac-toe. A classical minimax player assumes the opponent plays perfectly and so can never exploit its mistakes. A value-function approach instead learns from play against this particular opponent.

Keep a table with one number per board position: the estimated probability of winning from there. Positions with three X's in a row start at 1, positions that are lost or full start at 0, and every other position starts at 0.5. To move, look at the positions each legal move would produce and usually pick the one with the highest value (a greedy move). Occasionally pick at random instead (an exploratory move) to see positions you'd otherwise never visit.

After each greedy move, nudge the value of the earlier position toward the value of the later one:

The tic-tac-toe value updateV(St) ← V(St) + α [ V(St+1) − V(St) ]

Here St is the position just after one of your moves and St+1 the position after your next move (or the final position, if the game ended in between). The update moves an estimate toward a later estimate: this is a temporal-difference update, the idea developed in chapter 6. Exploratory moves don't trigger an update, so the values keep describing greedy play.

A tic-tac-toe player that learns values

games 0 · positions in table 0 · last 100: won – · draw – · lost –
0.10
0.20

You learn as X and move first; the opponent is O. Small numbers show the value of the position each move would create, at your last decision.

Results over the last 100 games

WonDrawLost

What to try

Notice what this simple method already shows: the player learns from interaction without a model of the opponent, it plans ahead implicitly because values summarise future outcomes, and it improves during play rather than only after a game is fully analysed. It also has limits the book goes on to address: a table works because tic-tac-toe has a few thousand positions, but backgammon has around 1020, which calls for the function approximation of Part II.

04Values versus evolutionary methods

Another way to get a good tic-tac-toe player is to search policy space directly: try many fixed policies for many games each, keep the best, and vary them (as genetic algorithms or hill climbing do). Such evolutionary methods use only the final outcome of each game and ignore everything that happened during it. Value-function methods use each individual state visited, so they can credit specific moves. When the agent can sense its state accurately, learning values usually uses experience far more efficiently.

05Where the field came from

Modern reinforcement learning joined three earlier threads.

06How the rest is organised

Part I (chapters 2–8) develops the core ideas where values fit in a table: bandits, MDPs, dynamic programming, Monte Carlo, temporal difference, n-step methods and planning. Part II (chapters 9–13) extends them to huge state spaces with function approximation, then covers eligibility traces and policy gradient methods. Part III (chapters 14–17) connects the algorithms to psychology and neuroscience, surveys applications, and looks at open problems.