Search

Search papers and lessons

DAPO: An Open-Source LLM Reinforcement Learning System at Scale

Qiying Yu, Zheng Zhang, Ruofei Zhu et al. · 2025

DAPO is an open-source reinforcement learning recipe for long reasoning in LLMs: four changes to GRPO that lift AIME 2024 from 30 to 50 on Qwen2.5-32B, with code and data released.

On this page

  • Colour = topic mix
  • Reinforcement learning
  • Probability
  • Calculus
  • Linear algebra
  • Post-training
  • Discrete math
  • Sign in to see your progress

TL;DR

DAPO is an open reinforcement learning recipe for training language models to reason over long chains of thought. It makes four changes to GRPO: a split clip range that lets unlikely tokens rise, dynamic sampling that drops prompts with no learning signal, a token-level loss, and a soft penalty for overlong answers. On Qwen2.5-32B it reaches 50 points on AIME 2024, against 30 for naive GRPO on the same model and 47 for DeepSeek's R1-Zero recipe. The authors also release the training code and dataset.

Where you'll see it: reproducing or extending reasoning RL on math and code tasks whose answers a program can check, and as released training code built on the verl framework.

The problem

The strongest reasoning models of 2025 got their results from large-scale reinforcement learning, but the details were withheld. The paper's abstract says the community "still struggles to reproduce their RL training results." The authors tried to reproduce the DeepSeek result themselves. Their first GRPO run on Qwen2.5-32B reached only 30 points on AIME 2024, well below the 47 points DeepSeek reported for the same base model.

They traced the gap to three symptoms in the naive run: entropy collapse, where the model's output distribution becomes too sharp and its samples stop differing; reward noise, where good long answers get penalised for reasons unrelated to their reasoning; and training instability. The question is not only whether RL can produce long reasoning, but which details make it stable enough to scale.

Long chain-of-thought is what makes this harder than ordinary fine-tuning. A single response can run to thousands of tokens, and the reward arrives only at the end. The paper reports that gibberish and repetition in overlong samples push entropy and length up unhealthily.

Key idea

The paper's answer is a set of four targeted fixes, each aimed at one symptom, plus two choices that remove parts of the usual setup. The fixes are:

  1. Clip-Higher. Widen the upper clip so that low-probability tokens can grow, which keeps the policy from collapsing onto a few answers.
  2. Dynamic sampling. Throw away prompts whose sampled answers are all right or all wrong, since they carry no gradient, and keep sampling until the batch is full.
  3. Token-level loss. Average the loss over all tokens in the group, not over answers first, so long answers are not under-weighted.
  4. Overlong reward shaping. Stop penalising truncated answers as if they were wrong, and instead apply a soft penalty that grows with length.

The two removals are the KL penalty, which is dropped, and the learned reward model, which is replaced by a rule that checks the final answer. The training loop then looks like this:

flowchart LR
  A[Sample a batch of prompts] --> B[Sample G answers per prompt]
  B --> C{Answers mixed: some right, some wrong?}
  C -- no --> D[Discard prompt and sample more]
  D --> A
  C -- yes --> E[Fill the batch with kept prompts]
  E --> F[Token-level clipped policy update]
  F --> A

The method

Background: PPO and GRPO

PPO updates a policy with a clipped ratio between the new and old probability of each token, weighted by an advantage estimate. It needs a learned value function to produce that advantage. GRPO removes the value function. For each question it samples a group of GG answers, gives each answer a reward RiR_i, and normalises within the group:

A^i=Ri−mean⁡(R1,…,RG)std⁡(R1,…,RG).\hat{A}_{i} = \frac{R_i - \operatorname{mean}(R_1, \dots, R_G)}{\operatorname{std}(R_1, \dots, R_G)}.

Every token of answer ii then shares that advantage. GRPO also adds a KL penalty to a frozen reference model, and it averages the loss within each answer before averaging across answers. The paper argues that each of these last two choices causes trouble in long-chain training.

Dropping the KL penalty

The KL term keeps the model close to its starting point. In RLHF that is the goal, because the model should not drift far from a helpful base. The paper argues that a long reasoning model is supposed to change a lot during training, so the constraint works against the goal. DAPO removes the term.

A rule-based reward instead of a reward model

A Reward Model can be gamed, a failure the paper describes as reward hacking. DAPO instead gives the final answer a score from a rule:

R(y^,y)={1,is_equivalent(y^,y)−1,otherwiseR(\hat{y}, y) = \begin{cases} 1, & \texttt{is\_equivalent}(\hat{y}, y) \\ -1, & \text{otherwise} \end{cases}

Here yy is the reference answer and y^\hat{y} the model's final answer. This works only for tasks where the answer can be compared automatically, such as math with a checkable result.

Clip-Higher

The PPO clip bounds the ratio ri,t(θ)=πθ(oi,t∣q,oi,<t)/πθold(oi,t∣q,oi,<t)r_{i,t}(\theta) = \pi_\theta(o_{i,t}\mid q, o_{i,\lt t}) / \pi_{\theta_{old}}(o_{i,t}\mid q, o_{i,\lt t}) to [1−ε,1+ε][1 - \varepsilon, 1 + \varepsilon]. For a token with positive advantage, the clip stops any increase beyond 1+ε1 + \varepsilon. The paper's example uses ε=0.2\varepsilon = 0.2. A token that starts at probability 0.90.9 can rise to 0.9×1.2=1.080.9 \times 1.2 = 1.08, which is above 1 and so not limited in practice. A token that starts at 0.010.01 can rise only to 0.0120.012.

The authors found that this cap blocks rare "exploration" tokens from gaining probability, while common "exploitation" tokens are free to dominate. Empirically, the mean probability of tokens that hit the upper clip was below 0.2. DAPO splits the clip into εlow=0.2\varepsilon_{low} = 0.2 and εhigh=0.28\varepsilon_{high} = 0.28. The lower bound stays tight, because loosening it would push rare tokens toward zero and shrink the set of answers the model can sample.

Dynamic sampling

For GRPO, when every answer to a prompt is correct, all rewards are equal, the advantage is zero, and the prompt gives no gradient. The same holds when every answer is wrong. As training proceeds the paper sees more prompts reach accuracy 1, so each batch holds fewer useful prompts and the gradient gets noisier. DAPO over-samples and keeps only prompts with mixed outcomes. Sampling continues until the batch is full. The paper notes that this costs more generation, but that generation time is dominated by long-tail samples anyway, so the overall training time is not much affected.

Token-level policy gradient loss

GRPO's loss gives every answer the same total weight, so a 100-token answer and a 1,000-token answer each count once, and each token of the long answer counts ten times less. The paper observes that long answers often contain gibberish or repetition, and that this per-answer weighting fails to penalise those tokens enough. Entropy and length then grow in an unhealthy way. DAPO normalises by the total number of tokens in the group, so every token has equal weight:

JDAPO(θ)=E(q,a), {oi}i=1G∼πθold[1∑i=1G∣oi∣∑i=1G∑t=1∣oi∣min⁡(ri,t(θ) A^i, clip⁡(ri,t(θ),1−εlow,1+εhigh) A^i)],\mathcal{J}_{\text{DAPO}}(\theta) = \mathbb{E}_{(q,a),\ \{o_i\}_{i=1}^{G} \sim \pi_{\theta_{old}}}\left[ \frac{1}{\sum_{i=1}^{G} |o_i|} \sum_{i=1}^{G} \sum_{t=1}^{|o_i|} \min\Big( r_{i,t}(\theta)\, \hat{A}_{i}, \ \operatorname{clip}\big(r_{i,t}(\theta), 1 - \varepsilon_{low}, 1 + \varepsilon_{high}\big)\, \hat{A}_{i} \Big) \right],

subject to 0<∣{oi:is_equivalent(a,oi)}∣<G0 \lt \left|\{o_i : \texttt{is\_equivalent}(a, o_i)\}\right| \lt G. The constraint is the dynamic sampling rule. The ∑i∣oi∣\sum_i |o_i| in the denominator is the token-level normalisation. Here ∣oi∣|o_i| is the length of answer ii in tokens.

Overlong filtering and soft overlong punishment

Generation is capped at a maximum length, and truncated answers are cut off. A default reward of −1-1 for truncation can punish a sound argument that happens to be long. The paper tests two fixes. Overlong filtering masks the loss on truncated answers, which the paper finds stabilises training. Soft overlong punishment keeps a length-aware penalty. With expected maximum LmaxL_{max} and a cache LcacheL_{cache}, the penalty is zero below Lmax−LcacheL_{max} - L_{cache}, falls linearly to −1-1 at LmaxL_{max}, and stays at −1-1 beyond it. It is added to the correctness reward:

Rlength(y)={0,∣y∣≤Lmax−Lcache(Lmax−Lcache)−∣y∣Lcache,Lmax−Lcache<∣y∣≤Lmax−1,Lmax<∣y∣R_{\text{length}}(y) = \begin{cases} 0, & |y| \le L_{max} - L_{cache} \\ \dfrac{(L_{max} - L_{cache}) - |y|}{L_{cache}}, & L_{max} - L_{cache} \lt |y| \le L_{max} \\ -1, & L_{max} \lt |y| \end{cases}

The dataset: DAPO-Math-17K

Answers in competition math come in many forms, such as expressions, formulas and numbers, and writing a rule-based checker for all of them is error-prone. Following AIME's format, the authors select problems and instruct an LLM to rewrite them so that every answer is an integer. A problem whose answer is a+bc\frac{a + \sqrt{b}}{c} is reworded so that the answer becomes a+b+ca + b + c. The result is DAPO-Math-17K, 17,000 prompts with integer answers. The authors collected the problems from the web and competition sites, combining scraping with manual annotation.

Results

The experiments use Qwen2.5-32B as the base model, the verl framework, and math tasks only. The paper says the method "can be readily transferred to other tasks", but it does not test that. The optimiser is AdamW with a constant learning rate of 1×10−61 \times 10^{-6} and a linear warm-up over 20 rollout steps. Each rollout uses 512 prompts with 16 responses each. The paper gives a mini-batch size of 512 and says there are 16 gradient updates per rollout step. The maximum generation length is 20,480 tokens: the 16,384-token expected maximum plus a 4,096-token cache. Evaluation averages 32 samples per problem (avg@32) at temperature 1.0 and top-p 0.7.

The headline comparison is in Table 1, which adds one technique at a time on AIME 2024:

ConfigurationAIME24, avg@32
DeepSeek-R1-Zero-Qwen-32B (quoted by the paper)47
Naive GRPO30
+ Overlong filtering36
+ Clip-Higher38
+ Soft overlong punishment41
+ Token-level loss42
+ Dynamic sampling (full DAPO)50

The steps are cumulative. The paper reports that the full system outperforms the DeepSeek number while using 50% of the training steps (its Figure 1). The token-level loss adds only a point, which the authors say brings "less performance improvement" but makes length growth healthier. The largest single step, dynamic sampling, adds 8 points and also reduces the number of steps to convergence, which the paper attributes to fewer wasted updates.

Several caveats matter when reading the table. The results come from one base model, one benchmark and one training run. The table reports single numbers, with no confidence intervals and no seed variation, so differences of one or two points are hard to read as reliable. The DeepSeek figure of 47 is quoted from the paper's comparison, not re-run by the authors.

The paper also reports training dynamics. Entropy collapses under naive GRPO and stays healthy with Clip-Higher. Response length and reward curves are monitored as diagnostics. The paper notes that final training reward correlates poorly with validation accuracy, which it reads as overfitting to the training set. A case study (its Table 2) shows the model beginning to check and backtrack on its own reasoning as training continues. The paper presents this as a single qualitative example and leaves its interpretation to future work.

Why it mattered

The paper's main contribution is openness. It releases the algorithm, the training code built on verl, and the DAPO-Math-17K dataset. A reader can rerun the recipe and inspect every setting, which the abstract frames as the answer to the reproducibility gap.

The techniques are small and can be understood one at a time. Each is a change to GRPO's clip, sampling, normalisation or reward, and the ablation table shows what each one buys. That makes the paper a useful guide for diagnosing RL runs, not only a recipe. The authors also recommend monitoring response length, reward, entropy and the mean probability of generated tokens together during training.

This lesson does not verify how the paper was cited or used after publication. The claims above rest on the paper's own text and tables.

Reading guide

Read the paper in this order. Each line names the prerequisites that matter for that part.

  1. Section 1 (introduction). Needs Reinforcement Learning, Language Model and Chain-of-Thought Prompting for the idea of long reasoning traces.
  2. Section 2.1 (PPO). Needs Policy Gradient, Advantage Function and Importance Sampling for the ratio ri,tr_{i,t} and the clip. Proximal Policy Optimization (PPO) is the direct source.
  3. Section 2.2 (GRPO). Needs Group Relative Policy Optimization (GRPO). The group normalisation of the advantage is the central equation.
  4. Section 2.3 (removing KL). Needs Kullback–Leibler Divergence. The paper's argument is about what this term constrains.
  5. Section 2.4 (rule-based reward). Needs Reward Model for the contrast, and Reinforcement Learning from Human Feedback (RLHF) for the RLHF setting the paper refers to.
  6. Section 3.1 (Clip-Higher). Needs Entropy to read Figure 2 and Importance Sampling for the ratio. The worked numbers in this section are the paper's own.
  7. Sections 3.2 to 3.4 (dynamic sampling, token-level loss, overlong reward shaping). Needs DAPO (Decoupled Clip and Dynamic Sampling Policy Optimization) for the full objective, since these sections each add one term to it. Algorithm 1 is the summary.
  8. Section 3.5 (dataset). No further prerequisites.
  9. Section 4 (experiments). Needs DeepSeek-R1: Incentivizing Reasoning in LLMs through Reinforcement Learning for the baseline the paper compares against and DeepSeekMath: Pushing the Limits of Mathematical Reasoning (GRPO) for the GRPO baseline it cites. Table 1 is the ablation.
  10. Section 4.4 (case study). No further prerequisites. Read it as an observation, not a result.

Check yourself

QuestionWhich of the four DAPO techniques is aimed at prompts whose sampled answers are all correct?Show answer

Dynamic sampling. When every answer to a prompt has the same reward, the group advantage is zero and the prompt gives no gradient. DAPO discards such prompts and keeps sampling until the batch is full of prompts with mixed outcomes, so each update uses more useful signal.

QuestionA token with positive advantage has old probability 0.050.05. Using the paper's values εlow=0.2\varepsilon_{low} = 0.2 and εhigh=0.28\varepsilon_{high} = 0.28, what is the upper cap on its new probability under DAPO, and how much room does that give over standard clipping at ε=0.2\varepsilon = 0.2?Show answer

Under DAPO the cap is 0.05×1.28=0.0640.05 \times 1.28 = 0.064. Under standard clipping at 0.20.2 it is 0.05×1.2=0.0600.05 \times 1.2 = 0.060. The extra room is 0.0040.004. That is small for one update. The paper's argument is that the standard cap is too tight for rare tokens, so the wider upper bound leaves them more room to grow.

QuestionWith Lmax=16384L_{max} = 16384 and Lcache=4096L_{cache} = 4096, what is the soft overlong penalty for an answer of 14,336 tokens, and for one of 17,000 tokens?Show answer

For 14,336 tokens the value is (16384−4096)−143364096=12288−143364096=−0.5\frac{(16384 - 4096) - 14336}{4096} = \frac{12288 - 14336}{4096} = -0.5. For 17,000 tokens the length exceeds LmaxL_{max}, so the penalty is −1-1. Answers up to 12,288 tokens are not penalised at all.

QuestionWhy does token-level normalisation matter for long answers, when sample-level averaging gives every answer the same total weight?Show answer

Under sample-level averaging, each token of a long answer counts for less than each token of a short one, so the model gets a weaker signal from long reasoning. The paper also finds that long degenerate answers, with repetition or gibberish, go under-penalised this way, which pushes entropy and length up. Token-level normalisation gives every token the same weight, so a harmful pattern is penalised equally wherever it appears.

QuestionYou are training on a set of coding problems where 90% of prompts are solved every time. What does dynamic sampling do to your sampling cost, and what would you monitor to check it is working?Show answer

Most sampled prompts are discarded, so the cost per full batch rises, potentially sharply if only a few prompts are mixed. The paper argues that long-tail generation already dominates wall-clock time, which limits the overhead. To check it, track the fraction of prompts with mixed outcomes, the number of samples drawn per batch, and whether the effective batch size stays at its target. The paper also tracks response length, reward and entropy as general health signals.

Sources

Read the full paper

Qiying Yu, Zheng Zhang, Ruofei Zhu et al., 2025. arXiv:2503.14476