| Sampling and policies | |
|---|---|
| question; -th sampled answer; its -th token | |
| answers sampled per question | |
| length of answer in tokens | |
| policy being trained; its parameters | |
| policy that sampled the current group | |
| reference policy of the KL penalty | |
| Rewards and objective | |
| reward of ; mean reward of the group | |
| group-normalized advantage of , given to all its tokens | |
| probability ratio of token under and | |
| GRPO objective | |
| value model; per-token reward; prefix , in PPO | |
| one-step value error , in GAE | |
| number of samples in Pass@K and Maj@K | |
| Constants | |
| clip range of the GRPO and PPO objectives (10 in R1's first RL stage) | |
| KL weight: 0.04 in DeepSeekMath, 0.001 in R1 | |
| GAE's bias-variance parameter and discount, in the PPO comparison | |
Context. The usual way to fine-tune a language model with reinforcement learning, the KL-regularized objective of InstructGPT optimized with PPOproximal policy optimization: a policy-gradient method that maximizes a clipped surrogate of expected reward, so each update moves the policy only a little from the one that produced the samples, trains a reward model on human comparisons and a value modela network, usually a copy of the language model with a scalar output, trained to predict the reward still to come from each prefix of a response; PPO subtracts its prediction from the observed return to make the gradient less noisy next to the policy, each about as large as the policy itself. For math and code there is a cheaper signal: a program can check the final answer or run the tests. DeepSeekMath (Shao et al., 2024) introduced GRPOgroup relative policy optimization: PPO's clipped objective with each answer's advantage computed from the rewards of a group of answers sampled for the same question, and no value model, a variant of PPO that drops the value model and scores each sampled answer against the other answers to the same question. DeepSeek-R1 (Guo et al., 2025) ran GRPO with rule-based rewards directly on a base modela pretrained language model that has had no instruction tuning or other fine-tuning, with no supervised stage, and reported that long, self-checking chains of thoughtthe intermediate reasoning a model writes out before its final answer grew out of the reward alone (the model R1-Zero); a short pipeline around that run produced a general-purpose model, R1.
Reinforcement learning improves reasoning when the reward is a check the policy cannot fool and the starting model already solves some of the problems. The gradient then needs only a comparison among a few answers to the same question: answers that score above the group's average are made more likely and the others less likely, so no value model has to be learned. In DeepSeekMath the gain showed up in majority voting while the chance that at least one of 64 samples is right stayed flat, so RL mostly made correct answers the model could already produce more likely. In R1-Zero, with a 671B base model and ten thousand steps, the model also learned to write much longer solutions and to check its own work.
Setting. For a question , GRPO samples a group of the number of answers sampled per question: 64 in DeepSeekMath, 16 in R1 answers from the policy as it was when the answers were sampled; the policy being trained, with parameters , moves away from it during the updates on those answers, scores each with a reward , and gives every token of the same advantagehow much better an answer did than expected for its question; the policy gradient raises the probability of answers with positive advantage and lowers it for negative,Write for token of , for its length, and the probability ratio of that token under the current and the sampling policy, the probability ratio of token . GRPO maximizes PPO's clipped surrogate, averaged first over the tokens of each answer and then over the group, minus a KL penaltyan estimate of the Kullback-Leibler divergence of the trained policy from a reference policy, times a weight, subtracted from the objective to keep the policy near it to a reference policy a fixed earlier copy of the policy (the starting model, or in R1 the latest policy, reset every 400 steps) that the KL penalty keeps the policy near:where the expectation is over questions and groups sampled from , with PPO's clip range: once leaves in the direction the advantage favors, that token's term stops contributing gradient the clip range and the weight of the KL penalty: 0.04 in DeepSeekMath, 0.001 in R1 the KL weight. The KL is estimated per token by , which is never negative. In R1 the reward is rule-based: an accuracy reward of 1 if the final answer matches the reference (or the code passes the tests) and 0 otherwise, plus a format reward for putting the reasoning between <think> tags.
Main findings (all empirical). (a) In DeepSeekMath, GRPO with a learned reward model, run on about 144k questions from GSM8Kgrade-school math word problems, scored by exact final answer and MATHcompetition math problems in five difficulty levels, scored by exact final answer, raises DeepSeekMath-Instruct 7B from 46.8% to 51.7% on MATH and from 82.9% to 88.2% on GSM8K, and also improves benchmarks with no questions in the RL data; it raises Maj@Kthe fraction of questions on which the most common answer among samples is correct at every up to 64 but Pass@Kthe fraction of questions on which at least one of samples is correct only at small . (b) In R1-Zero, rule-based GRPO from DeepSeek-V3-Base raises AIMEthe American Invitational Mathematics Examination, 15 hard competition problems per paper with integer answers; AIME 2024 has 30 2024 pass@1accuracy averaged over several sampled answers per question (here at temperature 0.6), the expected accuracy of a single sample from 15.6% to 77.9% (86.7% by majority vote over 16 samples), while the average response length grows steadily to many thousands of tokens. (c) For R1, thousands of curated long solutions before RL, a reward for staying in one language, a supervised round on 800k samples and a final RL stage that adds reward models give a readable general model at 79.8% on AIME 2024. Fine-tuning a 32B open base model on 800k R1 outputs does better than running large-scale RL on it (72.6% against 47.0% on AIME 2024), the one size where the two were compared. (d) In one comparison PPO comes close to GRPO when the bias-variance parameter of its advantage estimator (GAE, Step 1) is 1, and is much worse at the usual default of 0.95.
Consequences. The recipe that followed, now called RL with verifiable rewardsreinforcement learning in which the reward comes from a program that checks the answer (exact match, unit tests) instead of a learned reward model, is the one R1 states: hard questions with checkable answers, a reliable verifier, a large base model and many RL steps, with the value model replaced by a group baseline. Dropping the value model saves memory and compute and avoids learning per-token values for a reward that arrives only at the end of a long answer whose early parts may later be revised; the PPO comparison suggests a well-tuned PPO gets close, so the case for GRPO rests on cost. A learned reward is the weak point. R1 kept rule-based rewards for reasoning and used its preference reward models only in the last 400 steps of training, because longer training against them led to reward hackingthe policy raising a learned reward through flaws of the reward model, without the improvement the reward stands for. For smaller models, fine-tuning on a strong reasoner's outputs beat RL from the base model in R1's one comparison, at 32B, and costs far less.
The group mean replaces the value model as the baseline. PPO computes each token's advantage with GAEgeneralized advantage estimation: with , where is the reward at token , the value model, a discount and trades bias for variance from a value model trained alongside the policy, and in RLHFreinforcement learning from human feedback: RL against a reward model trained on human comparisons of responses the reward model scores only the last token, so the value model must predict the final reward from every prefix. GRPO samples answers per question and uses their mean reward as the baseline, dividing by their standard deviation; with a reward on the whole answer, every token of gets . The group mean includes itself; a standard identity, not stated in the paper, shows that centering on it equals centering on the leave-one-out mean, up to a constant factor,The leave-one-out mean does not depend on , so subtracting it leaves the expected gradient unchanged (the score has mean zero), and the centered estimator has the direction of the policy gradient on average; the division by the group's standard deviation changes how much each question weighs, which Liu et al. (2025) later examined. The KL penalty moves out of the per-token reward, where PPO for RLHF puts it, into the loss, and its per-token estimator has mean when tokens are drawn from . DeepSeekMath also defines a process-supervision variant, in which a process reward modela learned model that scores each intermediate reasoning step, as opposed to only the final answer scores each step, the step scores are normalized across the group, and each token gets the sum of the normalized scores of the steps from it onward.
Sampling from the current policy and penalizing wrong answers both add accuracy. Shao et al. write each method's gradient as an average over a data source of a per-token gradient coefficient times . Supervised fine-tuning uses human answers with coefficient 1. Rejection-sampling fine-tuning (RFT)sampling answers from a fixed model, keeping the correct ones, and fine-tuning on them with ordinary next-token loss samples from the supervised model and gives its correct answers coefficient 1; online RFT does the same with samples from the current policy. GRPO's coefficient is , graded by reward and negative for answers below the group mean. On DeepSeekMath-Instruct 1.3B, online RFT pulls ahead of RFT later in training, once the policy has moved away from the supervised model; GRPO beats online RFT; and process supervision beats outcome supervision. On the 7B model, two rounds of iterative RL, which retrain the reward model on the policy's samples (with 10% of the old data replayed) and reset the reference, add more, mostly in the first round. The method comparisons are on one 1.3B model.
RL raised Maj@K at every K and Pass@K only at small K. At temperature 0.7 on GSM8K and MATH, the RL model's Maj@K exceeds the Instruct model's for from 1 to 64. Its Pass@K is higher at , where Pass@1 and Maj@1 are the same number, but the gap is gone by , and on GSM8K the Instruct model is slightly ahead at (read off the paper's Figure 7). The authors read this as RL making the output distribution more robust: it makes correct answers that were already among the samples the most common and adds few problems the model could not already solve. They suggest two reasons specific to their setup, that the RL questions came from the supervised data and that sampling was plain nucleus samplingsampling each token from the smallest set of most likely tokens whose total probability exceeds a threshold. The measurement is for one 7B model with answers capped at 1,024 tokens; it does not settle what longer RL from a base model does, which is what R1 tests.
R1-Zero is GRPO on a base model with a rule-based reward and a fixed template. The policy starts from DeepSeek-V3-Base, a 671B mixture-of-expertsa transformer in which each token passes through only a few of many feed-forward blocks, so only part of the parameters is active per token model, and a template asks it to reason inside <think> tags and answer inside <answer> tags, with no guidance on how to reason. The reward is rule-basedwhy: R1 found that neural reward models, outcome or process, are open to reward hacking during large-scale RL, and retraining them adds compute and complexity, on math, code, STEM multiple-choice and logic questions. Training uses learning rate , , sampling temperature 1, , and 32 questions per step, so each step trains on 512 answers; each rollout generates 8,192 answers, split into 16 minibatches of 512 and trained on once (the note's reading: one rollout feeds 16 steps). The maximum length is 32,768 tokens until step 8,200 and 65,536 after, and both accuracy and length jump at the switch. The run lasts 10,400 steps, 1.6 epochs over the data, and the reference policy is replaced by the current policy every 400 steps.
Accuracy and response length grow together, and reflective behavior appears during training. AIME 2024 pass@1 rises from 15.6% to 77.9%. The average training response length rises steadily to many thousands of tokens without any length reward. On MATH, the easy levels are solved early and accuracy on the hardest level goes from about 0.55 to 0.90. Counts of reflective words ("wait", "mistake", "verify", "check" and others) rise five- to sevenfold over training, and "wait" in particular is nearly absent early, occasional between steps 4,000 and 7,000, and frequent after 8,000; the paper shows one transcript in which the model stops, writes that this is an "aha moment", and re-derives its answer. All of this is measured on one run. It shows that these behaviors arose without examples of them in training, since R1-Zero has no supervised stage before RL; it does not show they were absent from the base model, and later work found them there (see the limits below).
The R1 pipeline restores readability and general skills, at an early cost in reasoning. R1-Zero mixes English and Chinese and is hard to read, and its RL covered only reasoning. R1 first fine-tunes the base model on thousands of long solutions written in a first-person, readable style (R1-Zero outputs rewritten by annotators and then by a model), runs reasoning RL with a language-consistency rewardthe fraction of words in the chain of thought that are in the target language, added to the reward (which costs a little accuracy in an ablation), then fine-tunes on 800k samples of reasoning and other data, and ends with an RL stage that combines rule rewards with helpfulness and safety reward models, at temperature 0.7. The preference rewards enter only in the last 400 of that stage's 1,700 steps. Along the way AIME 2024 pass@1 is 59.0% after the small first fine-tune, against R1-Zero's 77.9%, and recovers to 79.8% for R1, while AlpacaEval 2.0a benchmark of open-ended instructions on which a strong model judges which of two responses is better; LC is its length-controlled win rate length-controlled win rate goes from R1-Zero's 24.7% to R1's 87.6%. The paper sets the clip range to 10 in the first RL stage and notes that small values remove the gradient of many tokens while large values destabilize training.
PPO nearly matches GRPO when GAE uses , not at 0.95. On MATH with DeepSeek-Coder-V2-Lite (16B mixture-of-experts, 2.4B active parameters), PPO with GAE at why: with , GAE's sum telescopes to the observed return minus , so the value model enters only as a baseline and its errors add noise without bias (standard GAE algebra; the paper gives no reason) nearly reaches GRPO, while the common default is considerably worse. The paper gives two further reasons to prefer GRPO for long chains of thought. A value model must predict the final reward from a partial answer whose content may later be revised, which is hard. And PPO's KL penalty enters the reward at every token, so the return accumulates it over the whole answer and implicitly penalizes length, while GRPO's KL term sits in the loss and is not summed into a return.
RL from a general base model worked from 32B up, and distillation beat it at 32B. Early attempts with a 7B dense and a 16B mixture-of-experts base model failed to improve AIME: as responses grew longer they became repetitive. Pure RL worked from 32B, 230B and 671B models. The threshold is not sharp: a math-specialized 7B base, Qwen2-Math-7B, trained with about 10,000 RL steps reached 22.3% on AIME 2024, against 7.9% for its instruct version. Qwen2.5-32B-Base trained with the same RL for over 10k steps reaches 47.0% on AIME 2024, against 72.6% for the same base model fine-tuned on 800k R1 outputs, and the distilledfine-tuned with ordinary supervised loss on outputs generated by a stronger model 1.5B model scores 28.9% where GPT-4o scores 9.3%. Two methods gave no net benefit at R1's scale: a process reward model (steps are hard to define and to label, and a learned model gets hacked) and Monte Carlo tree searcha search that grows a tree of partial solutions, choosing which branch to extend with a learned value model over reasoning steps (the token-level search space is too large and the value model too hard to train).
Limits. The evidence is mostly single training runs read off benchmark curves, and the reasoning behaviors are measured by counting words. Later analyses found self-reflection words in base models before any RL, DeepSeek-V3-Base among them, and traced part of the growth in response length to GRPO's per-answer length averaging (Liu et al., 2025). The Pass@K result is for one 7B model trained on questions from its own supervised data. DeepSeekMath's GRPO uses a learned reward model, while R1's uses rules, so the two papers support GRPO in different regimes.
Terms
- GRPO
- PPO's clipped objective with advantage from answers to one question; no value model
- Group baseline
- : unbiased up to a constant
- KL in the loss
- GRPO adds times a per-token KL estimate to the loss; PPO for RLHF subtracts it from each token's reward
- Verifiable reward
- 1 if the answer matches the reference or the code passes the tests, else 0; plus a format reward in R1
- R1-Zero
- GRPO on DeepSeek-V3-Base with rule rewards and no supervised stage; AIME 2024 pass@1 15.6% to 77.9%
- R1
- cold-start fine-tune, reasoning RL with a language reward, 800k-sample fine-tune, final RL with reward models
- Maj@K vs Pass@K
- DeepSeekMath's RL raised the first at every K, the second only at small K: it sharpened answers the model could already produce
- Gradient coefficient
- per-token weight on ; 1 for SFT and RFT, for GRPO
- PPO with
- nearly matches GRPO in R1's comparison; is much worse
- Reward hacking
- the policy raising a learned reward without real improvement; why R1 used rules for reasoning
- Distillation
- fine-tuning a small model on a strong model's outputs; beat RL from the base model at 32B (72.6% vs 47.0%)
Quiz
- GRPO trains no value model. What takes its place in the advantage?Each answer is compared with the other answers to the same question: . The baseline is computed afresh for every question from the group, so nothing has to be learned.
- Why did R1 use rule-based rewards for reasoning questions instead of a neural reward model?R1 states that outcome and process reward models are susceptible to hacking during large-scale RL and add retraining cost. An answer check cannot be raised without being right, which is what lets RL run for ten thousand steps.
- R1 argues that PPO's usual KL handling works against long chains of thought. What is the mechanism?PPO for RLHF subtracts from each token's reward, and the return accumulates these terms, an implicit penalty on length. GRPO puts the KL estimate in the loss, averaged over tokens.
Sources
- Zhihong Shao et al. DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models. arXiv preprint, 2024.
- Daya Guo et al. DeepSeek-R1 Incentivizes Reasoning in LLMs through Reinforcement Learning. Nature, 2025.
- Zichen Liu et al. DeepSeek-R1 Incentivizes Reasoning in LLMs through Reinforcement Learning. COLM, 2025.