Skip to content

Chapter 8 · RL with Verifiable Rewards

8.1 What is RLVR, and how does it differ from RLHF? ★★

One-sentence answer

RLVR (reinforcement learning with verifiable rewards) means that, on tasks such as math and code whose answers a program can check automatically, we do not train a reward model; instead, a rule-based verifier decides whether the response is correct, and that result serves as the reward for reinforcement learning. Its core difference from RLHF is the source of the reward: in RLHF the reward comes from a reward model fitted to human preferences, which is easy to hack; in RLVR the reward is sparse but trustworthy, so training can run for a long time, at the cost of applying only to tasks with objective answers.

I will address three aspects: where the RLVR reward comes from, its advantages over RLHF, and its costs.

(1) RLVR replaces the reward model with a programmatic verifier; the reward is sparse but trustworthy.

In RLHF (see Chapter 6), the reward comes from a reward model trained on human preference data, and it measures "how much does this response look like one people would prefer". RLVR takes a different route: for tasks whose answers can be checked automatically, it uses rules to decide directly whether the response is correct and uses that result as the reward. The name comes from Tülu 3 (Lambert et al. 2024), and DeepSeek-R1 is what made the paradigm widely known (see 8.2). There are three common kinds of verification:

  • Math: extract the final answer from the response (e.g. the content of \boxed{}) and check whether it is mathematically equivalent to the reference answer, giving 1 if it is and 0 if not.
  • Code: run the generated code in a sandbox and use unit tests to decide whether it passes.
  • Other automatically checkable tasks: for example logic puzzles, or instructions with checkable constraints ("output JSON", "at most 100 words").

In addition there is usually a format reward, which checks that the reasoning is inside the required tags and that the answer is in the designated place, so that the answer can be extracted reliably. This kind of reward has two properties. It is very sparse: a response of several thousand tokens receives a single 0 or 1 at the end, and nobody tells the model which steps were right or wrong. But it is largely trustworthy: as long as the verifier is written rigorously, a high score means the answer really is correct.

(2) All of RLVR's advantages over RLHF stem from the trustworthiness of the reward.

  • It is hard to hack: A learned reward model is only an approximation of human preferences, and it assigns wrongly high scores in regions it has not seen. RL applies strong optimization pressure, and the longer training runs, the more the policy specifically seeks out these holes, until the reward keeps rising while true quality falls; this is reward over-optimization. DeepSeek-R1 states explicitly that it does not use a neural reward model precisely because such models are easily hacked in large-scale RL, and once that happens the reward model has to be retrained. A rule-based verifier has no holes of the kind that gradient descent can gradually grind its way into.
  • It is cheaper and simpler: There is no preference data to collect and no reward model to train, and during RL there is no need to keep a reward model roughly the size of the policy in GPU memory to score samples.
  • Training can run for a long time: Because the reward is trustworthy, one can safely run thousands of RL steps and keep improving; with a learned reward model, hacking usually sets in at some point, and training has to stop early.

(3) The cost is a narrow scope, and an outcome reward does not check the reasoning process.

RLVR only applies to tasks with objective answers; writing, open-ended dialogue and advice have no reference answer and still need a reward model or an LLM-as-a-judge. In real post-training pipelines, therefore, RLVR and reward-model-based RLHF usually coexist: for example, DeepSeek-R1's final RL round uses rule-based rewards for reasoning data and a reward model for general data. Moreover, an outcome reward looks only at the final answer, so a response with flawed reasoning that happens to reach the right answer still receives full marks (see 8.7).

In summary: the essence of RLVR is trading an informative but hackable reward for a trustworthy but sparse one, which is what makes large-scale, long-running RL possible.

Going deeper: the concrete form of the reward, and a comparison with RLHF

(1) A typical reward consists of a correctness term and a format term.

\[ r(x, y) = r_{\text{acc}}(x, y) + r_{\text{format}}(y), \qquad r_{\text{acc}}(x, y) = \mathbb{1}\big[\mathrm{extract}(y) \equiv y^*\big] \]

Here \(x\) is the problem, \(y\) the model's response, \(y^*\) the reference answer, \(\mathrm{extract}(y)\) the final answer extracted from the response, \(\equiv\) denotes mathematical equivalence, \(\mathbb{1}[\cdot]\) is the indicator function (1 if the condition holds, 0 otherwise), and \(r_{\text{format}}(y)\) is the format reward. A few implementation details: math answers cannot be checked by string matching alone, since \(\frac{1}{2}\) and \(0.5\) should both count as correct; some implementations use +1/−1 rather than 1/0 (e.g. DAPO); and code tasks can require all tests to pass, or give partial credit by pass rate.

(2) Comparing RLHF and RLVR.

RLHF RLVR
Source of reward A reward model trained on preference data A rule-based verifier (answer matching, unit tests, etc.)
Signal A continuous score Usually 0/1 (or ±1)
Suitable tasks Open-ended tasks: dialogue, writing, safety Tasks with objective answers: math, code, checkable instructions
Risk of hacking High, and grows with training Lower, but a flawed verifier gets hacked too
Training length Often requires early stopping Can train stably for thousands of steps
Models needed besides the policy Reward model and reference; PPO also needs a critic Reference (can also be dropped without KL); GRPO needs no critic

Follow-up questions

Follow-up 1: Can rule-based rewards be hacked too?

Yes. "Verifiable" does not mean "unhackable": a verifier checks only what it was written to check, while the policy optimizes the verifier's score. The common cases fall into the following categories.

  • Answer-extraction loopholes: If the verifier counts a response as correct whenever the right answer appears anywhere in it, the model may list several candidate answers; it may also exploit a parser bug, using odd formatting that the verifier misjudges as equivalent.
  • Code-test loopholes: When the test cases are incomplete, the model may special-case the tests or simply hard-code the expected outputs; in agentic coding environments, it may even edit the test files.
  • Gaming the format reward: If the check is only whether a think tag exists, the model may write an empty or perfunctory thought.
  • Manipulating an LLM verifier: For free-form answers an LLM is sometimes used to judge equivalence, and the judge can be swayed by wording in the response, such as writing "this answer is correct" inside it.

Follow-up 2: How do you detect and prevent reward hacking in RLVR?

The core is to make the verifier strict and to keep monitoring training. On the verifier side, check equivalence symbolically and allow only one final answer; keep test cases comprehensive and hidden from the model, and run code in a permission-restricted sandbox. On the monitoring side, keep spot-checking samples and watch the reward and length curves, since a sudden jump in reward or an abnormal length is often a sign of hacking. One finding is worth knowing: using another model to monitor the CoT detects hacking effectively, but if one directly optimizes against "bad intent appearing in the CoT" as a penalty, the model learns to hide its intent and keeps hacking without revealing it in the CoT (Baker et al. 2025).

Follow-up 3: Can RLVR be used for tasks without a reference answer?

Not directly; a reward model or an LLM-as-a-judge is still needed. Tasks such as writing and dialogue cannot be judged right or wrong by rules, so the risk of hacking returns. One compromise is to hand the checkable parts of a task (such as format and length constraints) to rules and the rest to a judge. DeepSeek-R1's final RL round mixes the two in exactly this spirit: reasoning data uses rule-based rewards, while general data uses reward models that assess helpfulness and harmlessness.

Common mistakes

  • Do not say that having no reward model means having no reward: RLVR still has a reward; it is simply produced by a programmatic verifier rather than by a learned model.
  • Do not say that "verifiable" means "unhackable": The policy will find and exploit holes in the verifier as well.
  • Do not say that RLVR has replaced RLHF: The two suit different tasks and usually coexist in real post-training pipelines.
  • Do not say that an outcome reward guarantees correct reasoning: It checks only the final answer, so a lucky guess also gets full marks.

8.2 What did DeepSeek-R1-Zero and R1 each do? ★★

One-sentence answer

R1-Zero ran RL with GRPO and rule-based rewards directly on DeepSeek-V3-Base, with no SFT at all, and showed that an outcome reward alone can make a model spontaneously write long chains of thought and exhibit reflection; R1 then added a cold-start SFT, a language-consistency reward, rejection sampling plus SFT, and a final, all-scenario RL round, fixing R1-Zero's poor readability and weak general abilities.

I will address three aspects: what R1-Zero did and found, how cautiously those findings should be interpreted, and R1's multi-stage pipeline.

(1) R1-Zero showed that pure RL with only an outcome reward makes long chain-of-thought reasoning emerge on its own.

DeepSeek-R1-Zero (DeepSeek-AI 2025) runs RL directly on DeepSeek-V3-Base, with no SFT beforehand. The algorithm is GRPO (see 8.3), and the reward has just two parts: whether the answer is correct, and whether the reasoning is inside think tags. The prompt template only asks the model to think before answering, without prescribing how to think. As a result, AIME 2024 pass@1 rose from 15.6% to 71.0%. More important are two behaviors that emerged on their own during training:

  • Responses grew longer and longer: The average response length grew steadily during training, from hundreds of tokens to thousands. Nobody asked for this; the model discovered by itself that "thinking a bit longer" makes a correct answer more likely, so test-time compute (the compute spent at inference) grew naturally with training.
  • Reflection and verification appeared: The model began checking its own earlier steps and, on finding a problem, trying a different approach. The paper shows an intermediate checkpoint writing "Wait, wait. Wait. That's an aha moment I can flag here." and then going back to re-examine its solution; this is the so-called aha moment.

The significance is that nobody taught the model "how to reason"; it was only told whether the final answer was right, and complex reasoning behavior grew out of RL. This shows that with a strong enough base model and a reliable enough reward, an outcome reward is sufficient to drive long-chain reasoning.

(2) But R1-Zero has clear flaws, and "emergence" should be interpreted with care.

R1-Zero's outputs are hard to read and often mix Chinese and English (language mixing), because the reward cares only about the answer, not about whether the reasoning is readable. Moreover, Liu et al. (2025) found that many base models, including DeepSeek-V3-Base, already write self-reflective sentences before any RL. A more accurate statement is therefore that RL amplifies behaviors already present in the base model and ties them to "getting the answer right", rather than creating them from scratch. This bears directly on the debate in 8.8 about whether RL teaches new abilities.

(3) On top of R1-Zero, R1 builds a four-stage pipeline that alternates SFT and RL.

  • Cold-start SFT: First, SFT on a few thousand curated, readable long-CoT examples fixes the output format and the "think first, then answer" structure. RL can then start from a good point and skip the unstable early phase of running RL directly from the base model; the paper also found that the final result is better than R1-Zero's.
  • Reasoning-oriented RL: RL with rule-based rewards on tasks such as math and code, plus an additional language-consistency reward (the share of target-language words in the CoT) to address language mixing.
  • Rejection sampling and SFT: The post-RL model is sampled heavily, and only correct, cleanly formatted responses are kept (about 600k); about 200k non-reasoning samples such as writing and question answering are added, and the base model is fine-tuned again.
  • All-scenario RL: In the final RL round, reasoning data continues to use rule-based rewards, while general data uses reward models that assess helpfulness and harmlessness.

In summary: R1-Zero answered "can reasoning be trained with an outcome reward alone?", and R1 answered "how do we turn that into a usable model?": RL explores and discovers good behaviors, and SFT turns those behaviors into clean data and stabilizes them.

Going deeper: key numbers, reward trade-offs, failed attempts and distillation

(1) R1-Zero's numbers differ slightly between versions.

The first arXiv version reports AIME 2024 pass@1 rising from 15.6% to 71.0%, and reaching 86.7% with majority voting (64 samples per problem); the version later published in Nature reports a pass@1 of 77.9%. The full R1 reaches 79.8% pass@1 on AIME 2024.

(2) Every additional reward term competes with accuracy for optimization pressure.

The paper's ablation shows that the language-consistency reward slightly lowers the reasoning metrics but clearly improves readability. This shows that any reward term not directly serving correctness trades away some accuracy for other properties, and reward design has to make that trade-off explicit.

(3) The paper explicitly reports two unsuccessful attempts.

  • PRM: In general reasoning it is hard to define "a step" clearly, and it is hard to judge whether an intermediate step is correct; more importantly, a model-based PRM is easily hacked during RL (see 8.7).
  • MCTS: The token-level search space is too large to scale effectively the way it does in Go, and the value model that guides the search is hard to train.

(4) The roughly 800k samples generated by R1 were used to distill small models.

Running SFT directly on Qwen2.5 and Llama models with these data produced the DeepSeek-R1-Distill series, which outperforms large-scale RL run directly on the same small models (see Chapter 9).

Follow-up questions

Follow-up 1: Did the aha moment really emerge from scratch through RL?

Not entirely; more likely RL amplified behaviors already present in the base model. Liu et al. (2025) found on several base models (including DeepSeek-V3-Base) that the model occasionally writes self-reflective sentences such as "wait" or "let me check" before any RL. What RL does is raise the frequency of these behaviors and associate them with correct answers. They also pointed out that part of the growth in response length during RL comes from GRPO's length-normalization bias, rather than entirely from "learning to think more" (see 8.4).

Follow-up 2: If R1-Zero can already reason, why does R1 need a cold start?

To make RL more stable and its outputs more readable, and to get a better final result. Running RL directly from the base model gives messy output formats early on, unstable training and a hard-to-read final CoT. A cold-start SFT fixes the output format in advance with a small amount of high-quality data, which amounts to injecting human priors into RL's starting point. The paper found that the resulting model is not only more readable but also reasons better than R1-Zero.

Follow-up 3: Why run another round of rejection sampling plus SFT after RL?

Because RL is good at discovering good behaviors, whereas SFT is good at stabilizing behaviors and restoring general abilities. Reasoning RL covers only verifiable tasks such as math and code, so the model's abilities in writing, question answering and the like may be neglected. Sampling from the post-RL model, filtering for high-quality responses and fine-tuning again together with non-reasoning data both turns the reasoning behaviors learned by RL into clean training data and restores general abilities. These data were later also used directly to distill small models.

Common mistakes

  • Do not describe R1 as "trained with pure RL": The pure-RL, no-SFT model is R1-Zero; R1 includes two SFT rounds and two RL rounds.
  • Do not say that R1 used a PRM or MCTS: The paper states explicitly that both were tried without success, and in the end only outcome rewards were used.
  • Do not say that the aha moment proves RL can create reasoning from scratch: The base model already showed similar behaviors before RL.
  • Do not say that R1 used no reward model at all: Reasoning RL did not use one, but the final RL round used reward models for general data.

8.3 How does GRPO work, and how does it differ from PPO? ★★★

One-sentence answer

GRPO samples a group of responses for each question and uses the group-standardized reward as the advantage, shared by all tokens of a response, thereby replacing PPO's critic and GAE with "comparison within the group"; it keeps PPO's clipped objective and moves the KL out of the reward into a separate loss term. The costs are multiple samples per question and the loss of token-level credit assignment.

I will address four aspects: how GRPO computes the advantage, its objective, how it differs from PPO, and what is gained and lost by removing the critic.

(1) GRPO computes the advantage by comparing several responses to the same question.

GRPO (Shao et al. 2024, introduced in DeepSeekMath) works as follows: for each question \(q\), sample \(G\) responses \(o_1,\dots,o_G\) from the old policy, compute their rewards \(r_1,\dots,r_G\), and standardize within the group:

\[ \hat A_i = \frac{r_i - \mathrm{mean}(r_1,\dots,r_G)}{\mathrm{std}(r_1,\dots,r_G)} \]

Every token in a response uses the same \(\hat A_i\). Intuitively, it asks: "compared with the other responses to the same question, is this one better or worse?" The group mean is a Monte Carlo estimate of the question's expected reward, so it plays exactly the role of the value in a critic; dividing by the standard deviation puts the advantages of different questions on a similar scale. For example, with \(G=4\) and rewards 1, 0, 0, 0, the correct response gets an advantage of about +1.73 and each of the three wrong ones about −0.58, so on a hard problem the rare correct response receives a large positive push. Conversely, if a group is all correct or all wrong, every advantage is 0, and the question contributes nothing to the gradient.

(2) The objective keeps PPO's clipping mechanism but adds the KL as a separate loss term.

GRPO computes a PPO-style clipped surrogate at every token, averages over tokens within each response, then averages over the responses in the group, and finally subtracts a KL penalty (the full formula is in "Going deeper" below). The importance ratio is the probability ratio of the same token under the current policy and the old policy that sampled it: a batch of rollouts (i.e. responses sampled from the policy) is usually split into several mini-batches for multiple updates, and by the later updates the policy has changed, so this ratio is needed as a correction; the clip ensures that once the ratio leaves \([1-\varepsilon, 1+\varepsilon]\), the objective stops pushing, so a single update cannot move too far. The KL term is added directly to the loss to keep the policy from drifting too far from the reference model (usually the model before RL). Note that if each batch of rollouts receives only one gradient update, the ratio is identically 1 when the gradient is taken, the clip never activates, and GRPO reduces to "REINFORCE with a group baseline plus a KL penalty".

(3) Compared with PPO, GRPO keeps the clipped objective, and the differences fall into three areas.

GRPO can be viewed as a variant of PPO (details of PPO are in Chapter 6); its changes concern where the advantage comes from, where the KL goes, and the resulting change in the number of models.

  • The source of the advantage differs: PPO trains a critic to predict the value of every prefix, then uses GAE (generalized advantage estimation, a method that uses the value to estimate per-token advantages) to compute each token's advantage; GRPO compares several responses to the same question, and the whole response shares one advantage.
  • The location of the KL differs: PPO-RLHF folds the KL penalty into each token's reward, so it enters the advantage computation; GRPO adds the KL as a separate loss term, so the advantage reflects only the task reward.
  • The models being trained differ: PPO must train both the policy and a critic of comparable size; GRPO trains only the policy. Combined with a rule-based reward, not even a reward model is needed, leaving only the policy and the reference in GPU memory.

(4) Removing the critic suits LLMs especially well, but it comes at a price.

Removing the critic is not only about saving memory. For LLMs, the critic is hard to learn well in the first place: the reward appears only at the end of the response, yet the critic must predict "will this end up correct?" from every prefix, for example judging the success rate on a hard problem from its first 50 tokens, which is itself a very hard problem. An inaccurate critic makes the GAE advantages biased, which can actively mislead training, whereas the group Monte Carlo estimate needs no training and is simple and reliable at the question level. However, GRPO pays a price for this: each question needs \(G\) sampled responses, and generation is already the most expensive part of RL; all tokens in a response share one advantage, so there is no token-level credit assignment (i.e. deciding which tokens in a response are responsible for the outcome), useless detours in correct responses get rewarded and correct steps in wrong responses get punished, and this can only be averaged out statistically over many samples; in addition, questions where the whole group is right or wrong waste their samples.

In summary: the core of GRPO is replacing a learned value function with comparisons among several samples for the same question, trading sampling cost and precision of credit assignment for training that is simpler, more stable and lighter on memory.

Comparing GRPO and PPO:

PPO (RLHF) GRPO
Advantage Critic + GAE, computed per token Group-standardized outcome reward, shared by the whole response
Critic Required, usually as large as the policy Not needed
Samples per prompt Usually 1 \(G\) (e.g. 8–64)
Location of the KL Folded into each token's reward A separate loss term (k3 estimator)
Credit assignment Token-level, via the value function Response-level only
Models being trained Policy + critic Policy only
Frozen models Reference + reward model Reference (+ reward model if the reward is not rule-based)

Going deeper: the full objective, the memory budget, the relation to RLOO, and the original setup

(1) The full objective.

\[ \mathcal{J}_{\text{GRPO}}(\theta) = \mathbb{E}\left[\frac{1}{G}\sum_{i=1}^{G}\frac{1}{|o_i|}\sum_{t=1}^{|o_i|}\Big(\min\big(\rho_{i,t}\hat A_{i},\ \mathrm{clip}(\rho_{i,t}, 1-\varepsilon, 1+\varepsilon)\,\hat A_{i}\big) - \beta\, \hat{D}_{\text{KL}}^{(i,t)}\Big)\right], \qquad \rho_{i,t} = \frac{\pi_\theta(o_{i,t}\mid q, o_{i,<t})}{\pi_{\theta_{\text{old}}}(o_{i,t}\mid q, o_{i,<t})} \]

Here \(o_{i,t}\) is the \(t\)-th token of the \(i\)-th response, \(o_{i,<t}\) the tokens before it, \(|o_i|\) the length of the response, \(\pi_{\theta_{\text{old}}}\) the old policy that did the sampling, \(\rho_{i,t}\) the importance ratio, \(\varepsilon\) the clip range (usually 0.2), \(\beta\) the strength of the KL penalty, and \(\hat{D}_{\text{KL}}^{(i,t)}\) the per-token KL computed with the k3 estimator (see 8.6). This way of aggregating, "average by length within each response first, then across responses", was later found to have a length bias (see 8.4).

(2) The memory budget: removing the critic saves roughly half of the training state.

A model being trained stores gradients and Adam states in addition to its weights, about 16 bytes per parameter in mixed precision; a frozen model stored in bf16 takes about 2 bytes per parameter. For 7B models, PPO trains a policy and a critic (about 112 GB each) and also holds a frozen reward model and reference (about 14 GB each), about 250 GB in total; GRPO with a rule-based reward trains only the policy (about 112 GB) plus the reference (about 14 GB), about 126 GB. None of these figures includes activations or the KV cache.

(3) GRPO, REINFORCE and RLOO share one idea.

In policy gradient, subtracting a baseline that does not depend on the sample introduces no bias but substantially reduces variance. RLOO (Kool et al. 2019; Ahmadian et al. 2024) samples \(k\) responses per prompt and uses the mean reward of the other \(k-1\) responses as the baseline for response \(i\). GRPO's group mean includes the response itself, and the two differ only by a constant factor:

\[ r_i - \bar r = \frac{k-1}{k}\left(r_i - \frac{1}{k-1}\sum_{j\ne i} r_j\right) \]

Here \(\bar r\) is the group mean reward including the response itself. Hence, without dividing by the standard deviation, GRPO's advantage equals RLOO's up to a constant; dividing by the standard deviation introduces an additional bias (see Dr. GRPO in 8.4).

(4) The original setup in DeepSeekMath.

The original paper samples 64 responses per question, with a maximum length of 1024 and a KL coefficient of 0.04, and the policy is updated only once after each exploration stage. By the analysis above, this means the clip does not actually take effect in the original setup. Moreover, GRPO in the original paper used a learned reward model (comparing outcome supervision and process supervision), not a rule-based reward.

Follow-up questions

Follow-up 1: What happens if all responses in a group receive the same reward?

Every advantage in the group is 0, so the group contributes nothing to the gradient. Implementations add a small \(\epsilon\) to the standard deviation to avoid division by zero, but the numerator is already 0. As training progresses and the model gets stronger, more questions become all-correct, so fewer samples in a batch actually provide gradient, and the gradient becomes noisier. This is why dynamic sampling or difficulty filtering is needed to keep only questions with mixed results (see DAPO in 8.4 and 8.9).

Follow-up 2: Can GRPO be used only with verifiable rewards?

No. GRPO only specifies how to compute advantages from a group of rewards; the rewards can come from anywhere. In the original DeepSeekMath paper GRPO used a learned reward model, and R1's final stage also uses reward models to score general data. Its advantage is simply most pronounced when paired with rule-based rewards: neither a critic nor a reward model is needed.

Follow-up 3: If each batch is used for only one update, does GRPO's clip still do anything?

No. With a single update, at the moment the gradient is taken the current policy is exactly the policy that sampled the data, so the importance ratio is identically 1 and never falls outside the clip range. The clip only matters when the same batch is reused for several updates. In real systems, however, numerical differences between the training and inference engines mean that the probabilities computed on the two sides are not exactly equal (see 8.9).

Follow-up 4: Why do we say GRPO has no token-level credit assignment, and what are the consequences?

Because all tokens in a response share one advantage, the model cannot tell which step caused success or failure. For example, a useless detour in a correct response is rewarded along with everything else, and the correct early steps of a wrong response are punished along with everything else. GRPO can only rely on large numbers of samples for this noise to cancel out statistically. This is precisely the problem that process rewards (see 8.7) and on-policy distillation (see Chapter 9) try to solve.

Common mistakes

  • Do not say that GRPO has no importance ratio or clip: It keeps PPO's clipped objective in full; only the source of the advantage differs.
  • Do not say that GRPO performs token-level credit assignment: All tokens of a response share one advantage.
  • Do not say that GRPO can only be used with rule-based rewards: The original DeepSeekMath used a learned reward model.
  • Do not say that GRPO's objective is unbiased: Normalizing by response length and dividing by the group standard deviation both introduce optimization biases, which is exactly what Dr. GRPO fixes (see 8.4).
  • Do not say that GRPO and PPO-RLHF put the KL in the same place: PPO-RLHF folds the KL into the reward, whereas GRPO adds it as a separate loss term.

8.4 What problems in GRPO do DAPO, Dr. GRPO and GSPO each fix? ★★

One-sentence answer

The three fix different parts of GRPO: DAPO works on clipping, sampling, loss aggregation and overlong truncation, mainly to fight entropy collapse and wasted samples; Dr. GRPO removes the length bias and difficulty bias introduced by normalizing by response length and dividing by the standard deviation; GSPO moves the importance ratio and the clip from the token level to the sequence level, eliminating the noise of token-level ratios and making training more stable, especially for MoE models.

I will address this in three parts, one for each method, and then explain how they relate.

(1) DAPO targets entropy collapse, wasted samples and length problems in long-CoT training, with four changes.

DAPO (Yu et al. 2025) found several practical problems with GRPO while reproducing R1-Zero-style training and proposed a fix for each:

  • Clip-Higher: A symmetric clip range is unfair to low-probability tokens. With \(\varepsilon = 0.2\), a token at probability 0.01 can rise to at most 0.012 in one update, while a token at 0.9 has a cap of 1.08, i.e. no limit at all. As a result, already-likely tokens keep getting reinforced, low-probability tokens that represent new ideas can hardly grow, and entropy falls quickly (see 8.5). DAPO decouples the two bounds, keeping the lower bound at 0.2 and relaxing the upper bound to 0.28.
  • Dynamic Sampling: Groups that are all correct or all wrong have zero advantage and provide no gradient, and the stronger the model gets, the more such groups there are. DAPO oversamples and filters out these groups until the batch is filled with questions that have mixed results.
  • Token-level loss: GRPO first averages within each response, so every response gets the same total weight and each token in a long response is diluted. Long, good reasoning is therefore under-learned, while long, bad responses (repetition, gibberish) are penalized too lightly, leading to unhealthy growth in entropy and length. DAPO instead averages over all tokens together, so every token contributes equally to the loss.
  • Handling overlong responses: A response cut off at the maximum length receives no reward even if its reasoning was correct, which adds noise to training. DAPO masks the loss of truncated samples and applies a length penalty that grows as the response approaches the limit.

In addition, DAPO removes the KL term, on the grounds that long-CoT training needs the model to move far from its initial distribution anyway.

(2) Dr. GRPO points out that each of GRPO's two normalizations introduces a bias, and removes both.

Dr. GRPO (Liu et al. 2025) analyzes the two normalizations in GRPO's objective:

  • Length bias, from normalizing by response length: Each token's gradient weight is \(\hat A_i / |o_i|\). Among correct responses, shorter ones give each token a larger reward; among wrong responses, longer ones give each token a smaller penalty. The model therefore learns that if it is going to be wrong, it should be long, since the penalty gets diluted, and wrong responses grow longer and longer.
  • Difficulty bias, from dividing by the group standard deviation: Questions that are almost all right or almost all wrong have a small reward standard deviation, so dividing by it amplifies their advantages, giving questions that are too easy or too hard excessive weight in the update.

The fix is direct: replace \(1/|o_i|\) with a fixed constant (e.g. the maximum generation length), and have the advantage subtract the mean without dividing by the standard deviation. The authors show that this recovers the standard policy-gradient objective with a Monte Carlo return and an unbiased baseline. In practice, accuracy is on par with GRPO, but wrong responses no longer get stretched, so token efficiency improves.

(3) GSPO attributes the problem to the token-level importance ratio, so it changes the unit of optimization to the whole sequence.

GSPO (Zheng et al. 2025, the Qwen team) starts from the observation that importance sampling needs to average over many samples in order to correct for the change of distribution, but GRPO has only one sampled token at each position, so a ratio computed from that single sample cannot do any correcting and only adds noise. The longer the response, the more this noise accumulates, and clipping amplifies it, which can cause training to collapse, often irreversibly. The authors' principle is that the unit of the optimization objective should match the unit of the reward. The reward is given to the whole response, so the importance ratio and the clip should also operate at the level of the whole response. GSPO therefore uses the likelihood ratio of the whole response, taken to the power of one over its length (i.e. the geometric mean of the per-token ratios), as the ratio, and the clip also acts on the whole response. This design helps mixture-of-experts models (MoE; see the Model Architecture direction) in particular: after each parameter update, the experts activated for the same input change, so token-level ratios fluctuate wildly, whereas the likelihood of the whole sequence is barely affected by routing changes on individual tokens. GSPO is used in RL training for the Qwen3 series.

In summary: DAPO and Dr. GRPO change how the loss is aggregated and how the advantage is normalized, and they agree that one should not normalize by each response's own length; GSPO changes the more fundamental importance ratio and mainly addresses stability. These fixes are not mutually exclusive and are often combined in practice.

Going deeper: formulas, numbers and a comparison

(1) DAPO's objective and overlong penalty.

\[ \mathcal{J}_{\text{DAPO}}(\theta) = \mathbb{E}\left[\frac{1}{\sum_{i=1}^{G}|o_i|}\sum_{i=1}^{G}\sum_{t=1}^{|o_i|}\min\Big(\rho_{i,t}\hat A_{i},\ \mathrm{clip}\big(\rho_{i,t}, 1-\varepsilon_{\text{low}}, 1+\varepsilon_{\text{high}}\big)\hat A_{i}\Big)\right] \quad \text{s.t. } 0 < \big|\{o_i \mid \mathrm{correct}(o_i)\}\big| < G \]

The denominator \(\sum_i |o_i|\) is the total number of tokens across the responses, and the constraint says that the number of correct responses in each group is neither 0 nor \(G\). The overlong penalty is:

\[ R_{\text{length}}(y) = \begin{cases} 0, & |y| \le L_{\max} - L_{\text{cache}} \\ \dfrac{(L_{\max} - L_{\text{cache}}) - |y|}{L_{\text{cache}}}, & L_{\max} - L_{\text{cache}} < |y| \le L_{\max} \\ -1, & |y| > L_{\max} \end{cases} \]

Here \(L_{\max}\) is the maximum allowed length and \(L_{\text{cache}}\) a buffer zone: once the length enters the buffer, the penalty rises linearly from 0 to −1. The lower clip bound is not relaxed because doing so would push some tokens' probabilities toward 0 and shrink the sampling space instead. On Qwen2.5-32B base, DAPO reaches 50 points on AIME 2024, beating DeepSeek-R1-Zero-Qwen-32B's 47 with half the training steps.

(2) Dr. GRPO's modification.

\[ \text{GRPO: } \frac{1}{G}\sum_{i}\frac{1}{|o_i|}\sum_t (\cdots)\,\frac{r_i - \bar r}{\mathrm{std}(r)} \quad\longrightarrow\quad \text{Dr. GRPO: } \frac{1}{G}\sum_{i}\frac{1}{L}\sum_t (\cdots)\,(r_i - \bar r) \]

Here \((\cdots)\) denotes the per-token clipped term, \(\bar r\) the group mean reward, and \(L\) a fixed constant (e.g. the maximum generation length). The corrected advantage matches RLOO's up to a constant factor (see 8.3). The authors' Oat-Zero-7B reaches 43.3% on AIME 2024. Compared with DAPO: DAPO divides by the total number of tokens in the current batch, which removes the length bias within a batch, but that denominator still varies from batch to batch; Dr. GRPO divides by a fixed constant and removes the dependence on length completely.

(3) GSPO's sequence-level ratio.

\[ s_i(\theta) = \left(\frac{\pi_\theta(o_i\mid q)}{\pi_{\theta_{\text{old}}}(o_i\mid q)}\right)^{\frac{1}{|o_i|}} = \exp\!\left(\frac{1}{|o_i|}\sum_{t=1}^{|o_i|}\log\frac{\pi_\theta(o_{i,t}\mid q, o_{i,<t})}{\pi_{\theta_{\text{old}}}(o_{i,t}\mid q, o_{i,<t})}\right) \]
\[ \mathcal{J}_{\text{GSPO}}(\theta) = \mathbb{E}\left[\frac{1}{G}\sum_{i=1}^{G}\min\Big(s_i(\theta)\hat A_i,\ \mathrm{clip}\big(s_i(\theta), 1-\varepsilon, 1+\varepsilon\big)\hat A_i\Big)\right] \]

Taking the \(|o_i|\)-th root keeps the ratio in a similar numerical range for responses of any length. Because it is a geometric mean, the ratio stays very close to 1, so the clip range is tiny (the paper uses 3e-4 and 4e-4 on the two sides). GSPO clips about two orders of magnitude more tokens than GRPO yet trains more efficiently, which suggests that GRPO's token-level gradients really are very noisy. On Qwen3-30B-A3B, about 10% of the activated experts change after each update; the earlier remedy was Routing Replay, which caches the old policy's routing and forces the new policy to use the same experts when computing the ratio, and GSPO no longer needs it. (Where token-level advantages are needed, e.g. in multi-turn RL, its GSPO-token variant can be used.)

(4) Comparing the four methods.

GRPO DAPO Dr. GRPO GSPO
Advantage \((r-\bar r)/\mathrm{std}\) \((r-\bar r)/\mathrm{std}\) \(r-\bar r\) \((r-\bar r)/\mathrm{std}\)
Loss aggregation Mean over tokens within each response, then over responses Mean over all tokens together Sum over tokens divided by a constant One term per response
Importance ratio Per token Per token Per token Per sequence, length-normalized
Clipping Symmetric Wider upper bound Symmetric Sequence-level, very small range
KL term Yes (k3, in the loss) Removed Removed Not used in the paper
Main problem addressed Removing the critic Entropy collapse, wasted samples, length issues Length and difficulty biases Token-ratio noise, MoE training instability

Follow-up questions

Follow-up 1: Why make the clip range asymmetric?

Because a symmetric clip constrains low-probability tokens more tightly in probability space. The clip limits the ratio of new to old probability, not the absolute change in probability. With the same cap of 1.2 on the ratio, a high-probability token can gain a lot of probability, while a low-probability token can barely move. Relaxing the upper bound gives low-probability tokens that represent new ideas a chance to grow, which mitigates entropy collapse; the lower bound must not be relaxed, or some tokens' probabilities would be pushed toward 0 and the sampling space would shrink instead.

Follow-up 2: When responses keep getting longer during RL, does that necessarily mean the model has learned to think more?

Not necessarily. Part of the growth does come from the model learning to spend more tokens on hard problems, but Dr. GRPO's analysis shows that normalizing by response length dilutes the penalty on wrong responses and so makes wrong responses longer and longer. Degenerate outputs such as repetition and loops also push up the average length. One should therefore track the lengths of correct and wrong responses separately and judge them together with accuracy.

Follow-up 3: Why is GSPO more stable for training MoE models?

Because the sequence-level likelihood is insensitive to routing changes on individual tokens. After each update of an MoE model, the experts activated for the same token may differ, so the same token is computed by different experts under the old and new policies, the token-level ratio fluctuates wildly, and GRPO struggles to converge. GSPO looks only at the likelihood of the whole sequence and takes a geometric mean, so fluctuations on individual tokens are averaged out and Routing Replay is not needed. For the same reason, it is also more tolerant of numerical differences between the training and inference engines (see 8.9).

Common mistakes

  • Do not say that DAPO relaxes both clip bounds: It relaxes only the upper bound and keeps the lower bound unchanged.
  • Do not equate longer responses directly with better reasoning: Length bias and degenerate outputs also make responses longer.
  • Do not say that GSPO removes clipping: It still clips, only at the sequence level and with a very small range.
  • Do not say that GSPO's ratio is the product of the per-token ratios: A plain product drifts away from 1 exponentially with length; GSPO uses the length-normalized geometric mean.

8.5 What is entropy collapse, and how can it be mitigated? ★★

One-sentence answer

Entropy collapse means that early in RLVR training the policy's entropy drops sharply and outputs become nearly deterministic, so sampling the same question several times gives almost identical responses; group advantages become 0, exploration stops, and performance plateaus prematurely. Its root cause is that high-probability tokens keep receiving positive advantages; mitigations include Clip-Higher, restricting updates on high-covariance tokens, training only on high-entropy "forking" tokens, and using an entropy bonus with care.

I will address three aspects: what entropy collapse is and what it leads to, why it happens, and how to mitigate it.

(1) Entropy collapse is the premature exhaustion of the policy's uncertainty, and it cuts off both the learning signal and exploration.

Policy entropy measures how "uncertain" the model is at each position: at each position we compute the entropy of the next-token distribution over the whole vocabulary, then average over positions. In RLVR training, entropy often drops sharply early on, and the model's outputs become nearly deterministic. There are three consequences:

  • The learning signal disappears: If the responses in a group are all the same, so are the rewards, and the advantage becomes 0.
  • Performance plateaus prematurely: The model stops exploring and cannot discover new solutions. Cui et al. (2025) found an empirical relation between performance and entropy: performance gains are largely "bought with entropy", and when entropy runs out, performance reaches a predictable ceiling.
  • Diversity drops: pass@k (the probability that at least one of \(k\) samples is correct) gets worse, and the range of problems the model can solve narrows (see 8.8).

(2) Entropy falls because high-probability tokens keep receiving positive advantages.

Cui et al. (2025) analyzed entropy dynamics theoretically: for a softmax policy under policy-gradient-style updates, the change in entropy is determined by the covariance between a token's log-probability and the advantage it receives. If high-probability tokens get positive advantages, i.e. the model is rewarded for doing what it was already confident about, entropy falls; if low-probability tokens get positive advantages, i.e. an unusual choice turns out well, entropy rises. In RLVR, correct responses consist mostly of tokens the model already favored, so this covariance stays mostly positive during training and entropy keeps falling. The symmetric clip, which limits how much low-probability tokens can rise (see 8.4), further aggravates the process.

(3) The common idea behind the mitigations is to give low-probability but valuable tokens a chance to be reinforced, or to restrict the part of the update that drives entropy down.

  • Clip-Higher: DAPO relaxes the upper clip bound so that low-probability tokens can grow.
  • Restricting updates on high-covariance tokens: Cui et al. (2025) propose Clip-Cov and KL-Cov, which clip the gradient or apply a KL penalty only for the tiny fraction of tokens with the largest covariance, since those are the tokens driving entropy down.
  • Updating only high-entropy "forking" tokens: Wang et al. (2025) found that most tokens in a CoT have low entropy and only about 20% are high-entropy tokens, such as "wait" or "however" that decide where the reasoning goes next; they act like forks in the road. Applying policy gradient to only these tokens actually beats full updates on larger models.
  • Entropy bonus: Add an entropy reward term directly to the loss. This is the classic approach, but it is very sensitive for LLMs: too large a coefficient makes entropy explode and outputs turn into gibberish, and too small a coefficient has no effect, so it usually needs dynamic tuning.

In addition, a higher sampling temperature during rollouts, more diverse and harder data, dynamic sampling, and keeping a small KL term all slow the decline of entropy.

In summary: the goal in mitigating entropy collapse is not to make entropy as high as possible, but to keep enough diversity while converging so that the model can continue to explore.

Going deeper: the definition of entropy, the dynamics formula and concrete methods

(1) The definition of policy entropy and the performance–entropy relation.

\[ H_t = -\sum_{v \in \mathcal{V}} \pi_\theta(v \mid x, y_{<t}) \log \pi_\theta(v \mid x, y_{<t}), \qquad R \approx -a\, e^{H} + b \]

Here \(\mathcal{V}\) is the vocabulary and \(H_t\) the entropy at position \(t\); averaging over positions gives the overall entropy \(H\). \(R\) is downstream performance and \(a, b\) are fitted constants. When entropy is exhausted (\(H = 0\)), performance is capped at \(-a + b\), so the final performance can be predicted from the early training curve.

(2) The covariance form of the entropy change.

For a softmax policy, Cui et al. (2025) derive that under natural policy gradient, the change in entropy at state \(s\) after one update is approximately

\[ \mathcal{H}(\pi^{k+1}\mid s) - \mathcal{H}(\pi^{k}\mid s) \approx -\eta\cdot\mathrm{Cov}_{a\sim\pi^{k}(\cdot\mid s)}\Big(\log\pi^{k}(a\mid s),\ A(s,a)\Big) \]

Here \(\pi^k\) is the policy at step \(k\), \(\eta\) the learning rate, \(a\) an action (for an LLM, the next token), and \(A(s,a)\) its advantage; under vanilla policy gradient, \(A(s,a)\) inside the covariance is replaced by \(\pi^k(a\mid s)\,A(s,a)\). A positive covariance, i.e. "the more confident the token, the more it is rewarded", makes entropy fall.

(3) Concrete forms of several methods.

Method Tokens affected What it does
Clip-Higher (Yu et al. 2025) All tokens Relaxes \(\varepsilon_{\text{high}}\) from 0.2 to 0.28
Clip-Cov (Cui et al. 2025) About 1/5000 of tokens, those with the largest covariance Clips the gradient of these tokens
KL-Cov (Cui et al. 2025) About 1/500 to 1/5000 of tokens, those with the largest covariance Applies a KL penalty to these tokens
High-entropy tokens (Wang et al. 2025) The ~20% of tokens with the highest entropy Computes policy gradient only on these tokens

Wang et al.'s results: training only on the high-entropy 20% of tokens matches full updates on Qwen3-8B and clearly beats them on Qwen3-14B and Qwen3-32B, with larger gains for larger models; conversely, training only on the low-entropy 80% of tokens clearly hurts.

Follow-up questions

Follow-up 1: What is wrong with simply adding an entropy bonus?

It is extremely sensitive to its coefficient, and it encourages every position to become uncertain rather than preserving choices at the key positions. An LLM's vocabulary is very large, so entropy can grow quickly by spreading probability over many meaningless tokens; with a slightly too large coefficient entropy explodes and outputs turn into gibberish, and with a slightly too small one it has no effect. Later methods therefore prefer to target a small number of key tokens, for example by restricting only high-covariance tokens or by training only high-entropy tokens.

Follow-up 2: How do you detect entropy collapse during training?

Monitor the policy-entropy curve, the diversity of responses within a group, and the fraction of groups with zero advantage. A sharp early drop in entropy, nearly identical responses to the same question, and a rapidly rising share of zero-advantage groups are all signs of entropy collapse. In addition, if pass@1 rises while pass@k at large \(k\) falls, the model's coverage is narrowing.

Follow-up 3: Is higher entropy always better?

No. Excessively high entropy means outputs are close to random, and the model cannot reliably produce correct answers; RL is supposed to sharpen the distribution in the right direction. What we want is enough diversity at the key decision points and low entropy on the reasoning steps that are already settled.

Common mistakes

  • Do not say that entropy collapse is just caused by a low sampling temperature: It comes from the dynamics of the RL update itself; raising the temperature only partly helps.
  • Do not say that mitigating entropy collapse means maximizing entropy: Excessive entropy is harmful too; the goal is to preserve useful exploration.
  • Do not treat relaxing the lower clip bound as a mitigation for entropy collapse: Relaxing the lower bound pushes more tokens' probabilities toward 0 and shrinks the sampling space instead.

8.6 Is a KL term still needed in RLVR? How do the k1, k2 and k3 estimators differ? ★

One-sentence answer

The KL term is not essential in RLVR: rule-based rewards largely remove the risk of hacking a reward model, and long-CoT reasoning requires the model to move far from its initial distribution, so DAPO, Dr. GRPO and others simply drop the KL, while some works keep a small KL and periodically reset the reference. k1, k2 and k3 are three ways to estimate the KL from sampled tokens: k1 is unbiased but high-variance and can be negative, k2 is non-negative and low-variance but biased, and k3 is unbiased, non-negative and low-variance, which is why GRPO uses it; but note that putting k3 directly into the loss and differentiating does not give the gradient of the reverse KL.

I will address three aspects: whether the KL term is necessary in RLVR, how the three estimators differ, and the difference between "estimating the value of the KL" and "obtaining the gradient of the KL".

(1) The KL term is much less necessary in RLVR; the common choices are to remove it or keep only a very small KL.

In RLHF, the KL penalty does two main jobs: it keeps the policy from hacking an imperfect reward model, and it prevents language quality from degrading (see Chapter 6). In RLVR the situation changes: the reward is computed by rules, so the risk of hacking a reward model is basically gone, and long-CoT reasoning actually requires the model's distribution to move far from the base model, so the KL holds it back. That is why DAPO, Dr. GRPO and others remove the KL term entirely, which also saves the reference model's forward pass. There are reasons to keep it, however: it makes training more stable, slows entropy collapse, and keeps the model from drifting into strange distributions during long runs. ProRL (Liu et al. 2025) keeps the KL but periodically resets the reference model to the current policy, so the KL only constrains "do not move too far in each phase" instead of tying the model to the base model forever.

(2) All three estimators estimate the KL from sampled tokens only; they differ in bias, variance and sign.

What we want to estimate is the reverse KL \(\mathrm{KL}(\pi_\theta\,\|\,\pi_{\text{ref}})\), where \(\pi_{\text{ref}}\) is the reference model. In RL training we usually do not sum over the whole vocabulary but estimate it from the sampled tokens only. Writing \(r = \pi_{\text{ref}}(y_t)/\pi_\theta(y_t)\) for the probability ratio of the sampled token under the reference and the current policy, Schulman (2020) summarized three estimators:

  • k1 \(= -\log r\): This is the definition of the KL itself; it is unbiased but high-variance, and a single sample can even be negative, although the KL itself is never negative.
  • k2 \(= \frac{1}{2}(\log r)^2\): It is always non-negative and low-variance, but biased; the bias is small when the two distributions are close.
  • k3 \(= (r - 1) - \log r\): It is both unbiased and always non-negative, with low variance. It is built by adding to k1 a term \(r - 1\) whose expectation is 0, which acts as a control variate. GRPO uses k3.

(3) "Estimating the value of the KL" and "obtaining the gradient of the KL" are different things.

As an estimate of the KL's value, k3 is unbiased, but if it is put directly into the loss and autodiff computes the gradient, the result is the gradient of the forward KL \(\mathrm{KL}(\pi_{\text{ref}}\,\|\,\pi_\theta)\), the opposite direction, rather than that of the reverse KL. The same analysis shows that k1 placed directly in the loss has zero expected gradient, so it does nothing; k2 placed in the loss has an expected gradient equal to exactly the reverse-KL gradient; and folding k1 into the reward and applying policy gradient, as PPO-RLHF does, also gives the correct reverse-KL gradient. When the policy is close to the reference, the two directions of the KL barely differ and these choices are nearly equivalent; only when the policy is far away does the difference become noticeable.

In summary: in RLVR the KL term changes from "a necessity for preventing reward hacking" into "an optional stabilizer"; if it is kept, one also has to check which direction of the KL is actually being optimized once the estimator is placed in the loss.

Going deeper: properties of k3 and the gradient derivation

(1) Definitions and properties of the three estimators.

Let the sampled token be \(y_t \sim \pi_\theta\) and \(r = \pi_{\text{ref}}(y_t\mid\cdot)/\pi_\theta(y_t\mid\cdot)\):

\[ k_1 = -\log r, \qquad k_2 = \tfrac{1}{2}(\log r)^2, \qquad k_3 = (r - 1) - \log r \]
Estimator Unbiased for the KL value Always non-negative Variance Expected gradient when placed directly in the loss
k1 Yes No High 0
k2 No (small bias when distributions are close) Yes Low Gradient of the reverse KL
k3 Yes Yes Low Gradient of the forward KL

k3 is non-negative because \(x - 1 - \log x \ge 0\) for every \(x > 0\); k3 is unbiased because \(\mathbb{E}_{y\sim\pi_\theta}[r] = \sum_y \pi_{\text{ref}}(y) = 1\), so the added \(r - 1\) has expectation 0. All three estimators are computed per token and then averaged over tokens.

(2) Why k3 in the loss gives the gradient of the forward KL.

For a single token, treating the sampled token as a constant and differentiating k3 gives \(\nabla_\theta k_3 = (1 - r)\,\nabla_\theta\log\pi_\theta(y)\); taking the expectation under \(\pi_\theta\):

\[ \mathbb{E}_{y\sim\pi_\theta}\big[(1 - r)\,\nabla_\theta\log\pi_\theta(y)\big] = \sum_y \big(\pi_\theta(y) - \pi_{\text{ref}}(y)\big)\nabla_\theta\log\pi_\theta(y) = -\mathbb{E}_{y\sim\pi_{\text{ref}}}\big[\nabla_\theta\log\pi_\theta(y)\big] = \nabla_\theta\,\mathrm{KL}(\pi_{\text{ref}}\,\|\,\pi_\theta) \]

The derivation uses \(\sum_y \pi_\theta\nabla_\theta\log\pi_\theta = \nabla_\theta\sum_y\pi_\theta = 0\). The same method verifies that the gradient of k1, \(\nabla_\theta\log\pi_\theta(y)\), has expectation 0, and that the gradient of k2, \(\log\frac{\pi_\theta(y)}{\pi_{\text{ref}}(y)}\nabla_\theta\log\pi_\theta(y)\), has expectation exactly \(\nabla_\theta\mathrm{KL}(\pi_\theta\,\|\,\pi_{\text{ref}})\).

(3) Two finer issues arise in actual implementations.

  • A missing importance weight: GRPO's samples actually come from \(\pi_{\theta_{\text{old}}}\) rather than \(\pi_\theta\), so strictly speaking the KL term is missing an importance weight.
  • Missing cross-position gradients: All of the above holds per token; a loss built by summing per-token terms misses the part of the gradient that comes from the current token affecting the KL at later positions.

Tang & Munos (2025) and Zhang et al. (2025) analyze these issues systematically. Also, papers sometimes use "forward" and "reverse" the opposite way round, so it is safest to write out both arguments of the KL when discussing it.

Follow-up questions

Follow-up 1: Why is folding k1 into the reward correct, while putting it directly into the loss is not?

Because once folded into the reward, k1 multiplies \(\nabla_\theta\log\pi_\theta\) as a weight, which supplies the part of the gradient that comes from the sampling distribution changing with \(\theta\). The expectation in the KL is taken over \(\pi_\theta\)'s own samples, so its gradient must differentiate both the integrand and the sampling distribution. With k1 directly in the loss, autodiff differentiates only the integrand, giving \(\nabla_\theta\log\pi_\theta\), whose expectation is 0; folding it into the reward and applying policy gradient uses the score function to supply the derivative with respect to the sampling distribution, which yields exactly the reverse-KL gradient.

Follow-up 2: Once the KL term is removed, is a reference model still needed?

No. In GRPO the reference model's only role is to compute the KL term. Without the KL, training needs only the policy (when paired with a rule-based reward), which saves both memory and one forward pass.

Common mistakes

  • Do not say that putting k3 into the loss optimizes the reverse KL: k3 is only an unbiased estimate of the reverse KL's value; its expected gradient corresponds to the forward KL.
  • Do not say that the KL term must be kept in RLVR: Many works remove it, and when it is kept, its coefficient is often very small or the reference is periodically reset.
  • Do not say that k1 is a bad estimator: It is unbiased for the KL's value, only high-variance; folded into the reward and used with policy gradient, it gives the correct gradient.

8.7 How do process reward models (PRMs) and outcome reward models (ORMs) differ? ★★

One-sentence answer

An ORM evaluates only the final result, giving a sparse signal with cheap labels, and a rule-based verifier can be seen as an ORM that needs no learning; a PRM scores each step of the reasoning, giving a dense signal that locates the faulty step and does not reward lucky guesses, but process labels are expensive, "a step" is hard to define, and a learned PRM is easily hacked during RL. Current RLVR training therefore relies mainly on outcome rewards, while PRMs are used mostly for test-time reranking and search.

I will address four aspects: the definitions and the trade-off, how process labels are obtained, why RLVR mainly uses outcome rewards, and where PRMs are used today.

(1) An ORM evaluates the outcome and a PRM evaluates the process; the trade-off centers on signal density versus labeling cost.

An ORM (outcome reward model) evaluates only the final result: whether the answer is right, or whether the whole response is good; a rule-based verifier can be seen as an ORM that needs no learning. A PRM (process reward model) instead scores each step of the reasoning, judging whether that step is correct; giving feedback step by step in this way is called process supervision. The benefits of process supervision are intuitive: the signal is dense and points to the step where things went wrong, which addresses credit assignment; and it rewards "correct reasoning" rather than just "correct answers", so it does not reward lucky guesses. Lightman et al. (2023), "Let's Verify Step by Step", is the representative work: they had human labelers mark each step of the model's solutions as right or wrong, built the PRM800K dataset, and found that using a PRM to pick an answer from many candidate solutions clearly outperforms both an ORM and majority voting.

(2) Process labels can come from human annotation or be estimated automatically with Monte Carlo completions, but each has problems.

  • Human annotation: The highest quality, but very expensive and hard to scale to large datasets and new domains.
  • Automatic annotation: Math-Shepherd (Wang et al. 2023) starts from a given step, has the model complete the solution several times, and uses how often the completions reach the correct answer to estimate that step's "value". This removes human labeling, but the labels are noisy: a correct step may score low because the completions after it are weak, and a wrong step may happen to reach the correct answer.

(3) RLVR training mainly uses outcome rewards because the problems of PRMs are magnified in large-scale RL.

DeepSeek-R1 tried PRMs and eventually gave up, for three reasons:

  • "A step" is hard to define: In general reasoning it is hard to delineate clearly what counts as one step.
  • The correctness of a step is hard to judge: Automatic labels are unreliable, and human labels do not scale.
  • A learned PRM gets hacked: A model-based PRM inevitably gets hacked during RL and needs constant retraining; this is the most important reason.

It turned out that rule-based outcome rewards plus large-scale sampling are enough: sampling many responses per question and comparing them also achieves a degree of credit assignment statistically.

(4) PRMs are now used mainly at test time, and they are getting renewed attention in long-horizon agent tasks.

The typical uses of a PRM are scoring several candidate solutions and picking the best one (best-of-N), or scoring each step during search to guide beam search (see the Inference, Evaluation and Deployment direction). In long-horizon agent tasks, outcome rewards are too sparse, and process rewards are getting renewed attention (see the Agent direction). In addition, generative verifiers, in which an LLM writes an analysis before giving a verdict, can be seen as a variant of PRMs.

In summary: the choice between a PRM and an ORM is essentially a trade-off between signal density and reliability: in large-scale RL training, the reliable but sparse outcome reward wins; in test-time selection and search, the dense signal of a PRM is more valuable.

Going deeper: a comparison table, how a PRM scores a solution, and concrete numbers

(1) Comparing ORMs and PRMs.

ORM PRM
What it evaluates The final answer or the whole solution Each intermediate step
Signal One sparse signal per response Dense, step-level signals
Labels Cheap: compare with the reference answer Expensive: human step labels, or Monte Carlo completions
Credit assignment Weak: the whole response shares one reward Can point to the earliest wrong step
Main risk Rewards lucky guesses with wrong reasoning Ambiguous step boundaries; a learned PRM gets hacked during RL
Typical use RLVR rewards, best-of-N reranking Test-time reranking and search, step verification

(2) How a PRM scores a whole solution.

Lightman et al. (2023) define a solution's PRM score as the probability that all of its steps are correct, i.e. the product of the per-step correctness probabilities:

\[ \mathrm{score}(y) = \prod_{j=1}^{m} p_j \]

Here \(y\) is a solution with \(m\) steps and \(p_j\) is the PRM's probability that step \(j\) is correct. PRM800K contains about 800k step-level labels. On a subset of MATH, choosing among 1,860 candidate solutions, the PRM solves 78.2% of problems, versus 72.4% for an ORM and 69.6% for majority voting.

(3) Math-Shepherd's two kinds of automatic labels.

Starting from step \(j\), the model completes the solution \(N\) times (\(N = 8\) in the paper): hard estimation labels the step as correct if at least one completion reaches the correct answer; soft estimation uses the fraction of completions that reach the correct answer as the step's score.

Follow-up questions

Follow-up 1: With only an outcome reward, how does the model know which step went wrong?

Through statistical comparison across many samples. Among several responses to the same question, steps shared by correct and wrong responses receive positive and negative advantages that cancel out; only steps that appear more often in correct responses are reinforced on average. An outcome reward therefore still gives the correct gradient direction in expectation; it just needs more samples to average away the noise.

Follow-up 2: Do Lightman et al.'s results show that PRMs make good rewards for RL training?

Not directly. They compared test-time best-of-N selection, in which the PRM is fixed and the candidate solutions are fixed. In RL training, the policy keeps optimizing against the PRM, so any hole in the PRM is magnified and exploited, which is the main reason DeepSeek-R1 abandoned PRMs.

Follow-up 3: Can best-of-N with a PRM or an ORM be hacked too?

Yes, though to a lesser degree. Best-of-N is itself a form of optimization: the larger \(N\) is, the more likely it is to pick a solution that happens to exploit a hole in the verifier and receives an inflated score. With a very large \(N\), performance may therefore fall rather than rise, and robustness can be improved by combining it with majority voting or multiple verifiers.

Common mistakes

  • Do not say that a PRM is always better than an ORM: PRMs are often better for test-time selection, but in large-scale RL training a learned PRM is easily hacked, and outcome rewards are more practical.
  • Do not say that process labels can only come from human annotation: They can be estimated automatically with Monte Carlo completions, though the labels are noisy.
  • Do not say that a rule-based verifier is not an ORM: It is exactly an ORM that evaluates only the final result and needs no learning.
  • Do not generalize a PRM's test-time results directly to training: The two face completely different optimization pressures.

8.8 Does RL teach the model new reasoning abilities, or does it just make it better at sampling? ★★

One-sentence answer

Under today's common RLVR setups, the evidence favors "RL mainly improves sampling efficiency": the RL model's pass@1 is clearly higher, but at large \(k\) the base model's pass@k catches up and even overtakes it, which shows that RL mainly concentrates probability on correct paths the base model could already find. However, when training runs long enough and exploration is maintained, RL can extend the boundary to some degree and can learn to compose existing skills; to reliably extend a small model's reasoning boundary, distillation from a stronger teacher is more effective.

I will address three aspects: how to measure the "reasoning boundary", the evidence that "RL only sharpens sampling", and the counter-evidence.

(1) pass@k at large \(k\) can be used to measure the boundary of a model's reasoning ability.

pass@k is the probability that at least one of \(k\) samples is correct. \(k = 1\) measures the ability to "get it right in one try"; a large \(k\) measures "can the model solve this problem at all", so it can be read as the boundary (coverage) of the model's reasoning ability. The question then becomes: after RL, has the set of problems the model can solve grown, or has the model merely become more likely to solve, in one try, the problems it could already solve?

(2) The pass@k experiments of Yue et al. (2025) support "RL mainly sharpens sampling".

They compared base models with RLVR-trained models on math, code and visual reasoning, and found the following:

  • The curves cross: At small \(k\), the RL model is clearly better; as \(k\) grows, the base model catches up and overtakes the RL model at large \(k\) (typically in the tens to hundreds).
  • What RL solves, the base model can mostly solve too: Problems the RL model solves are mostly solvable by the base model with a few more samples; perplexity analysis also shows that the RL model's reasoning paths already have high probability under the base model.
  • Different algorithms differ little: Six popular RLVR algorithms perform similarly, and all of them remain far from the base model's pass@k ceiling.
  • Distillation is different: Distillation from a stronger teacher can bring in new reasoning patterns and genuinely expand the boundary.

This also makes intuitive sense: RL can only reinforce what it samples. If the base model never samples a correct answer for a problem, the reward is always 0, the advantage is always 0, and the problem is never learned. It is also consistent with entropy collapse in 8.5: as probability concentrates on a few paths, coverage narrows.

(3) But the counter-evidence shows that the conclusion depends on the training setup and the base model.

  • Train longer and more stably, and the boundary can grow: ProRL (Liu et al. 2025) ran prolonged RL with KL control, periodic reference resets and diverse tasks, and on many tasks raised pass@k above the starting model's at every \(k\), including some tasks the starting model could not solve no matter how many samples it drew. However, the size of the expansion is strongly tied to how good the starting model already is: the weaker the starting model on a task, the larger the expansion.
  • RL can learn to compose existing skills: Yuan et al. (2025) found in controlled experiments that if the base model already knows the single functions \(f\) and \(g\), RL lets it learn the unseen composition \(g(f(x))\) and generalize to deeper compositions; but RL on single functions alone does not teach composition.
  • The measurement itself is biased: For problems whose answer is a single number, at large \(k\) the base model may guess right with incorrect reasoning, which overstates the base model's boundary.
  • Sharpening is valuable in itself: Users experience pass@1. Compressing what the base model needs hundreds of samples to achieve into getting it right in one try saves a great deal of test-time compute.

In summary: a safe answer is that under today's common setups, RL mainly sharpens existing abilities; when exploration is maintained, training runs long enough, and the base model has basic skills that can be composed, RL can extend the boundary to some degree. For small models, distillation from a strong teacher is the more reliable way to extend the boundary.

Going deeper: estimating pass@k, key numbers and a cautionary example

(1) The unbiased estimator of pass@k.

\[ \text{pass@}k = \mathbb{E}_{x}\left[1 - \frac{\binom{n-c}{k}}{\binom{n}{k}}\right] \]

For each problem \(x\) we draw \(n \ge k\) samples, \(c\) of which are correct; \(\binom{n-c}{k}/\binom{n}{k}\) is the probability that \(k\) samples drawn at random from the \(n\) are all wrong (Chen et al. 2021). Computing \(1-(1-c/n)^k\) directly is biased, which is why this combinatorial form is used.

(2) A direct comparison of distillation and RL.

The Qwen3 technical report (Yang et al. 2025) starts from the same off-policy-distilled 8B checkpoint: RL raises AIME'24 pass@1 from 55.0% to 67.6%, but pass@64 does not improve and stays at 90.0%; on-policy distillation raises pass@1 to 74.4% and pass@64 to 93.3% (see Chapter 9).

(3) Details of ProRL.

ProRL starts from DeepSeek-R1-Distill-Qwen-1.5B and trains on diverse tasks covering math, code, logic puzzles and more. It also found that on tasks where the starting model was already strong (such as some math benchmarks), pass@k at large \(k\) stays flat or even drops, consistent with what Yue et al. observed.

(4) A cautionary example: even random rewards can "improve" performance.

Shao et al. (2025) found that on Qwen2.5-Math-7B, even random rewards raise MATH-500 by 21.4 points (versus 29.1 points with true rewards), but this largely fails on Llama and OLMo. The original authors explain it as GRPO's clipping amplifying behaviors the model already favored from pretraining (such as Qwen-Math's habit of "reasoning in code"), even though the reward itself carries no information; later, Wu et al. (2025) found that Qwen2.5 is contaminated on benchmarks such as MATH-500, and that on clean, new data only the true reward gives steady gains. Studies of RL's effect therefore need to be checked across several model families and on clean benchmarks.

Follow-up questions

Follow-up 1: Why does the base model's pass@k overtake the RL model's at large \(k\)?

Because RL concentrates probability on a few paths and sacrifices coverage. The base model's distribution is more spread out, so its chance of getting it right in one try is low, but with enough samples it eventually hits some rare correct paths. The RL model concentrates probability on the paths it has already learned, so its one-try success rate is high, but the paths suppressed during training become very hard to sample again, so on some problems it fails no matter how many samples it draws.

Follow-up 2: How do distillation and RL differ in their effect on the reasoning boundary?

RL can only reinforce what the student itself samples, whereas distillation brings in new reasoning patterns from outside. For problems on which the base model never samples a correct answer, RL has no learning signal; a teacher's trajectories or per-token distributions, by contrast, can show the student the correct path directly, so distillation can expand the boundary, as Qwen3's comparison also confirms.

Follow-up 3: If you wanted to show that RL really teaches new abilities, how would you design the experiment?

Compare pass@k at very large \(k\) before and after RL, on clean data and across several model families, and check whether the reasoning itself is correct. Concretely, rule out data contamination and avoid drawing conclusions from a single, possibly contaminated model family; use tasks whose answers are hard to guess, or inspect the reasoning by hand; and, as Yuan et al. did, design controlled synthetic tasks that clearly separate "existing skills" from "new compositions".

Common mistakes

  • Do not say that "RL teaches nothing": It substantially raises pass@1, and in some setups it can also extend the boundary or learn to compose skills.
  • Do not treat pass@k at large \(k\) as a fully reliable measure of ability: For problems whose answers are easy to guess, it overstates the model's boundary.
  • Do not draw conclusions from a single model family: The random-reward example shows that effects observed on some base models may come from pretraining preferences or data contamination.

8.9 What engineering problems arise in RLVR? ★

One-sentence answer

There are three main kinds: in terms of data difficulty, only questions with mixed results provide a learning signal, so difficulty filtering and curricula are needed; numerical differences between the training and inference engines quietly turn nominally on-policy training into off-policy training, requiring recomputed log-probabilities or importance-sampling corrections; and long rollouts make generation the largest cost while a few very long responses hold up the whole batch, calling for asynchronous training, partial rollouts and length curricula.

I will address three aspects: data difficulty, the training–inference mismatch, and the efficiency problems caused by long rollouts.

(1) Questions of moderate difficulty provide the most learning signal, so difficulty filtering and curricula are needed.

In GRPO-style methods, a question with a pass rate of 0 or 1 has all-zero advantages within its group, so its samples are completely wasted. For a 0/1 reward, the standard deviation of rewards within a group is \(\sqrt{p(1-p)}\) (where \(p\) is the question's pass rate), largest at \(p = 0.5\) and zero at both ends. Questions that are too easy therefore have nothing to teach, and questions that are too hard never yield a correct sample to learn from. Common practices include:

  • Offline filtering: Before training, sample each question several times with the current model, estimate its pass rate, and drop questions that are always right or always wrong.
  • Online filtering: During training, dynamically drop groups that are all right or all wrong (DAPO's dynamic sampling), and re-filter periodically, since questions of moderate difficulty become all-correct as the model gets stronger.
  • Curriculum learning: Order data from easy to hard, or train with a shorter maximum generation length first and relax it gradually.
  • Checking reference answers: A wrong reference answer means a correct response gets punished, which is very harmful; evaluation benchmarks also need deduplication and decontamination.

(2) Numerical differences between the training and inference engines quietly turn on-policy training into off-policy training.

In RL training, rollouts are usually generated by an inference engine such as vLLM or SGLang, while log-probabilities and gradients are computed by a training engine such as FSDP or Megatron. The two differ in kernel implementations, order of operations and numerical precision, and rollouts sometimes use quantization for speed. As a result, even with identical weights, the two sides compute different token probabilities, nominally on-policy training actually becomes off-policy, and the algorithm has no idea. The mismatch accumulates over long sequences, is worse for MoE (the two sides may select different experts), and in bad cases makes training collapse. Common remedies include:

  • Recomputing log-probabilities with the training engine: Do not use the values returned by the inference engine directly; this is standard practice.
  • Truncated importance sampling (TIS): Treat the gap between the two sides as off-policy and correct for it by multiplying each token by a truncated probability ratio (Yao et al. 2025).
  • Making the two sides numerically more consistent: Switch RL training precision from BF16 to FP16; FP16 has more mantissa bits and smaller rounding errors, so the two sides agree better (Qi et al. 2025).
  • Handling MoE specifically: Use routing replay so that both sides use the same experts, or use a sequence-level method such as GSPO that is more tolerant of the mismatch (see 8.4).

(3) Long rollouts make generation the main bottleneck, and a few very long responses hold up the whole batch.

Responses from reasoning models often run to thousands or tens of thousands of tokens, and autoregressive generation can only proceed token by token, so generation usually takes up most of the RL training time. Worse, response lengths follow a long-tailed distribution: most responses in a batch finish quickly, while a few run all the way to the maximum length. In synchronous training, all GPUs must wait for the longest response to finish before the update can start, which leaves them idle much of the time. Common remedies include:

  • Asynchronous RL: Decouple generation from training, so that rollout workers generate continuously and training workers update as soon as a batch is ready, as in AReaL (Fu et al. 2025). The cost is that some data are generated by older versions of the policy, so the staleness of the data must be controlled and corrected for off-policy.
  • Partial rollouts: Set a token budget for each round of generation; responses that exceed the budget are saved and continued in the next round, so that no single very long response occupies resources for long, as in Kimi k1.5 (Kimi Team 2025).
  • Length curricula: Train with a shorter maximum length first and relax it gradually; for example, DeepScaleR (Luo et al. 2025) extends the context from 8K to 16K and then 24K.
  • Handling truncated responses: Mask the loss of samples truncated for being too long, or apply a soft length penalty, so that "unfinished" is not treated as "wrong" (see DAPO in 8.4).

In summary: the engineering difficulties of RLVR come down to three things: the data must be "just hard enough", the probabilities must be "truly on-policy", and generation must not be "held up by the long tail".

Going deeper: formulas and concrete methods

(1) Difficulty and learning signal.

\[ \mathrm{std}(r) = \sqrt{p(1-p)} \]

This is the standard deviation of the reward under a 0/1 reward for a question with pass rate \(p\). For example, it is 0.5 at \(p = 0.5\), 0.3 at \(p = 0.9\) and 0 at \(p = 1\).

(2) The concrete form of TIS.

Each token's gradient is multiplied by the weight

\[ w_t = \min\!\left(\frac{\pi_{\text{train}}(y_t\mid\cdot)}{\pi_{\text{infer}}(y_t\mid\cdot)},\ C\right) \]

where \(\pi_{\text{train}}\) and \(\pi_{\text{infer}}\) are the probabilities computed by the training and inference engines, and \(C\) is a truncation threshold that keeps the weight of any single token from growing too large and blowing up the variance.

(3) Several ways to handle long rollouts.

Method What it does Cost
Asynchronous RL (AReaL) Fully decouples generation from training; generates continuously and updates at any time Some data come from older policies and need off-policy correction
Partial rollouts (Kimi k1.5) Sets a token budget per round; unfinished responses go into a replay buffer and are continued in the next round Different segments of one response come from different policy versions
Length curriculum (DeepScaleR) Extends the maximum length from 8K to 16K and then 24K Early on, problems that need very long reasoning cannot be learned
Overlong handling (DAPO) Masks the loss of truncated samples, or applies a soft penalty near the limit The buffer length must be tuned

AReaL reports that, with the same number of GPUs, training runs up to more than 2.5 times as fast as synchronous systems, with equal or better final performance. APRIL (Zhou et al. 2025) also designs partial rollouts for the long-tail problem and reports that in its experimental setting rollouts account for more than 90% of total RL runtime.

Follow-up questions

Follow-up 1: Why do the two engines compute different probabilities even with identical weights?

Because floating-point arithmetic is not associative, and the two engines compute in different ways. For speed, the inference engine uses different kernels, different parallel partitioning and different reduction orders, and the composition of a batch can also change the computation path of some kernels; at low precision these differences in order produce different rounding errors. If the rollouts also use quantization, the differences are larger still. The difference on a single token may be tiny, but accumulated over thousands of tokens it is enough to pull training away from on-policy.

Common mistakes

  • Do not say that harder questions are always better: A question with a pass rate of 0 provides no gradient at all; questions of moderate difficulty are the most valuable.
  • Do not compute the importance ratio directly from log-probabilities returned by the inference engine: The two sides are numerically inconsistent, which quietly makes training off-policy.
  • Do not treat asynchronous RL as a free speedup: It pays with data staleness and needs additional off-policy correction.
  • Do not simply count truncated responses as wrong: That punishes responses whose reasoning was correct but unfinished, and adds noise to training.