PPO Proximal Policy Optimization
PPO (Proximal Policy Optimization) is a policy-gradient reinforcement learning algorithm whose core idea is to keep the new policy from moving too far from the old one in each update. It is widely used in large model alignment and is the most mainstream reinforcement learning optimizer of the RLHF era.
Core Principles
Policy-gradient methods compute gradients directly with respect to policy parameters, raising the probability of high-reward actions. But naive policy gradients are sensitive to step size: too large a step makes the policy collapse, too small a step learns slowly. PPO's solution is to add an importance sampling ratio to the objective, the action probability under the new policy divided by the action probability under the old policy, and to clip this ratio between "one minus epsilon" and "one plus epsilon". When the advantage is positive, the reward stops once the ratio reaches the upper bound; when the advantage is negative, the penalty stops once the ratio falls to the lower bound. In this way, data collected once can be reused for several rounds of mini-batch updates, giving far higher sample efficiency than the original policy gradient.
The advantage function is usually computed with GAE (Generalized Advantage Estimation), which sums multi-step temporal-difference residuals weighted by a discount factor and a smoothing coefficient, trading off bias against variance. In the large model setting, the state is the prompt plus the generated prefix, the action is the next token, and the reward is often given only at the end of the sequence by a reward model, while rewards at intermediate steps come from estimates of a value network or from per-token allocation of a KL penalty.
Key Points
First, the KL penalty is the key stabilizer. At each step a coefficient times the KL divergence of the new policy from a reference model is subtracted from the reward, preventing the policy from drifting entirely away from the language model's original distribution in order to game the score, and also preventing the output from degenerating into gibberish. Second, the value network must be trained separately, usually at the same scale as the policy model, which makes PPO very expensive in GPU memory; training a 700-million-parameter model often requires keeping four sets of weights resident at once, namely policy, reference, reward and value, and is often combined with 3D parallelism and offloading. Third, the clipping coefficient is usually around 0.2; too small and learning is slow, too large and it loses its constraining meaning. Fourth, advantages must be normalized within the batch, otherwise differences in reward scale destroy training stability.
Common Misconceptions
Misconception one: believing that clipping fully guarantees the policy will not drift. Clipping only constrains the probability ratio of a single update; after many rounds the policy can still drift, so the KL penalty must serve as a backstop. Misconception two: ignoring the bias of the value network. Inaccurate value estimates contaminate the advantage and cause the policy to learn noise. Misconception three: thinking PPO must be used on large models; in fact small models are often better served by DPO, which is more cost-effective.
Application Scenarios
RLHF alignment training, reinforcement of mathematical and code reasoning, learning of robot control policies, optimization of recommendation policies, and training of dialogue safety constraints.
In the large model setting, keeping the four models resident at the same time is the biggest pain point. Common engineering optimizations include: the reference model and reward model can use quantization or a smaller backbone; the value network can use a structure of shared parameters plus an independent head; tensor parallelism, pipeline parallelism and activation checkpointing are combined to spread the memory load. Training usually begins with a cold-start supervised fine-tuning pass so that the policy model does not start out producing outputs that cannot be scored at all.
Another detail is reward clipping and scaling. Sequence-level rewards of language models often range from tens to hundreds; without normalization, advantage estimates are dominated by large values and the gradients of some samples explode. In practice, rewards within a batch are mean-centered and divided by the standard deviation, and the KL term is averaged over the number of tokens rather than summed, so that long sequences are not over-penalized.