Group-Based Policy Optimization for LLM Fine-Tuning vs PPO
Machine LearningModel answerLast updated
Describe how group-relative policy optimization trains a language model from scored samples without a critic, how it compares with PPO-based RLHF, and where it breaks.
You are asked to describe a reinforcement learning method that fine-tunes a language model by comparing several sampled answers to the same prompt against one another. It is commonly used to strengthen reasoning, for example on math or code tasks. The method is known as Group Relative Policy Optimization (GRPO).
Please cover the following:
- One training iteration. What gets sampled, how each sample is scored, and how those scores are turned into a learning signal for each response.
- The optimization objective. Which quantities appear in the loss, how the policy is kept from moving too far in one update, and how the model is kept close to a fixed reference.
- Comparison with PPO in RLHF. What GRPO removes or changes, and what that gains and costs in memory, stability and credit assignment.
- Failure modes. Situations where the signal is weak or misleading, and how you would mitigate them.
State any assumptions you make. For instance, you can say whether you treat rewards as one score per full response or per step, and whether the reward comes from a learned model or from rule-based verification.
Hints
Hint 1
Start with the cast of models: a trainable policy, a frozen reference, a reward source, and (in PPO only) a value network. Ask which of these GRPO drops.
Hint 2
Think of the advantage as 'how much better is this answer than its siblings for the same prompt?' What statistics of the group's rewards would you use to answer that, and what happens if all of them are equal?
Hint 3
For the PPO comparison, reason about what the critic does (a baseline and per-token credit assignment) and what it costs (an extra model of similar size, extra training, and instability). Then ask what the group mean replaces and what is lost.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Setting
GRPO is a policy-gradient method for fine-tuning an LLM. The components are:
- Policy
π_θ: the model being trained. - Old policy
π_old: a snapshot used to generate samples for the current iteration. - Reference policy
π_ref: a frozen model, usually the supervised fine-tuned starting point. - Reward source: a learned reward model, or, increasingly, a rule-based verifier (exact-match math answer, unit tests, format checks).
There is no value network. That is the defining difference from PPO.
One training step
-
Sample prompts from the training set.
-
Sample a group: for each prompt
q, drawGresponseso_1 … o_Gfromπ_old(typicalGis 8 to 64). -
Score each response to get rewards
r_1 … r_G. With outcome supervision this is one scalar per response. -
Compute group-relative advantages:
A_i = (r_i − mean(r_1..r_G)) / (std(r_1..r_G) + ε)Every token in response
ishares the advantageA_i. The group mean acts as the baseline that a critic would otherwise provide. -
Update the policy for one or a few gradient steps on the objective below, then set
π_old ← π_θand repeat.
Objective
For each token t of response i, define the ratio
ρ_{i,t} = π_θ(o_{i,t} | q, o_{i,<t}) / π_old(o_{i,t} | q, o_{i,<t})
The loss to maximize is the average over group members and tokens of
min(ρ_{i,t}·A_i, clip(ρ_{i,t}, 1−ε, 1+ε)·A_i) − β·KL(π_θ ‖ π_ref)
- Clipping is identical in spirit to PPO. It removes the incentive to push the ratio beyond roughly
[1−ε, 1+ε], so reusing the same samples for several gradient steps stays safe. - KL penalty keeps the policy near the reference. GRPO puts it directly in the loss, not folded into the reward as in classic RLHF PPO. It is usually estimated per token with the low-variance, non-negative estimator
π_ref/π_θ − log(π_ref/π_θ) − 1. - Averaging: the original formulation averages over tokens within each response and then over the group, which makes the length weighting a design choice (see failure modes).
Comparison with PPO in RLHF
| Aspect | PPO (RLHF) | GRPO |
|---|---|---|
| Baseline | Learned value function V(s) | Mean reward of the sampled group |
| Advantage | GAE, per token | Group-normalized, same for all tokens in a response |
| Extra model | Critic, comparable in size to the policy | None |
| KL | Typically added to the per-token reward | Separate term in the loss |
| Samples per prompt | Often 1 | Several (G) |
What it buys
- Roughly one fewer large model to hold in memory and train, which matters at tens of billions of parameters (policy, reference and optimizer state already dominate).
- No critic to fit. Value heads on long, sparse-reward sequences are notoriously hard to train and can destabilize PPO.
- A natural fit for verifiable, outcome-only rewards, where each prompt's own samples provide a calibrated per-prompt baseline.
What it costs
- More generation:
Gsamples per prompt makes rollouts the main cost. Compute shifts from the critic to the sampler. - Coarse credit assignment: every token in a response gets the same advantage, so a single wrong step in a long correct-looking chain penalizes all tokens. A critic with GAE can localize credit. Process-level rewards can partly restore this.
- Noisy baseline when
Gis small: the group mean is a high-variance estimate of the prompt's expected reward.
Failure modes and mitigations
- Zero-variance groups. If all
Gresponses get the same reward (all correct or all wrong), the std is zero and advantages are zero (or blow up withoutε). The prompt contributes no gradient. Mitigate with largerG, curriculum or difficulty filtering, and dynamic sampling that discards or resamples such prompts. - Normalization bias. Dividing by std upweights very easy or very hard prompts, where small reward differences get amplified. Per-response length normalization biases toward long wrong answers (their per-token penalty is diluted) and short right ones. Variants drop the std division, or normalize by a constant token budget instead of per-response length.
- Reward hacking. With a learned reward model the policy exploits its blind spots; with rule-based rewards it can game formatting or shortcut checks. Mitigate with a sufficiently strong KL term, verifiers that are hard to game, held-out evaluation, and monitoring response length and entropy.
- Entropy collapse. The policy becomes deterministic, groups lose diversity and signal fades. Mitigate with a higher upper clip bound, entropy bonuses, or temperature control.
- Off-policy drift. If many gradient steps reuse one batch, ratios leave the trust region. Keep few inner epochs and watch the clip fraction and KL.
- Sparse reward. If the base model almost never succeeds, groups are all zeros. Warm-start with supervised data or add shaped partial rewards.
Common mistakes in answers
- Saying GRPO has no baseline. It does; the baseline is the group mean.
- Forgetting that the KL term is against the reference, not the old policy, and that clipping handles the old-policy trust region.
- Claiming GRPO is strictly better than PPO. It trades critic cost for sampling cost and credit-assignment precision.
Summary
GRPO replaces the learned critic with a within-prompt comparison: sample several answers, standardize their rewards, and use that as the advantage in a PPO-style clipped loss with a KL leash to the reference. It is cheaper and simpler when rewards are outcome-based and verifiable, at the price of more sampling and coarser credit assignment.