Part II / Reinforcement Learning
PPO and GRPO
PPO and GRPO answer two practical questions: was this response better than expected, and how far should the model move toward it? PPO usually learns the expectation with a critic. GRPO estimates it by comparing several answers to the same prompt.
A learned critic commonly estimates advantage.
Responses for one prompt are compared within a group.
Fresh rollouts, rewards, token log-probabilities, and constrained updates.
Start with one response
Give an LLM a coding problem. At each position, the model sees the prompt plus the tokens generated so far, then chooses a next token. The vocabulary is its action space. The prompt and the rules that produce feedback make up the environment. The completed response is a trajectory, and an end token finishes this simple episode. A tool-using agent adds observations, tool results, action masks, and a harder credit-assignment problem, while still training generated token log-probabilities.
The policy writes an answer. The reward system grades what happened. The optimizer changes the probability of the sampled tokens. The first useful distinction is how each method decides whether that grade was better or worse than expected.
A final score of 0.8 is not enough by itself. Perhaps 0.8 is unusually good for this prompt, or perhaps the policy almost always earns 0.95. PPO uses an advantage: the observed result minus a useful baseline. Positive advantage makes the sampled behavior more likely; negative advantage makes it less likely.
The four jobs inside a common LLM-PPO system
A KL-regularized RLHF implementation commonly has four logical model roles. They are easiest to understand by asking what each one contributes to a single training batch.
Implementations can realize these four jobs with fewer than four separate models and place them across devices or phases. A critic may be a separate transformer, a shared policy backbone with a value head, or a smaller model. A reward system may be much smaller than the policy or may contain no neural model at all. In InstructGPT, for example, the authors used 6B reward models, initialized the value function from the reward model, and trained policy models at several sizes.[source]
A separate critic of comparable scale is still expensive. It carries weights and activations and, while training, its own gradients and optimizer state. DeepSeekMath identifies this case as a major PPO burden.[source] PPO itself does not require the critic to match or exceed the actor's size; that is an empirical architecture choice. A stronger reward model or judge is another choice again. It scores behavior, while the critic predicts expected return for policy states.
Follow one PPO batch through the loop
A large policy already needs memory for weights, gradients, optimizer states, and activations. A separate trainable critic adds another training workload; the reward and reference models add inference workloads; rollout generation adds a large token bill. Teams respond with sharding, mixed precision, activation checkpointing, offload, shared backbones, and careful placement of rollout and training workers. PPO defines the update rule. The cluster architecture decides whether the rule is affordable.
A ratchet, not a leap
Imagine improving a recipe while the restaurant is open. One dinner suggests more salt, but replacing every measured spoon with a ladle would be catastrophic. Policy optimization has the same instability: samples are noisy, neural parameters interact globally, and a large probability shift changes the distribution of future data.
PPO says: use the policy-gradient direction, but stop paying extra for probability changes beyond a trusted neighborhood. GRPO says: estimate "better than expected" by comparing multiple attempts on the same prompt.
Let r_t(theta) be the probability of a sampled token action under the new policy divided by its probability under the rollout policy. A ratio of 1.0 means no change; 1.2 means 20 percent more likely; 0.8 means 20 percent less likely. PPO's clipped surrogate compares the raw ratio with a clipped ratio and takes the pessimistic objective.[source]
Read the sign before the clip
"Compare both paths" has positive advantage +2. The new policy makes it 1.3 times as likely. With epsilon 0.2, PPO uses a ratio of 1.2 for the objective. If the advantage were negative, decreasing probability too far would also be clipped through the minimum.
Clipping does not guarantee a hard bound on the final policy's KL divergence. Many token updates and optimization epochs interact. Implementations therefore monitor approximate KL, clip fraction, entropy, value loss, and gradient norms; some stop an epoch early when KL grows too large. The reference-model KL used in RLHF is related but serves a different role: it penalizes drifting from a fixed pretrained or supervised policy.
A typical PPO batch stores prompt and response tokens, action masks, old log-probabilities, reference log-probabilities, rewards, old values, returns, and advantages. The policy and value losses train over several minibatch epochs. After those updates, the data is too stale for unrestricted reuse, so the system collects fresh rollouts.
GRPO replaces the critic with a local contest
Group Relative Policy Optimization samples several responses for the same prompt, scores them, and normalizes rewards within that group. An above-mean answer gets positive relative advantage; a below-mean answer gets negative relative advantage. DeepSeekMath introduced GRPO as a PPO variant intended to reduce the memory and compute burden of a critic model.[source]
Suppose four code completions receive rewards [0, 0, 0.5, 1.0]. GRPO centers and scales those scores within the group. The fully correct completion gets positive advantage, the failed completions get negative advantage, and the partial solution lands between them. No value model predicts what this prompt should have earned.
The group provides a prompt-specific difficulty baseline. A reward of 0.5 may be excellent when seven alternatives score zero and poor when all alternatives score one. This is especially useful for verifiable math, code, or reasoning tasks where multiple independent samples can be graded.
The original GRPO objective keeps PPO's old-policy probability ratio and clipping. It changes the advantage estimator and places reference-policy KL directly in the loss rather than folding it into the reward.[source] Later variants change some of these details, which is why the optimizer name alone does not specify a complete training recipe.
Removing the critic saves its weights, activations, optimizer state, and training pass. The policy, reward computation, reference-policy regularization, and rollout system remain. The group baseline also requires several completions from each prompt. PPO may sample more than one response too, but GRPO needs the group to define its baseline. It trades critic training for a sampling-dependent estimate that exists only inside the group.
Implementations differ well beyond removal of the value model. Variants make different choices about normalization, clipping, KL treatment, token aggregation, length normalization, and whether advantages are assigned per sequence or token. Group size changes both compute cost and statistical resolution. If every response receives the same reward, that group supplies no reward-derived policy signal; a KL term may still produce a gradient. Implementations must also handle zero reward variance explicitly, usually by adding a small denominator constant or skipping the group.
| Dimension | PPO with critic | GRPO-style group baseline |
|---|---|---|
| Baseline | Learned value function | Mean or standardized reward within prompt group |
| Baseline-specific burden | Value head or critic training | Group-sized rollout sampling |
| Generalization | Critic can estimate unseen states | Baseline exists only from sampled group |
| Failure mode | Biased or unstable value estimates | Low reward variance, group bias, length effects |
The algorithm is the whole loop
In conversation, "we use PPO" can hide crucial decisions: how prompts are sampled, how many responses are generated, what temperature is used, how rewards are scaled, which tokens receive advantages, how KL is computed, how many epochs reuse data, and which evaluations stop a run. Two pipelines with the same acronym may optimize materially different objectives.
For an incident-reasoning engine, group sampling might generate eight investigations for one seeded scenario. The grader applies deterministic cause checks, evidence-process scores, cost penalties, and hard gates. Relative advantage increases probability on the strongest traces and suppresses weak ones. But if the scenario or rubric leaks the cause, the entire group can learn the exploit efficiently. Algorithmic stability does not repair environment invalidity.
The standard clipped objective clips the probability ratio used in the surrogate loss. Optimizers may separately clip gradient norm, and neither operation literally clamps every parameter to a fixed interval.
Choose by bottleneck and feedback, not fashion
PPO with a critic can be attractive when a learned baseline generalizes across diverse states and group sampling would be expensive. GRPO can be attractive when prompts support several gradeable responses and critic infrastructure dominates. DPO may be simpler when a trusted offline preference dataset already exists and online exploration is not required. Rejection sampling plus supervised fine-tuning is another baseline when the base policy already produces useful solutions often enough to filter them.
Always preserve a simple baseline. If sophisticated online RL does not beat best-of-n selection, SFT, or preference optimization under equal inference and labeling budget, choose the simpler method.
References
- Schulman et al. is the primary PPO source.
- InstructGPT provides a concrete LLM-PPO system with policy, reward, value, and reference roles.
- DeepSeekMath is the primary GRPO source.
- Ray's distributed GRPO example provides an official systems reference.