Simple Algorithm
Deep Learning · Emergence · 28 min

Reinforcement Learning for Reasoning

Verifiable rewards, GRPO and spending more compute at test time.

A base model that solved 15.6% of the AIME 2024 competition problems on its first attempt was trained by reinforcement learning on rewards a program could check: was the final answer right, and was the reasoning placed inside the required tags? By the end it solved over 70%, writing chains of thought thousands of tokens long (DeepSeek-AI, 2025). Checkable rewards turned post-training into a way to buy reasoning with compute twice: during training, and again at test time by sampling, searching and checking. This lesson follows the path from bootstrapped rationales and process rewards to GRPO and test-time scaling, and asks what the reinforcement learning actually adds.

What you’ll learn

  • Show that STaR and ReST-EM are approximate policy-gradient and EM methods for binary rewards, and that fine-tuning on a model's own correct samples ascends the log of its success probability.
  • Compare outcome and process supervision, and explain what Monte Carlo step labels estimate (a value function of the completer) and why progress, an advantage, makes a better process reward.
  • Write GRPO's objective exactly as published, derive its group-relative advantages for binary rewards and the properties of its KL estimator, and describe what DeepSeek-R1 reported, including distillation into smaller models.
  • Analyze test-time compute: the unbiased pass@k estimator, why coverage follows a power law in the number of samples, and when search, revision or a larger model is the better use of compute.

Bootstrapping rationales

Prompting a model to write out intermediate steps, a chain of thought, and voting over several sampled chains (self-consistency) improves accuracy on multi-step problems. The Artificial Intelligence course proves when voting helps and covers search over thoughts; What Transformers Can Compute shows why written-out steps add computational power. This lesson is about training models to reason, and the obstacle is data: worked solutions written by people are scarce, while problems with checkable answers are plentiful.

STaR (Zelikman et al., 2022) bootstraps from about ten worked examples. Prompted with them, the model writes a rationale and an answer for every training problem, and the rationales that reach the correct answer are kept. For problems it got wrong, it is shown the correct answer as a hint and asked to justify it (rationalization); those rationales are kept too, with the hint removed. The original pretrained model is fine-tuned on everything kept, and the loop repeats with the new model generating. On CommonsenseQA, the 6-billion-parameter GPT-J gained 35.9 points over few-shot prompting and 12.5 over fine-tuning on answers alone, reaching 72.5%, close to the 73.0% of a fine-tuned model 30 times larger.

DerivationFiltered fine-tuning is approximately reinforcement learning
  1. ∇θ∑xpx(θ)=∑xEy∼πθ(⋅∣x)[r(x,y) ∇θlog⁡πθ(y∣x)]\nabla_{\boldsymbol\theta}\sum_xp_x(\boldsymbol\theta)=\sum_x\E_{y\sim\pi_{\boldsymbol\theta}(\cdot\mid x)}\big[r(x,y)\,\nabla_{\boldsymbol\theta}\log\pi_{\boldsymbol\theta}(y\mid x)\big]

    Give a sampled rationale-plus-answer yy the binary reward r(x,y)∈{0,1}r(x,y)\in\{0,1\}, and let px(θ)=Ey∼πθ(⋅∣x)[r(x,y)]p_x(\boldsymbol\theta)=\E_{y\sim\pi_{\boldsymbol\theta}(\cdot\mid x)}[r(x,y)] be the probability of solving problem xx. The policy gradient keeps only the successful samples, exactly as STaR's filter does, a link Zelikman et al. point out:

  2. q(y∣x)=r(x,y) πθt(y∣x)px(θt),θt+1=arg max⁡θ∑xEy∼q(⋅∣x)[log⁡πθ(y∣x)]q(y\mid x)=\frac{r(x,y)\,\pi_{\boldsymbol\theta_t}(y\mid x)}{p_x(\boldsymbol\theta_t)},\qquad\boldsymbol\theta_{t+1}=\argmax_{\boldsymbol\theta}\sum_x\E_{y\sim q(\cdot\mid x)}\big[\log\pi_{\boldsymbol\theta}(y\mid x)\big]

    ReST-EM (Singh et al., 2024) makes the link exact with expectation–maximization. The E-step restricts the current policy to its correct responses; the M-step is supervised fine-tuning on them:

  3. ∇θEq[log⁡πθ(y∣x)]∣θt=∑yr πθtpx ∇log⁡πθt=Eπθt[r ∇log⁡πθt]px=∇θlog⁡px(θt)\nabla_{\boldsymbol\theta}\E_{q}\big[\log\pi_{\boldsymbol\theta}(y\mid x)\big]\Big|_{\boldsymbol\theta_t}=\sum_y\frac{r\,\pi_{\boldsymbol\theta_t}}{p_x}\,\nabla\log\pi_{\boldsymbol\theta_t}=\frac{\E_{\pi_{\boldsymbol\theta_t}}\big[r\,\nabla\log\pi_{\boldsymbol\theta_t}\big]}{p_x}=\nabla_{\boldsymbol\theta}\log p_x(\boldsymbol\theta_t)

    At the current parameters, the M-step's gradient is the gradient of the log success probability (Fisher's identity):

  4. So fine-tuning on each problem's successes, normalized per problem, ascends ∑xlog⁡px\sum_x\log p_x rather than ∑xpx\sum_xp_x: a problem solved 1% of the time gets 100 times the weight REINFORCE would give it. Three things separate it from on-policy RL: the samples come from the previous round's model, wrong answers are discarded rather than pushed down, and each round restarts from the base model to limit overfitting.

With PaLM 2 models on competition mathematics (MATH) and code (APPS), ReST-EM sampled 32 or 64 solutions per problem, kept at most 10 correct ones per problem so that easy problems would not dominate, and beat fine-tuning on human-written solutions, by margins that grew with model size. It raised pass@kk at every kk measured, most at k=1k=1; gains shrank over iterations, and more iterations began to overfit.

Shao et al. (2024) wrote supervised fine-tuning, rejection-sampling fine-tuning, DPO, PPO and GRPO as one gradient, E[1∣o∣∑tGC(q,o,t) ∇log⁡πθ(ot∣q,o<t)]\E\big[\frac1{\abs o}\sum_t GC(q,o,t)\,\nabla\log\pi_{\boldsymbol\theta}(o_t\mid q,o_{<t})\big], differing only in where the data come from, what supplies the reward, and the per-token gradient coefficient GCGC. Online rejection-sampling fine-tuning reinforces every correct answer equally and never penalizes a wrong one; GRPO, which scales both by the reward, beat it.

Check your understanding

In the policy-gradient view of STaR, what happens to a sampled rationale that reaches a wrong answer?

  1. It is pushed down, as a negative advantage would do
  2. It is kept with the correct answer appended, and trained on
  3. It contributes nothing: the indicator reward zeroes its term in the gradient
  4. It is kept with a smaller weight than correct rationales
Show the answer

C. It contributes nothing: the indicator reward zeroes its term in the gradient

With reward 1[y^=y]\mathbb 1[\hat y=y] and no baseline, failed samples multiply their score function by zero, which is exactly STaR's filter. Rationalization is separate: for a failed problem the model writes a new rationale with the answer as a hint. Methods with a baseline, such as GRPO, do push wrong answers down.

Outcome versus process supervision

An outcome reward model (ORM) scores a whole solution by whether its final answer is right; a process reward model (PRM) scores every step. Uesato et al. (2022) compared them on grade-school math (GSM8K) with a 70-billion-parameter model. Final-answer error came out similar either way, 23.5% against 22.3% without a reward model and 16.6% against 14.8% with one. Reasoning was another matter: among answer-correct solutions, the best model trained by RL directly on final-answer correctness still had flawed reasoning in 12.4% of them, against 3.8% for the best process-supervised method, and RL against a learned reward model brought it to 5.5%. Their best system cut the trace error from the previous best of 14.0% to 3.4%.

Lightman et al. (2024) scaled process labels up. PRM800K holds 800,000 human labels (positive, negative or neutral) for the steps of 75,000 solutions to 12,000 MATH problems, and the PRM was supervised only up to each solution's first incorrect step. A solution's PRM score is the product of its steps' probabilities of being correct. Choosing the best of 1,860 sampled solutions per problem on 500 test problems, the PRM solved 78.2%, an ORM 72.4% and majority voting 69.6%. Active learning, labeling the solutions the current PRM found most convincing but that reached wrong answers, made labeling about 2.6 times more data-efficient.

Think first A completer finishes 8 solutions from a partial solution and 3 reach the right answer. What are the soft and hard labels, and what does the hard label's average become if the completer truly succeeds 37.5% of the time?

Soft label 3/8=0.3753/8=0.375, hard label 11. With Vμ=0.375V^\mu=0.375 and N=8N=8 the hard label's mean is 1−0.6258≈0.981-0.625^8\approx0.98: hard labels call almost any salvageable step good, so they mostly detect steps from which the answer is unreachable.

Automatic process labels work in practice. Step-by-step PPO against Math-Shepherd's PRM raised Mistral-7B from 77.9% to 84.1% on GSM8K and from 28.6% to 33.0% on MATH. Trained to predict progress under a prover, Setlur et al.'s process advantage verifiers made search more than 8% more accurate and 1.5 to 5 times more compute-efficient than with an ORM, and as dense RL rewards gave 5 to 6 times better sample efficiency, where automated PRMs had previously beaten ORMs in RL by only 1–2%.

At the largest scale the verdict has been cautious. The DeepSeek-R1 report lists PRMs among its unsuccessful attempts: a "step" is hard to define in general reasoning, step correctness is hard to label automatically and expensive to label by hand, and a learned PRM invites reward hacking. It kept them for reranking and guided search, where they work, but found their benefit in large-scale RL too small for their cost.

GRPO, as published

With a verifiable reward there is no reward model to train, but PPO still needs a value network about as large as the policy, which is hard to train when the only reward arrives at the last token. GRPO (Shao et al., 2024) drops it: for each question qq it samples a group of GG outputs from the old policy and uses their rewards relative to one another as the baseline, maximizing

JGRPO(θ)=Eq, {oi}i=1G∼πold 1G∑i=1G1∣oi∣∑t=1∣oi∣{min⁡(ρi,tA^i,t, clip⁡(ρi,t,1−ϵ,1+ϵ) A^i,t)−β DKL[πθ ∥ πref]},ρi,t=πθ(oi,t∣q,oi,<t)πold(oi,t∣q,oi,<t)J_{\text{GRPO}}(\boldsymbol\theta)=\E_{q,\ \{o_i\}_{i=1}^G\sim\pi_{\text{old}}}\ \frac1G\sum_{i=1}^G\frac1{\abs{o_i}}\sum_{t=1}^{\abs{o_i}}\Big\{\min\Big(\rho_{i,t}\hat A_{i,t},\ \operatorname{clip}(\rho_{i,t},1-\epsilon,1+\epsilon)\,\hat A_{i,t}\Big)-\beta\,\mathbb D_{\text{KL}}\big[\pi_{\boldsymbol\theta}\,\|\,\pi_{\text{ref}}\big]\Big\},\qquad\rho_{i,t}=\frac{\pi_{\boldsymbol\theta}(o_{i,t}\mid q,o_{i,<t})}{\pi_{\text{old}}(o_{i,t}\mid q,o_{i,<t})}
Equation (3) of Shao et al. (2024). With outcome rewards every token of output ii gets the same advantage, A^i,t=r~i=(ri−mean⁡(r))/std⁡(r)\hat A_{i,t}=\tilde r_i=(r_i-\operatorname{mean}(\mathbf r))/\operatorname{std}(\mathbf r); with a process reward model, A^i,t\hat A_{i,t} is the sum of the normalized step rewards from token tt on. Unlike PPO for RLHF, the KL term is added to the objective, not folded into the reward.
DerivationGroup advantages and the KL estimator
  1. A^correct=1−p^p^(1−p^)=1−p^p^,A^wrong=−p^1−p^\hat A_{\text{correct}}=\frac{1-\hat p}{\sqrt{\hat p(1-\hat p)}}=\sqrt{\frac{1-\hat p}{\hat p}},\qquad\hat A_{\text{wrong}}=-\sqrt{\frac{\hat p}{1-\hat p}}

    With binary rewards and kk of GG outputs correct, let p^=k/G\hat p=k/G. The group mean is p^\hat p and the population standard deviation p^(1−p^)\sqrt{\hat p(1-\hat p)}, so

  2. The advantages sum to zero; a rare success earns a large one (7≈2.65\sqrt7\approx2.65 when 1 of 8 is right, against 11 when 4 of 8 are); and a group whose rewards are all equal has zero advantages and contributes only the KL term. Implementations that use the sample standard deviation scale every advantage by (G−1)/G\sqrt{(G-1)/G}.

  3. Eπθ[ρ−log⁡ρ−1]=DKL(πθ ∥ πref),ρ−log⁡ρ−1≥0\E_{\pi_{\boldsymbol\theta}}\big[\rho-\log\rho-1\big]=\KL\big(\pi_{\boldsymbol\theta}\,\|\,\pi_{\text{ref}}\big),\qquad\rho-\log\rho-1\ge0

    The KL term is estimated at each sampled token with ρ=πref/πθ\rho=\pi_{\text{ref}}/\pi_{\boldsymbol\theta} (Schulman, 2020, a blog note). For tokens sampled from πθ\pi_{\boldsymbol\theta} itself, Eπθ[ρ]=∑yπref(y)=1\E_{\pi_{\boldsymbol\theta}}[\rho]=\sum_y\pi_{\text{ref}}(y)=1 and Eπθ[−log⁡ρ]=DKL(πθ∥πref)\E_{\pi_{\boldsymbol\theta}}[-\log\rho]=\KL(\pi_{\boldsymbol\theta}\|\pi_{\text{ref}}), so the estimate is unbiased, and because u−log⁡u−1≥0u-\log u-1\ge0 for all u>0u>0, no single sample is ever negative:

  4. Unbiased in value is not unbiased in gradient: differentiated as part of the loss with the samples held fixed, the estimate's expected gradient at each token is that of DKL(πref∥πθ)\KL(\pi_{\text{ref}}\|\pi_{\boldsymbol\theta}), the divergence with its arguments swapped (the Reinforcement Learning course derives this). DeepSeekMath used G=64G=64, β=0.04\beta=0.04 and a single gradient update per batch of samples. With one update, ρi,t=1\rho_{i,t}=1 wherever the gradient is taken, so the clipping never binds and the gradient is a group-baselined policy gradient plus the KL term; clipping matters only when a batch is reused.

Predict before you look

GRPO samples 8 answers to a question and 2 are correct (reward 1; the rest get 0). Using the population standard deviation, what advantage does each correct answer receive?

Show the answer

1.73

Mean 0.250.25, standard deviation 0.25×0.75≈0.433\sqrt{0.25\times0.75}\approx0.433, so A^=0.75/0.433=3≈1.73\hat A=0.75/0.433=\sqrt3\approx1.73 for each correct answer and −0.25/0.433=−1/3≈−0.58-0.25/0.433=-1/\sqrt3\approx-0.58 for each wrong one; they sum to zero. With the sample standard deviation, as torch.std computes by default, both shrink by 7/8\sqrt{7/8}, to 1.621.62 and −0.54-0.54.

python
def grpo_loss(logp, logp_old, logp_ref, rewards, mask, eps=0.2, beta=0.04):
    """One question. logp, logp_old, logp_ref: (G, T) log-probs of each sampled token
    under the current, sampling and reference policies; rewards: (G,); mask: (G, T)."""
    adv = (rewards - rewards.mean()) / (rewards.std() + 1e-4)   # group-relative advantage
    ratio = torch.exp(logp - logp_old)
    clipped = torch.clamp(ratio, 1 - eps, 1 + eps)
    surrogate = torch.min(ratio * adv[:, None], clipped * adv[:, None])
    log_r = logp_ref - logp
    kl = torch.exp(log_r) - log_r - 1                            # per-token KL estimate, always >= 0
    per_token = (surrogate - beta * kl) * mask
    per_output = per_token.sum(1) / mask.sum(1)                  # average over each output's tokens
    return -per_output.mean()                                    # minimize the negative objective

The objective above for one group, written as a loss. The small constant keeps a group with equal rewards from dividing by zero; such a group then contributes only its KL term.

In DeepSeekMath itself the rewards came not from a checker but from a learned reward model, whose training data were built as in Math-Shepherd (previous step). Trained this way on about 144,000 chain-of-thought questions from GSM8K and MATH, DeepSeekMath-Instruct 7B rose from 82.9% to 88.2% on GSM8K and from 46.8% to 51.7% on MATH, and improved on benchmarks it was not trained on. The authors also observed that RL raised accuracy under majority voting over KK samples but not pass@KK, the chance that any of KK samples is right: it made the output distribution more reliable rather than widening what it could solve.

The normalizations are choices with side effects. Dividing each output's sum by its length ∣oi∣\abs{o_i} penalizes a long wrong answer less per token than a short one, which Liu et al. (2025) found lengthened incorrect responses during training; dividing by the group's standard deviation reweights questions by difficulty. Their Dr. GRPO removes both. The Reinforcement Learning course analyzes these normalizations and critic-free estimators such as RLOO.

DeepSeek-R1, and distilling reasoning

R1-Zero. DeepSeek-AI (2025) applied GRPO directly to the DeepSeek-V3 base model, with a template asking for the reasoning between <think> tags before the answer and rule-based rewards only: accuracy (a matching answer, or passing test cases for code) plus format, weighted equally. Neural reward models, outcome or process, were left out because they were susceptible to reward hacking in large-scale RL. Pass@1 on AIME 2024 rose from 15.6% to over 70% (86.7% with self-consistency over 16 samples), and the average response grew steadily to thousands of tokens, with more passages that re-check earlier steps or try another approach. The report's "aha moment", an intermediate checkpoint writing "Wait, wait. Wait." and starting over, is an anecdote; Liu et al. (2025) found such self-reflection already present in DeepSeek-V3-Base before RL, so training may have amplified rather than created it.

R1. R1-Zero's reasoning was hard to read and mixed languages. DeepSeek-R1 added stages: fine-tuning on a few thousand curated long chain-of-thought examples (a "cold start"), reasoning RL with an extra reward for staying in one language, rejection sampling from the RL model to build about 800,000 supervised examples (about 600,000 reasoning traces that reached correct answers, 200,000 general ones), fine-tuning DeepSeek-V3-Base afresh on them, and a second RL stage for helpfulness and harmlessness that also kept refining reasoning. The report stresses the base model: pure RL from a 7-billion-parameter dense and a 16-billion-parameter mixture-of-experts base failed to improve AIME accuracy, their longer outputs turning repetitive, while 32-billion dense and 230- and 671-billion mixture-of-experts bases improved substantially.

32-billion-parameter modelHow it was trainedAIME 2024 pass@1
QwQ-32B-Previewan earlier open reasoning model, for reference50.0%
Qwen2.5-32B-Zerolarge-scale RL from the base model, over 10,000 steps47.0%
DeepSeek-R1-Distill-Qwen-32BSFT only, 2–3 epochs on the 800,000 samples generated with R172.6%
From the DeepSeek-R1 report. Within each family of distilled students (Qwen from 1.5 to 32 billion parameters, Llama at 8 and 70 billion), AIME scores rose with size. The authors' conclusions: distilling a stronger model into a smaller one works far better than large-scale RL on the small model, though going beyond the teacher may still need stronger bases and more RL.

How little distillation data is needed? s1 (Muennighoff et al., 2025) selected 1,000 questions from a pool of 59,000 for difficulty, diversity and quality, with reasoning traces generated by a Gemini model, and fine-tuned Qwen2.5-32B-Instruct on them in 26 minutes on 16 GPUs. Budget forcing then controls the thinking at test time: to stop, the end-of-thinking marker is forced in; to continue, the marker is suppressed and "Wait" is appended whenever the model would end its thinking, which often leads it to re-check and fix its answer. Forcing longer thinking raised its AIME 2024 accuracy from 50% to 57%. Supervised distillation of traces is sequence-level knowledge distillation (Knowledge Distillation), and the forward-KL analysis of Instruction Tuning & Its Data applies to it.

Check your understanding

DeepSeek-R1-Distill-Qwen-32B far outperformed the same base model trained by large-scale RL. What best explains why distillation can win for a smaller model?

  1. RL cannot be applied to models below 70 billion parameters
  2. The distilled model saw the test problems during training
  3. RL can only reinforce strategies the small model already samples, while supervised fine-tuning on the teacher's traces makes it imitate strategies it would rarely find itself
  4. Distillation uses a larger learning rate
Show the answer

C. RL can only reinforce strategies the small model already samples, while supervised fine-tuning on the teacher's traces makes it imitate strategies it would rarely find itself

The policy gradient sees only what the policy samples, so RL sharpens what is reachable. Imitating a stronger model's long traces (a forward-KL fit) transfers patterns from outside the student's sampling distribution, as Yue et al. (2025) also report. The price is needing a stronger teacher.

Spending compute at test time

A trained model can spend more test-time compute in three ways: sample many answers in parallel and select one (majority vote, or best-of-NN by a verifier or reward model); search step by step, guided by a process reward model (beam search, lookahead); or generate and revise sequentially, as long chains of thought and revision models do. Brown et al. (2024) separate two questions: coverage, whether any sample is correct, and precision, whether the right one can be picked. Coverage is measured by pass@kk, which needs care to estimate.

DerivationAn unbiased estimate of pass@k (Chen et al., 2021)
  1. E[(1−p^)k] ≥ (1−p)k\E\big[(1-\hat p)^k\big]\ \ge\ (1-p)^k

    For a problem with single-sample success probability pp, pass@k=1−(1−p)kk=1-(1-p)^k. Draw n≥kn\ge k samples, of which cc are correct. Plugging in p^=c/n\hat p=c/n is biased: x↦xkx\mapsto x^k is convex, so by Jensen's inequality the estimated failure rate is too high on average, and pass@kk too low:

  2. pass@k^=1−(n−ck)/(nk)\widehat{\text{pass@}k}=1-\binom{n-c}{k}\Big/\binom nk

    Instead, choose kk of the nn samples uniformly at random. The probability that none of them is correct is a ratio of binomial coefficients, so

  3. Averaged over the draw of the nn samples, a random kk-subset is a set of kk independent samples, so its expectation is exactly 1−(1−p)k1-(1-p)^k: the estimator is unbiased, and averaging it over problems estimates a benchmark's pass@kk.

Predict before you look

You draw n=20n=20 samples for a problem and c=3c=3 are correct. What is the unbiased estimate of pass@5, in percent?

Show the answer

60 %

1−(175)/(205)=1−6188/15504≈0.6011-\binom{17}{5}/\binom{20}{5}=1-6188/15504\approx0.601. The plug-in estimate 1−0.855≈0.5561-0.85^5\approx0.556 is lower, as Jensen's inequality predicts; the gap matters when pass@kk curves are compared at large kk.

Coverage is not accuracy. With a checker, coverage turns directly into solved problems: on SWE-bench Lite, repeated sampling raised the issues solved by DeepSeek-Coder-V2-Instruct from 15.9% with one sample to 56% with 250, above the single-sample state of the art of 43% (Brown et al., 2024). Without one, majority voting and reward models plateaued beyond several hundred samples: the gap between generating a correct answer and recognizing it becomes the bottleneck.

Allocating compute. Snell et al. (2025) studied PaLM 2-S* on MATH, sorting questions into five difficulty levels by the model's own success rate. On easy questions, beam search against a PRM over-optimized it and got worse as the budget grew, while best-of-NN did not; on medium questions beam search won; on the hardest, nothing helped much. Easy questions did best with purely sequential revisions, harder ones with a mix of sequential and parallel. Choosing the strategy per difficulty beat best-of-NN with about 4 times less compute, and at matched FLOPs extra test-time compute beat a roughly 14 times larger model on easy and medium questions, though not on the hardest ones or when inference load is large compared with pretraining.

Revision needs a signal. Asked only to review and correct its own answer, without external feedback, a model rarely improves its reasoning and sometimes makes it worse (Huang et al., 2024). Revision works when it is trained, as in Snell et al.'s revision model, or when the feedback comes from a checker.

What does the RL add? Across model families, six RL algorithms and math, code and visual benchmarks, Yue et al. (2025) found that models trained with verifiable rewards beat their base models at small kk but were matched or overtaken at large kk, and that their reasoning paths were already probable under the base model, whereas distillation added new ones: current RL mostly sharpens sampling toward what the base model can find, as DeepSeekMath's majority-voting result also suggested. Under other conditions the opposite has been reported: prolonged RL with KL control and periodic resets of the reference policy improved pass@kk even on tasks where the starting model, a 1.5-billion-parameter distillation of DeepSeek-R1 rather than a pretrained base, failed at every kk (Liu et al., 2025, ProRL), and ReST-EM raised pass@kk at every kk it measured. The answer likely depends on the task, base model, training length and measurement; the Reinforcement Learning course examines the debate.

Key takeaways

  • STaR and ReST-EM sample, keep what a checker accepts, fine-tune and repeat: an EM approximation to RL whose step ascends the log success probability, upweighting hard problems, without pushing wrong answers down.
  • Process supervision lowers reasoning errors more than final-answer errors (Uesato et al.), and Lightman et al.'s PRM picked correct MATH solutions more often than an ORM (78.2% against 72.4%, best of 1,860). Monte Carlo step labels estimate the completer's value; progress, a step-level advantage, is the better reward.
  • GRPO is PPO with group-standardized rewards as advantages, per-output token averaging and an unbiased, nonnegative KL estimator in the objective; binary rewards give advantages (1−p^)/p^\sqrt{(1-\hat p)/\hat p} and −p^/(1−p^)-\sqrt{\hat p/(1-\hat p)}, and its normalizations bias length and difficulty.
  • DeepSeek-R1 grew long, self-checking chains of thought from rule-based rewards on a large base model; distilling its traces into smaller models (SFT only) beat large-scale RL on them, and 1,000 curated traces with budget forcing (s1) already give test-time scaling.
  • At test time, estimate pass@kk without bias, expect coverage power laws from a heavy tail of hard problems, and treat verification as the bottleneck; the best use of compute depends on difficulty, and whether RL with verifiable rewards expands or mainly sharpens a base model's reasoning is debated.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

In GRPO with binary rewards, compare a group of 8 in which one answer is correct with a group of 8 in which four are. How do the correct answers' advantages compare?

  1. They are equal, since both answers earned reward 1
  2. The lone correct answer's advantage is larger: 7≈2.65\sqrt7\approx2.65 against 11
  3. The lone correct answer's advantage is smaller, because its group's mean is lower
  4. Both are zero, because the advantages sum to zero
Show the answer

B. The lone correct answer's advantage is larger: 7≈2.65\sqrt7\approx2.65 against 11

A^correct=(1−p^)/p^\hat A_{\text{correct}}=\sqrt{(1-\hat p)/\hat p}: with p^=1/8\hat p=1/8 it is 7\sqrt7, with p^=1/2\hat p=1/2 it is 11. Standardizing within the group makes a rare success count heavily, which is part of why training sets are filtered toward problems the model sometimes, but not always, solves.

Question 2

A process reward model is trained on Monte Carlo labels: for each step, the fraction of a completer's continuations that reach the right answer. What does it learn to predict?

  1. The completer's probability of eventually succeeding from that prefix, a value function
  2. Whether each step is logically valid
  3. How a human expert would grade the step
  4. The probability that the step appears in the reference solution
Show the answer

A. The completer's probability of eventually succeeding from that prefix, a value function

The soft label is an unbiased estimate of Vμ(s≤i)V^\mu(s_{\le i}) for the completer μ\mu. A valid step can score low if the completer is weak, and a flawed one high if the completer recovers, which is why Setlur et al. propose rewarding progress, the change in value a step causes.

Question 3

A model is fine-tuned on its own correct solutions, each problem's correct samples weighted equally in total (the EM view of STaR and ReST-EM). At the current parameters, which objective's gradient does this follow?

  1. The expected reward ∑xpx(θ)\sum_xp_x(\boldsymbol\theta), exactly as REINFORCE
  2. The likelihood of human-written solutions
  3. The KL divergence to the base model
  4. The log success probability ∑xlog⁡px(θ)\sum_x\log p_x(\boldsymbol\theta), which weights hard problems by 1/px1/p_x
Show the answer

D. The log success probability ∑xlog⁡px(θ)\sum_x\log p_x(\boldsymbol\theta), which weights hard problems by 1/px1/p_x

With q∝r πθq\propto r\,\pi_{\boldsymbol\theta}, Fisher's identity gives ∇Eq[log⁡πθ]=∇px/px=∇log⁡px\nabla\E_q[\log\pi_{\boldsymbol\theta}]=\nabla p_x/p_x=\nabla\log p_x. Relative to REINFORCE's ∇px\nabla p_x, rarely solved problems get far more weight. Filtering without that normalization weights each problem by its number of correct samples, which favors easy problems; ReST-EM's cap of 10 correct samples per problem moves the weighting toward the normalized one.

Question 4

Snell et al. (2025) compared ways of spending test-time compute on MATH by question difficulty. Which matches their findings?

  1. One strategy, beam search against a PRM with the largest budget, was best for every question
  2. Easy questions did best with sequential revisions, and beam search there over-optimized the PRM; harder questions needed a mix with parallel sampling or search; on the hardest, little helped, and a larger model could be the better buy
  3. Test-time compute always beat a 14 times larger model, whatever the difficulty
  4. Sequential revision never helped
Show the answer

B. Easy questions did best with sequential revisions, and beam search there over-optimized the PRM; harder questions needed a mix with parallel sampling or search; on the hardest, little helped, and a larger model could be the better buy

The best use of test-time compute depended on difficulty, so allocating it per question beat best-of-NN with about 4 times less compute. At matched FLOPs it beat a much larger model on easy and medium questions, but pretraining a larger model was better for the hardest ones or under heavy inference load.

Further reading

  • E. Zelikman, Y. Wu, J. Mu & N. D. Goodman, "STaR: Bootstrapping reasoning with reasoning," NeurIPS (2022).
  • H. Lightman et al., "Let's verify step by step," ICLR (2024).
  • Z. Shao et al., "DeepSeekMath: Pushing the limits of mathematical reasoning in open language models," arXiv:2402.03300 (2024).
  • DeepSeek-AI, "DeepSeek-R1: Incentivizing reasoning capability in LLMs via reinforcement learning," arXiv:2501.12948 (2025).
  • C. Snell, J. Lee, K. Xu & A. Kumar, "Scaling LLM test-time compute optimally can be more effective than scaling parameters for reasoning," ICLR (2025).
  • Y. Yue et al., "Does reinforcement learning really incentivize reasoning capacity in LLMs beyond the base model?," NeurIPS (2025).