Policy gradient methods and PPO
Methods that improve a policy directly by following a sampled estimate of the gradient of expected return. Proximal Policy Optimization (PPO) is the default on-policy variant in games, robotics and language models.
On this page15 sections
PPO is the optimiser behind OpenAI Five, the original RLHF pipelines for instruction-following models, and most RL baselines; GRPO and other reasoning-model recipes are modifications of its clipped objective.
Teach a decision-maker by nudging it toward actions that worked, in small safe steps.
- 1Try actions, collect rewards
- 2Estimate which actions beat average
- 3Nudge policy toward better actions
- 4Clip the change to stay safe
- 5Repeat with fresh experience
What it is for. Reinforcement learning (RL) trains an agent, a program that picks actions, by trial and error: it acts, receives a number called a reward, and adjusts itself to collect more reward over time. A robot arm learning to grasp or a game agent learning to win are typical cases. The policy is the agent's rule for choosing actions. Here it is a neural network, a large function with adjustable parameters fitted by gradient descent, that outputs a probability for each action.
The goal. The agent maximises the expected discounted return . An expected value is a probability-weighted average over everything that could happen. The discount factor (slightly below 1) makes rewards far in the future count a little less, like interest in reverse.
The policy gradient. Gradient ascent climbs by moving along the gradient, the vector of partial derivatives (the slope in every parameter direction at once). The difficulty is that depends on the environment, which cannot be differentiated. The policy gradient theorem (Sutton et al., 1999) avoids this: In words: for each action actually taken, nudge the parameters to make that action more likely if it turned out better than expected (positive advantage ) and less likely if worse. The advantage is the action's return minus a baseline, an estimate of how good the situation was anyway. Subtracting the baseline leaves the average direction unchanged but makes the noisy estimate much steadier. REINFORCE (Williams, 1992) is the simplest version, using sampled returns.
Why PPO. A step that is too large can change the policy so much that performance collapses, and the data collected under the old policy no longer describes the new one. TRPO (2015) limits each step by the KL divergence, a measure of how different two probability distributions are. PPO (Schulman et al., 2017) gets a similar effect cheaply: it computes the ratio between the new and old probability of each action and clips it to (the paper used ), so the update gains nothing by moving further. Several passes of updates can then reuse one batch of experience.
In practice. Engstrom et al. (2020) found that much of PPO's advantage over TRPO on robot-control benchmarks came from code-level details (reward scaling, initialisation, learning-rate schedules) rather than the clipping rule. PPO trained OpenAI Five and the RL stage of InstructGPT; CleanRL and Stable-Baselines3 hold reference implementations.
Go deeper
The full technical text.
The problem they solve
A reinforcement learning agent picks actions in states with a policy and receives rewards. The goal is to maximise the expected discounted return . Value-based methods such as Q-learning learn how good actions are and act greedily on that. Policy gradient methods instead adjust the parameters of the policy itself, which handles continuous actions and stochastic policies naturally.
The policy gradient theorem
Sutton, McAllester, Singh and Mansour (NeurIPS 1999) showed that the gradient of can be written without differentiating the unknown state distribution:
Williams's REINFORCE (1992) is the Monte Carlo estimator of this expression, using sampled returns in place of . Its variance is high. Subtracting a state-dependent baseline, usually a learned value function , leaves the gradient unbiased and reduces variance; the weight on becomes an advantage . Generalised Advantage Estimation (Schulman et al., 2015) trades bias against variance with a parameter and is the standard advantage estimator in actor-critic code.
Trust regions and PPO
A plain gradient step can change the policy so much that performance collapses and the data collected under the old policy no longer describes the new one. Trust Region Policy Optimization (TRPO, Schulman et al., 2015) maximises a surrogate objective subject to a bound on the KL divergence between old and new policy, with a monotonic-improvement argument behind it. PPO (Schulman et al., 2017) replaces the constrained problem with a cheap clipped surrogate. With the probability ratio it maximises
which removes the incentive to move the ratio outside , so several epochs of minibatch updates can reuse one batch of rollouts. The paper's experiments used as the best-performing value.
What the algorithm really is
Engstrom et al. (2020) found that much of PPO's advantage over TRPO on continuous-control benchmarks comes from code-level choices such as value-function clipping, reward scaling, orthogonal initialisation and learning-rate annealing, not from the clipping rule itself. Huang et al. documented 37 implementation details that affect results. The consequence is that "PPO" in a paper and "PPO" in a library can differ materially, and reproduction claims need the code, not only the objective.
Where it is used
PPO trained OpenAI Five (Dota 2, 2019) and was the reinforcement-learning stage of InstructGPT. Open reference implementations include CleanRL and Stable-Baselines3. Theory lags practice: tabular and softmax policy gradient have global convergence guarantees under assumptions on distribution mismatch (Agarwal et al., 2019), and softmax policy gradient can need exponentially many iterations in the effective horizon (Li et al., 2021), but guarantees for the clipped objective used in practice with neural networks are limited to overparametrised variants (Liu et al., 2019).
Words on this page (11)
- reinforcement learning
- Learning by trial and error: an agent acts, gets rewards, and adjusts its behaviour to collect more reward over time.
- policy
- The rule an agent uses to choose an action in each situation. In deep RL it is usually a neural network.
- reward
- A number the environment gives after each action, telling the agent how well it is doing.
- gradient
- The direction in which a number changes fastest. Training follows it to improve the model a little at a time.
- KL divergence
- A measure of how different one probability distribution is from another. Used to keep a new policy close to an old one.
- advantage
- How much better an action was than the typical action in the same situation.
- baseline
- A reference value subtracted from rewards to make gradient estimates less noisy without changing their average.
- discount factor
- A number below 1 that makes rewards sooner count more than rewards later.
- neural network
- A large function with many adjustable numbers (weights), fitted to data by gradient descent; it maps inputs such as a game screen to outputs such as action probabilities.
- expected value
- The probability-weighted average of all possible outcomes, i.e. the long-run average if the experiment were repeated many times.
- REINFORCE
- The simplest policy-gradient method: weight the log-probability gradient of each taken action by the return that followed it.
New to this? Read first (3)
- Spinning Up: Intro to policy optimizationClear derivation of the policy gradient with code pointers.
- Wikipedia: Policy gradient methodShort summary of REINFORCE and variants.
- The 37 implementation details of PPOShows how many small choices make up 'PPO' in practice.
Understanding map
map of the whole wiki →What to read before Policy gradient methods and PPO (left), and what builds on it: entries that depend on it and its open problems (right). Every box links to its page.
- Start with
- Step 2
- Policy gradient methods and PPOYou are here
- Then
- RLHF and preference optimization (DPO)Algorithm
- RL with verifiable rewards and GRPO for reasoning modelsFrontier
- Monte Carlo tree search and AlphaZeroAlgorithm
- Model-based RL and world models (MuZero, Dreamer)Algorithm
- Offline reinforcement learningAlgorithm
- RL benchmarks and evaluation: Atari 100k, ProcGen, rliableLibrary
- Tight iteration complexity of exact softmax policy gradient in tabular discounted MDPsOpen problem · D45
- Formalise the policy gradient theorem for finite discounted MDPs in Lean 4Open problem · D18
Open problems & questions
Progress timeline
- Nov 5, 2025Q-learning and TD convergence in LeanRelated to: Formalise the policy gradient theorem for finite discounted MDPs in Lean 4source
Zhang formalises almost-sure convergence of Q-learning and linear TD (preprint).
- Feb 22, 2021Exponential-time lower bound for softmax policy gradientsource
Li, Wei, Chi, Gu and Chen construct a three-action MDP on which exact-gradient softmax policy gradient needs a number of iterations doubly exponential in the effective horizon (COLT 2021; Mathematical Programming).
- Feb 22, 2021Exponential lower boundRelated to: Tight iteration complexity of exact softmax policy gradient in tabular discounted MDPssource
Li et al. exhibit a three-action MDP requiring exponentially many iterations (preprint).
- May 25, 2020Implementation matterssource
Engstrom et al. attribute much of PPO's gain over TRPO on MuJoCo tasks to code-level optimisations rather than the clipping rule.
- May 13, 2020O(1/t) rateRelated to: Tight iteration complexity of exact softmax policy gradient in tabular discounted MDPssource
Mei et al. prove a sublinear rate with problem-dependent constants.
- Jul 20, 2017PPOsource
Proximal Policy Optimization introduces the clipped surrogate objective that allows several epochs of updates per batch.
- Feb 19, 2015TRPOsource
Trust Region Policy Optimization introduces a KL-constrained surrogate objective with a monotonic-improvement argument.
- Nov 29, 1999Policy gradient theorem with function approximationsource
Sutton, McAllester, Singh and Mansour prove the gradient formula for parametrised policies (NeurIPS 1999 proceedings; date approximate).
- May 1, 1992REINFORCEsource
Williams publishes the likelihood-ratio gradient estimator for stochastic policies. Month is known, day approximated.