Reinforcement Learning: An Introduction (2nd edition)
TL;DR. The standard RL textbook, free online as a PDF. Do not read it cover to cover for the LLM path. Chapters 3–6 and 13 (about 114 pages) give you MDPs, Bellman equations, dynamic programming, Monte Carlo, TD learning and policy gradients with the cleanest notation anywhere. Section 11.3 (the deadly triad), 12.1 (the λ-return) and 17.4 (designing reward signals) are short, high-value detours.
Why it matters now. When an LLM-RL paper writes , , or “semi-gradient”, it uses this book’s notation. Section 16.7 (personalized web services) is an IR-adjacent case study of contextual bandits. And Section 17.4 on reward design reads like a prologue to the reward hacking literature.
Book facts (checked)
Section titled “Book facts (checked)”- Official page: incompleteideas.net/book/the-book-2nd.html, with the full PDF, code, errata and solutions links. Second edition, MIT Press, 2018.
- Structure: Ch 1 introduction; Part I tabular methods (Ch 2–8); Part II approximate methods (Ch 9–13); Part III looking deeper (Ch 14–17: psychology, neuroscience, applications, frontiers). The preface marks sections that are more difficult and not essential to the rest of the book with an asterisk.
- Page numbers below are the printed page numbers in that PDF.
Chapter map
Section titled “Chapter map”| Ch (page) | Title and sections to read | Prepares you for | Priority |
|---|---|---|---|
| 1 (p. 1) | Introduction | Vocabulary | Skim |
| 2 (p. 25) | Multi-armed Bandits; 2.8 Gradient Bandit Algorithms (p. 37) is the first baseline | Entropy mechanism (exploration), REINFORCE (baseline idea) | Optional |
| 3 (p. 47) | Finite MDPs: 3.1 agent–environment interface, 3.3 returns and episodes, 3.5 policies and value functions (p. 58; Bellman equation 3.14), 3.6 optimal policies | MDPs and returns, Value functions and Bellman | Core |
| 4 (p. 73) | Dynamic Programming: 4.1 policy evaluation, 4.2 improvement, 4.3 policy iteration, 4.4 value iteration, 4.6 generalized policy iteration | Value functions and Bellman | Core |
| 5 (p. 91) | Monte Carlo Methods; 5.5 off-policy prediction via importance sampling (p. 103) | MC, TD, Q-learning; the ratio in PPO | Core |
| 6 (p. 119) | Temporal-Difference Learning: 6.1 TD prediction (update 6.2), 6.4 Sarsa, 6.5 Q-learning (p. 131; update 6.8), 6.7 maximization bias and double learning | MC, TD, Q-learning, DQN | Core |
| 7 (p. 141) | n-step Bootstrapping | GAE (n-step advantages) | Skim 7.1 |
| 8 (p. 159) | Planning and Learning with Tabular Methods: 8.2 Dyna, 8.10 rollout, 8.11 MCTS | Planning in agents, stage 8 | Later |
| 9–10 (p. 197, 243) | On-policy prediction and control with approximation (semi-gradient methods, 9.7 neural networks) | Value heads in Actor-critic | Skim 9.3 |
| 11 (p. 257) | Off-policy Methods with Approximation; 11.3 The Deadly Triad (p. 264) | DQN, why critic-free methods are attractive | Read 11.3 |
| 12 (p. 287) | Eligibility Traces; 12.1 The λ-return (p. 288) | GAE | Read 12.1 |
| 13 (p. 321) | Policy Gradient Methods: 13.1 advantages of policy approximation (Example 13.1), 13.2 policy gradient theorem (p. 324), 13.3 REINFORCE (p. 326), 13.4 with baseline (p. 329), 13.5 actor–critic (p. 331) | REINFORCE, Actor-critic, RLOO, GRPO | Core: most important |
| 14–15 (p. 341, 377) | Psychology; Neuroscience | Not on the LLM path | Skip |
| 16 (p. 421) | Applications: 16.5 Atari, 16.6 Go, 16.7 personalized web services | Context; 16.7 for IR readers | Optional |
| 17 (p. 459) | Frontiers: 17.3 observations and state, 17.4 designing reward signals (p. 469) | Rewards map, Specification gaming | Read 17.4 |
Suggested order: Ch 3 → 4 → 5 (through 5.5) → 6 (through 6.5) → 13 → 12.1 → 11.3 → 17.4. Pair each with the matching Silver lecture if you prefer to watch first.
The equations you will see quoted everywhere
Section titled “The equations you will see quoted everywhere”- Bellman equation for (3.14): .
- TD(0) update (6.2): . The bracket is the TD error.
- Q-learning (6.8): the same, with target . It learns whatever policy generated the data.
- REINFORCE (13.8): . The ratio is , which the book calls the eligibility vector. Dividing by stops frequently chosen actions from winning just because they are updated more often. The text works with ; the boxed pseudocode is the discounted version and therefore carries an extra .
- REINFORCE with baseline (13.11): replace with . Because , the expected update is unchanged for any baseline that does not depend on the action, but the variance can drop a lot (Figure 13.2, short corridor).
- The deadly triad (11.3): function approximation + bootstrapping + off-policy training. With all three, instability and divergence can occur, even in planning with a known model. With any two, it can be avoided.
Why stochastic policies matter (Example 13.1). In the “short corridor with switched actions”, every state looks the same to the features. An ε-greedy action-value method can only choose between “mostly right” and “mostly left”, worth less than −44 and −82 with ε = 0.1. The best stochastic policy picks right with probability about 0.59 and gets about −11.6. A policy-gradient method can learn that probability directly.
Worked example: the search toy in the book’s notation
Section titled “Worked example: the search toy in the book’s notation”Toy (shared with the course map): in s₀ the agent can search (reward −0.1, go to s₁) or answer (+1 with probability 0.2). In s₁, answer pays +1 with probability 0.9 and search costs −0.1 and stays in s₁. Take γ = 0.9.
- Evaluate a policy with (3.14). Let π search from s₀ with probability 0.5 and always answer from s₁. Then and .
- Improve (4.2). , so the greedy policy always searches first. Its value 0.71 satisfies the optimality equation: policy iteration is done.
- Learn from samples (6.2). Suppose and , and the agent searches. The TD error is , so V(s₀) moves up by without waiting for the episode to finish.
- Policy gradient (13.11). With at , one episode “search, then correct answer” has . With baseline , the update is .
- Translate. For an LLM, s₀ is a prompt, the actions are tokens, and is the end-of-sequence reward. Step 4 with a per-prompt group mean as is the core of RLOO and GRPO.
Limitations
Section titled “Limitations”- Mostly tabular and linear function approximation. Deep RL appears in case studies (Ch 16), not as algorithms such as TRPO or PPO.
- Nothing on reward models from human preferences, KL-regularized RLHF, DPO or verifiable rewards.
- Dense and long: the full book is over 500 pages. Reading it in order delays the LLM material by months.
Connections
Section titled “Connections”- Watch instead of read: David Silver’s lectures cover Ch 3–6 and 13 in lecture form.
- Code next: Spinning Up Part 3 implements Ch 13 in PyTorch.
- The LLM version of Ch 13: the RLHF book, Chapter 6.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
Use the Bellman equation for v_π (equation 3.14) on the search toy with γ = 0.9 and the policy that searches from s0 with probability 0.5 and always answers from s1. Compute v_π(s1) and v_π(s0). Then do one policy-improvement step (Section 4.2): what is the new policy, and is it optimal?
What a strong answer covers
- v_π(s1) = 0.9, because the policy always answers from s1.
- v_π(s0) = 0.5·0.2 + 0.5·(−0.1 + 0.9·0.9) = 0.1 + 0.355 = 0.455.
- Greedy improvement compares q_π(s0, search) = 0.71 with q_π(s0, answer) = 0.2, so the new policy always searches from s0 (and still answers from s1).
- Its value is 0.71, which satisfies the Bellman optimality equation, so policy iteration has converged after one improvement step.
- Mechanism
The REINFORCE update (13.8) multiplies the return by ∇π(A|S)/π(A|S), not by ∇π(A|S). Explain, in the book's own terms, why the division by π is needed, and what the boxed pseudocode's extra γ^t factor is doing.
What a strong answer covers
- ∇π/π = ∇ ln π, the eligibility vector. The policy gradient theorem sums over actions; sampling actions from π introduces a factor π that the division cancels.
- Book's intuition: without the division, frequently selected actions would win out because updates move in their direction more often, even if they do not have the highest return.
- The text derives the update for the undiscounted case (γ = 1); the boxed algorithm is the general discounted version, which carries γ^t.
- REINFORCE uses the complete return G_t, so it is a Monte Carlo method defined for episodic tasks with updates after the episode ends.
- What if…
Section 13.4 adds a baseline b(S) to REINFORCE (13.10–13.11), and Figure 13.2 shows it learning much faster on the short corridor. Prove that the baseline adds no bias, then design the matching ablation for an LLM policy trained with an outcome reward.
What a strong answer covers
- Σ_a b(s)∇π(a|s) = b(s)∇Σ_a π(a|s) = b(s)∇1 = 0, so the expected update is unchanged for any baseline that does not depend on the action.
- It changes the variance: a state-dependent baseline separates better and worse actions in states where all actions have high or all have low value.
- LLM ablation arms: no baseline, a running batch mean, a per-prompt group mean (as in GRPO and RLOO), and a learned value head (as in PPO), at matched samples.
- Measure gradient-estimate variance, reward against samples, and stability across seeds; keep the prompt set, reward and KL setting fixed.
- Critique
A colleague claims a value-based method with ε-greedy action selection can always match a policy-gradient method if you tune ε. Use Example 13.1 (short corridor with switched actions) to critique this, and say why the same issue can appear for a search agent with a truncated context window.
What a strong answer covers
- In the corridor, all states look identical to the features, so an action-value method can only choose between "mostly right" and "mostly left": values below −44 and −82 with ε = 0.1.
- The best stochastic policy picks right with probability about 0.59 and reaches about −11.6. Only a method that learns action probabilities directly can represent it.
- The underlying issue is state aliasing (partial observability), not tuning; Section 17.3 treats observations versus state.
- A search agent whose context drops earlier results can see identical observations in different true states, so a stochastic policy, or a better state representation, may be required.
- Connect
Section 11.3 names the deadly triad: function approximation, bootstrapping and off-policy training. Classify DQN, PPO with a learned critic as used in RLHF, and critic-free GRPO by which elements they contain, and say what each does about the risk.
What a strong answer covers
- DQN has all three: a neural Q-network, a bootstrapped max target, and replay of old transitions. Fixed target networks and replay are its stabilisers.
- PPO for RLHF: the critic is a neural network and its targets bootstrap when λ is below 1; reusing a batch for several epochs makes the data slightly off-policy, which the ratio and clipping partly correct.
- GRPO drops the critic, so there is no bootstrapping in the advantage; the triad's instability cannot arise through a value function.
- The book notes that with any two of the three, instability can be avoided, which is one way to read the move away from learned critics in RLVR.
- Design
Section 17.4 says reward design is critical, warns of sparse rewards (the "plateau problem") and of agents finding unexpected ways to get reward. Design a reward for a multi-step search agent answering factoid questions that addresses sparsity without opening an obvious hack. Say how you would detect a hack.
What a strong answer covers
- Base reward: +1 for a correct final answer judged against a held-out reference, 0 otherwise; this is sparse but hard to game.
- Dense help: a small per-step cost to discourage endless searching, and possibly a capped bonus for retrieving a gold-relevant document, checked against relevance labels the agent never sees.
- Hack risks: shaping terms that pay for retrieval actions or citation strings can be farmed without answering correctly.
- Detection: track the shaped reward and an independent end-task metric separately; a rising proxy with flat accuracy, or growing search counts, indicates gaming.