Skip to content
DAH

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
Why other work relies on it

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.

  1. 1Try actions, collect rewards
  2. 2Estimate which actions beat average
  3. 3Nudge policy toward better actions
  4. 4Clip the change to stay safe
  5. 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 θ\theta fitted by gradient descent, that outputs a probability for each action.

The goal. The agent maximises the expected discounted return J(θ)=E[∑tγtrt]J(\theta)=\mathbb{E}[\sum_t \gamma^t r_t]. An expected value is a probability-weighted average over everything that could happen. The discount factor γ\gamma (slightly below 1) makes rewards far in the future count a little less, like interest in reverse.

The policy gradient. Gradient ascent climbs JJ by moving θ\theta along the gradient, the vector of partial derivatives (the slope in every parameter direction at once). The difficulty is that JJ depends on the environment, which cannot be differentiated. The policy gradient theorem (Sutton et al., 1999) avoids this: ∇θJ=E[∇θlog⁡πθ(a∣s) A(s,a)].\nabla_\theta J=\mathbb{E}\big[\nabla_\theta\log\pi_\theta(a\mid s)\,A(s,a)\big]. 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 AA) and less likely if worse. The advantage is the action's return minus a baseline, an estimate V(s)V(s) 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 ρ\rho between the new and old probability of each action and clips it to [1−ϵ,1+ϵ][1-\epsilon,1+\epsilon] (the paper used ϵ=0.2\epsilon=0.2), 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 aa in states ss with a policy πθ(a∣s)\pi_\theta(a\mid s) and receives rewards. The goal is to maximise the expected discounted return J(θ)=Eπθ[∑tγtrt]J(\theta)=\mathbb{E}_{\pi_\theta}\left[\sum_t \gamma^t r_t\right]. Value-based methods such as Q-learning learn how good actions are and act greedily on that. Policy gradient methods instead adjust the parameters θ\theta 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 JJ can be written without differentiating the unknown state distribution:

∇θJ(θ)=Eπθ[∇θlog⁡πθ(a∣s) Qπθ(s,a)].\nabla_\theta J(\theta)=\mathbb{E}_{\pi_\theta}\left[\nabla_\theta \log \pi_\theta(a\mid s)\, Q^{\pi_\theta}(s,a)\right].

Williams's REINFORCE (1992) is the Monte Carlo estimator of this expression, using sampled returns in place of QQ. Its variance is high. Subtracting a state-dependent baseline, usually a learned value function V(s)V(s), leaves the gradient unbiased and reduces variance; the weight on ∇log⁡π\nabla\log\pi becomes an advantage A(s,a)=Q(s,a)−V(s)A(s,a)=Q(s,a)-V(s). Generalised Advantage Estimation (Schulman et al., 2015) trades bias against variance with a parameter λ\lambda 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 ρt(θ)=πθ(at∣st)/πθold(at∣st)\rho_t(\theta)=\pi_\theta(a_t\mid s_t)/\pi_{\theta_{\text{old}}}(a_t\mid s_t) it maximises

LCLIP(θ)=Et[min⁡(ρtAt, clip⁡(ρt,1−ϵ,1+ϵ)At)],L^{\text{CLIP}}(\theta)=\mathbb{E}_t\left[\min\left(\rho_t A_t,\ \operatorname{clip}(\rho_t,1-\epsilon,1+\epsilon)A_t\right)\right],

which removes the incentive to move the ratio outside [1−ϵ,1+ϵ][1-\epsilon,1+\epsilon], so several epochs of minibatch updates can reuse one batch of rollouts. The paper's experiments used ϵ=0.2\epsilon=0.2 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)
Words on this page
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)
New to this? Read first

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.

  1. Start with
  2. Step 2
  3. Then

Open problems & questions

Progress timeline

  1. Nov 5, 2025
    Q-learning and TD convergence in Lean
    Related to: Formalise the policy gradient theorem for finite discounted MDPs in Lean 4

    Zhang formalises almost-sure convergence of Q-learning and linear TD (preprint).

    source
  2. Feb 22, 2021
    Exponential-time lower bound for softmax policy gradient

    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).

    source
  3. Feb 22, 2021
    Exponential lower bound
    Related to: Tight iteration complexity of exact softmax policy gradient in tabular discounted MDPs

    Li et al. exhibit a three-action MDP requiring exponentially many iterations (preprint).

    source
  4. May 25, 2020
    Implementation matters

    Engstrom et al. attribute much of PPO's gain over TRPO on MuJoCo tasks to code-level optimisations rather than the clipping rule.

    source
  5. May 13, 2020
    O(1/t) rate
    Related to: Tight iteration complexity of exact softmax policy gradient in tabular discounted MDPs

    Mei et al. prove a sublinear rate with problem-dependent constants.

    source
  6. Jul 20, 2017
    PPO

    Proximal Policy Optimization introduces the clipped surrogate objective that allows several epochs of updates per batch.

    source
  7. Feb 19, 2015
    TRPO

    Trust Region Policy Optimization introduces a KL-constrained surrogate objective with a monotonic-improvement argument.

    source
  8. Nov 29, 1999
    Policy gradient theorem with function approximation

    Sutton, McAllester, Singh and Mansour prove the gradient formula for parametrised policies (NeurIPS 1999 proceedings; date approximate).

    source
  9. May 1, 1992
    REINFORCE

    Williams publishes the likelihood-ratio gradient estimator for stochastic policies. Month is known, day approximated.

    source