In one line: GRPO replaces PPO's critic with a group-mean reward baseline (advantage = z-scored reward across G samples per question, KL moved into the loss), taking a 7B math model to 51.7% MATH and becoming the default RLVR algorithm.
How far to trust it: Believe the data pipeline and the headline scores: the gains are large against the noise. Treat GRPO's superiority as an argument, not a result: the paper never trains PPO, its memory saving is asserted rather than measured, and GRPO's lead over Online RFT in its own ablation is within one standard error. GRPO's standing rests on cost and on what later work found. The evidence, judged.
The idea in one sentence: a 7B open model reaches 51.7% on competition maths (MATH) from two things: a 120B-token maths corpus mined from Common Crawl with a fastText classifier that keeps widening its own seed, and GRPO, PPO with the value model deleted, where each answer's advantage is its reward against the mean of a group of answers to the same question.
You need: PPO's clipped objective and GAE in general are taught on Policy gradients and actor-critic; GRPO as it is used today, with its later fixes and real rollouts, on RL for LLMs. This page is the 2024 paper. New terms: GRPO (Group Relative Policy Optimization); outcome and process supervision (one reward per answer, or one per reasoning step); RFT (rejection-sampling fine-tuning: train only on sampled answers that are right; online when sampled from the current policy); k3 (Schulman's per-token KL estimator); gradient coefficient (how hard a method pushes each token up or down); Pass@K, Maj@K (any of K samples right; the most common of K right).
Left: MATH accuracy with chain-of-thought and no tools: Base 7B few-shot (Table 2), Instruct and RL 7B top-1 (Table 5); GPT-4 and the best earlier open model (InternLM2-Math 20B) from Table 5. Right: the models each algorithm keeps in memory, filled when trained (§4.1, Figure 4); the group of eight rewards is illustrative (the paper samples G = 64). The 3D stage in GRPO (Fig. 2) runs both on one question.
At the start of 2024 the best mathematical reasoners were closed. On MATH, the competition-level benchmark, GPT-4 scored 52.9% and Gemini Ultra 53.2% with step-by-step reasoning and no tools; the best open models in the paper's own comparison were InternLM2-Math 20B at 37.7% and Qwen 72B at 35.2%, and the best open base model, Llemma 34B, was at 25.3% (Table 5, Table 2). The paper names two bottlenecks:
The paper answers both: a 120B-token math corpus mined from Common Crawl, which lets a 7B model reach 51.7% on MATH; and GRPO (Group Relative Policy Optimization), which deletes the critic and uses the average reward of a group of answers to the same question as the baseline. It also offers a unified view of SFT, rejection sampling, DPO, PPO and GRPO as one gradient with three knobs.
An iterative loop over Common Crawl, starting from a small high-quality seed (§2.1, Figure 2):
After four rounds: 35.5M pages, 120B tokens (about 3,400 tokens a page, derived). In the fourth round nearly 98% of what was collected had already been collected in the third, so they stopped. The stage (Fig. 1) runs the same loop on a synthetic web, with and without step 3.
illustrative A synthetic web of 48 domains and 1,440 pages, each math page written in one of six styles; the "classifier" recognises a style once it has seen enough positives in it. Only the mechanism is the paper's (a classifier that recalls pages like its seed, and domains with over 10% recalled); the counts are not. The paper's own numbers: 40B tokens kept in round one, 120B after four, 98% overlap between rounds three and four.
The fastText classifier: vector dimension 256, learning rate 0.1, word n-grams up to 3, minimum word count 3, 3 epochs. Decontamination (§2.1): any text segment containing a 10-gram that exactly matches a substring of GSM8K, MATH, CMATH or AGIEval is removed; benchmark texts shorter than 10 grams but at least 3 grams are matched exactly. The method is from DeepSeek-Coder (Guo et al., 2024).
The same 1.3B model (DeepSeek-LLM 1.3B) was trained for 150B tokens on each corpus (§2.2.1; settings in the closed block below). The rivals: MathPile (8.9B tokens from textbooks, Wikipedia, ProofWiki, Common Crawl, StackExchange and arXiv, over 85% arXiv), OpenWebMath (13.6B, Common Crawl filtered for math) and Proof-Pile-2 (51.9B: OpenWebMath, AlgebraicStack with 10.3B tokens of math code, and 28.0B of arXiv, mixed arXiv:Web:Code 2:4:1). Sizes are counted with DeepSeek's 100K-vocabulary tokenizer.
AdamW with β1 = 0.9, β2 = 0.95 and weight decay 0.1; 2,000 warm-up steps to a peak learning rate of 5.3e-4, cut to 31.6% of peak after 80% of training and to 10.0% after 90%; batches of 4M tokens with a 4K context; trained with DeepSeek's HAI-LLM framework (§2.2.1).
The paper's three claims for it (§2.2.2): quality, since at 50B tokens, one full pass of Proof-Pile-2, the DeepSeekMath model is already ahead (Figure 3); multilingual, mostly English and Chinese, so it lifts Chinese benchmarks where the English-centric corpora barely help or even hurt (MathPile drops CMATH from 12.3% to 1.2%); and scale, so its curve keeps climbing while the smaller corpora, repeated several times over 150B tokens, plateau. Figure 3 is a raster image in the paper, so this page does not redraw its curves.
Table 1 as printed, few-shot chain-of-thought. The DeepSeekMath Corpus leads on all eight, by 0.8 (Gaokao-MathCloze) to 21.6 points (CMATH) over the next best.
The base model starts from DeepSeek-Coder-Base-v1.5 7B, a code model (specifically the checkpoint just before its learning-rate decay, Table 4), and continues pretraining for 500B tokens at a peak learning rate of 4.2e-4 and 10M-token batches, otherwise as at 1.3B (§2.3), on the data mix drawn to scale in the figure.
Results with few-shot chain-of-thought (Table 2): 64.2% GSM8K and 36.2% MATH, ahead of every open base model on all eight benchmarks and 10.9 points above Llemma 34B on MATH. Against the closed Minerva 540B, 77 times larger, it is ahead on GSM8K (64.2 against 58.8) and MATH (36.2 against 33.6) but behind on OCW Courses (15.4 against 17.6) and MMLU-STEM (56.5 against 63.9); "comparable", the paper's word in §1.1, is fairer than "outperforms".
With tools (program-of-thought, Python with math and sympy) it reaches 66.9% on GSM8K and 31.4% on MATH, and on informal-to-formal proving in Isabelle (proof sketches finished by the Sledgehammer prover) 25.8% on miniF2F-valid and 24.6% on miniF2F-test, all above Llemma 34B (Table 3). Math training also lifted MMLU from 49.1% to 54.9% and BBH from 55.2% to 59.5% over the released Coder model; code held up against the checkpoint it started from (HumanEval 40.9% against 40.2%, MBPP 52.6% against 52.6%), though not against the released Coder (43.2%, 60.4%) (Table 4).
The data mix of §2.3, to scale: DeepSeekMath Corpus 56%, GitHub code 20%, arXiv 10%, Common Crawl natural language (English and Chinese) 10%, AlgebraicStack 4%. Derived: 56% of 500B is 280B tokens drawn from a 120.2B-token corpus, about 2.3 passes over it.
Lesson 1: code first helps math (§5.1.1, Tables 6 and 7). At 1.3B, with the 89B-token second-round corpus: 400B tokens of code then 150B of math beats 400B general then 150B math, without tools (GSM8K 21.9% against 19.1%, MATH 15.3% against 14.4%) and with tools (17.4% against 14.3%, 9.4% against 6.7%). Mixing code and math in one stage keeps coding (HumanEval 29.3%, MBPP 39.4%, where two-stage math training falls back to 12.2% and 17.0%) and is best with tools, but is worse without tools (17.6% GSM8K); the authors' conjecture is that a 1.3B model lacks the capacity for both at once. "A partial answer": it holds for math, at 1.3B, in one run per setting.
It fell: 11.5% after MathPile, 11.1% after ArXiv-RedPajama. GSM8K fell too (29.0% to 23.6% and 28.1%), and so did miniF2F-test, the formal-proof benchmark where arXiv might be expected to help most (21.7% to 16.4% and 11.9%). SAT is the exception, up from 40.6% to 46.9% and 50.0%.
776K examples in English and Chinese, with solutions in three formats: chain-of-thought, program-of-thought, and tool-integrated reasoning (natural language interleaved with code) (§3.1).
English: GSM8K and MATH annotated with tool-integrated solutions, a subset of MathInstruct, and the Lila-OOD training set (chain-of-thought or program-of-thought). Chinese: K-12 problems over 76 sub-topics such as linear equations, annotated in chain-of-thought and tool-integrated formats. Training: examples packed to 4K tokens, 500 steps at batch 256, constant learning rate 5e-5 (§3.2).
The result, 46.8% on MATH without tools, is above every open model in the comparison and above Inflection-2 (34.8%) and Gemini Pro (32.6%) by 12 and 14 points, and 9.1 points above the best other open model; it trails GPT-4 and Gemini Ultra and roughly matches the Chinese closed models GLM-4 (47.9%) and Baichuan-3 (49.2%). With tools it reaches 57.4%, "approaching 60%", above every open model (Table 5).
PPO maximises a clipped surrogate: per token, the ratio of the new policy's probability to the old one's, times an advantage At, clipped so one update cannot move the policy far (Eq. 1):
GRPO samples a group of G outputs for each question and maximises (Eq. 3):
Outcome supervision (§4.1.2), the variant everyone now means by GRPO: the reward model scores each whole output, the G rewards are normalised, and every token of output i gets the same advantage Âi,t = (ri − mean(r)) / std(r). Process supervision (§4.1.3): a process reward model scores each reasoning step; all step rewards of all G outputs are normalised together, and a token's advantage is the sum of the normalised rewards of the steps ending at or after it.
The stage (Fig. 2) runs one question of this page's toy (Train all six methods: two-digit addition, three output tokens, a rule verifier as the reward) through both algorithms, with the toy's real probabilities: the four models PPO keeps are the glass plates at the back; switch to GRPO and the value model's plate is gone.
Question 7 + 8 from the toy's base ("Instruct") model, which answers it correctly only about one time in four (three of its four demonstrations forgot the carry). The value model is the toy PPO's critic after 100 training steps (λ = 0.95, β = 0.04), computed in your browser. For the group arithmetic with any G, and the share of groups that teach nothing, see the GRPO calculator in section 8 of Test-time compute and reasoning.
Why the critic is the hard part. With γ = 1, GAE gives the final reward a weight of λL−1−t in the advantage of token t; the rest must come from the value model. At the paper's length limit of 1,024 tokens and the common λ = 0.95, the first token's share is 1.6 × 10−23 (derived): early tokens learn only what the critic has learned. DeepSeek-R1's supplement later measured exactly this: PPO with λ = 0.95 "performs considerably worse than GRPO", and with λ = 1.0 comes close (DeepSeek-R1, Supplementary A.3).
Derived from GAE with γ = 1: weight of the final reward in each token's advantage, λL−1−t, log scale. GRPO gives every token the whole normalised reward, weight 1, whatever the length. The toy's outputs are 3 tokens long, so it cannot show this (see the toy).
What dropping the critic saves. The paper says "significantly reducing training resources" and gives no number. A derived estimate for a 7B policy (6.91B parameters from the released config), counting only weights and optimiser state, is in the figure.
Derived: 16 bytes per trained parameter (bf16 weights and gradients, fp32 Adam states and master weights, as in the ZeRO paper §3.1), 2 bytes per frozen parameter, every model the policy's size (the paper's reward model starts from the 7B base; a PPO critic usually starts from the reward model or the policy). Activations, the rollout engine's KV cache and sharding are left out, so this is the saving's shape, not a measurement.
Iterative RL (§4.1.4, Algorithm 1): a fixed reward model goes stale as the policy improves. So after each round, sample from the current policy, continue training the reward model on the new data with a replay of 10% historical data, reset the reference model to the current policy, and continue.
The recipe for DeepSeekMath-RL 7B (§4.2): start from Instruct 7B; RL only on the chain-of-thought questions about GSM8K and MATH from the SFT data, about 144K questions, leaving out the rest on purpose to see what happens on benchmarks RL never touches. Reward model built following Math-Shepherd (Wang et al.), initialised from the Base 7B, learning rate 2e-5. Policy learning rate 1e-6, KL coefficient β = 0.04, G = 64 samples per question, maximum length 1,024, training batch size 1,024, and "a single update following each exploration stage".
Nothing. The ratio compares the policy with the policy that sampled the batch; with one update per batch they are the same model when the gradient is taken, so ρ = 1, the min and the clip are inactive, and the gradient is simply Â∇log π plus the KL term. The paper's own Appendix A.1.5 makes this assumption explicit to derive the gradient coefficients ("we can remove the min and clip operation"). The clip only matters when several updates reuse one batch (μ > 1 in Algorithm 1), as in DeepSeek-R1, which split each rollout into 16 mini-batches and found the clip ratio "plays a crucial role" (R1, Supplementary). Keeping the policy near the reference is the KL term's job, not the clip's. This page checks the toy's GRPO gradient against PyTorch autograd of Eq. 3 with ρ = 1: identical to 1e-16 (check).
k3 is an unbiased, always-positive estimate of the value of KL(πθ ‖ πref). But GRPO puts it in the loss and differentiates it, and that does not give the gradient of the KL it estimates: in expectation it gives the gradient of the opposite direction, KL(πref ‖ πθ) (Tang and Munos, 2025, who call such loss-based implementations "generally incorrect"). The paper's own gradient coefficient (Eq. 21, β(πref/π − 1)) is exactly that. On one categorical step, exactly:
Five outcomes; πref fixed, π = softmax(logits of πref + s · d) for a fixed direction d. Bars: the gradient with respect to the five logits, computed exactly (no sampling). The two directions agree near π = πref and part as π moves; both still pull π back towards πref, so in practice it acts as a regulariser of a slightly different kind.
From Instruct 7B to DeepSeekMath-RL 7B (Table 5): GSM8K 82.9% to 88.2% and MATH 46.8% to 51.7% in domain; out of domain, MGSM-zh 73.2% to 79.6% and CMATH 84.6% to 88.8%; with tools, 83.7% to 86.7% and 57.4% to 58.8% (RL used only chain-of-thought data). Every number in the row improves, as the paper says. Self-consistency over 64 samples reaches 60.9% on MATH (Figure 7). On MATH without tools it beats every open model from 7B to 70B and every closed one in the table except GPT-4 and Gemini Ultra.
Two qualifiers the headline drops. "Over 50% on MATH for the first time within the open-source community" is true without tools: with tools, InternLM2-Math 20B (54.3%) and DeepSeek-LLM-Chat 67B (51.1%) were already above 50% in the same table. And the gain from RL is evaluated against the paper's own Instruct model, not against a PPO-trained one (How much to believe).
Table 5 as printed. Hatched: Gemini Ultra's and Gemini Pro's GSM8K scores are majority votes over 32 samples, printed in grey in the paper, not top-1 like the rest.
Section 5.2 writes the gradient of every post-training method in one form (Eq. 5):
It is still one of the cleanest mental models for why these methods behave differently. The widget in the figure applies each method's coefficient to the same eight outputs, sampled from the toy's base model for one question.
Bars: the coefficient GC on each token of each output (three tokens: scratch digit, tens, units), drawn to one scale across methods. SFT trains on a human demonstration, not on these samples. RFT and Online RFT apply the same rule; they differ in where the samples come from. DPO uses one correct and one wrong output as its pair. PPO's coefficients come from the toy critic after 100 steps. β = 0.04 (DPO: 0.1), as in the toy.
The authors then turn each knob on a 1.3B model (DeepSeekMath-Instruct 1.3B, MATH and GSM8K), decoded here from the figures' vector data (Figure 5 and, below it, Figure 6):
Figure 5, every point read from the SVG's coordinates (tick fit residual under 0.002 points). Shaded: ±1 binomial standard error of one evaluation around GRPO+OS, assuming the standard test sets (1,319 GSM8K, 5,000 MATH problems; the paper does not say). Only four methods are plotted: no DPO and no PPO, although Table 10 analyses both.
Figure 6, decoded. Iteration 1 branches from iteration 0 at step 1,100 and iteration 2 from iteration 1 at step 2,700; iteration 0 continues as the single-round control.
To ask what RL changed, the authors compare Instruct and RL 7B at temperature 0.7 with two metrics over K samples: Pass@K (any of K is right) and Maj@K (the most common answer among K is right).
Slightly lower, on both benchmarks: 86.8% against 87.5% on MATH, 97.3% against 99.1% on GSM8K. Maj@K rises (MATH Maj@64 59.9% to 60.9%), and the gap is largest at small K.
This one figure prefigured the 2025 debate over whether RL with verifiable rewards adds capability or only sharpens the distribution (Yue et al., 2025: base models overtake their RL versions on Pass@K at large K; the evidence since is weighed on RL for LLMs). The paper's own diagnosis (§5.2.3) is the data: RL used only the SFT questions and plain nucleus sampling.
Its directions for each knob: data, out-of-distribution questions, tree-search decoding, and fast inference, which sets how much a policy can explore; algorithms robust to noisy rewards, since "all methods now fully TRUST the signal of the reward function" and even PRM800K has about 20% incorrect annotations, pointing to weak-to-strong methods; reward models that generalise to out-of-distribution questions and decoding (otherwise RL "may merely stabilize the distribution"), that express their uncertainty, and process reward models built efficiently. The limitations section adds that geometry and theorem proving remain weaker than in closed models (§6).
Figure 7, decoded (values exact to 0.1 point). The paper's reading: RL "enhances the model's overall performance by rendering the output distribution more robust", boosting correct answers already in the top K "rather than the enhancement of fundamental capabilities". In this page's toy the same shape appears for Maj@K, and Pass@64 rises slightly, because the toy's few impossible questions share their skill (carrying) with the others (the toy).
What holds up. The headline gains are large against any plausible noise: RL adds 4.9 points on MATH (46.8% to 51.7%), about five standard errors on 5,000 problems, and improves all eight Table 5 entries. The corpus comparison (Table 1) is a controlled experiment, same model, same 150B tokens, with leads of up to 21.6 points. The released checkpoints let anyone re-evaluate the numbers, and the corpus recipe and GRPO were both reproduced at scale (DeepSeek-R1; open GRPO implementations in TRL, verl and OpenRLHF). The authors flag the limits of the arXiv finding themselves, and the code-helps-math claim is stated as "a partial answer".
What is weaker, concretely:
This page's toy adds one more data point: with every method given the same rule reward and the same sample budget, Online RFT matched or beat GRPO and PPO (three seeds each), and offline RFT came close; GRPO and PPO were indistinguishable (the toy). A three-token toy cannot test long outputs or a learned reward model, so it does not refute the paper; it shows the ranking is not automatic.
Verdict. Believe the corpus recipe, the base, instruct and RL scores, and the unified view as a way to think. Treat "GRPO beats PPO" and "GRPO's graded coefficients beat rejection sampling" as unproven by this paper: the first was never run, the second is within one standard error. GRPO won on cost and simplicity, and on what later work (R1, Dr. GRPO, DAPO) found when it ran the comparisons.
A dated timeline and the objective's changes, term by term, are in Then and now.
The paper puts SFT, RFT, Online RFT, DPO, PPO and GRPO in one formula (the unified view) but runs only four of them, with different reward functions. Here all of them train from the same base model, on the same questions, with the same rule reward and the same number of samples per step, in your browser. Everything is exact and seeded: the same settings give the same curves every time.
100 questions a + b with digits 0 to 9. An answer is three tokens: a scratch digit (a correct process writes the units digit of the sum), then the sum as two digits. The reward is a rule: 1 if the two answer digits make the sum. The policy is one small network (an MLP with 64 hidden units, parameters) shared by the three positions; it sees a and b as thermometer codes and the tokens written so far.
The base ("Instruct") model is that network trained from scratch for steps on careless demonstrations: four per question, all right without a carry, but forgetting the carry (7 + 7 answered "04") in one of four when the sum is 10 to 14, three of four when it is 15 or 16, and all four when it is 17 or 18. It answers correctly with probability on average (Pass@1 at temperature 1), forgets the carry of the time on carry questions, Maj@64 , Pass@64 .
Metrics are exact: the page enumerates all 1,000 possible outputs of every question, so accuracy is the mean probability of a right answer, and KL is the exact sequence-level KL(π ‖ πref). Maj@K uses 400 seeded simulated votes per question.
Try: the defaults first (about 25 seconds for all eight). Then β = 0 for GRPO (does the KL term matter here?), G = 2 against G = 16 at the same 64 samples per step (the batch shrinks as G grows), λ = 0 for PPO (a critic-only advantage), and DPO at learning rate 0.0003.
Probability of a right answer for every question, rows a, columns b. The base model's errors sit in the lower right, where the demonstrations forgot the carry; the three cells with sums of 17 and 18 never saw a right answer.
heldout_trial.mjs: trained on 70 questions, every method lowered accuracy on the other 30, from 79.9% to between 40.6% for SFT and 72.7% for GRPO, because this small network learns sums largely one by one; so the toy trains and evaluates on all 100 questions, and the paper's out-of-domain gains cannot be tested here); scale.Tables 1 to 10 transcribed from the arXiv HTML (v3) by mk_tables.py, values as printed; Figures 5 to 7 decoded from the figures' vector SVGs by decode_figs.py (every tick fitted to its printed label; residuals under 0.002 points); every derived number recomputed by recompute.py.
Highlighted: the term that changes at this step; struck through: what it replaces. Each change is shown on top of the previous ones only for reading; real recipes mix them differently (DAPO, for one, keeps the std).
Almost every reasoning model trained with RL since 2025 runs something called GRPO, but rarely the objective of Eq. 3 as printed. The animation changes one thing per step, in the order it was published, with its source; the toy box under it says whether this page's toy can see the change.
Sources: the quoted lines of each paper are saved in src/inputs/later_extracts.txt; links open the papers.
Every link opens in a new tab. Reading time of the resources below: 4h 40m.
arXiv preprint (technical report), the paper itself; the HTML version has the anchors this page links to. abstract page, PDF.
(1h 30m)
the official repository: MIT-licensed code (inference and evaluation scripts), the three 7B checkpoints under the DeepSeek Model License (commercial use permitted); no training code, no RL code and no corpus. About 20 minutes for the README and the evaluation entry point.
(20 min)
Yuge (Jimmy) Shi: the clearest from-first-principles walkthrough of the PPO machinery and exactly what GRPO deletes from it.
(40 min)
Nathan Lambert: GRPO in the context of REINFORCE and PPO variants, with the advantage formulas and the implementation caveats side by side.
(30 min)
Hugging Face TRL: the reference open implementation (docs, about 20 minutes for the core pages); its loss section documents where modern practice departs from the paper (loss aggregation, KL handling).
(20 min)
Liu et al., 2025: the critical follow-up that identifies GRPO's length and difficulty biases; read it after the original.
(45 min)
Tang and Munos, 2025: why differentiating the k3 estimator as a loss, as GRPO does, does not give the gradient of the KL it estimates.
(25 min)
DeepSeek-AI on Hugging Face: the released RL checkpoint (Base and Instruct sit beside it), with the chat template and the license.
(10 min)
2022: the PPO-based RLHF pipeline GRPO simplifies; GRPO keeps its clipping and its KL to a reference. Its page trains a PPO toy live.
2023: the other way to remove a model from the RLHF stack; the unified paradigm here places DPO as offline, rule-rewarded, pairwise. Its page trains DPO against PPO on a toy with an exact optimum.
2025: GRPO at scale with rule (verifiable) rewards, the direct descendant; its Supplementary A.3 is the first GRPO against PPO comparison.
2024: the model family whose post-training inherits this pipeline.
2019: the 16-bytes-per-parameter accounting used here to put a number on the memory GRPO saves.
2025: trained with GSPO, a sequence-level successor to GRPO's token-level ratio.
2025: a fully open recipe ending in reinforcement learning with verifiable rewards.
2026: advantage reweighting for multi-reward policy optimisation, a later turn of the advantage design GRPO started.
the GRPO group-advantage calculator and the share of groups that teach nothing, plus RLVR's sharpening and the R1 recipe.
the lab page: where DeepSeekMath and GRPO sit in DeepSeek's line from V2 to V4.
the algorithm page: the PPO comparison, the KL term and the 2026 fixes to textbook GRPO.
RL for LLMs, RLVR and GRPO.
where SFT, rejection sampling, DPO and RL sit in post-training.
the Common Crawl mining pipeline as a recipe for domain-targeted data.
This page is one row of the Papers database; its properties (Paper, Takeaway, Topics, Year) live there.