RL post-trains a language model by sampling its answers, scoring each whole answer with one number, and raising the probability of every token in proportion to how much better than expected its answer scored; the algorithms differ in how they estimate "expected": a learned critic at every token (PPO), or the mean of a group of answers to the same prompt (GRPO, RLOO).
Fig. 1, step by step: one real group of answers, scored and credited
Real data: Qwen2.5-0.5B-Instruct on GSM8K test problem 3, this page's rollouts (the Real rollouts tab lists all 16 answers).
You need: the policy-gradient theorem, baselines, GAE and PPO's clip from Policy gradients and actor-critic (sections 4, 6 and 9); where RL sits in post-training from Alignment: SFT, RLHF, DPO Family, RLVR (section 4 draws the PPO and GRPO loops, section 7 the swap of a reward model for a verifier).
Why RL at all: supervised fine-tuning (SFT) can only imitate demonstrations; RL can improve on them, because it needs a way to score an answer, not a way to write one. That makes RL the engine behind instruction-following chat models (RL from human feedback, RLHF) and behind reasoning models such as DeepSeek-R1 (RL with verifiable rewards, RLVR). Three methods carry most of the field, and each removes one component from the one before it:
| Method | Where the score comes from | How a token gets its credit | Where the KL to the reference goes | Large models in memory | Rollouts per prompt |
|---|---|---|---|---|---|
| RLHF with PPO (InstructGPT) | A learned reward model | A learned value model (critic) and GAE, token by token | Into the per-token reward | 4 (policy, reference, reward, value) | usually 1 |
| GRPO (DeepSeekMath) | Any scorer | The response's score minus its group's mean, divided by the group's spread; the same for every token | Into the loss (k3 estimator) | 3, or 2 with a verifier | a group, 8 to 64 |
| RLVR (Tülu 3, R1-Zero) | A program that checks the answer | Either of the above | Either; often dropped | PPO or GRPO minus the reward model | as the optimiser |
Read as a lineage, these are two deletions: GRPO deletes RLHF's critic, RLVR deletes its learned reward model. GRPO with verifiable rewards is the default open recipe for reasoning models, and most research since 2025 is about its biases and their fixes (Dr. GRPO, DAPO, GSPO, CISPO, section 7) and about the gap between the engine that samples and the trainer that learns (section 8). Elsewhere: SFT, reward-model training and the DPO family are on Alignment; proxies in general are on Reward Hacking; one batch through PPO, GRPO and DPO with the memory each needs is "Same batch, three algorithms" on Topic: llm-training-and-post-training; where these methods sit among all of RL is the Topic: rl root's Method atlas.
Real data on this page: 160 responses sampled for it from Qwen2.5-0.5B-Instruct on ten GSM8K test problems (16 per problem, temperature 1), with per-token log-probabilities under three numerical set-ups and under the base model, three verifiers, and a real reward model, Skywork-Reward-V2-Qwen3-0.6B; the Real rollouts tab lists every answer, src/rollouts/ has the scripts.
The MDP vocabulary of the root (Topic: rl, "The loop, state and return") maps onto generation with three things unusual: the environment is trivial, the action space is huge, and the reward comes once.
How the advantage is estimated is exactly what separates the algorithms on this page: PPO learns a value model to predict it token by token; GRPO and RLOO estimate it from a group of samples for the same prompt. Three consequences: credit assignment is severe (one scalar for hundreds or thousands of tokens); the environment model is trivially known, so model-based planning buys nothing (the reward model does not make RLHF model-based, the root's common mistakes); and rollouts are expensive, because generating at inference speed dominates wall-clock time (section 12).
The standard recipe since InstructGPT (verified on the InstructGPT page, which trains the three-step pipeline live in its "Run the three steps" tab) runs four models:
Fig. 2, step by step: one RLHF step on a real answer
Why the KL penalty: it keeps the policy where the reward model is trustworthy, near the data it was trained on (the leash against over-optimisation, drawn on Reward Hacking section 2); it preserves general capabilities and fluency; and it ties the policy to a fixed anchor, a trust region relative to the start rather than to last iteration's policy.
GAE over tokens. GAE (Schulman et al. 2015; the λ dial is explained on Policy gradients and actor-critic, section 6) blends one-step and multi-step estimates of how much better a token turned out than the critic expected:
With γ = λ = 1 the sum telescopes: Ât = (final score − β × the sum of the remaining log-ratios) − V(st), and the critic serves only as a per-prefix baseline (the hero's PPO row). With λ < 1 a token's credit is mostly the jump in predicted value it caused: the point of a critic, and its weakness, because it must be right about every prefix of every response.
The clipped update is PPO's, unchanged: maximise min(ρtÂt, clip(ρt, 1 − ε, 1 + ε) Ât) with the per-token ratio ρt = πθ(ot | st) / πθold(ot | st) and ε typically 0.2 (Schulman et al. 2017). Once a token's ratio has moved more than ε the way its advantage wants, its gradient is zero; a wrong-way move keeps its gradient, which makes several minibatch epochs on one batch of rollouts safe. The four cases, the derivation from TRPO and the clip animated over epochs are on Policy gradients and actor-critic, section 9; what the clip does to rare tokens in an LLM is section 7 here.
Pain points: four large models in memory; a value model as big as the policy, trained from scratch during RL, asked to value every prefix when the true reward is one scalar at the end. How hard that is was measured: on MATH and GSM8K, PPO's value networks "often produce poor estimate of expected return and barely outperform a random baseline when comparing alternative steps"; replacing them with Monte Carlo estimates from extra rollouts at intermediate states (VinePPO, the method this page's hero uses) beat PPO in up to 3.0 times less wall-clock time (Kazemnejad et al., ICML 2025). GRPO removes the pain differently: it gives up per-token credit altogether.
RLHF began with simulated robots and Atari learning from preferences between clips (Christiano et al. 2017); PPO with a KL-penalised learned reward arrived with fine-tuning language models from preferences (Ziegler et al. 2019), moved to summarisation (Stiennon et al. 2020) and became the standard recipe with InstructGPT, which also mixed in pretraining gradients ("PPO-ptx") to limit regressions on public benchmarks.
Results (verified on the InstructGPT page): outputs of the 1.3B InstructGPT model were preferred to those of 175B GPT-3; 175B InstructGPT was preferred to 175B GPT-3 85 ± 3% of the time; the RL stage cost 60 petaflop/s-days against 3,640 for pretraining GPT-3, about 1.6% (60 / 3,640 = 0.0165).
Click a response to flip its score. The "real" groups are this page's Qwen2.5-0.5B-Instruct samples on GSM8K, with their real lengths in tokens and the strict verifier's verdicts; the others are worked examples with illustrative lengths. Dr. GRPO removes the division by the standard deviation and replaces 1/|oi| by a constant (here the longest length in the group); RLOO subtracts the mean of the other responses.
Group Relative Policy Optimization is PPO minus the value model (DeepSeekMath, Shao et al. 2024; the DeepSeekMath page animates PPO against GRPO on one question and trains six methods live). For each prompt, sample a group of G responses, score each, and give every token of a response the same advantage: its score's distance from the group mean, in units of the group's spread.
A group of four, worked. A maths prompt, G = 4, a binary verifier; one response is correct and three are wrong, r = (1, 0, 0, 0). Computed by the page's engine and checked against src/recompute.py:
If all four had been correct, or all wrong, every advantage would be zero and the group would teach nothing but cost four rollouts; DAPO's dynamic sampling (section 7) filters such groups. On this page's real data, 4 of 10 GSM8K groups of 16 from the 0.5B model are uniform under the strict verifier (all four all-wrong).
Predict first: in a group of 16 with one correct answer, is that answer's advantage larger or smaller than a correct answer's in a half-right group? Then pick "1 of 16" and watch.
The group widget, step by step
In symbols, with rewards r1, ..., rG for the group of prompt q, the advantage and the objective (the clip as in PPO, the KL added to the loss rather than folded into the reward, so it does not contaminate the advantages) are:
The KL is estimated per token with Schulman's k3 estimator (Approximating KL divergence): 𝔻KL ≈ x − log x − 1 with x = πref(token) / πθ(token). It is never negative (x − log x − 1 ≥ 0 for every x > 0, zero only at 1) and unbiased for KL(πθ ‖ πref) when tokens are sampled from πθ, because the expectation of x under πθ is exactly 1. On a token the reference gives half the policy's probability, x = 0.5 and k3 = 0.5 + 0.693 − 1 = 0.193.
RLOO, REINFORCE leave-one-out, is the older member of the family: response i's baseline is the mean of the other G − 1 rewards (Kool et al. 2019). That baseline does not use ri, so the estimator is exactly unbiased, and algebra shows it is the mean-centred reward scaled by G/(G − 1): ri − (Σj≠i rj)/(G − 1) = (G/(G − 1)) (ri − mean). For (1, 0, 0, 0) that is +1.000 and −0.333. GRPO's mean-centring includes ri in its own baseline, which only shrinks the advantage by (G − 1)/G; the bias that matters is the standard-deviation division (section 7). Ahmadian et al. 2024 ("Back to Basics") argued that such "simpler REINFORCE-style optimization variants outperform both PPO and newly proposed 'RL-free' methods such as DPO and RAFT" for RLHF.
When the reward depends on the group. Everything above assumes a response's reward is its own. A diversity bonus, a coverage reward or a distribution-matching reward also depends on the groupmates, and then the group baseline changes the objective: in expectation GRPO and RLOO weight a response's effect on its groupmates' rewards by −1/(G − 1) instead of the true gradient's +1 (plain REINFORCE weights it 0), so each response is rewarded for beating its groupmates, a zero-sum tournament. A pairwise diversity bonus keeps 0, 1/3 and 3/7 of its weight at G = 2, 4 and 8, never more than half; at G = 2, two different good answers and two copies of one good answer both get zero advantage. Team-GRPO credits each response with its marginal effect on the group's total reward (a difference reward, computed from the reward matrix with no extra model calls for pairwise rewards) and restores the true gradient. Plain per-response verifier rewards are unaffected (When Rewards Depend on the Group, GRPO Plays a Tournament (arXiv 2611.02404)).
When beating the group is not enough. A group baseline credits a response for beating its siblings, even when every sibling is bad. QORL, an RL run that teaches a 4B model to write Postgres query hints, first rewarded a search with the log of its speedup over Postgres's default plan and gave a search with no valid plan −3. In one group of four, two failures (−3, −3), a slower plan (0.80x, ln 0.80 = −0.23) and a copy of the default plan (−0.05), mean-centring gave the copy +1.52, the largest push of the four. The fix anchors the advantage to the fixed reference and to the timing noise: a response's quality is its log speedup soft-thresholded by 0.05 (anything within about 5% counts as zero, so keeping the default scores exactly zero), its baseline is RLOO's leave-one-out mean of its siblings floored at zero, so it is never credited for being the least bad, and a failed search costs −0.1. The same four then get −0.10, −0.10, −0.18 and −0.02 (a small penalty for picking the default): nothing is reinforced (Training a 4B model to produce faster query plans).
The −1/(G − 1) weight is a theorem for any exchangeable group reward; the retained fraction of a pairwise bonus is (G − 2)/(2(G − 1)), and as G grows GRPO approaches REINFORCE, not the true gradient. Retuning the bonus coefficient cannot fix G = 2. Team-GRPO's advantage is R(group) − G/(G − 1) R(group without response k), unbiased for any G ≥ 2, with variance 1.1 to 2.1 times RLOO's for G ≥ 4. Experiments use one 9B policy (Qwen3.5-9B, rank-16 LoRA) on two tasks: on GlobalOpinionQA at G = 2 the squared error to the human answer distribution went from 0.20 untrained to 0.49 under GRPO (collapse onto majority answers) and 0.08 under Team-GRPO; on NoveltyBench GRPO lost diversity in every seed, and Team-GRPO raised set utility over GRPO by 1.16 at G = 2 and 0.56 at G = 8. Clipping with several epochs per batch was tested only in simulation.
What GRPO gains and loses. No value model: roughly half the memory and no critic warm-up. The DeepSeek-R1 team report that PPO can match GRPO, but only with careful GAE tuning (λ = 1.0; "the default value in most open-source PPO implementations", 0.95, is much worse), and still at the cost of a full value model (DeepSeek-R1 page). GRPO is group-baselined REINFORCE with PPO-style clipping, policy-based rather than actor-critic because nothing bootstraps from the baseline (the root's common mistakes). It pays with equal credit for every token, noisier on long agentic tasks, and with G rollouts per prompt (typically 8 to 64), shifting cost from memory to inference compute. Buying token-level credit back also costs generated tokens, so a dense reward must be compared at a matched token or GPU-hour budget, not per update: with small Qwen models trained on MATH, a Monte-Carlo process reward (continuations sampled from cut points of each response, the hero's VinePPO-style measurement) trailed outcome-only GRPO at equal generated tokens at 0.6B, 1.5B, 1.7B and 4B; on Qwen2.5-1.5B it led by 1.5 points per update, yet trailed by 14.3 at equal tokens (the continuations were 91% of them) and by 7.8 at equal GPU-hours (Are Dense Rewards Worth Their Tokens in GRPO?).
The clip, on one token of the correct response: suppose that after a few minibatch steps its ratio is ρ = 1.3, with ε = 0.2. The unclipped term is 1.3 × 1.732 = 2.252 and the clipped term 1.2 × 1.732 = 2.078; the min takes 2.078, which does not depend on θ, so this token contributes no more gradient. The same ratio on a token of a wrong response: unclipped 1.3 × (−0.577) = −0.751, clipped 1.2 × (−0.577) = −0.693; the min takes −0.751, the unclipped term, so the gradient still pushes that token's probability back down. With one gradient step per batch the ratio stays at 1 (up to the rollout mismatch of section 8) and the clip never binds: the update is plain REINFORCE with a group baseline, and the clip matters only when a batch is reused for several steps.
Published settings. DeepSeekMath-RL 7B used G = 64 samples per question, β = 0.04, a policy learning rate of 1e-6 and a single policy update per sampling batch, so its clip barely binds; it lifted the 7B instruct model from 46.8% to 51.7% on MATH and 82.9% to 88.2% on GSM8K. DeepSeek-R1-Zero used G = 16, β = 0.001, a learning rate of 3e-6, a reference replaced every 400 steps, and 16 minibatches per rollout trained once each with an unusually large clip ratio of 10 (DeepSeekMath page, DeepSeek-R1 page). The β values are not comparable with InstructGPT's 0.02, which sits in the reward rather than the loss.
The standard deviation. Implementations differ on dividing by G or G − 1 (for (1, 0, 0, 0): 0.433 and +1.732 / −0.577 with G; 0.5 and +1.5 / −0.5 with G − 1), and add a small constant so that a uniform group does not divide by zero (without it the loss becomes NaN); the examples on this page divide by G.
The same response, run through everything each method computes for each of its tokens. Before: RLHF with PPO, a reward model's score at the end, a KL penalty on every token, a critic's value at every prefix, GAE. After: GRPO with a verifier, the recipe that replaced it for reasoning: a pass or fail, the group's mean and spread, one number for every token. Dr. GRPO is the 2025 fix of GRPO's two normalisations (section 7). Predict before stepping: on the wrong answer, does the reward model score it above or below the correct one?
The animation, step by step: before, RLHF with PPO
What it shows: the critic places credit where the predicted outcome changed, and pays with a second network that must be right about every prefix (here measured with real continuations, as VinePPO does); GRPO gives every token the same push and pays with a group of rollouts per prompt; Dr. GRPO keeps that and stops long responses being let off lightly.
RL with verifiable rewards replaces the learned reward model with a program: exact-match answer checking for maths, unit tests for code, format checks, task-success checks for agents. The reward is binary or a small rubric sum. The name and first recipe are Tülu 3's (November 2024: a reward of 10 when the verifier accepts, optimised with PPO and a value model; Lambert et al.; its lineage is on Alignment section 7). DeepSeek-R1-Zero's reward is the reference shape: an accuracy reward (the final answer matched against the reference for maths; compilation plus hidden test cases for code) plus a format reward for reasoning inside <think> tags, equally weighted, and deliberately no neural reward model "because of reward hacking" by neural reward models at scale (DeepSeek-R1 page). It needs no preference data, cannot be flattered the way a reward model can, and scales with compute; it works only where a checker exists, and an imperfect checker is the new proxy.
| Verifier | Checks | Typical failure |
|---|---|---|
| Answer match (rule-based) | An extracted final answer equals the reference, after normalisation | False negatives on equivalent forms ("0.5" against "1/2"), false positives when extraction is lenient. Rule-based verifiers "fail to recognize equivalent answers in different formats, leading to substantial false negatives that increasingly hinder RL performance as the policy model gets stronger": a correct answer punished teaches the checker's format, not maths (Huang et al. 2025) |
| Unit tests | Code runs and passes tests | Weak tests, special-cased outputs, edited tests, exiting before assertions (Reward Hacking section 4 and its Case gallery) |
| Format or constraint check | Tags, length, an instruction's constraints (IFEval) | Satisfied in form, not in substance: a <think> block can be empty or decorative |
| Model-based verifier or LLM judge | An LLM decides whether an answer matches or is good; covers open-ended tasks and rubrics | They "substantially improve static accuracy" but are "highly susceptible to reward hacking during RL, where they misclassify certain patterns in responses as correct, particularly after fine-tuning" (Huang et al.); "master keys", a lone ":" or "." or an opener such as "Thought process:" or "Let's solve this step by step", "can consistently elicit false positive rewards without any substantive reasoning"; the authors' fix trains the judge on truncated answers as negatives (Zhao et al. 2025) |
Three checkers on the same 160 real answers. Strict takes the last \boxed{...}, strips "$" and commas and compares its last number with the reference (no box, no reward; the reward used everywhere else on this page). Last number takes the last number anywhere, forgiving a missing box and rewarding a stray trailing number. Lenient passes if the reference number appears anywhere, the buggy extractor that rewards listing many numbers. Of 160 answers the strict checker passes 37, last-number 43 and lenient 66: the lenient checker passes 29 answers the strict one fails, most of them wrong answers that merely mention the reference number on the way. Where two checkers disagree, one is wrong, and a policy trained against it learns the wrong thing.
Beyond maths and code, rubric-based and generative verifiers are a main 2026 research front; rubric-based rewards gave up to 31% relative improvement on HealthBench over Likert-style judge rewards (Rubrics as Rewards, Scale AI, authors' measurement).
Released in January 2025 (arXiv 2501.12948), published in Nature in September 2025 in a much longer version (Nature); the DeepSeek-R1 page rebuilds its tables, decodes its figures and trains a tiny R1-Zero live.
Each fix below removes one measured bias of the objective in section 3. The DeepSeekMath page's Then and now tab walks GRPO's objective term by term through them; here each is derived with numbers.
"GRPO Done Right", from Understanding R1-Zero-Like Training (Liu et al. 2025):
The fix drops both: Âi,t = ri − mean(r1, ..., rG), and token losses are summed and divided by a constant (the maximum generation length in the authors' code) instead of each response's own length. What is left is an unbiased REINFORCE-style estimator with a group-mean baseline (1 of 16 now gets +0.9375 and 8 of 16 gets +0.5: the push reflects how surprising the success was, not the group's spread). The paper reports less length inflation, especially on wrong answers, at equal reasoning performance, and its minimalist recipe reaches 43.3% on AIME 2024 from a 7B base model.
DAPO (Decoupled Clip and Dynamic sAmpling Policy Optimization; ByteDance Seed with Tsinghua University's Institute for AI Industry Research, Yu et al. 2025), an open, widely adopted recipe, reports 50 points on AIME 2024 from the Qwen2.5-32B base model, above DeepSeek-R1-Zero-Qwen-32B's 47 with 50% of its training steps:
Shaping changes how a truncated rollout is scored, not the fact that the cap censors what the model is trained on. On Qwen3.5-4B trained with GRPO under an 8k cap, loss masking of truncated rollouts, DAPO's soft overlength penalty and Dr. GRPO each still let the cap become a learned limit on how far accuracy grows with a larger test-time budget (single-seed ablations, Budget Internalization); what that does to test-time scaling is taught on Test-time compute and reasoning section 6.
At the defaults (start 0.010, η = 0.05), after 16 steps the token reaches 0.0124 under the 0.2 clip (gradient on 4 of 16 steps), 0.0131 under clip-higher (5 of 16), 0.0259 under CISPO and 0.0385 with no clip (16 of 16). illustrative One sampled token with advantage +1, a softmax over its logit and the rest of the vocabulary, sixteen gradient steps on the same rollout (R1-Zero used 16 minibatches per rollout), exact gradients of each objective. In a real model the same token appears in many contexts; the toy isolates one. CISPO's cap is set to the same 1.28 as clip-higher so the two are comparable; MiniMax does not publish its value. Checked against src/recompute.py.
The symmetric clip treats rare tokens unfairly. With ε = 0.2, a token the policy gives probability 0.01 can rise only to 0.012 in one update, while a token at 0.9 is effectively unconstrained (0.9 × 1.2 > 1). Low-probability exploratory tokens can barely grow, the distribution sharpens, and entropy collapses; with εhigh = 0.28 the same rare token can reach 0.0128. The collapse has a fitted law: in long runs, performance follows R = −a eH + b in the policy's entropy H, so it is capped at −a + b once entropy reaches 0; clip-higher and covariance-based clipping (Clip-Cov and KL-Cov, which restrict updates on the few tokens whose log-probability and advantage covary most) keep entropy alive (Cui et al. 2025).
MiniMax-M1's CISPO (MiniMax 2025) names the tokens this hurts: reflective tokens such as "However", "Recheck", "Wait" and "Aha" have low probability under the base model, so their ratios grow fast, they are clipped after the first update, and they stop contributing gradient. CISPO "clips importance sampling weights rather than token updates": every token keeps its gradient, and only the importance weight is clipped, under a stop-gradient:
The rare-token toy, in four stretches
On Qwen2.5-32B and AIME 2024, "CISPO achieves a 2x speedup compared to DAPO", matching DAPO's results in 50% of the training steps. It gives up the clip's trust region and relies on the weight cap and small steps. CISPO is a component of ScaleRL, the recipe from a 400,000-GPU-hour study of how RL scales (section 12).
GSPO (Group Sequence Policy Optimization; Qwen Team, Alibaba, Zheng et al. 2025) argues that token-level ratios are noisy and misaligned with a reward given to the whole sequence, which destabilises long sequences and mixture-of-experts (MoE) training. A 3-token response with per-token ratios 1.1, 0.9 and 1.0 gets one ratio, exp((ln 1.1 + ln 0.9 + ln 1.0)/3) = exp(−0.00335) = 0.99666, in place of three noisy ones:
Because the sequence ratio sits so close to 1, the clip ranges are tiny: 3e-4 below and 4e-4 above (against 0.2 and 0.27 for the paper's GRPO runs), with "a difference of two orders of magnitude in the fractions of clipped tokens between GSPO and GRPO", GSPO clipping more and still training more efficiently. The price is the per-token view: one outlier token is no longer clipped on its own. For MoE models it removes the need for "Routing Replay" (caching which experts were active during rollout so token ratios stay comparable). The paper credits GSPO with contributing to the RL of the Qwen3 models; a GSPO-token variant restores per-token advantages for multi-turn settings. Section 8 computes si on all 160 real responses.
Real systems are off-policy in two ways: minibatch updates make later steps off-policy within a batch (the ratio and the clip handle this), and training/inference mismatch: the vLLM or SGLang engine computes slightly different probabilities than the training stack (kernels, precision, KV cache, batch shapes), so an implementation gap quietly turns on-policy RL into off-policy RL (Yao et al. 2025, "Your Efficient RL Framework Secretly Brings You Off-Policy RL Training"). How large is it? Below, the same weights computed three ways on this page's rollouts.
Per-token log(πtrain / πrollout) for every sampled token. Real, on this page's rollouts: float16 with a KV cache (generation, Apple MPS) against float32 in one pass (CPU), mean |log-ratio| 0.0015 nats per token over 55,718 tokens; bfloat16 in one pass against float32, 0.0112; and an engine left with the model's shipped repetition penalty 1.1 against the plain model, 0.298 over 32 responses (9,397 tokens). The trainer here is the same weights in float32; a real trainer (FSDP, Megatron) and engine differ in more ways (kernels, batch-dependent reductions, FP8 rollouts), so production gaps can be larger. Histograms are binned (0.0005 nats for float16, 0.004 for bfloat16, 0.05 for the penalty); fractions are read from the bins.
The fix that spread is truncated importance sampling (TIS), introduced in that post, against the probabilities the engine actually sampled with:
decoupled_token_is(threshold=2.0) (verl, Rollout Correction)A token the engine sampled at 0.20 that the trainer scores at 0.25 gets weight 1.25; one sampled at 0.05 and scored at 0.25 has ratio 5, truncated to 2. Unlike PPO's two-sided clip the cap is one-sided: weights below 1 pass through. The sequence-level variant multiplies the per-token ratios over the response (∏ρt), which compounds every token's gap, so its thresholds are higher ("typical threshold 2.0-10.0" in verl); rejection sampling (masked importance sampling, MIS) instead drops tokens or sequences whose ratio falls outside set bounds; CISPO's clipped weight (section 7) is the same idea applied to the policy ratio. verl distinguishes a "decoupled" mode with three policies (rollout, old, current) from a "bypass" mode that sets πold = πrollout to skip a forward pass.
In production the gap matters. ScaleRL found that computing the language-model head in FP32 for both generator and trainer "dramatically improves the asymptotic performance A from 0.52 to 0.61" (Khatri et al. 2025); the Qwen team's study of a 30B MoE model over "hundreds of thousands of GPU hours" argues that a token-level objective is a valid surrogate for the sequence reward "only when both the training-inference discrepancy and policy staleness are minimized" (Zheng et al. 2025). The weight export opens a quieter gap: casting the fp32 master to bf16 with round-to-nearest drops every update smaller than half a bf16 step, so on Qwen3-1.7B (AdamW, learning rate 10-6) only 0.4 to 0.5% of served weights change per step and the sampler serves a policy 50 to 150 optimizer steps stale, a staleness that importance ratios computed on the trainer's fp32 copy cannot see. Fair Cast exports with stochastic rounding and computes the loss on the served copy, so rollouts are on-policy for the weights that produced them; in GRPO runs on one H100 each with models up to 4B parameters (Qwen3-0.6B to 4B, OLMoE-1B-7B), it ended more than a point ahead on 18 of 25 matched seed-pairs and within a point on 6 (Fair Cast). MoE models add a discrete version, router drift: a tiny probability difference can flip which experts a token is routed to. And low-precision rollouts widen the gap on purpose, to buy speed: the recipes that work treat the mismatch, not the quantisation error, as the thing to engineer, and reach BF16-level RL with FP4 rollouts (TRACE, up to 5.4x faster rollouts), or avoid the gap by training in the rollout's format from the first pretraining step. Both in detail:
The trainer computes the gradient through different experts than the engine sampled with (router drift). Routing replay (R3) reuses the rollout's expert choices during training; Router Drift Control argues that replay biases the gradient, because it drops the experts the training router would have picked, and instead rejects whole responses whose routing disagreement is high. In asynchronous RL, Router Drift Control plus TIS raised the average peak validation accuracy on AIME 2024 and 2025 by 5.5 points over TIS alone and 4.5 over R3 (Router Drift Control (arXiv 2610.21682)).
TRACE guides the trainer's FP4 rounding by the rollout's and reaches RL "comparable to BF16 rollout" with FP4 weights, activations and KV cache on four large MoE models, with up to 5.4x faster rollouts (TRACE (arXiv 2610.07767)); TRIAGE repairs mismatched updates by their gradient direction and keeps native NVFP4 W4A4 on both sampler and learner, reaching full-precision scores on five math benchmarks with Qwen3-4B and Qwen3-30B-A3B at up to 2.3x BF16 rollout throughput (TRIAGE (arXiv 2610.07043)); KV4-RL found that plain INT4 KV rollouts "can degrade learning even with token-level truncated importance sampling" and fixed it by keeping attention sinks and recent tokens in INT8 (KV4-RL (arXiv 2610.14448)). The other route is one numerics configuration from pretraining to the last rollout: Thinking Machines ran Inkling 2 Small's expert layers with an NVFP4 forward pass from the start, so its RL sampler runs the same NVFP4 forward the model was trained with and no 4-bit checkpoint has to be calibrated at the end; it reports about 20% faster RL than full MXFP8 with "no discernible difference in reward" (a vendor figure for one model, with no reward curve or task given; End-to-End 4-Bit Training). The formats themselves are on Quantization and Precision.
Drift: what the mismatch does to the expected update. On-policy, the trainer's expected score at a prefix is zero, Σv pv ∇log pv = ∇Σv pv = 0 (the identity every baseline relies on, Policy gradients and actor-critic). When the token is drawn from the engine's q but scored through the trainer's p, s̄ = Σv qv ∇log pv is not zero, and the expected update at each prefix splits into drift, 𝔼q[R] · s̄, plus signal, Covq(R, ∇log p). Drift ignores which rollout won and pulls the trainer toward the sampler; since the sampler is then refreshed from the trainer, the pull compounds. Group centring does not remove it: at a prefix whose expected reward differs from the group mean, drift survives in proportion to that difference. Exact importance weights cancel it, but the cap or mask every recipe uses brings it back. Score centering subtracts s̄ from each token's score: an additive, deterministic bias correction (not a variance reduction), computed from the engine's top 128 logged log-probabilities with the tail modelled from the trainer, at under 1% extra wall-clock, and it composes with TIS or MIS, which together remove what each leaves (Marek and Ryabinin, Score Centering; Score Centering, our reading of Wolfe's explainer).
The paper made the mismatch severe on purpose (a fixed weight offset, INT8 samplers with FP4 or INT4 KV caches, syncing every 64 steps), with short sequences, plain SGD and mostly training accuracy, and reads it as a proxy for mild mismatch over long runs. At 30B (Qwen3-30B-A3B-Base on math) it ties TIS with an FP4 cache (52% against 51% training accuracy) and wins only with an INT4 cache (30% against 12%, 4 and 3 seeds); with FP8 uncorrected training was fine. Under stale rollouts it needs TIS or MIS beside it, because its covariance is measured under the stale sampler. A later paper found the top-128 shortcut weaker than Monte Carlo centring and score centering behind on agentic tasks with rare refreshes; it does not cover MoE routing differences, which still need routing replay. Like every correction here, it trusts the probabilities the engine logs, so the export lag of the Fair Cast paper sits upstream of it.
Theory caught up: Group-Relative REINFORCE Is Secretly an Off-Policy Algorithm (Yao et al., ICLR 2026) derives group-relative REINFORCE without assuming where the data came from, reframes GRPO and its relatives as regularised REINFORCE and clarifies "the roles of importance sampling and clipping in GRPO", which makes these corrections principled rather than patches. For a from-scratch loop: log the engine's log-probabilities and compare them with the trainer's; the gap is your mismatch diagnostic.
RLVR reliably raises pass@1. The question is whether it adds abilities the base model lacked or makes the base model's best answers its usual ones (sharpening). The tool is pass@k = 1 − (1 − p)k for a problem solved with probability p per sample, averaged over problems: sharpening raises pass@1 and can lower pass@k at large k, because probability taken from rarely solved problems is coverage lost. Predict: if RL only sharpens, which model solves more problems with 1,024 tries?
What the evidence says. Yue et al. 2025 (NeurIPS 2025 oral): RLVR-trained models beat their base at small k, but "the base models achieve a higher pass@k score when k is large"; RLVR operates "within the base model's capabilities rather than expanding beyond them", six popular RLVR algorithms "perform similarly and remain far from optimal", and distillation introduces genuinely new reasoning patterns. Against: prolonged RL with KL control and reference resets (ProRL) "consistently outperform[s] base models across a wide range of pass@k evaluations", including problems the base cannot solve at any sampling budget (Liu et al. 2025). Agentic tool use pays the same tax: base models with a light harness "often surpass their post-trained counterparts in solution coverage (pass@K)", and the loss of retry value, a Sharpening Tax estimable from a few rollouts, is positive in 36 of 42 base and post-trained pairs, while the base model reaches more tasks at pass@128 in only 26 (clearly in 18, mostly the larger models): the two counts differ. Posterior-tempered group sampling (PTGS), which sets each prompt's sampling temperature from its estimated difficulty during RL, lowered the tax only within run-to-run noise (five runs per arm, two grid-world games, one 7B model), and a plain fixed temperature of 0.5 paid a smaller tax in both games: promising, not shown (Sharpening Tax in Post-Training, paper page; arXiv 2610.01509). And a warning about reading any gain: spurious rewards, random ones, lifted Qwen2.5-Math-7B on MATH-500 by 21.4 points against 29.1 for true rewards, traced to "clipping bias" in GRPO amplifying a pretraining behaviour (code-style reasoning, 65% to over 90% of answers), an effect that "often fail[s] to produce gains for other model families, such as Llama3 or OLMo2" (Shao et al. 2025).
Where the gain lives. Comparing Qwen3-4B-Base with its RL-trained model on 120 AIME problems, taking the RL model's token only at the positions where the two models' greedy choices differ (about 4% of positions) and the base model's everywhere else recovered 90.5% of the pass@1 gain; forcing just the RL model's opening word, "Alright", recovered 35%, and power sampling the base model (sharpening its own distribution, at 8,192 tokens) gave nothing over greedy decoding (What RL Brings to Reasoning (arXiv 2610.24663)). So RL changes a few decisions the base model would not make, and sharpening the base model's own distribution does not find them. The markers people read as RL-made reasoning are mostly inherited: RL from a base model almost never coins "wait"; it arrives with the data (mid-training, reasoning-trace SFT) and some RL recipes multiply it where present, so a marker's frequency is not evidence that RL induced the reasoning (Inherited, Not Invented (arXiv 2610.30882)). The RL itself does matter against a filtered-data baseline: in a pre-registered comparison (Qwen3-4B-Base, LoRA, 3 seeds, one synthetic task), GRPO beat a rejection-sampling fine-tune tuned over 27 runs on every prompt set (Is it RL or Data? (arXiv 2610.25812)).
Sharpening only: pass@1 10.4% (base) to 21.1% (after RL); pass@1024 80.0% to 77.9%. With expansion, pass@1024 rises to 82.9%. illustrative 40 problems with per-sample success probabilities spread from 0 to 0.9 for the base model; "sharpening" raises every probability above 0.15 toward 1 and pushes the rest toward 0; "expansion" also gives a quarter of the unsolved problems a small chance. pass@k computed exactly per problem and averaged; the shape, not the numbers, is the point.
The reading the sources support: RLVR reliably converts pass@k into pass@1 and improves reasoning validity, through a small number of changed decisions that plain sharpening of the base model does not reproduce and that training on the base model's own filtered samples matches only partly; the coverage post-training gives up shows in agentic tool use as in maths and code, and how much depends partly on how rollouts are sampled; whether it creates capability outside the base model's support remains contested, with prolonged multi-stage RL the strongest claim for expansion. Measure pass@k at large k, on more than one base family, before claiming a new capability. The same question seen from inference (a measured chart where pass@1 climbs and pass@256 does not, and what that means for spending samples) is on Test-time compute and reasoning, section 8.
Every RL method optimises the reward it is given, not the one intended. The general picture, the over-optimisation curve of Gao et al. 2022 (proxy reward keeps rising while the true reward peaks and falls as the policy moves away from its start) and how the KL leash decides where the policy stops on it, is Reward Hacking section 2; chat models are its section 3, coding agents section 4, and its Case gallery tab lists every documented case. What is specific to the RL step of a language model, measured where this page can:
<think> block satisfies a format reward while empty.Defences that belong to the RL loop: the KL penalty or a refreshed reference; rule rewards for long runs and learned rewards only briefly (R1's last 400 steps); held-out verifiers; logging reward components separately; and reading samples, especially the highest-reward ones. Monitoring the chain of thought helps, but training against the monitor teaches the model to hide it (Reward Hacking, section 6); routing a flagged rollout's update into an adapter deleted after training, instead of penalising its reward, keeps the monitor out of the objective (GRAFT, paper page; Reward Hacking, section 7).
Every one of the 160 answers as a dot: reward-model score across, length up; filled when the strict verifier passes it. A reward model a policy could not exploit would put every filled dot right of every hollow one. Here it ranks a correct answer above a wrong one in 85% of pairs (AUC), scores 10 of 123 wrong answers above the average correct one, and its score falls with length (r = −0.54: long answers here are mostly truncated or confused ones, so the sign of a length preference depends on the reward model and the data, which is why it has to be measured).
When the policy calls tools, the MDP of section 1 changes in three ways. The transition is no longer trivial: after a tool call the environment appends tokens the policy did not generate (a search result, a test log, a shell's output). Those tokens must be masked out of the loss, because the policy cannot be credited or blamed for them; Search-R1 introduced "retrieved token masking for stable RL training" (Jin et al. 2025). And episodes span many turns with one reward at the end, so credit assignment is harder than in single-turn reasoning; GiGPO adds step-level advantages computed from states that recur across a group, and reports over 12% better than GRPO on ALFWorld and 9% on WebShop (arXiv 2505.10978, authors' measurement).
An RL step for an LLM is four jobs on one or two pools of GPUs: generate rollouts with an inference engine (vLLM, SGLang), score them (a verifier, a reward model, an environment), train on them, and sync the new weights back to the engine. verl's HybridFlow colocates trainer and engine on the same GPUs and switches between them, which makes weight sync fast; disaggregated designs give each its own pool and ship weights over the network. The frameworks (verl, OpenRLHF, TRL, SkyRL, NeMo RL) are listed on Alignment; few methods reach them: of 1,598 papers proposing general RL methods from January 2025 to June 2026, 37 reached any of seven open frameworks, and the included papers more often trained 30B+ policies (41% against 10%) (From RL Papers to Framework Code (arXiv 2610.28027)); checkpoints, failures and goodput on Fault tolerance at scale.
Fig. 3, step by step: one RL step on the GPUs
Synchronous or asynchronous. A synchronous step waits for the longest response in the batch, and reasoning lengths have a long tail, so most of the engine idles at the end of every generation phase. Asynchronous systems let generation run ahead, and pay with staleness, the off-policy problem of section 8. Predict how much of the engine's time the synchronous schedule wastes on this page's real lengths, then compare the two timelines on the right (the same 160 responses, the same engine):
On this model the synchronous schedule takes 5,915 ticks with the engine busy 59% of slot time; the asynchronous one 3,982 ticks, 87% busy, and 121 of the 160 responses are trained on after the weights moved on, by at most 2 versions.
How RL scales. A 400,000-GPU-hour study fits reward against compute with a sigmoid, RC − R0 = (A − R0) / (1 + (Cmid/C)B), and finds that most recipe details (loss aggregation, normalisation, curriculum, the off-policy algorithm) change the efficiency B more than the ceiling A (Khatri et al. 2025).
| Choice | Buys | Costs | Use it when |
|---|---|---|---|
| PPO-RLHF | Per-token credit from a learned critic; works with any learned reward | Four large models in memory, a value model fitted during RL, many sensitive hyperparameters (GAE λ among them) | The reward is a learned preference model and you have the infrastructure for the critic |
| GRPO | A critic-free loop with roughly half the memory and a baseline that needs no training | G rollouts per prompt; equal credit for every token of a response | The default for single-turn reasoning with a verifier; long-horizon agentic tasks feel its lack of per-token credit most |
| RLOO | The same group baseline, exactly unbiased, no std division | As GRPO | You want REINFORCE's simplicity with a free baseline (Ahmadian et al.) |
| GRPO with the Dr. GRPO and DAPO fixes | GRPO's cost without its length and difficulty biases; zero-signal groups filtered; entropy kept alive | More rollouts to fill a batch (dynamic sampling) | Long chain-of-thought runs; the checklist below makes each an explicit decision |
| GSPO | Stability on long responses and MoE models by clipping whole sequences | The per-token view of the ratio: one outlier token no longer gets clipped on its own | MoE policies, long responses |
| CISPO | Rare tokens keep their gradient; 2× faster than DAPO in MiniMax's runs | No trust region from the clip; relies on the weight cap and small steps | Long reasoning where reflective tokens matter |
| Verifier or reward model | A verifier cannot be flattered and needs no preference data | Exists only where correctness is checkable; a reward model covers open-ended quality and is exploitable | Verifier for checkable tasks; reward model briefly, as R1 confined its preference rewards to the final 400 steps of its last RL stage |
| Offline preference methods (DPO family) | No RL loop: cheap broad preference shaping | Consistently weaker than online RL at equal data where it matters most (reasoning, agentic behaviour) | Cheap style and preference tuning; on Alignment |
Letting the engine's sampling defaults change the policy. A model's shipped generation_config.json can carry sampling settings the trainer knows nothing about; Qwen2.5-0.5B-Instruct's sets repetition_penalty 1.1, temperature 0.7, top_p 0.8 and top_k 20 (file). Building this page, a first run that overrode temperature, top_p and top_k but not the repetition penalty sampled from a different distribution than πθ: its stored log-probabilities differed from the model's by 0.08 to 0.45 nats per token on average across 32 responses (up to 3.2 on one token), against about 0.0015 for a pure precision gap (section 8's third set-up). Sample at temperature 1 with every processor off, or record and correct for what you change.
Assuming the rollout policy is the old policy. Computing ρ against the trainer's recomputed log-probabilities alone hides the engine's systematic gap; log both and correct with TIS or rejection sampling.
Counting the KL penalty twice. RLHF-PPO puts it in the reward, GRPO in the loss. Doing both, or comparing β across the two placements (0.02 in InstructGPT's reward, 0.04 and 0.001 in DeepSeek's losses), mixes up two different regularisers.
Expecting PPO's behaviour from GRPO. With one gradient step per batch the clip never binds (section 3's closed block); the clip matters only when a batch is reused, as in R1-Zero's 16 minibatches.
Training on environment tokens. In multi-turn RL, tool outputs are part of the state, not the policy's actions; mask them from the loss, and pass token ids end to end.
The Mercor run in section 11 makes the same point about where the difficulty sits: steps 1, 2, 5 and 7 are where its work actually landed.
RLVR pays 1 for a right answer and 0 for a wrong one, so guessing pays. RLCR (RL with Calibration Rewards, Damani et al. 2025) has the model state a confidence q after its answer and rewards R = c − (q − c)2, correctness minus the Brier penalty: wrong at 0.9 earns −0.81, wrong at 0.2 earns −0.04, right at 0.9 earns 0.99. Because the Brier score is a proper scoring rule, stating the true chance of being right maximises the expected reward (a model right 70% of the time earns 0.49 by saying 0.7 and 0.40 by saying 1.0). On Qwen2.5-7B trained on HotpotQA, against RLVR, it cut expected calibration error from 0.37 to 0.03 at 62.1% against 63.0% accuracy; on six other datasets, from 0.46 to 0.21, with accuracy 56.2% against 53.9% (Table 1(a)). The baselines are RLVR and post-hoc classifiers, not RLVR plus temperature scaling. A worked walk-through: Language Models for Text Classification.
The data behind every real number on the Reading tab. Qwen2.5-0.5B-Instruct answered ten GSM8K test problems, 16 times each, at temperature 1 with every other sampling processor off and a 512-token cap, prompted to "reason step by step, and put your final answer within \boxed{}". Each answer was checked by three verifiers (Reading, section 5) and scored by a real reward model, Skywork-Reward-V2-Qwen3-0.6B; every token's log-probability was recorded under the policy and the base model. Pick a problem; click an answer to read its ending.
Columns: tokens (cut = truncated at 512), the three verifiers' verdicts, the reward-model score, the three group advantages of sections 3 and 7 (GRPO, Dr. GRPO, RLOO) and the mean per-token KL estimate against the base model. Scripts: src/rollouts/rollouts.py (sampling, log-probabilities, verifiers), rm_score.py, mc_values.py, mk_data.py (this page's extract). Apple M1 Pro, PyTorch on MPS and CPU, seeds fixed; one sample of 16 per problem, so pass rates carry sampling noise of up to about ±12 points (one standard error at 50%).
Links open in a new tab, with reading times. The resources below add up to 20h 55m (summed by the build from the times shown; the old page's "+8h 40m" did not match its own list).
160 real answers from Qwen2.5-0.5B-Instruct on ten GSM8K problems: verdicts of three verifiers, reward-model scores, GRPO, Dr. GRPO and RLOO advantages, KL to the base model, and each answer's ending.
The parent: RL in one through-line (one target, many estimators) and where GRPO and PPO sit; its tabs Taxonomy, Method atlas (47 methods) and Milestones and benchmarks. (17 min, plus 2 in closed details)
The machinery this page uses: the policy gradient theorem, baselines (section 4), GAE (section 6), PPO's clip with its four cases (section 9). (45 min, plus 9 in closed details)
Behaviour cloning, which SFT is, and learning from a fixed dataset, which DPO does. (34 min, plus 9 in closed details)
Monte Carlo against TD, importance sampling and on- against off-policy learning: the roots of GRPO's Monte Carlo credit and of the off-policy corrections. (34 min, plus 9 in closed details)
The rest of the topic, in its reading order. (23, 35, 29 and 36 min read)
The pipeline these algorithms slot into: SFT, reward models, the PPO and GRPO loops drawn (section 4), the DPO family, the RLVR swap and lineage (section 7), how recipes combine the stages (section 8). (26 min, plus 4 in closed details)
What the KL penalty and a verifier defend against: the over-optimisation curve and the KL leash (section 2), chat models (section 3), coding agents (section 4), detection, mitigations, a case gallery. (27 min, plus 11 in closed details)
"Same batch, three algorithms" (PPO, GRPO and DPO with the memory each needs), open recipes compared, the Mercor and SkyRL recipe in full, SWE-2 and the cost of RL post-training. (22 min, plus 22 in closed details)
Failures, checkpoints and goodput at scale, the ground an RL run stands on. (41 min, plus 27 in closed details)
RLHF with PPO; the three-step pipeline trained live, numbers rebuilt and corrected. (26 min read)
GRPO introduced; PPO against GRPO animated, the k3 gradient, six methods trained live, and "Then and now" through R1, DAPO, Dr. GRPO and GSPO. (25 min read)
R1-Zero and R1, v1 against v2 kept apart, a tiny R1-Zero trained live. (34 min read)
RLHF without the RL loop, against PPO on a toy with an exact optimum. (24 min read)
RL from AI feedback. (20 min read)
Saturation-aware advantage reweighting for multi-reward GRPO. (21 min read)
DeepSeek's sandbox infrastructure for agentic RL, with a burst of sandboxes placed live. (27 min read)
The reference text for this whole area, kept current; read the policy-gradient and GRPO chapters before writing any training code. (6h)
A step-by-step derivation of the GRPO loss from PPO. (25 min)
The canonical picture of the PPO-RLHF pipeline. (20 min)
The practical guide to training/inference mismatch and importance-sampling fixes. (20 min)
Where truncated importance sampling against the engine's probabilities came from. (20 min)
Still where most GRPO bugs are caught. (50 min)
k1, k2 and k3, and why k3 is unbiased and never negative. (10 min)
Agentic RL at scale, told mostly through infrastructure, environments and harness. (25 min)
A whole effort ladder trained in one RL run with cost in the reward. (15 min)
RLHF with PPO and a per-token KL. (1h)
Why PPO's value networks fail on reasoning, and Monte Carlo values instead. (40 min)
GRPO. (45 min)
REINFORCE and RLOO against PPO for RLHF. (35 min)
R1-Zero and R1. (1h)
The length and difficulty biases, derived and ablated. (45 min)
Clip-higher, dynamic sampling, token-level loss and overlong shaping, with ablations. (45 min)
The sequence-level ratio and its MoE stability argument. (30 min)
Clipping the importance weight instead of the update. (45 min)
GRPO reframed as off-policy REINFORCE. (45 min)
When a token-level objective is a valid surrogate; routing replay. (40 min)
pass@k at large k. (40 min)
False negatives and hackable verifiers. (35 min)
Multi-turn RL with a search tool and retrieved-token masking. (30 min)
Fully asynchronous RL with staleness control. (35 min)
In-flight weight updates. (30 min)
Sigmoidal compute curves and the ScaleRL recipe. (50 min)