Preface

Reinforcement learning is learning what to do — how to map situations to actions — so as to maximize a numerical reward signal, by an agent that is told nothing about which actions to take and must discover it by trying them.Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL http://incompleteideas.net/book/the-book-2nd.html Richard Sutton and Andrew Barto’s Reinforcement Learning: An Introduction is the book that defined the field: its first edition (1998) gave the subject its vocabulary, and its second edition (2018) rebuilt it around function approximation, off-policy learning and policy gradients, just as deep reinforcement learning was making the ideas famous.Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. MIT Press, Cambridge, MA, 1998

This companion is a guide to the second edition. It is shorter than the original and organized around the few ideas that do almost all the work:

  • Values and the Bellman equations. A value is the expected return from a state, and it satisfies a one-step consistency condition; nearly every algorithm is a way of solving that condition approximately, from experience or from a model (Chapter 3).
  • Generalized policy iteration. Evaluation drives the value function toward the policy’s true values, improvement makes the policy greedy with respect to the values, and the two processes, interleaved at any granularity, meet at optimality (Section 4.7).
  • Sampling and bootstrapping. Dynamic programming bootstraps (it updates estimates from estimates) but needs a model; Monte Carlo samples but waits for the end of the episode; temporal-difference learning does both (Chapter 6), and n-step returns and eligibility traces fill the space between (Chapter 7, Chapter 12).
  • On- and off-policy learning. Learning about a policy other than the one being followed is what makes exploration and planning work, and, together with bootstrapping and function approximation, what makes learning unstable (Section 11.3).
  • Approximation and gradients. When states are too many, values and policies become parameterized functions, learned by (semi-)gradient methods (Chapter 9, Chapter 13).

The chapters follow the original’s order, in three parts: tabular methods (bandits, finite MDPs, dynamic programming, Monte Carlo, temporal-difference and nn-step methods, planning), approximate methods (prediction, control, off-policy learning, eligibility traces, policy gradients), and a final part on psychology and neuroscience, case studies and the frontiers. The original’s introductory chapter opens the first part, and its two chapters on psychology and on neuroscience are merged into one. The derivations are written out; the convergence arguments the book omits or only sketches are proved, or sketched with a reference, using the tools collected in Appendix A; and each chapter ends with a few exercises with worked solutions.

0.1Algorithms, Reproduced Symbolically

The central algorithms and results are reproduced in the Wolfram Language, symbolically: an update rule is written as a function and run on parametric inputs, such as a discount γ\gamma, a step size α\alpha or a small Markov decision process with symbolic dynamics, and its outcome is compared with the closed form in the text. After kk sweeps of symbolic policy evaluation the error is exactly (γ𝐏π)k(\gamma\mathbf{P}_\pi)^k times the initial one, so the iterates converge to (𝐈−γ𝐏π)−1𝐫π(\mathbf{I} - \gamma\mathbf{P}_\pi)^{-1}\mathbf{r}_\pi; the expected TD update has the predicted fixed point; the policy gradient theorem agrees with a direct differentiation of J(𝜽)J(\boldsymbol{\theta}). These checks run in the JavaScript mode of wolfram-ws-bridge, and every formula shown under a code block is the kernel’s own output, typeset with KaTeX; Notation and Conventions explains the conventions. The figures were also drawn by the Wolfram kernel, from exact formulas rather than random simulations wherever possible.

0.2Beyond the Book

The field moved fast after 2018. Where a chapter’s ideas grew into something important — regret-optimal exploration, AlphaZero and MuZero, distributional and offline reinforcement learning, proximal policy optimization, reinforcement learning from human feedback and from verifiable rewards — the chapter says so, briefly and with the primary sources, in sidenotes marked Beyond Sutton and Barto (2018) and in a closing section.