15  Deep Reinforcement Learning

The last agent of Chapter 14 swung a pendulum up after a few hundred thousand steps. A simulator makes that cheap. A robot arm would wear out first, and a language model trained on its own answers cannot discard each batch of answers after one update. The agent waited for every episode to end, used each batch once and never limited how far an update moved its policy. How much can one sample teach, and what goes wrong when we make it teach more?

Four ideas answer, each with an error of its own. An agent can trust a learned estimate of the rest of an episode instead of waiting for it (Samuel 1959; Sutton 1988); the estimate is biased while it is young. It can reuse an older policy’s data, reweighted or replayed (Lin 1992); the data goes stale and the targets move. It can bound each update by the change in the policy’s behavior (Kakade and Langford 2002; Schulman et al. 2017); the bound limits each step, not where the steps lead. It can learn a model of the environment and plan in it (Sutton 1990), inheriting the model’s errors and computing at every step. Together, a learned target, a network shared across states and another policy’s data can make values diverge, which a table never does. Controllers, game players and post-trained language models are built from these ideas.

The chapter develops these ideas in three movements. We start with on-policy and regularized policy optimization: Section 15.1 replaces full-episode waiting with a bootstrapped critic and multi-step advantages, Section 15.2 reuses each rollout across several guarded updates via probability-ratio clipping, and Section 15.3 anchors the policy to a reference distribution when the reward itself is fitted from comparisons. Next we move to off-policy replay and planning: Section 15.4 stabilizes neural Q-learning on replayed transitions with a frozen target copy and Double DQN, Section 15.5 pairs twin critics with a maximum-entropy continuous actor to swing up the pendulum in a few thousand steps, and Section 15.6 learns the physics from a few hundred steps and plans inside the model. Finally, we study settings without online exploration or transition uncertainty: Section 15.7 learns conservatively from a fixed log, and Section 15.8 specializes the chapter’s tools to token-level language-model post-training.

CartPole carries the discrete-action methods on a shared axis of environment steps, Pendulum carries soft actor-critic and the learned model, and the verifier task and two small gridworlds supply exact closed-form checks. All examples run in PyTorch and JAX in CPU minutes. Figure 14.9.3 and Table 14.9.1 place every method of both chapters, and Section 15.9 surveys extensions beyond our scope, while the Language Models part treats preference-based post-training at scale.