Simple Algorithm
Reinforcement Learning · Fixed Point · 28 min

GRPO & Critic-Free Policy Optimization

Group-relative advantages, RLOO, and the biases hidden in normalization.

GRPO looks like PPO with the critic deleted, but each of its normalizations changes the objective it optimizes. Dividing by the group's standard deviation reweights prompts by difficulty; dividing by response length favors short answers when right and long ones when wrong; and differentiating its KL estimate follows the gradient of a different divergence. This lesson derives each effect exactly and shows how RLOO, Dr. GRPO, DAPO and VinePPO respond.

What you’ll learn

  • Write the GRPO objective term by term, prove that the k3 estimator is unbiased and non-negative, and derive what its gradient estimates when it is used as a loss.
  • Derive the leave-one-out identity linking RLOO and mean-centered group advantages, and the effective objective of standard-deviation normalization in the large-group limit.
  • Derive the length bias of per-response normalization, and compare sample-level, token-level and constant normalizers.
  • Explain DAPO's four changes and VinePPO's Monte Carlo credit assignment: what each fixes and what it costs.

The objective, term by term

With a single gradient step per batch, as in DeepSeekMath, πold=πθ\pi_{\text{old}}=\pi_{\boldsymbol\theta} when the gradient is taken, every ratio equals 1 and the clip never acts: GRPO is then REINFORCE with the group baseline, plus a KL term. Clipping matters only when the same samples are reused for several updates.

DerivationProof
  1. Eq[w−1]=∑yq(y) p(y)q(y)−1=∑yp(y)−1=0\E_q[w-1]=\sum_yq(y)\,\frac{p(y)}{q(y)}-1=\sum_yp(y)-1=0

    Eq[−log⁡w]=Eq[log⁡q(Y)p(Y)]=DKL(q ∥ p)\E_q[-\log w]=\E_q\big[\log\frac{q(Y)}{p(Y)}\big]=\KL(q\,\|\,p) by definition. For k3k_3, add a control variate with mean zero:

  2. Since log⁡w≤w−1\log w\le w-1 for every w>0w>0, with equality only at w=1w=1, each sample of k3k_3 is non-negative, while a single k1k_1 is negative whenever p(Y)>q(Y)p(Y)>q(Y). Schulman (2020) compares these and other estimators; k3k_3 typically has lower variance when pp and qq are close. ■\blacksquare

DerivationWhat the gradient of a KL estimate estimates
  1. EY∼qθ[∇θk1]=E[∇θlog⁡qθ(Y)]=0\E_{Y\sim q_{\boldsymbol\theta}}\big[\nabla_{\boldsymbol\theta}k_1\big]=\E\big[\nabla_{\boldsymbol\theta}\log q_{\boldsymbol\theta}(Y)\big]=\mathbf 0

    In code, the sampled estimate is differentiated with respect to θ\boldsymbol\theta while the sample Y∼qθY\sim q_{\boldsymbol\theta} is held fixed. For k1=log⁡qθ(Y)−log⁡p(Y)k_1=\log q_{\boldsymbol\theta}(Y)-\log p(Y) the score has mean zero, so

  2. ∇θk3=(1−p(Y)qθ(Y))∇θlog⁡qθ(Y)\nabla_{\boldsymbol\theta}k_3=\Big(1-\frac{p(Y)}{q_{\boldsymbol\theta}(Y)}\Big)\nabla_{\boldsymbol\theta}\log q_{\boldsymbol\theta}(Y)

    A k1k_1 loss adds zero-mean noise and no regularization at all. For k3=p(Y)qθ(Y)−1+log⁡qθ(Y)−log⁡p(Y)k_3=\frac{p(Y)}{q_{\boldsymbol\theta}(Y)}-1+\log q_{\boldsymbol\theta}(Y)-\log p(Y),

  3. EY∼qθ[∇θk3]=−∑yp(y) ∇θlog⁡qθ(y)=∇θDKL(p ∥ qθ)\E_{Y\sim q_{\boldsymbol\theta}}\big[\nabla_{\boldsymbol\theta}k_3\big]=-\sum_yp(y)\,\nabla_{\boldsymbol\theta}\log q_{\boldsymbol\theta}(y)=\nabla_{\boldsymbol\theta}\KL\big(p\,\|\,q_{\boldsymbol\theta}\big)

    In expectation the first term vanishes again, and the second reweights the score by p/qp/q:

  4. So the k3k_3 loss, an unbiased estimate of DKL(πθ ∥ πref)\KL(\pi_{\boldsymbol\theta}\,\|\,\pi_{\text{ref}}) in value, follows the gradient of DKL(πref ∥ πθ)\KL(\pi_{\text{ref}}\,\|\,\pi_{\boldsymbol\theta}), the divergence with its arguments swapped, which penalizes the policy for losing mass where the reference has it (Tang & Munos, 2025). The gradient of DKL(πθ ∥ πref)\KL(\pi_{\boldsymbol\theta}\,\|\,\pi_{\text{ref}}) itself is E[log⁡qθ(Y)p(Y) ∇log⁡qθ(Y)]\E\big[\log\frac{q_{\boldsymbol\theta}(Y)}{p(Y)}\,\nabla\log q_{\boldsymbol\theta}(Y)\big], the log-ratio acting as a negative reward, which is what putting the penalty into the reward, as in PPO-based RLHF, computes.

  5. A further subtlety: applied token by token, these losses ignore how a token changes the KL contributions of the tokens after it, so they give at best a partial derivative of the sequence-level divergence.

Check your understanding

A team adds β k3\beta\,k_3, averaged over sampled tokens, to its loss, believing that it penalizes DKL(πθ ∥ πref)\KL(\pi_{\boldsymbol\theta}\,\|\,\pi_{\text{ref}}). What does its expected gradient actually descend?

  1. DKL(πθ ∥ πref)\KL(\pi_{\boldsymbol\theta}\,\|\,\pi_{\text{ref}}), exactly as intended
  2. DKL(πref ∥ πθ)\KL(\pi_{\text{ref}}\,\|\,\pi_{\boldsymbol\theta})
  3. Nothing: its expected gradient is zero
  4. The entropy of πθ\pi_{\boldsymbol\theta}
Show the answer

B. DKL(πref ∥ πθ)\KL(\pi_{\text{ref}}\,\|\,\pi_{\boldsymbol\theta})

Holding the sample fixed and differentiating k3k_3 gives (1−p/q)∇log⁡q(1-p/q)\nabla\log q, whose expectation under qq is −∑yp(y)∇log⁡q(y)=∇DKL(p ∥ q)-\sum_yp(y)\nabla\log q(y)=\nabla\KL(p\,\|\,q). The two divergences agree to second order when the policies are close, so the difference matters most when the policy has moved far from the reference.

Leave-one-out, the mean, and the standard deviation

DerivationThree group baselines
  1. g^RLOO=1G∑i=1G(ri−1G−1∑j≠irj)∇log⁡π(yi∣x),E[g^RLOO]=∇p(x)\hat g_{\text{RLOO}}=\frac1G\sum_{i=1}^G\Big(r_i-\frac{1}{G-1}\sum_{j\ne i}r_j\Big)\nabla\log\pi(y_i\mid x),\qquad\E[\hat g_{\text{RLOO}}]=\nabla p(x)

    Sample y1,…,yGy_1,\dots,y_G independently given xx, with success probability p(x)p(x) under 0/1 rewards. RLOO's baseline for yiy_i does not depend on yiy_i, so its estimator is unbiased:

  2. Because ri−1G−1∑j≠irj=GG−1(ri−rˉ)r_i-\frac{1}{G-1}\sum_{j\ne i}r_j=\frac{G}{G-1}(r_i-\bar r), centering on the full mean gives exactly G−1G g^RLOO\frac{G-1}{G}\,\hat g_{\text{RLOO}}: biased only by a constant factor, which does not change the direction.

  3. ∇p(x)p(x) (1−p(x))=∇[ 2arcsin⁡p(x) ]\frac{\nabla p(x)}{\sqrt{p(x)\,\big(1-p(x)\big)}}=\nabla\Big[\,2\arcsin\sqrt{p(x)}\,\Big]

    Dividing by the group's standard deviation ss is different: ss depends on yiy_i and varies across prompts. As G→∞G\to\infty, rˉ→p(x)\bar r\to p(x) and s→p(x) (1−p(x))s\to\sqrt{p(x)\,(1-p(x))}, and since E[(r−p)∇log⁡π]=∇p\E\big[(r-p)\nabla\log\pi\big]=\nabla p, the per-prompt update tends to

  4. In the large-group limit, ignoring clipping and length normalization, GRPO therefore ascends Ex[2arcsin⁡pθ(x)]\E_x\big[2\arcsin\sqrt{p_{\boldsymbol\theta}(x)}\big] instead of pass@1, Ex[pθ(x)]\E_x[p_{\boldsymbol\theta}(x)]. The weight 1/p(1−p)1/\sqrt{p(1-p)} is 2 at p=12p=\tfrac12, 3.33 at p=0.1p=0.1 or 0.90.9, and 10.05 at p=0.01p=0.01 or 0.990.99: prompts the policy almost always or almost never solves get the largest steps per unit of improvement. Liu et al. (2025) call this the question-level difficulty bias.

Whether the reweighting helps is an empirical question. It amplifies a rare success on a hard prompt, which can speed learning there, and a rare failure on an easy prompt, which can amplify noise in the verifier. Dr. GRPO drops it and so ascends pass@1 directly. For 0/1 rewards s≤12s\le\tfrac12, so the division also at least doubles every step: part of its effect is simply a larger step size.

Predict before you look

A prompt is solved with probability p=0.9p=0.9. With groups of G=16G=16, what percentage of its groups carry no signal at all, because every reward in the group is equal?

Show the answer

19 %

All 16 correct with probability 0.916≈0.1850.9^{16}\approx0.185, all 16 wrong with probability 0.1160.1^{16}, which is negligible: about 19% in total. At G=8G=8 it is 43%. In general the fraction is pG+(1−p)Gp^G+(1-p)^G, so prompts near p=0p=0 or 11 waste most of their samples unless the group is large, precisely the prompts that the standard-deviation normalization weights most when they do give signal.

Length normalization and its bias

DerivationWhat dividing by the response length optimizes
  1. Ey∼πθ[r(y)−p∣y∣ ∇log⁡πθ(y∣x)]=∇θ Ey∼πθ[r(y)−p∣y∣]\E_{y\sim\pi_{\boldsymbol\theta}}\Big[\frac{r(y)-p}{\abs{y}}\,\nabla\log\pi_{\boldsymbol\theta}(y\mid x)\Big]=\nabla_{\boldsymbol\theta}\,\E_{y\sim\pi_{\boldsymbol\theta}}\Big[\frac{r(y)-p}{\abs{y}}\Big]

    At ratio 1, response ii's token terms sum to A^i∑t∇log⁡π(yi,t∣⋅)=A^i ∇log⁡π(yi∣x)\hat A_i\sum_t\nabla\log\pi(y_{i,t}\mid\cdot)=\hat A_i\,\nabla\log\pi(y_i\mid x), and GRPO divides this by ∣yi∣\abs{y_i}. Treat the baseline as the fixed number pp (exact as G→∞G\to\infty, where rˉ→p\bar r\to p). Since f(y)=r(y)−p∣y∣f(y)=\frac{r(y)-p}{\abs{y}} does not depend on θ\boldsymbol\theta, the expected update is the gradient of a different objective:

  2. A correct response contributes (1−p)/∣y∣(1-p)/\abs{y}, larger when the response is short. An incorrect one contributes −p/∣y∣-p/\abs{y}, which is larger, that is, less negative, when the response is long. Among correct answers brevity is rewarded; among wrong answers, length softens the penalty.

  3. Liu et al. (2025) call this the response-level length bias and argue that it inflates the length of incorrect responses over training; they found the same per-response normalization in several widely used open-source implementations. Dr. GRPO replaces ∣yi∣\abs{y_i} by a constant, such as the generation budget, which makes the update an unbiased policy gradient up to scale.

NormalizerWeight of each token of response iiLength preferenceUnbiased up to scale?
per response, 1G∑i1∣yi∣∑t\frac1G\sum_i\frac{1}{\abs{y_i}}\sum_t (GRPO)1G∣yi∣\frac{1}{G\abs{y_i}}short when right, long when wrongno
per batch of tokens, 1∑j∣yj∣∑i∑t\frac{1}{\sum_j\abs{y_j}}\sum_i\sum_t (DAPO)1∑j∣yj∣\frac{1}{\sum_j\abs{y_j}}, the same for every token in the batchnone within a batch; batches of long responses take smaller stepsapproximately, for large batches: the normalizer depends on the samples
constant, 1GL∑i∑t\frac{1}{GL}\sum_i\sum_t (Dr. GRPO)1GL\frac{1}{GL} for a fixed budget LLnoneyes
Under the token-level average every token counts equally, so long responses weigh more than under GRPO's per-response average. DAPO adopted it because the per-response average let long, low-quality responses, with gibberish or repetition, go under-penalized.
Think first Under GRPO's per-response normalization, two incorrect responses to the same prompt get the same negative advantage; one is 200 tokens long and the other 2,000. How do their per-token penalties compare?

Each token's gradient is scaled by A^i/∣yi∣\hat A_i/\abs{y_i}, so the long response spreads the same total penalty over ten times as many tokens: each of its tokens is pushed down one tenth as hard. Nothing in the update discourages long wrong answers in particular, which is the bias Dr. GRPO removes. With a constant normalizer, each of the long response's tokens would be penalized as hard as the short one's, ten times the total.

DAPO: repairs for long chains of thought

Yu et al. (2025) trained a 32-billion-parameter base model with an open recipe, DAPO, and reported a higher AIME 2024 score than DeepSeek's own RL run from the same base model (50 against 47 points) with half as many training steps. Its four changes target failure modes of plain GRPO on long chains of thought:

  • Clip-Higher. PPO's symmetric clip lets a token's probability grow by at most a factor 1+ϵ1+\epsilon per round of updates. From 0.9 that allows anything (the bound 1.08 exceeds 1), but from 0.01 only 0.012. Rare tokens, which carry exploration, are the ones held back, and the policy's entropy collapses. DAPO decouples the bounds, with ϵlow=0.2\epsilon_{\text{low}}=0.2 and ϵhigh=0.28\epsilon_{\text{high}}=0.28, so a token at 0.01 can grow to 0.0128.
  • Dynamic sampling. All-equal groups contribute nothing. DAPO over-samples and keeps only prompts whose group accuracy is strictly between 0 and 1, so every batch is full of informative groups.
  • Token-level loss. Averaging over all tokens in the batch, as in the table above, so that long responses are not under-weighted.
  • Overlong reward shaping. Responses cut off at the length limit are either excluded from the loss (overlong filtering) or penalized linearly within a buffer zone just below the limit (soft overlong punishment), instead of being scored like ordinary wrong answers.

DAPO also drops the KL term, arguing that a reasoning policy should be free to move far from its initialization, and uses rewards of +1+1 and −1-1. Each change's contribution was measured in one setting; the changes interact, and their individual effects may differ elsewhere. The common thread is that clipping, sampling and normalization, details of PPO-style code, decide how fast the policy's entropy falls and which samples carry signal.

Credit assignment without a critic

Every method so far gives all tokens of a response the same advantage. In a 5,000-token solution where one step was a decisive idea and another a careless slip, both get identical credit, and only averaging over many samples sorts them out. PPO's learned value network was meant to solve this, but Kazemnejad et al. (2025) found that on reasoning tasks its estimates were poor, barely better than chance at ranking candidate next steps.

DerivationMonte Carlo values at step boundaries (VinePPO)
  1. V^(st)=1K∑k=1Kr(x,y(k)),y(k)∼πθ(⋅∣st)\hat V(s_t)=\frac1K\sum_{k=1}^Kr\big(x,y^{(k)}\big),\qquad y^{(k)}\sim\pi_{\boldsymbol\theta}(\cdot\mid s_t)

    A language-model environment can be reset to any prefix for free: feed the prefix back in. So instead of learning V(st)V(s_t), estimate it by sampling KK completions from the intermediate state sts_t with the current policy and averaging their rewards:

  2. A^t=V^(st+1)−V^(st)\hat A_t=\hat V(s_{t+1})-\hat V(s_t)

    This is an unbiased estimate of Vπθ(st)V^{\pi_{\boldsymbol\theta}}(s_t), with variance at most 14K\frac{1}{4K} for 0/1 rewards. With no intermediate rewards and γ=1\gamma=1, the advantage of the step from sts_t to st+1s_{t+1} is estimated by

  3. Over a response these telescope to r−V^(s0)r-\hat V(s_0), the outcome minus the prompt's estimated success rate: the same total credit as a group baseline gives, now distributed to the steps that changed the odds. The price is KK extra completions per step boundary. Kazemnejad et al. reported that, despite slower iterations, the method beat PPO and other baselines on MATH and GSM8K, and in less wall-clock time.

Key takeaways

  • With one gradient step per batch, GRPO's clip is inactive and the method is REINFORCE with a group baseline plus a KL loss; clipping matters only when samples are reused.
  • The k3 estimator is unbiased and non-negative in value, but as a loss its gradient follows DKL(πref ∥ πθ)\KL(\pi_{\text{ref}}\,\|\,\pi_{\boldsymbol\theta}), and the k1 loss has zero expected gradient. Putting the log-ratio into the reward gives the gradient of DKL(πθ ∥ πref)\KL(\pi_{\boldsymbol\theta}\,\|\,\pi_{\text{ref}}).
  • Mean-centering is RLOO times G−1G\frac{G-1}{G}. Dividing by the group's standard deviation makes GRPO ascend Ex[2arcsin⁡p(x)]\E_x\big[2\arcsin\sqrt{p(x)}\big] in the large-group limit, weighting prompts near p=0p=0 or 11 most.
  • Per-response length normalization rewards brevity in correct answers and leniency toward long wrong ones; Dr. GRPO uses a constant normalizer, DAPO a token-level average.
  • DAPO widens the upper clip, filters all-equal groups, averages over tokens and shapes overlong responses; VinePPO replaces the critic with Monte Carlo values at step boundaries, giving each step its own credit.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

DeepSeekMath made a single gradient update per batch of samples. What did PPO-style clipping do in that setting?

  1. It limited every update to a ratio change of ϵ\epsilon
  2. Nothing: when the gradient is taken, πold=πθ\pi_{\text{old}}=\pi_{\boldsymbol\theta}, every ratio is 1 and the clip is inactive
  3. It replaced the KL penalty
  4. It removed the length normalization
Show the answer

B. Nothing: when the gradient is taken, πold=πθ\pi_{\text{old}}=\pi_{\boldsymbol\theta}, every ratio is 1 and the clip is inactive

At ρ=1\rho=1 both terms of the minimum agree and the gradient is A^ ∇log⁡π\hat A\,\nabla\log\pi. Clipping only bites after the policy has moved away from the one that sampled the data, that is, on the second and later updates using the same samples.

Question 2

In the large-group limit, with 0/1 rewards and no length normalization, which objective does GRPO's standard-deviation normalization ascend?

  1. Ex[p(x)]\E_x[p(x)]
  2. Ex[log⁡p(x)]\E_x[\log p(x)]
  3. Ex[2arcsin⁡p(x)]\E_x\big[2\arcsin\sqrt{p(x)}\big]
  4. Ex[p(x)2]\E_x\big[p(x)^2\big]
Show the answer

C. Ex[2arcsin⁡p(x)]\E_x\big[2\arcsin\sqrt{p(x)}\big]

The update per prompt tends to ∇p/p(1−p)\nabla p/\sqrt{p(1-p)}, and ddp2arcsin⁡p=1/p(1−p)\frac{d}{dp}2\arcsin\sqrt p=1/\sqrt{p(1-p)}. This concave-then-convex transform has infinite slope at p=0p=0 and p=1p=1, which is the difficulty weighting.

Question 3

Why does DAPO's dynamic sampling over-sample prompts and keep only those whose group accuracy is strictly between 0 and 1?

  1. Because all-equal groups have zero advantages and contribute no gradient, which shrinks the effective batch and makes updates noisier
  2. To make the KL penalty unnecessary
  3. To remove overlong responses
  4. To guarantee that every prompt is eventually solved
Show the answer

A. Because all-equal groups have zero advantages and contribute no gradient, which shrinks the effective batch and makes updates noisier

As training improves the policy, more prompts are always solved and their groups carry no signal. Filtering keeps each batch full of informative groups, at the cost of extra sampling.

Question 4

VinePPO estimates the value of an intermediate reasoning state by averaging the rewards of KK fresh completions from it. Why is this practical for language models but rarely for robots?

  1. Language models never need value estimates
  2. Language-model rewards are deterministic
  3. Robots have no intermediate states
  4. A text prefix can be restored exactly, so the environment can be reset to any intermediate state for the cost of a forward pass, while a physical system cannot be returned to an earlier state
Show the answer

D. A text prefix can be restored exactly, so the environment can be reset to any intermediate state for the cost of a forward pass, while a physical system cannot be returned to an earlier state

Monte Carlo value estimation needs restarts from arbitrary states. For text generation the state is the prefix, so restarting is free; for a robot it would require resetting the world, which is possible only in simulation.

Further reading

  • Z. Shao et al., "DeepSeekMath: Pushing the limits of mathematical reasoning in open language models," arXiv:2402.03300 (2024).
  • Z. Liu, C. Chen, W. Li, P. Qi, T. Pang, C. Du, W. S. Lee & M. Lin, "Understanding R1-Zero-like training: A critical perspective," COLM (2025); arXiv:2503.20783.
  • Q. Yu et al., "DAPO: An open-source LLM reinforcement learning system at scale," NeurIPS (2025); arXiv:2503.14476.
  • A. Kazemnejad, M. Aghajohari, E. Portelance, A. Sordoni, S. Reddy, A. Courville & N. Le Roux, "VinePPO: Refining credit assignment in RL training of LLMs," ICML (2025).
  • Y. Tang & R. Munos, "On a few pitfalls in KL divergence gradient estimation for RL," arXiv:2506.09477 (2025).