Forward Deployed EngineeringAI EngineeringPreference Alignment
GRPO vs PPO-based RLHF: how does group-relative reward let you drop the value model?
Question 69 of 73 · Updated
On this page
Interview-ready answer#
Group Relative Policy Optimization (GRPO) replaces PPO's learned value-function baseline with a baseline estimated from multiple responses to the same prompt.
In conventional PPO-based RLHF, a critic estimates expected future reward from a partially generated sequence. GRPO instead samples a group of completions, scores each one, and uses their relative rewards as advantage estimates. Responses better than the group average receive positive advantages; worse responses receive negative advantages.
This removes the need to train and maintain a separate learned critic. It does not eliminate the reward signal, rollout generation or policy optimization. GRPO trades critic-related memory and computation for multiple completions per prompt.
1. How group-relative advantage works#
Imagine training a coding model on a problem with executable unit tests. Sample four solutions to the same problem and award 1 for passing and 0 for failing.
The rewards are [1, 1, 0, 0]. Their mean is 0.5 and population standard deviation is 0.5.
A common GRPO advantage estimator is:
Here ε prevents division by zero. The resulting advantages are approximately [+1, +1, −1, −1]. Rather than learning a critic to predict the expected return, the algorithm uses the other completions as a local comparison. For outcome-level rewards, each completion's advantage can be assigned to its generated tokens.
The group is formed from the same prompt because its difficulty provides a meaningful comparison context. The baseline is a finite-sample estimate, not a learned prediction of the value of every intermediate token state. Including the sampled response itself in the group statistics also introduces dependence; this is not an exact unbiased replacement for every critic-based estimator.
2. What changes from PPO?#
| Component | Conventional PPO-based RLHF | GRPO |
|---|---|---|
| Advantage | Estimated returns minus learned value predictions, often using GAE | Relative rewards within a sampled completion group |
| Critic | Learned value model or value head | Not required |
| Rollouts | Generated responses | Multiple responses per prompt |
| Policy update | Clipped importance-ratio objective | Typically a related clipped objective |
| Reward | Learned reward model or other scorer | Learned reward model or other scorer |
Both methods can use a frozen reference policy to limit drift. GRPO's commonly cited formulation includes a KL penalty, but variants differ.
For token t of completion i, let ρᵢₜ be the probability ratio between the current policy and the rollout policy. A PPO-like clipped reward term is:
min(ρᵢₜ Aᵢ, clip(ρᵢₜ, 1−δ, 1+δ) Aᵢ)
The objective maximizes an aggregate of these terms, with an optional reference-policy KL penalty. The original GRPO outcome-supervision formulation averages token terms within each completion and then across the group; other formulations change the aggregation or clipping. Clipping controls the update incentive, not a strict bound on policy change.
3. A small tested example#
PYTHONfrom math import isfinite from statistics import mean, pstdev def group_advantages(rewards, eps=1e-8): if len(rewards) < 2 or not all(map(isfinite, rewards)) or not isfinite(eps) or eps <= 0: raise ValueError('need at least two finite rewards and positive epsilon') mu = mean(rewards) sigma = pstdev(rewards) return [(r-mu)/(sigma+eps) for r in rewards]
Using population standard deviation for this example, [1, 1, 0, 0] gives approximately [+1, +1, −1, −1]. For [1, 1, 1, 1], all advantages are zero.
Tested: Python 3.13.5 passed 1,095 cases: 1,089 exhaustive reward groups of sizes two through six with rewards in {0, 1, 2}, and six invalid-input cases. The checks compared the calculation against an independent mean/variance formula and tested centering, variance and identical rewards. This is an advantage estimator, not a complete RL trainer.
4. Practical trade-offs#
- Memory: removing the critic can save its parameters, gradients, activations and optimizer state. The actual saving depends on whether PPO uses a separate critic or a shared value head.
- Compute: sampling several long completions per prompt can consume substantial inference compute and KV memory. Removing the critic does not guarantee a cheaper training run.
- Zero-variance rewards: if all completions pass or all fail, the centered reward signal is zero; a separate KL term may still contribute. Monitor the fraction of such groups and improve task difficulty, sampling or reward quality.
- Credit assignment: an outcome-level advantage rewards or penalizes the whole completion, even when only a few steps determine success. A reliable token-level critic or other supervision may be useful for longer-horizon tasks.
- Reward quality: group-relative normalization does not prevent reward hacking, and scaling by group variance changes the weight assigned to different prompts. Validate against held-out tests, not reward alone.
5. When would I choose GRPO?#
For coding or math tasks with reliable outcome verification and enough rollout budget, GRPO is a practical candidate. I can generate several attempts, execute a trusted test suite and obtain a useful relative training signal without operating a critic.
For tasks with sparse feedback, expensive rollouts, long-horizon interactions or a need for more detailed value estimation, I would compare against a well-tuned critic-based approach. If I only have a fixed offline preference dataset and cannot generate new rollouts, standard DPO may be simpler (see FDE-0059).
Before choosing, benchmark quality improvement per generated token, total GPU-hours, peak memory, zero-variance group rate and independent task success. GRPO's main advantage is eliminating the learned critic, not eliminating reinforcement learning.
References
- 1.
- 2.
- 3.
Related questions
Explore other topics:AI AgentsAI System DesignLarge Language Models