| Sampling | |
|---|---|
| question; -th sampled answer; its -th token | |
| answers per question; length of in tokens | |
| policy being trained; policy that sampled the batch | |
| probability of given and | |
| optimizer updates per sampled batch (4 here) | |
| Rewards, ratios, gradients | |
| reward of ; its group-normalized advantage | |
| token ratio | |
| GSPO's sequence ratio, the geometric mean of the | |
| ; its weight in the gradient ( or ) | |
| per-token advantage; GSPO-token's ratio; stop-gradient (Step 5) | |
| Constants | |
| GRPO's symmetric clip range (0.2 by default) | |
| lower and upper clip ranges: and for GSPO, 0.2 and 0.27 for the GRPO baseline | |
Context. In RL with verifiable rewardsreinforcement learning in which a program checks each answer (exact match, unit tests) and returns the reward, a GRPOgroup relative policy optimization: PPO without a value model, in which every token of an answer gets the answer's reward minus its group's mean reward, divided by the group's standard deviation, as advantage step samples a group of answers to each question, scores them, and then takes several gradient steps on that batch, one per minibatch. From the second minibatch on, the model being trained has moved away from the one that sampled the data. GRPO corrects for this as PPOproximal policy optimization: a policy-gradient method whose objective multiplies each token's advantage by the token's probability ratio, current over sampling policy, and clips that ratio so each update moves the policy only a little does, token by token: each token's gradient is weighted by that token's probability ratio, and the token is clipped when its ratio leaves a narrow band around 1. Zheng et al. (2025) report that at large scale this training can collapse beyond repair (rolling back to an earlier checkpoint and retuning did not rescue it), that the problem grows with response length, and that for mixture-of-expertsa transformer in which a learned router sends each token through a few of many feed-forward blocks (the experts) at each layer, so only part of the parameters is active per token models GRPO converged only with an extra fix, Routing Replayrecording which experts the sampling policy used for each token of a sampled answer and forcing the trained policy to use the same experts when the ratio is computed. Their GSPO, group sequence policy optimization, computes one probability ratio per response and clips whole responses.
Zheng et al.'s principle is that the off-policy correction should act on the same unit as the reward. The reward is given to a whole response, so the ratio that corrects for stale samples, and that decides what is clipped, should also belong to the whole response. A long response has thousands of token ratios; each is computed from a single sampled token, each multiplies one token's gradient, and in a mixture-of-experts model each can jump when an update changes which experts the token is routed to. GSPO averages the token log-ratios over the response and exponentiates the average. This smooths out the token-level noise, gives every token of a response the same weight, and keeps or clips the response as a unit. On a mixture-of-experts model with 30B parameters, GSPO trained stably without Routing Replay and reached higher training reward and benchmark scores than GRPO for the same compute, while clipping about 15% of tokens against 0.13% for GRPO.
Setting. For a question , sample the number of answers sampled per question answers from the policy as it was when the batch was sampled; , with parameters , is the policy being trained, write for token of and for its length in tokens, and score each answer with a reward . Every token of gets the advantage , with and the mean and standard deviation of the rewards in the group of . Each batch of answers is used for the number of optimizer updates made on one batch of sampled answers, one per minibatch; is fully on-policy updates ( in the experiments), so within a batch drifts away from . Write for the probability of given and the earlier tokens , and , the probability ratio of token of , the ratio of token . GRPO maximizes PPO's clipped objective token by token, with clip range the clip range: for a token with positive advantage the term stops contributing gradient once , and for negative advantage once and without the KL term, as in the paper:GSPO replaces by one ratio per answer, the geometric mean of its token ratios,and maximizeswith lower and upper clip ranges and GSPO's clip ranges in the experiments; the GRPO baseline uses 0.2 and 0.27 on its token ratios, several hundred times smaller than GRPO's because is a per-token average.
Main findings (empirical apart from the gradient comparison). (a) Without clipping, the two gradients differ only in how the tokens of an answer are weighted: GSPO gives every token of the weight , GRPO gives each token its own , and on the first minibatch, where both ratios are 1, the two gradients are equal. (b) On a mixture-of-experts model fine-tuned from Qwen3-30B-A3B-Base, GSPO trains stably and keeps improving as compute, fresh questions and longer generation limits are added, with higher training reward and higher scores on AIME 2024the 30 problems of the 2024 American Invitational Mathematics Examination, each with an integer answer; here pass@1 averaged over 32 samples per problem, LiveCodeBencha benchmark of recent competitive-programming problems scored by hidden tests; here problems from October 2024 to February 2025, pass@1 averaged over 8 samples and CodeForcesa competitive-programming site; the score is an Elo rating estimated from the model's solutions to its contest problems than GRPO at the same compute (curves only, no tables). (c) Averaged over training, GSPO clips 15% of tokens and GRPO 0.13%, so GSPO learns more from fewer tokens. (d) In this model about 10% of the experts used for a given answer change after one gradient update; GRPO fails to converge unless the routing is frozen with Routing Replay, while GSPO converges without it.
Consequences. For RL on long responses, and in particular on mixture-of-experts models, the change to a GRPO implementation is small: average each answer's token log-ratios, exponentiate, clip that number with ranges of order , and weight all the answer's tokens by it. A clip fraction is not comparable between token and sequence clipping, so a high fraction under GSPO is not by itself a sign of trouble. The authors also expect GSPO to tolerate the small numerical differences between a training engine and an inference engine, since only an answer's average log-ratio enters, which would let one take 's log-probabilities from the inference engine instead of recomputing them with the trainer; this is argued without a measurement. Where tokens of one answer should get different advantages, as in multi-turn RL, a token-level variant keeps the sequence ratio (Step 5).
The likelihood ratio of a whole answer is a product over its tokens, and GSPO uses that product's per-token geometric mean. Importance sampling: estimating an average under a target distribution from samples of another distribution , each sample weighted by the ratio of the two densities corrects an average under one distribution using samples from another. The reward is a function of the whole answer, so the weight that corrects for sampling from is the answer's likelihood ratio . GRPO instead multiplies each token's gradient by that token's ratio alone. The paper argues that a ratio computed from one sampled token per next-token distribution cannot perform the intended correction and instead adds high-variance noise, which accumulates over long answers and which clipping amplifies. The product itself is not usable either: it changes exponentially with length, so a few tokens whose probabilities moved can swing it by large factors, and answers of different lengths would need different clip ranges. Taking the -th root removes both problems. The scale of the clip range follows (my computation): on a 10,000-token answer, still allows the whole-answer likelihood ratio to reach , and allows it to fall to about .
The two gradients differ only in how the tokens of one answer are weighted. Write , the gradient of the log-probability of token of for the gradient of a token's log-probability. Since , , and is the average of the , whose gradients are the because does not depend on , both unclipped gradients have the formwith token weight the weight of token of in the gradient: for GSPO and for GRPO equal to for GSPO and to for GRPO. On the first minibatch , every and equals 1, and the two are the same gradient. They part once the policy has moved: GRPO then weights the tokens of one answer unequally, by ratios that for the tokens still contributing lie in when and in when , while GSPO scales the whole answer by one number. The paper's view is that these unequal token weights accumulate over training into the instability it observes; it shows the instability but does not measure the accumulation.
At equal compute GSPO learns faster than GRPO while clipping about a hundred times more tokens. The model is a cold-startbriefly fine-tuned on example solutions before RL, so that the base model starts RL already writing in the expected format fine-tune of Qwen3-30B-A3B-Base, a mixture-of-experts model with 30B parameters of which about 3B are active per token, and each batch of answers is split into four minibatches (). GRPO is run with Routing Replay (Step 4) and clip ranges 0.2 and 0.27, which the authors tuned for a fair comparison. GSPO's training reward and its scores on AIME 2024, LiveCodeBench and CodeForces are higher than GRPO's at equal compute in the paper's curves, and keep rising as the authors add compute, refresh the question set and raise the generation limit. Averaged over training, GSPO clips 15% of tokens (as whole answers) against 0.13% for GRPO, and changing the clip ranges does not change the gap's order of magnitude. So GSPO learns more while using fewer tokens, which the authors read as evidence that GRPO's token-level gradient estimates are noisy and make poor use of the samples.
In a mixture-of-experts model a token's ratio jumps when its routing changes; GRPO needs Routing Replay and GSPO does not. In the 48-layer Qwen3-30B-A3B-Base, after one gradient update about 10% of the experts activated for the same answer differ between and . A token's two probabilities are then computed by partly different networks, so its ratio can move far more than the size of the update would suggest; the effect is larger in deeper models. Routing Replay makes both probabilities come from the same experts; without it GRPO's training does not converge properly (the paper's Figure 3), and with it GRPO trains. It costs extra memory and communication and restricts which experts the model can use. GSPO trains normally without it. The authors' explanation is that the likelihood of a whole answer changes little when some of its tokens are routed differently, because the updated model still predicts the text about as well; only the per-token average enters .
A token-level variant keeps the sequence ratio and allows a different advantage for each token. For settings such as multi-turn RL, where tokens of one answer should get different advantages , GSPO-token useswith stop-gradient: has the value of and passes no gradient (detach in PyTorch) the stop-gradient, in GRPO's token-level objective in place of . The fraction has value 1, so equals and is clipped exactly when is, and its gradient is , so token is weighted by . With for every token it matches GSPO in value, clipping and gradient.
Limits. The evidence is one model (a 30B mixture-of-experts model after a cold start), one GRPO baseline and training curves, with no tables, seeds or error bars. Because GRPO needs Routing Replay in this setup, the main comparison is GSPO without it against GRPO with it; how much of GSPO's gain remains on a dense model, where there is no routing to change, is not shown. The claim that GSPO can use the inference engine's likelihoods directly is not tested, and the reason given for GRPO's collapse (token-level noise that accumulates with length) is an interpretation of the curves rather than a measurement of gradient variance.
Terms
- Token ratio
- , one per token; GRPO weights and clips each token by it
- Sequence ratio
- , the geometric mean of the token ratios
- Sequence clipping
- clip to and drop or keep the whole answer
- Clip ranges
- GSPO and ; GRPO baseline 0.2 and 0.27
- Gradient difference
- GSPO weights every token of by ; GRPO weights token by ; equal when
- Clip fraction
- 15% of tokens for GSPO, 0.13% for GRPO, yet GSPO learns faster
- Expert volatility
- about 10% of activated experts change after one update in the 48-layer 30B model
- Routing Replay
- reuse 's experts when computing 's token probabilities; GRPO needs it, GSPO does not
- GSPO-token
- : sequence clipping, per-token advantages
Quiz
- What does Routing Replay do, and why is it unattractive?Freezing the routing makes both token probabilities come from the same network, which restores stable token ratios for GRPO. The cached routes cost memory and communication and keep the model from using its experts freely; GSPO does not need them.
- Which conclusion does the paper's evidence not support directly?The first three are shown in the paper's training curves and clip-fraction figure. The infrastructure benefit is argued from GSPO's use of averaged log-ratios but no experiment tests it.
Sources
- Chujie Zheng et al. Group Sequence Policy Optimization. arXiv preprint, 2025.
- Zhihong Shao et al. DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models. arXiv preprint, 2024.
- John Schulman et al. Proximal Policy Optimization Algorithms. arXiv preprint, 2017.