Understanding R1-Zero-Like Training

Standard GRPO divides each answer’s learning signal by its length, so long wrong answers are pushed down less. Dr. GRPO deletes that division and reaches 43.3% on AIME 2024 with a 7B model.

Set how many of eight answers are right and how long the wrong ones run. Switch between the two losses and watch the push on each answer change. Then we build, piece by piece, what a base model already knows, what GRPO does to it, and how the fix works.

You need a little probability (an average, a standard deviation) and a rough idea of what a language model does. We build reinforcement learning from zero.

Based on “Understanding R1-Zero-Like Training: A Critical Perspective” by Zichen Liu, Changyu Chen, Wenjun Li, Penghui Qi, Tianyu Pang, Chao Du, Wee Sun Lee and Min Lin (Sea AI Lab, National University of Singapore, Singapore Management University; COLM 2025). A reading for Lecture 6, Model Evolution of MIT MAS.S62 AI4AI. Every idea is re-taught here in our own words and devices.

Push on each answer

3
2,400

The formulas are the paper’s (Eq. 3 for GRPO; Sec. 3.2 for Dr. GRPO, with the 3,000-token generation budget of its Table 6 as the constant). The eight answers are a toy: correct ones run 500 to 860 tokens, wrong ones spread around your slider (never past 3,000), and the reward is 1 for correct and 0 for wrong. The push is the per-token factor times 1,000; the standard deviation is the population one over the eight rewards.

Chapter 0

A Curve That Looks Like Reasoning

Meet the two suspicions behind this paper, and walk one reinforcement learning step from question to update

A team takes a small language model and trains it on maths problems. They use no worked solutions. The only teacher is a checker that says “right” or “wrong” about the final answer. After a few hundred steps, two curves climb together. The score goes up. The answers also get longer.

Then the model starts to write things like “wait, let me check that again.” It looks as if reasoning has been born from nothing but a score. This is the story told about DeepSeek-R1-Zero, a model that DeepSeek trained by applying reinforcement learning directly to a pretrained model, with no supervised step in between. The paper calls this recipe R1-Zero-like training.

Two plain words first

A base model is a language model that has only done pretraining. It learned to continue text, as a phone keyboard does. Nobody taught it to answer a question. Give it “What is 12 times 7?” and it may well continue with “What is 13 times 7?”, as a worksheet would.

Reinforcement learning (RL) is learning by trying. The model tries something, gets a score, and does more of what scored well. Think of training a dog with treats. The dog never sees a manual. It sees which behaviour got the treat.

In this setting the treat comes from a verifier: a small program that reads the model’s final answer and returns 1 if it matches the known correct answer, and 0 if not. The paper uses a library called Math-Verify for this. No human and no learned judge is involved.

The two suspicions

The paper is a careful second look at that story. It does not say R1-Zero is fake. It asks two questions, and each one has a chapter group of its own.

The first question is about the starting point. Was the skill already inside the base model before RL began? If so, RL may have uncovered a skill, not built one. Chapters 2 to 4 test this on many base models, including DeepSeek-V3-Base, the model that R1-Zero was actually trained from.

The second question is about the training rule. The rule used by most R1-Zero work is called GRPO. Does GRPO itself push answers to grow longer, whether or not longer answers are better? Chapters 5 to 7 derive the rule, find two hidden weights in it, and remove them. The fixed rule is Dr. GRPO, short for “GRPO Done Right.”

Chapter 8 puts the findings together into a small recipe. It trains the 7B model Qwen2.5-Math-7B for 27 hours on 8 A100 GPUs and reaches 43.3% on AIME 2024, a hard maths contest set. The paper calls that a new best for a 7B model trained this way at the time.

Walk one training step

Before we question the recipe, we should see it. One step of R1-Zero-like training has six moves. The device below walks them with one question and made-up numbers. Press Next step and read the box under the picture. Each box shows what goes in, what comes out and the shape of the data.

Walk one training step

Six stages from a question to a changed model. The lit stage is the one explained in the box below. Press Next step to move on.

Toy numbers: the question, the eight answers and which ones are correct are made up. The six stages, G = 8 answers per question, temperature 1.0 and the 3,000-token limit are the paper’s setup (its Table 6 and Sec. 3.2).

Two details matter later. First, the model is asked the same question eight times, so the eight answers can be compared with each other. That comparison replaces a trained judge. Second, the update at the end is where the paper finds its problem: how the loss is averaged over tokens decides how hard each token is pushed.

What the paper claims

The authors list six takeaways. We keep them in view as a map. Templates make a base model answer instead of continue. Every base model they tested already solves some maths before RL. The Qwen2.5 models do best with no template at all, which hints at their pretraining data. The “Aha moment” already appears in base models, including DeepSeek-V3-Base. Dr. GRPO fixes GRPO’s bias and gives shorter answers at the same accuracy. And a mismatch between model and template can destroy ability that RL must then rebuild.

  1. Reinforcement learning on a language model: sample, score, push, from zero.
  2. Templates: how a base model is made to answer.
  3. Qwen already answers: the no-template result in Table 1.
  4. The Aha moment: self-reflection before any RL.
  5. Two hidden weights in GRPO: the length bias and the difficulty bias.
  6. Dr. GRPO: delete two terms, with the proof and the code.
  7. Does the fix work? Training curves, ablations and seeds.
  8. The minimalist recipe: question sets, math pretraining and the final table.
  9. The whole paper on one page: numbers, code, checklist and where to go next.
The paper asks whether a rising response length proves that reasoning is emerging. Which two things could also explain it?

Chapter 1

Reinforcement Learning on a Language Model

Turn “try, score, repeat” into one formula, and see why a group average makes a good baseline

Picture a student with a stack of practice questions and an answer key. The student writes eight attempts at one question, checks them against the key, and notices that three were right. The next time, the student leans toward whatever habits produced those three. That is reinforcement learning in one sentence. This chapter makes it exact.

A language model as a decision maker

The paper treats text generation as a game with one move type. At each step the model sees the question and everything it has written so far. This is the state, written st = [q; o<t]. The model then picks one action: the next token, chosen from the vocabulary. The new state is the old state with that token added. Nothing random happens in the transition. Only the model’s own choice is random.

The model’s way of choosing is its policy, written πθ(ot | q, o<t). It is the next-token probability list that you met in any language model, where θ stands for all the weights. The game stops when the model writes an end-of-sequence token or runs out of budget. In this paper the budget is 3,000 tokens.

The goal

Each finished answer o gets one return R(q, o), the total reward. With a verifier, the return is 1 for a correct final answer and 0 otherwise. We want weights θ that make the average return as high as possible, across questions q and across the answers the policy writes.

J(θ)
The score we want to raise: the average return of the policy with weights θ. The paper’s Eq. 4.
Eq ~ pQ
Average over questions drawn from the training set pQ.
Eo ~ πθ
Average over answers the current policy writes for that question.
R(q, o)
The verifier’s reward for the answer: 1 if the final answer is right, 0 if not.

The paper’s Eq. 1 adds a penalty that keeps the new policy close to a reference policy. The penalty is useful when a learned reward model can be fooled far from its training data. A rule-based verifier cannot be fooled in that way, so the authors drop the penalty. This also saves the memory that a second copy of the model would need. We follow them and ignore it.

The gradient, derived

We cannot differentiate through “the verifier said 1.” But we can differentiate the probability of an answer. The trick is that ∇θ π = π · ∇θ log π. Applying it inside the average gives the policy gradient.

∇θJ
The direction in weight space that raises the average return fastest.
∇θ log πθ(o | q)
The direction that makes this exact answer more likely. It is a sum over tokens, one term per token.
R(q, o) − B
How much better than the baseline B the answer did. When B is the average return, this is the advantage.

Read it as a rule. For every answer the policy wrote, push its probability up in proportion to its advantage. A positive advantage raises the answer. A negative advantage lowers it. This is the REINFORCE rule, and every method in this paper is a version of it.

Why subtract a baseline?

Without B, a wrong answer with return 0 contributes nothing, and a right answer with return 1 is pushed up. That still works on average, but it is noisy. With B, an answer is judged against its peers. The paper’s Appendix A shows that any B which does not depend on the token being chosen leaves the expected gradient unchanged:

E[∇ log π(ot)] · B = ( ∑ot ∇π(ot) ) · B = ( ∇ ∑ π(ot) ) · B = ( ∇ 1 ) · B = 0

The probabilities of all tokens add up to 1, so their total never changes, so its gradient is zero. The baseline costs nothing in bias and can cut noise a lot. The standard choice is a learned value model, a second network that guesses the expected return. For a large language model that doubles the training cost.

The GRPO idea avoids the value model. Sample a group of G answers to the same question and use their own average return as B. If 3 of 8 are right, B = 0.375. This is the cheap baseline from the walk-through in Chapter 0.

Why PPO clips

A single batch gives a noisy estimate. If we took a huge step on it, the policy could change so much that the batch no longer describes it. Proximal Policy Optimization (PPO) limits the step. For each token it compares the new policy with the old one that wrote the samples. The ratio is πθ(ot)/πold(ot). PPO multiplies the advantage by this ratio, but clips the ratio to [1 − ε, 1 + ε] and keeps the smaller product. The paper uses ε = 0.2.

Try it with the device below. It is a tiny policy that chooses between three answers to one question. Only one is right. Press One step to sample a group, score it, and push.

Sample, score, push

Bars: the policy’s chance of writing each answer. Dots: the latest group, coloured by outcome. Line: the chance of the right answer, step by step. Change the group size, then press One step or Run 10.

8

A toy: three answers, a softmax policy over three numbers, the true answer starts at 20%, learning rate 2. The update is exactly the formula above with the group mean as the baseline: each logit moves by the average of A × (1 if chosen else 0, minus its probability). The samples are real random draws in your browser.

Notice what happens when a group has no right answers. Every reward is 0, the average is 0, every advantage is 0, and the policy does not move. RL can only improve a skill that the model sometimes shows. That fact makes the base model’s starting skill matter, and it is the subject of the next three chapters.

A group of 8 answers to one question gets rewards [0, 0, 0, 0, 0, 0, 0, 0]. What does the policy-gradient update do?

Chapter 2

A Base Model Needs a Template to Answer

See how a few lines of wrapper text turn a text-continuer into a question-answerer, and why RL needs that to work

Type “What is 12 times 7?” into a phone keyboard and tap the suggestions. You may get “What is 12 times 7 and why?” The keyboard has no idea you wanted an answer. It only guesses what words follow. A pretrained base model behaves the same way, only at a far higher level of skill.

The paper writes this as a difference in what the model represents. A base model was trained to give pθ(x): the chance of a stretch of text. R1-Zero-like training needs something else, a policy πθ(· | q): the chance of an answer given a question. The bridge between them is a prompt template, a fixed piece of text placed around the question so that an answer is the most natural continuation.

The three templates

The paper compares three. Template 1, the R1 template, comes from the DeepSeek-R1 paper. It describes a conversation between a User and an Assistant, tells the Assistant to think first inside think tags and then answer inside answer tags, and ends with the question and the opening tag for thinking. The model continues from that open tag.

Template 2, the Qwen-Math template, uses the chat format of the Qwen family. A system message says “Please reason step by step, and put your final answer within \boxed{}”. The user message holds the question. The prompt ends with the start of an assistant turn. Template 3 is no template: the question alone.

The device below assembles each one for our toy question, so that you see the exact string the model receives. Switch between them. The panel under the picture also shows what the paper’s numbers mean for that choice, which we explain next.

How the authors tested a base model

They took 500 questions from the MATH training set. They asked each model each question, with no template first. A judge model, GPT-4o-mini, read every response and decided one thing only: is this response trying to answer the question, or is it merely continuing the text? The share of answering responses is the answering rate. Quality does not matter at this point.

Then they tried the R1 template and the Qwen-Math template on the same questions and picked the template with the best answering rate for each model. Finally they measured pass@8 with the chosen template. Pass@8 is the chance that at least one of 8 sampled answers is right.

Why pass@8 measures readiness for RL

Chapter 1 ended with a rule: if no sample earns a reward, the update is zero. So a base policy must be able to explore. It must find a right answer now and then by luck, so that RL has something to amplify. Pass@8 asks exactly that.

A worked example. Suppose each try is right 10% of the time, and tries are independent. The chance that all 8 are wrong is 0.9 multiplied by itself 8 times, which is 0.43. So pass@8 = 1 − 0.43 = 57%. At 1% per try, pass@8 is only 7.7%, and almost every group carries no signal. At 30% per try, pass@8 is 94%.

pass@k
The chance that at least one of k independent samples is right.
p
The chance that a single sample is right.
k
The number of samples. The paper uses 8, the same as a GRPO group.

The formula holds when tries are independent and p is the same for every question. Real questions vary: some have p near 1 and some have p near 0. The paper measures pass@8 on real samples, not from the formula. We use the formula only to build intuition.

Wrap the question, then check the signal

Choose a template for Qwen2.5-Math-1.5B. The box shows the prompt the model receives. The curves show how likely a group of k tries is to hold a right answer, if each try were right at the model’s average score.

The three scores are the paper’s Table 1 averages for Qwen2.5-Math-1.5B (greedy decoding, five benchmarks): R1 template 7.9%, Qwen template 24.2%, no template 33.1%. Using one average as the chance of every single try is a toy simplification (tries are not independent and questions differ), so the curves show the shape of the idea, not the paper’s own pass@8, which it measures on 500 MATH questions (its Fig. 3). The template strings are the paper’s Templates 1 to 3 with the question “What is 12 x 7?” filled in.

What the paper found

For Llama-3.1-8B and the DeepSeek models, the R1 template raises the answering rate a lot. Without it they often continue the text instead of answering. DeepSeek-V3-Base has the lowest no-template answering rate, so it is close to a pure base model. That matters because it is the model R1-Zero was really trained from.

The Qwen2.5 models behave differently. They answer 100% of the time with no template at all. Chapter 3 follows that clue. On pass@8, every model tested explores well enough for RL to work, and the Qwen2.5 models do best, even ahead of the 685B-parameter DeepSeek-V3-Base. The authors suggest that this explains why most open R1-Zero reproductions chose Qwen2.5.

Why does the paper measure pass@8 on a base model before running RL?

Chapter 3

The Model That Answers Without Being Asked

Read Table 1 to see why the best results come from using no template, and what that says about Qwen2.5’s pretraining

Imagine hiring a student who has never been in your class. You give the student a blank page with only a question on it, no instructions. Most students would be puzzled. This one writes a full worked solution and boxes the answer. You would suspect that the student has seen this kind of page before.

That is what the authors saw with the Qwen2.5 base models. In Chapter 2 they answered 100% of the time with no template. The paper then measured how well they answer.

The test

The authors evaluated Qwen2.5-Math-1.5B and Qwen2.5-Math-7B on five standard maths benchmarks. AIME 2024 and AMC are contest sets. MATH500 is a 500-question subset of the MATH dataset of competition problems. Minerva Math is a set of quantitative reasoning problems, and OlympiadBench holds olympiad-level problems. A score is the percentage of questions answered correctly.

They used greedy decoding, which means the model always takes its single most likely next token, and a budget of 3,000 generated tokens. They compared four ways of prompting: the usual 4-shot prompt (four worked examples, then the question), the R1 template, the Qwen-Math template, and no template.

Reading Table 1

Look at the averages first. For the 7B model, the 4-shot prompt scores 23.8%, the Qwen template 26.5%, and the R1 template 0.0%. With no template the model scores 38.2%. That is 14.4 points above the 4-shot prompt, and it is the “about 60% improvement” the authors quote (38.2 divided by 23.8 is 1.6). For the 1.5B model the same order holds: 19.7%, 7.9%, 24.2% and 33.1%.

The 0.0% is striking. With the R1 template, Qwen2.5-Math-7B gets almost nothing right on any benchmark. The template does not add a little noise. It breaks the model. We return to this in Chapter 8, where RL has to rebuild what the template destroyed.

One cell goes the other way. On AIME 2024, the 7B model with no template scores only 0.2%, while the Qwen template scores 16.7%. Every other benchmark favours no template. The paper does not explain this cell, and we will not guess at it.

Use the device to explore. Pick a model and a benchmark. The four bars are the four prompting methods.

Four ways to ask the same model

Pick a model, then a benchmark. Each bar is the score with one way of prompting. Look for the tallest bar, and for the bars that fall to zero.

All scores are the paper’s Table 1 (percent correct; greedy decoding; at most 3,000 generated tokens). The 4-shot row gives the model four worked examples in the prompt.

The hypothesis: pretrained on questions glued to answers

Why would a base model answer a bare question? The Qwen2.5-Math report says that its pretraining used data from chat models, which is question-and-answer pairs. The authors reason from this. Suppose the pretraining text often had a question followed at once by its answer, as one long string. The training goal for a base model is to maximise the log-probability of the whole string. Write the question as q and the answer as o. The chain rule of probability splits that into two parts:

log pθ(q ; o)
The score the model gets for the question and answer written one after the other as a single string.
log pθ(q)
How well the model predicts the question text alone.
log pθ(o | q)
How well it predicts the answer once it has read the question. This is exactly the policy that RL wants.

So a model that trains on glued pairs is already trained to answer, as a side effect. It is a model that has done something like supervised fine-tuning without anyone calling it that. The authors state this as a hypothesis. They do not prove it, since the pretraining data are not public. In Chapter 8 they test the idea by building such data themselves.

The consequence for researchers is practical. A paper that says “pure RL on a base model lifted maths scores” may have started from a model that already behaves like a fine-tuned chat model. The authors ask us to be more careful with Qwen2.5 when reproducing R1-Zero. The baseline is stronger than it looks.

Qwen2.5-Math-7B scores 0.0% on average with the R1 template and 38.2% with no template. What is the most direct reading?

Chapter 4

The Aha Moment Was Already There

Learn how to count self-reflection fairly, and see what DeepSeek-V3-Base writes before any RL

Read this answer from a language model: “The total is 36. Hmm, that cannot be right. Let me recheck the sum. Yes, it is 38.” It stopped, doubted itself, went back and fixed its work. People call this self-reflection. The DeepSeek-R1 paper reported a vivid case in R1-Zero, a moment where the model wrote “Aha” and rethought a step. It named this the Aha moment and presented it as something that emerged from RL alone.

A missing control

A good experiment needs a control: what happens without the treatment? Earlier replications of R1-Zero (Liu et al. 2025b; Yeo et al. 2025) noticed that their base models, before any RL, already wrote self-reflection words. So the Aha might not be an RL discovery there. But those replications used small Qwen models. The real R1-Zero was trained from DeepSeek-V3-Base, and nobody had looked at that model.

This paper does. The authors host DeepSeek-V3-Base-685B themselves, ask it the same 500 MATH questions with the R1 template, and sample answers. Their Fig. 3 (right) shows that the model already writes a decent amount of self-reflection. Their Fig. 13 gives examples with the words “Aha” and “wait” in them, written by the base model before RL.

How to count self-reflection

Counting is harder than it sounds. The paper uses two detectors and combines them.

The keyword detector searches for a short list of words. The authors kept the list small on purpose: recheck, rethink, reassess, reevaluate, re-evaluate, reevaluation, re-examine, reexamine, reconsider, reanalyze, double-check, check again, think again, verify again, and go over the steps. They left out “wait” and “try again”, because those words often appear without any real reflection, so they give many false positives.

The LLM detector asks GPT-4o-mini to read a response and sort it into four categories: off-topic or incoherent, an answer with no reflection, an answer with reflection (explicit keywords or implicit rethinking), or pure code. The judge can catch reflection that uses no keyword. But it can be fooled by long, complex responses.

The two detectors make different mistakes. So the authors keep a response only when both agree, a step they call cross-validation. Counting is done per question. A question counts as having self-reflection if at least one of its 8 sampled responses shows it. Their keyword counts come from 40,000 responses per model: 500 questions, 8 responses each, at 10 temperatures.

Try it. The device shows four short responses. Each is a toy written for this lesson, in the style of the paper’s cases. Pick one and see what each detector says.

Two detectors, one response

Pick a response. Keywords from the paper’s list light up in the text. The grid shows where the response lands: columns say whether the keyword detector fired, rows say whether a careful reader sees real reflection.

The four responses are toys written for this lesson; the paper’s real cases are in its Figs. 11 and 13. The keyword list is the paper’s (Appendix D) and is matched live in your browser. The “real reflection” row is our own label, standing in for the paper’s LLM judge, so it shows what cross-validation is for, not how often each case happens.

What happens after RL

Appendix F compares DeepSeek-V3-Base with DeepSeek-R1-Zero on the same 500 questions. After RL, most incorrect responses become correct. Unformatted responses, those that miss the required answer format, increase. Response length jumps. The average response string is 621 characters for correct answers from the base model and 4,965 characters from R1-Zero: eight times longer. Incorrect answers go from 1,039 to 8,206 characters, also about eight times.

The paper is careful here. Incorrect answers are longer than correct ones in both models. The authors suggest the reason is simple: hard questions need longer answers, and hard questions are the ones more often answered wrongly.

Most important, self-reflection does not equal accuracy. For R1-Zero, the authors took questions where at least one of 8 trials reflected. They sampled 100 responses per question and compared the accuracy of reflecting answers with non-reflecting ones. Their Fig. 15 shows that nearly half of the responses with self-reflection are no more accurate than those without it. Reflection can help exploration during training, a point the paper leaves outside its scope. But at test time it is not a guarantee of being right.

Why does the paper combine a keyword detector with an LLM judge and keep only the cases where both agree?

Chapter 5

Two Hidden Weights Inside GRPO

Read the GRPO objective term by term, and find the two divisions that give some answers and some questions more say than others

Imagine a teacher who marks eight essays by the same student on one prompt. The teacher wants each essay to count the same, in proportion to how good it was. Now suppose the grading sheet has a rule: “divide each essay’s feedback by its page count.” A one-page essay gets all its feedback in one place. A ten-page essay gets the same feedback spread thin over ten pages. The rule looks like tidy averaging. It quietly changes who gets heard.

GRPO has this rule built in. This chapter finds it and measures it.

The GRPO objective

Chapter 1 gave the policy gradient. GRPO (Group Relative Policy Optimization, from the DeepSeekMath paper) turns it into a loss that an optimiser can run on a group of G answers to one question. Here is the paper’s Eq. 3.

1/G ∑i
Average over the G answers in the group.
1/|oi|
The length term. Divide answer i’s total by its own number of tokens.
∑t
Add up the loss of every token in answer i.
ρi,t
The probability ratio for token t: new policy over old policy. PPO clips it to [1 − ε, 1 + ε].
Âi,t
The advantage, the same number for every token t of answer i: its reward minus the group average, scaled.
std(R)
The difficulty term. The standard deviation of the G rewards, which measures how much the group disagreed.

Two divisions sit inside this formula. Neither comes from the policy gradient of Chapter 1. Both are extra, and the paper shows that they bias the training.

The length bias

Look at 1/|oi|. The sum over tokens adds up one loss term per token. Dividing by the number of tokens turns that sum into an average. For a short answer, each token carries a large share. For a long answer, each token carries a small share. The advantage is the same for all tokens of an answer, so the per-token push is Âi / |oi|.

Now follow the signs. When an answer is correct (Â > 0), shorter answers get a bigger push up per token. The policy learns to be brief when it is right. When an answer is wrong (Â < 0), longer answers get a smaller push down per token. The policy is punished less for rambling when it is wrong. The paper calls this the response-level length bias. The net result it predicts: a preference for short right answers and long wrong ones.

A worked example with 3 of 8 correct. The mean is 0.375, the standard deviation is 0.484, a correct answer has  = (1 − 0.375)/0.484 = +1.29, and a wrong answer has  = −0.375/0.484 = −0.77. A 500-token correct answer gets +1.29/500 = +0.00258 per token. A 1,000-token correct answer gets half of that. A wrong answer of 600 tokens gets −0.00129 per token. A wrong answer of 3,000 tokens gets −0.00026 per token, five times gentler. The hero at the top of this page draws exactly this.

The difficulty bias

Now look at std(R). It is computed over one question’s group, so each question gets its own divisor. If 4 of 8 answers are right, the rewards are split evenly and the standard deviation is as large as it can be, 0.5. If only 1 of 8 is right, the standard deviation falls to 0.33. Dividing by a smaller number gives a larger result. So questions that are almost always right or almost always wrong get a larger weight, 1/std, than middling questions.

Normalising advantages is a standard trick in RL. The catch is where it is done. Common practice normalises across a whole batch, so every question is scaled by the same number. GRPO normalises per question, so each question has its own scale. The paper calls the result the question-level difficulty bias. It treats questions unequally for a reason that has nothing to do with learning.

Who gets a louder voice?

Each bar is a question whose group had k right answers. Its height is the weight 1/std that GRPO multiplies into that question’s advantages. Drag the group size and the highlighted question.

8
1

Exact arithmetic with rewards of 1 or 0: std = sqrt( (k/G) (1 − k/G) ), the population standard deviation. Groups with k = 0 or k = G are left out because every reward is equal and every advantage is 0. The paper shows this bias in its Fig. 4 and does not tabulate the weights; the bars are our calculation from its formula.

With G = 8 the weight is 3.02 for a question with 1 right answer, 2.31 for 2 right, 2.07 for 3 right, and 2.00 for 4 right. The lopsided questions get about 1.5 times the pull of the balanced ones. Is that wanted? Maybe, maybe not. The point is that it is an accident of the formula, not a design choice backed by the policy-gradient derivation.

The same bug in PPO code

The length term is not only in GRPO. The authors checked popular open PPO code: trl, OpenRLHF, verl, SimpleRL-Zero and Open-Reasoner-Zero. All five divide the loss by the response length (the paper’s Listing 1 and Table 2). The PPO objective in the textbook has no such division. The authors suspect the habit comes from pretraining, where every sequence is packed to one fixed length and dividing by that fixed number is harmless and stable. In RL, response lengths differ, so the same habit changes the maths. The paper’s Fig. 5 and the next two chapters show what it does to training.

Under GRPO, two wrong answers to the same question have lengths 600 and 3,000 tokens. How do their per-token pushes compare?

Chapter 6

Dr. GRPO: Delete Two Terms

Derive the unbiased objective from the policy gradient, prove its baseline is fair, and change one line of code

Chapter 5 found two extra divisions. The fix sounds too small to be a paper: take them out. This chapter shows why that is correct, and not only convenient. It also shows the one line of code that makes the change real.

The objective, from the start

Begin where Chapter 1 stopped. The policy gradient with a baseline B is an average, over answers, of the token-by-token gradient of log-probability times an advantage. The paper’s Appendix A picks the group mean as the baseline: B = mean({R1, …, RG}). Then the advantage of every token of answer i is the same number, Ri minus the group mean. The gradient is:

∇θJ
The direction that raises the expected return, the paper’s Eq. 6.
1/G ∑i
Average over the group. This is a plain average over answers, with no division by length.
∑t
Add the token terms. A longer answer has more terms and so a larger total pull.
∇ log π(oi,t | …)
The direction that makes token t of answer i more likely, given everything before it.
Ãi,t
The unscaled advantage: reward minus the group mean. There is no standard deviation.

Compare with the GRPO objective of Chapter 5. The policy gradient has no 1/|oi| and no 1/std. Both came in from elsewhere. The paper then wraps this gradient in the PPO clip of Chapter 1, and calls the result Dr. GRPO. Its summary is Fig. 1: remove the length normalisation and the standard-deviation normalisation, and nothing else.

Why the group mean is a fair baseline

Chapter 1 showed that a baseline is harmless if it does not depend on the action. The group mean seems to break that rule, since answer i helps make the mean. The appendix settles this by comparing with a method called RLOO (REINFORCE Leave-One-Out). RLOO uses, for answer i, the average reward of the other G − 1 answers. That baseline does not contain answer i at all. The algebra is short:

G/(G − 1) · ( Ri − mean(R) ) = G/(G − 1) · Ri − 1/(G − 1) · ∑j Rj = Ri − 1/(G − 1) · ∑j ≠ i Rj

The left side is the Dr. GRPO advantage times the constant G/(G − 1). The right side is the RLOO advantage. So the two differ only by a constant factor, and a constant factor can be absorbed into the learning rate. Take G = 8 and rewards [1, 0, 0, 1, 0, 0, 1, 0]. For the first answer, R1 − mean = 1 − 0.375 = 0.625. The RLOO value is 1 − 2/7 = 0.714. And 0.625 × 8/7 = 0.714. They match.

The paper also notes that Dr. GRPO’s advantage is a Monte Carlo return with an unbiased baseline. “Monte Carlo” means the return comes from actually finishing the answer and checking it, with no learned value guess in between. This is the textbook policy gradient, so the paper says it recovers the PPO objective of its Eq. 2.

The change in code

The length term enters in a single helper. Typical open-source code averages the per-token loss over only the real tokens, using the mask. The fix divides by a constant, such as the generation budget.

pythondef masked_mean(tensor, mask, dim):                      # tensor, mask: [G, T]
    return (tensor * mask).sum(axis=dim) / mask.sum(axis=dim)   # biased: divides by the length
# Dr. GRPO: one line changes
    return (tensor * mask).sum(axis=-1) / MAX_TOKENS         # constant: every token weighs the same

ppo_loss      = ...                  # per-token clipped loss, [G, T]
response_mask = ...                  # 1 on real tokens, 0 on padding, [G, T]
loss = masked_mean(ppo_loss, response_mask, dim=-1).mean()   # mean over the G answers

Two shapes carry the story. The loss tensor has shape [G, T]: G answers, T token slots, padded to the longest. The mask has the same shape and marks which slots are real. Dividing by mask.sum gives each answer its own divisor, its length. Dividing by MAX_TOKENS gives every answer the same divisor. The paper says other constants also work, with different gradient norms. It also drops the standard deviation when computing the advantage, which is a change in the advantage code, not in this helper.

The device lets you feel the difference. Four answers share one question. Two of the four have lengths you can change. Switch between the two divisors and watch the per-token weight of each answer, and the total pull of each answer.

Divide by length, or by a constant

Rows are answers, cells are token slots. Cell height is the pull each token gets. The bar at the right is the total pull of the answer. Change the lengths of o1 (right) and o2 (wrong), then flip the divisor.

2
8

A toy with 4 answers and 8 token slots, so MAX_TOKENS is 8 here (the paper’s runs use 3,000). Rewards are [1, 0, 0, 1], the group mean is 0.5, so the advantages are +0.5, −0.5, −0.5, +0.5; o3 has 6 tokens and o4 has 4. Every token has the same ratio of 1, so the pull of a token is simply |advantage| divided by the divisor. The standard-deviation term is left out so that the length effect stands alone.

With o1 at 2 tokens and o2 at 8 tokens, dividing by length gives each o1 token a pull of 0.25 and each o2 token a pull of 0.0625. The short right answer is pulled four times harder per token. With the constant 8, every token of every answer has a pull of 0.0625, and the 8-token wrong answer has four times the total pull of the 2-token right one, because it has four times as many tokens. That is what the plain policy gradient says should happen.

In Dr. GRPO, what does the loss helper divide the summed token losses by?

Chapter 7

Does the Fix Work?

Read the training curves, the ablation and the seed check, and see what each one proves and what it leaves open

A fix needs a test. Chapter 6 gave a derivation, but a derivation says what the objective should do, and a training run says what actually happens. A good test changes one thing and watches what moves. This chapter reads three tests from the paper: a head-to-head run, an ablation of each term, and a repeat with different random seeds.

The setup

The main comparison uses the Qwen2.5-1.5B base model with the R1 template. The reward is the rule from Chapter 0: 1 if the final answer matches, 0 otherwise, checked by Math-Verify. The questions come from the MATH training set. After every few steps the authors test the model on five benchmarks: AIME 2024, AMC, MATH500, Minerva Math and OlympiadBench.

The hyperparameters, from the paper’s Table 6, are the same for every run. Each question gets 8 responses of at most 3,000 tokens, sampled at temperature 1.0. The optimiser is AdamW with betas 0.9 and 0.95, no weight decay, gradient clipping at 1.0, and a constant learning rate of 1 × 10−6. The PPO clip is 0.2, with one inner epoch, and both KL terms are 0. A whole run takes about one day on 8 A100 GPUs, using the authors’ Oat framework.

The only change between the two arms is the loss: vanilla GRPO or Dr. GRPO.

Test 1: the head-to-head (Fig. 5)

The paper shows five plots against the policy iteration step: training reward, output length, length of correct outputs, length of incorrect outputs, and average benchmark score. We describe what the authors report in words, because the paper gives no table of these values.

Both losses show the pattern seen in R1-Zero: response length grows as training reward grows. This is the part that looked like emerging reasoning. But GRPO keeps lengthening its answers even when the reward gain slows down. The authors argue that the length term in the loss confounds the usual reading, because it pushes in that direction on its own. Dr. GRPO keeps the length from growing wildly.

The fourth plot is the sharpest. On evaluation questions, the incorrect responses of the Dr. GRPO model are much shorter than those of the GRPO model. The authors read this as less overthinking: long, rambling attempts at problems the model cannot solve. The fifth plot shows the benchmark average. The paper’s claim is that Dr. GRPO improves token efficiency (less text per correct result) while keeping reasoning accuracy. It does not claim a large gain in score.

Test 2: remove one term at a time (Fig. 8)

A head-to-head cannot say which of the two terms matters. Appendix C runs four variants on a mix of 3,000 diverse maths questions from ASDiv, MATH and AIME (before 2023): vanilla GRPO, GRPO without length normalisation, GRPO without standard-deviation normalisation, and full Dr. GRPO. Try the toggles below. The tiles show the per-token pull of two wrong answers, and the paper’s finding for each variant.

Flip the two divisions

Switch each division on or off. The lit tile is the variant you built. Its two bars are the pull on a 600-token and a 3,000-token wrong answer; the text under it is what the paper’s Fig. 8 shows.

The bars are our arithmetic for a group with 3 of 8 correct (mean 0.375, spread 0.484), per token times 1,000, with 3,000 as the constant when length is not divided. The findings are the paper’s Appendix C, Fig. 8, and are qualitative: it prints no numbers for the curves, only that the two variants without length normalisation write shorter responses and that all three modified variants beat vanilla GRPO on training reward and evaluation accuracy.

The paper’s reading: the length term has the stronger effect on response length. Both the full Dr. GRPO and the variant that keeps the standard deviation but drops the length division give shorter responses than the other two. And removing either term improves reward and accuracy over vanilla GRPO, so the two terms each cost something.

Test 3: is it luck? (Fig. 9)

A single run can mislead. RL is noisy. Fig. 9 repeats GRPO and Dr. GRPO across 3 independent runs and shows the mean and the standard deviation. The authors report that Dr. GRPO is better in both token efficiency and final accuracy across seeds, and call the gain statistically significant. Three runs is a small sample, so the claim is modest.

What these tests do not settle

Three limits are worth stating. First, the main comparison uses one 1.5B model; Chapter 8 adds a Llama run and a 7B recipe, but the cleanest ablation is small. Second, the figures are curves, with no table of final numbers. Third, the paper explains the length growth from the weights alone; it does not prove that the weights force the growth. It shows that the growth shrinks when the weights are removed, which is evidence, not a theorem. The authors also say that part of the growth may be real reasoning. Their position is that it is confounded.

In the Fig. 8 ablation, which finding supports the claim that the length term drives response length?

Chapter 8

The Minimalist Recipe

Combine templates, question sets and pretraining into one small recipe, and read the final table honestly

Suppose you want to cook a good soup with the fewest ingredients. You would test each ingredient alone, then in pairs, then build the recipe from what stays. The authors do the same with R1-Zero-like training. We have seen two ingredients so far, the template and the loss. This chapter adds two more: the set of questions and the pretraining of the base model. Then we read the result.

Templates and question sets together (Sec. 3.3)

Chapter 3 showed that Qwen2.5-Math-1.5B answers best with no template. So what does a template do to RL? The authors ran Dr. GRPO from this model with three templates (R1, Qwen-Math, none) on four question sets (the paper’s Table 3). The sets differ in size and difficulty. ORZ has 57k questions that mix AIME, NuminaMath and Tulu 3 MATH, so it is diverse and large. MATH has 12k high-school contest questions. GSM has 8k simpler grade-school questions. ASDiv has 2k basic arithmetic and algebra questions. Fig. 6 plots the benchmark average during RL for all twelve runs.

The authors draw two observations. First, templates set the starting point, but RL lifts every run to a similar score of about 40%, given a suitable question set. Second, the question set matters most when the template is a poor match. With the R1 template, which does not fit this model, narrow question sets plateau lower. With the Qwen-Math template, the best final score comes from the simple GSM-8K set. Training on much easier questions, outside the test distribution, nearly doubles accuracy on harder ones.

Three lessons follow, in the authors’ words. The base model already has strong maths skill. A mismatched template in fact destroys the skill before RL reconstructs it, so claims for the gains of pure RL should be more careful. When template and model are far apart, the gain comes mainly from RL, so the question set needs good coverage. And when they are close, even a small, off-distribution set works, because RL then reinforces behaviours that exist and does not teach new facts.

A weak base model: Llama with maths pretraining (Sec. 3.4)

Qwen is strong in maths from the start. Can R1-Zero-like training work on a model that is weak at it? The authors try Llama-3.2-3B with Dr. GRPO and the R1 template. They compare three starting points. The first is the plain model. The second, Llama-3.2-3B-FineMath, was pretrained further on the FineMath dataset. The third, Llama-3.2-3B-NuminaQA, was the FineMath model pretrained for 2 more epochs at a learning rate of 1 × 10−5 on NuminaMath-1.5 questions with their answers glued on, one string each. That copies the guess about Qwen from Chapter 3.

The result, in Table 4: the plain model rises from an average of 3.3% to 6.8% after RL, a minimal gain. FineMath goes from 6.0% to 14.8%. NuminaQA goes from 0.1% to 20.7% and becomes the paper’s Oat-Zero-3B, which beats Llama-3.2-3B-Instruct at 17.1%. So domain pretraining raises the ceiling, and the glued question-and-answer format helps most. The Llama run also repeats the loss lesson: GRPO shows a “double increase” of accuracy and length that could be read as long reasoning emerging, but Dr. GRPO controls the length (Fig. 7).

The recipe

Put it together. Start from Qwen2.5-Math-7B. Use the Qwen-Math template, since it fits the model. Train with Dr. GRPO on MATH level 3 to 5 questions. The reward is the 1-or-0 verifier. Run for 27 hours on 8 A100 GPUs. The result is Oat-Zero-7B. There is no KL term, no value model, no supervised step and no process reward. That is why the paper calls it minimalist.

Read the final table

Pick a benchmark. Each bar is a 7B model scored under the paper’s protocol. The first bar is the base model with no template; the last bar is the recipe’s result.

All scores are the paper’s Table 4 (percent correct; generation limited to 3,000 tokens, since Qwen2.5-Math has a 4k context). The base model is the starred row, scored with no template. OpenReasoner-Zero is shown at its 3k limit; at 8k it scores 45.9 on average. R1-Distill-Qwen-7B, which is trained on long reasoning traces, reaches 54.7 on average at 8k and is not shown.

Read the bars by benchmark. On AIME 2024 the recipe scores 43.3%, far ahead of the others, and this is the paper’s headline. On the average it is first at 51.4%. But on MATH500 and Minerva Math it is behind PRIME-Zero-7B (83.8% and 36.0%), and its OlympiadBench score is below OpenReasoner-Zero. So the claim is a new best average for this kind of training at 7B, with one very large AIME gain. It is not a win on every column.

For the 1.5B model the same recipe reaches an average of 42.1%, up from 33.1% for the base model scored with no template. The compute is small. That is the paper’s other point: a careful look at the base model and the loss gets you most of the way without a larger system.

Why did the authors build the NuminaQA model by gluing each question to its answer before further pretraining Llama?

Chapter 9

The Whole Paper on One Page

Review the argument, keep the numbers and the code, and see where to read next

You can now rebuild the paper from memory. It asks two questions about R1-Zero-like training. The answers fit in one paragraph.

The one-paragraph summary

R1-Zero-like training applies RL straight to a base model, with a rule-based verifier as the only teacher. A base model continues text, so a template is needed to make it answer, and the wrong template can wipe out its skill. Qwen2.5 models answer well with no template (38.2% average for the 7B maths model, against 23.8% for 4-shot), which hints that their pretraining used question-answer strings. The Aha moment already appears in DeepSeek-V3-Base, and self-reflection does not reliably mean a right answer. GRPO divides each answer’s advantage by its length and by the group’s standard deviation. These add a length bias and a difficulty bias. Dr. GRPO deletes both, and in the paper this gives shorter wrong answers at similar accuracy. With the Qwen-Math template, Dr. GRPO and MATH level 3 to 5 questions, the 7B recipe reaches 43.3% on AIME 2024 in 27 hours on 8 A100 GPUs.

The numbers that matter

WhatNumberWhy it matters
Qwen2.5-Math-7B, average of 5 benchmarks (Table 1)4-shot 23.8; Qwen template 26.5; R1 template 0.0; none 38.2No template is best; the wrong template breaks the model
Qwen2.5-Math-1.5B, same table4-shot 19.7; R1 7.9; Qwen 24.2; none 33.1The same order holds at a smaller size
Self-reflection counting (App. D)15 keywords; 40,000 responses per model (500 questions x 8 x 10 temperatures)A keyword detector and an LLM judge are cross-checked
Average response length in characters (Table 5)Correct: 621 to 4,965. Incorrect: 1,039 to 8,206 (base to R1-Zero)Length grows about eight times, for right and wrong answers
GRPO per-token push, 3 of 8 rightwrong 600 tokens: −1.29 per 1,000 tokens; wrong 3,000 tokens: −0.26Long wrong answers are pushed five times more gently (our arithmetic)
Difficulty weight 1/std, G = 81 right: 3.02; 4 right: 2.00Lopsided questions count about 1.5 times as much (our arithmetic)
Run settings (Table 6)G = 8; 3,000 tokens; temperature 1.0; AdamW at 1e-6; clip 0.2; KL 0; 8 A100 for about a dayA small, repeatable setup
Llama-3.2-3B average, before and after RL (Table 4)plain 3.3 to 6.8; FineMath 6.0 to 14.8; NuminaQA 0.1 to 20.7; Instruct 17.1Maths pretraining raises the ceiling for RL
Oat-Zero-7B (Table 4)AIME 2024 43.3; average 51.4The paper’s headline result, scored at a 3,000-token limit
Oat-Zero-1.5B (Table 4)average 42.1 against 33.1 for the base modelThe recipe also lifts a small model

The core as code

This sketch is the whole change, in PyTorch style. logp and logp_old hold the log-probability of each sampled token under the new and old policy. It is a sketch to read, not the authors’ full code, which is in their repository.

pythonimport torch

def group_advantage(R):                    # R: [G] rewards of one question's group
    return R - R.mean()                  # Dr. GRPO: no division by R.std()

def dr_grpo_loss(logp, logp_old, R, mask, eps=0.2, max_tokens=3000):
    # logp, logp_old, mask: [G, T] (T padded to the longest answer)   R: [G]
    A     = group_advantage(R)[:, None]            # [G, 1], copied to every token
    ratio = torch.exp(logp - logp_old)          # [G, T]
    tok   = torch.min(ratio * A, torch.clamp(ratio, 1-eps, 1+eps) * A)   # PPO clip
    per_answer = (tok * mask).sum(-1) / max_tokens   # constant, NOT mask.sum(-1)
    return -per_answer.mean()                # mean over the G answers

# one step: q -> template -> sample G=8 -> verifier R=[G] -> dr_grpo_loss -> AdamW(lr=1e-6)

A checklist for your own R1-Zero run

  1. Test the base model with no template. Measure the answering rate and the score before RL.
  2. Try each template. Pick the one that fits the model. A mismatch can drop the score to zero.
  3. Measure pass@8. If no group ever holds a right answer, RL has nothing to amplify.
  4. Read your loss helper. If it divides by mask.sum, it divides by the answer length.
  5. Do not divide advantages by a per-question standard deviation. Use R minus the group mean.
  6. Log length for correct and wrong answers separately. A rising total hides which one grows.
  7. Count reflection with two detectors, and test whether it predicts accuracy.
  8. Repeat with three seeds before you claim a gain.

What the paper does not show

The authors work on maths with a 1-or-0 verifier, and on models up to 7B (plus a 685B model for the Aha check). The cleanest ablation is one 1.5B model. The Qwen pretraining story is a hypothesis, since the data are private. The figures are curves without tables. And the claim that GRPO’s weights cause long wrong answers is supported by experiments, not by proof. The authors themselves say the length growth is confounded, not fully explained.

Where this sits

The paper reads DeepSeek-R1 and DeepSeekMath from the outside: it takes their recipe apart and tests each piece. It belongs to Lecture 6, Model Evolution of MIT MAS.S62 AI4AI, which looks at how models are improved over generations. Lecture 7 follows with RL in practice.

Keep going

The takeaway. Before you credit RL for a new skill, check what the base model could already do, and check what your loss function is quietly weighting. Then remove the weights that do not belong.

Go to Present to explain the paper aloud, or Teach to draw it on a whiteboard. Or go back to the instrument and try the two losses again with what you know now.

Credit

This lesson re-teaches “Understanding R1-Zero-Like Training: A Critical Perspective” by Zichen Liu, Changyu Chen, Wenjun Li, Penghui Qi, Tianyu Pang, Chao Du, Wee Sun Lee and Min Lin (Sea AI Lab; National University of Singapore; Singapore Management University), published at COLM 2025. Their code is at github.com/sail-sg/understand-r1-zero, built on the Oat framework. It is a reading for the MIT MAS.S62 AI4AI course (Fall 2026). All explanations, devices and toy numbers are ours, and are marked wherever they are not the paper’s.

Understanding R1-Zero-Like Training: A Critical Perspective
Read the paper · Back to Lecture 6, Model Evolution · Back to Gleams