Trust Region Policy Optimization (TRPO)
- Paper: Trust Region Policy Optimization
- Authors: John Schulman, Sergey Levine, Philipp Moritz, Michael I. Jordan, Pieter Abbeel
- Lab, year: University of California, Berkeley, 2015 (ICML 2015)
- Video: YouTube Short coming on 7 Dec 2026 on Backprop Daily
Summary
A policy is the rule an agent uses to pick actions. Policy-gradient methods improve it with small gradient steps, but one step that is too large can make the policy much worse, and the agent then collects bad data and may not recover.
TRPO limits how far each update may move the policy. It maximizes an estimate of the improvement (the surrogate objective) while keeping the average KL divergence between the old and new action probabilities below a small limit δ (Section 4). The paper first proves that a penalised version of this objective improves the policy at every step (Section 3), then makes practical approximations (Sections 4 to 6).
The same method, with the same limit δ = 0.01, learned swimming, hopping and walking gaits in simulation and played Atari games from screen images (Section 8).
What Problem Does It Solve
Imagine learning to ride a bike by changing your whole style after every fall. One big wrong change and you crash again and again. A coach who says “change only a little at a time, and only if it seems better” keeps you improving.
TRPO is that coach. The trust region is the “only a little” part: the new policy must stay close to the old one, measured by how much its action probabilities change. Inside that region, the estimate of improvement can be trusted.
Core Idea
- Improvement bound: the true return of the new policy is at least the surrogate objective minus a penalty C times the largest KL divergence between the two policies. Maximizing this lower bound improves the policy at every step (Section 3, Theorem 1, Algorithm 1).
- Constraint instead of penalty: with the theoretical C, the steps are very small. TRPO instead maximizes the surrogate subject to a limit δ on the KL divergence, and uses the average KL over states instead of the maximum (Section 4).
- Estimating the objective: samples come from the old policy, and the advantage of each action is estimated from rollouts, with a single path (whole trajectories) or a vine (several rollouts branching from chosen states) (Section 5).
- Solving the step: a linear approximation of the objective and a quadratic approximation of the KL constraint give the direction s ≈ A⁻¹g, where A is the Fisher information matrix. Conjugate gradient finds s without forming A, and the step is scaled to β = √(2δ / sᵀAs) (Appendix C).
Key Method Details
- KL limit: δ = 0.01 in all experiments (Section 8.1, Tables 2 and 3).
- Fisher matrix: built from the analytic Hessian of the KL divergence, not from the covariance of the gradients (Section 6). Products with it are computed without forming the matrix (Appendix C.1).
- Conjugate gradient: k = 10 iterations was quite effective; more iterations did not speed up learning (Appendix C.1).
- Line search: starting from the largest step, the step shrinks exponentially until the surrogate improves and the KL limit holds. Without it, the algorithm sometimes took large steps that badly hurt performance (Appendix C).
- Locomotion: averaged over five runs, single-path and vine TRPO solved all the swimmer, hopper and walker tasks; natural policy gradient did well on the two easier tasks but could not learn hopping and walking gaits that moved forward (Section 8.1, Figure 4).
- Atari: one network of 33,500 parameters with the same settings for all seven games. TRPO beat prior methods on only some games, for example 20.9 on Pong for both variants and 7,732.5 on Q*bert with the vine (Table 1). The 500 iterations took about 30 hours on a 16-core computer (Section 8.2).
Simplifications in This Notebook
- Task: CartPole-v1 (two discrete actions, maximum reward 500) instead of MuJoCo locomotion and Atari.
- Networks: a policy MLP (two Tanh hidden layers of 64, 4,610 parameters) and a separate value MLP (4,545 parameters) trained with Adam.
- Advantages: GAE (γ = 0.99, λ = 0.95), a later method by the same first author, instead of the paper’s Monte Carlo estimates. Only the single-path style of sampling is used.
- Fisher-vector product: damping 0.01 is added, which the paper does not mention.
- Length: 100 iterations of 2,000 timesteps, one seed. The paper’s KL limit (0.01) and 10 conjugate-gradient steps are kept.
What the Notebook Result Shows
- It learned the task: the average episode reward rose from 20.3 in iteration 1 to 218.6 in iteration 10 and first reached the maximum of 500 in iteration 15.
- Mostly at the maximum: 79 of the 100 iterations averaged 500. After the first 500, the worst iteration averaged 370.0, and the 10-iteration moving average dipped to 471.4 (iteration 30) and 483.6 (iteration 90) before ending at 500.0.
- The trust region held: the largest KL after an update was 0.0100, at the limit, and the line search accepted a step in all 100 iterations.
Influence
When OpenAI released Proximal Policy Optimization (PPO), it named TRPO as an earlier approach that constrains the size of a policy update, and described PPO as performing comparably or better while being much simpler to implement and tune (OpenAI, 2017). OpenAlex lists about 8,400 citations (8,370 when checked on 3 December 2026).
Resources
| File | Description |
|---|---|
| README.md | This overview — a 5-minute read covering the paper’s summary, core idea, key method details, influence, and a plain-English explanation of the problem it solves |
| solution.ipynb | From-scratch PyTorch TRPO (conjugate gradient, Fisher-vector products, line search) on CartPole-v1 |
| CODE_ARCHITECTURE.md | Section-by-section breakdown of the notebook — what each cell does, data flow, tensor shapes, and key design decisions |
| TALK.md | Press coverage, Q&A (answers from the paper), citations, and common misconceptions about the paper |