DAPO: An Open-Source LLM Reinforcement Learning System at Scale
arXiv ↗PDF ↗Paper ↗Website ↗Code ↗
Read first: DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models
TL;DR. DAPO is a recipe and an open system for long chain-of-thought RL, built from a plain GRPO baseline that scored 30 on AIME 2024 with Qwen2.5-32B. Four changes bring it to 50: an asymmetric clip range (clip-higher), dynamic sampling that drops groups with no learning signal, a token-level loss average, and overlong reward shaping for truncated answers. The paper reports beating DeepSeek’s RL result on the same base model (47) with half the training steps.
Why it matters now. DAPO is the most common “GRPO plus fixes” baseline in open RLVR work, and each fix is a reusable idea for any RL-trained agent. If you train a search agent whose trajectories vary from a few hundred to tens of thousands of tokens, you will face the same four questions: how far rare actions may move, what to do with prompts that are always or never solved, how to average over unequal lengths, and how to treat running out of budget.
Key idea
Section titled “Key idea”DAPO starts from the GRPO setup. It keeps the group advantage , uses a rule-based reward of if the final answer matches and otherwise, and removes the KL term. The paper argues that long-CoT training is meant to move far from the initial model. The objective (eq. 8) is:
Each part of this equation is one of the four changes.
1. Clip-higher (, ). For positive advantage, this sample’s surrogate stops rewarding further increases once its ratio exceeds , that is, once the token’s probability passes . This is not a hard cap on the new probability: a gradient step can overshoot, and other samples sharing parameters can still move a clipped token (see the PPO page). The examples below are incentive cutoffs, not guaranteed maximum probabilities. The cutoff is very uneven across tokens. For a token at it sits at , which never binds. For a rare token at the incentive stops at . The paper finds that the tokens hitting the upper clip have low probability (below 0.2 on average). So the clip mostly stops rare “exploration” tokens from growing, and the policy’s entropy collapses early. Raising only the upper bound gives rare tokens more room. The lower bound stays at 0.2, because a larger one would let negative updates drive rare tokens to zero. The clip only acts because DAPO takes 16 gradient steps per rollout. With one step, the ratio is 1 (see the GRPO page).
2. Dynamic sampling. The constraint on the right of the equation keeps only groups that are neither all right nor all wrong. In the running example, a group with rewards or has zero std and zero advantage, so it contributes nothing. As training goes on, more prompts are always solved, so the useful part of each batch shrinks and the gradient gets noisier. DAPO keeps sampling until the batch holds useful prompts. The cost is extra generation per step; the paper reports reaching the same accuracy in fewer steps.
3. Token-level loss. GRPO averages token losses within each answer and then over answers, so every answer counts equally. DAPO divides the sum of all token losses by the total number of tokens in the group, so every token counts equally. The paper’s reason is practical: very long answers often contain gibberish and repetition. Under per-answer averaging those tokens are diluted and barely penalized, and entropy and length grow unhealthily (Fig. 4). This is the same per-response length weighting that Dr. GRPO calls a bias. The two papers fix it differently: DAPO divides by the group’s token count, while Dr. GRPO divides by a constant and also drops the std.
4. Overlong reward shaping. Answers longer than the generation limit are cut off. Giving a cut-off answer the “wrong” reward punishes sound reasoning just for being long, which adds reward noise. DAPO first tried overlong filtering, which masks truncated answers out of the loss. It then added a soft overlong punishment on top of the correctness reward:
with and . A correct answer of 18,432 tokens gets . One that hits the limit gets .
Key results
Section titled “Key results”- Setup (§4.1). Base model Qwen2.5-32B, trained with the verl framework on DAPO-Math-17K, a set of 17K math prompts whose answers were rewritten as integers so a rule can check them. Each rollout has 512 prompts × 16 samples, with minibatches of 512 samples, giving 16 gradient updates per rollout. Learning rate 1e-6 with 20 warm-up steps. Maximum generation is 20,480 tokens (16,384 expected plus a 4,096-token penalty band). Evaluation reports AIME 2024 avg@32 at temperature 1.0 and top-p 0.7.
- Main result (Fig. 1, Table 1). 50 on AIME 2024, compared with 47 for DeepSeek-R1-Zero-Qwen-32B, using 50% of its training steps.
- Cumulative ablation (Table 1). Naive GRPO 30 → overlong filtering 36 → clip-higher 38 → soft overlong punishment 41 → token-level loss 42 → dynamic sampling 50. These are single runs added in one fixed order, so each step’s gain is conditional on the earlier ones.
- Training-dynamics advice (§4.3). Length does not rise steadily; it can stall or fall for long periods. Training reward often correlates poorly with validation accuracy, a sign of overfitting. Entropy should stay in a range: too low means collapse, too high goes with gibberish.
Limitations & open questions
Section titled “Limitations & open questions”- Evidence is one base model, one domain (integer-answer math) and one benchmark of 30 problems. There are no seed repeats in Table 1.
- Dynamic sampling trains only on questions that are partly solvable now. It cannot teach anything on questions the policy never solves, which links to the RL-boundary debate.
- Clip-higher raises entropy, but higher entropy is not the same as useful exploration. The Entropy Mechanism paper finds it can become unstable later in training.
- Removing the KL relies on the reward being hard to hack. With learned or LLM-judge rewards, dropping the anchor is riskier (see Reward hacking with noisy verifiers).
Connections
Section titled “Connections”- Base objective: DeepSeekMath / GRPO and PPO.
- The same length-weighting problem, fixed differently: Dr. GRPO.
- Adds a critic back on top of DAPO’s tricks: VAPO. Changes the ratio to sequence level: GSPO.
- Why entropy collapses and better interventions: The Entropy Mechanism.
- The R1-Zero baseline it compares against: DeepSeek-R1.
- Reading avg@32 and pass@k fairly: Evaluating reasoning RL.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
With a positive advantage, DAPO's clipped surrogate stops rewarding further increases in a token's probability once it passes π_old·(1 + ε_high); with a negative one it stops rewarding decreases below π_old·(1 − ε_low). These are incentive cutoffs, not hard caps on the new probability. For π_old = 0.01, 0.1 and 0.9, compute the upper cutoff at ε = 0.2 and at ε_high = 0.28, and the lower cutoff at ε_low = 0.2. Why does raising ε_high mostly matter for rare tokens, and why keep ε_low small?
What a strong answer covers
- Upper cutoffs at 0.2: 0.012, 0.12, 1.08. At 0.28: 0.0128, 0.128, 1.152. Lower cutoffs: 0.008, 0.08, 0.72.
- For π_old = 0.9 the cutoff exceeds 1, so the clip never binds: a likely token can already go to 0.999. For 0.01 the surrogate rewards an absolute increase of only 0.002 (or 0.0028) per rollout. A gradient step can still overshoot, and updates from other samples sharing parameters can move a clipped token, so this is not a guaranteed maximum.
- The paper finds that up-clipped tokens have low mean probability (below 0.2, Fig. 3a), which supports the idea that the upper clip mainly limits rare "exploration" tokens.
- A larger ε_low would let negative-advantage updates push rare tokens toward 0 faster, collapsing the sampling space, so it stays at 0.2.
- Clipping only binds after the first of the 16 minibatch updates per rollout. With a single update per batch, the ratio is 1 and neither bound matters.
- Derive / compute
DAPO adds a soft overlong penalty to the ±1 correctness reward, with L_max = 20,480 and L_cache = 4,096. Compute the total reward of a correct answer of 15,000, 18,432 and 20,480 tokens, and of a wrong answer of 19,456 tokens. In a group of four with these lengths and correctness, which answer has the largest advantage?
What a strong answer covers
- Penalty = 0 up to 16,384 tokens; (16,384 − |y|)/4,096 between 16,384 and 20,480; −1 beyond.
- Correct 15,000: 1 + 0 = 1. Correct 18,432: 1 − 0.5 = 0.5. Correct 20,480: 1 − 1 = 0.
- Wrong 19,456: −1 − 0.75 = −1.75.
- Rewards [1, 0.5, 0, −1.75]: mean −0.0625, so the short correct answer gets the largest advantage and a correct answer at the cap scores only about the group mean.
- The penalty grows smoothly, so the model is told "too long" without being told "wrong", unlike a hard −1 for truncation that punishes sound but long reasoning.
- Mechanism
Explain why groups where every answer is correct (or every answer is wrong) hurt GRPO training even though their loss is just zero, how dynamic sampling fixes this, and what new bias the filtering introduces into the training distribution.
What a strong answer covers
- An all-equal group has std 0 and advantage 0, so it adds no gradient. The batch gradient then averages fewer useful prompts, so it is smaller and noisier.
- As training proceeds, more prompts reach accuracy 1 (Fig. 3b), so the effective batch shrinks over time.
- Dynamic sampling oversamples and keeps only groups with accuracy strictly between 0 and 1 until the batch holds N such prompts, keeping the effective batch constant.
- Cost: more generation per step; the paper argues that wall-clock time is dominated by long-tail samples anyway, and reaches the same accuracy in fewer steps (Fig. 6).
- Bias: training now only sees questions of medium difficulty for the current policy. Hopeless questions never teach anything, so this is an implicit curriculum that cannot open new problems.
- What if…
Table 1 adds the techniques one at a time: 30 → 36 → 38 → 41 → 42 → 50 on AIME24 avg@32. What can and cannot be concluded about each technique's individual value from this ladder? Propose a cleaner ablation design and say what it would cost.
What a strong answer covers
- Cumulative ladders measure the gain of each step given everything before it; the order is a choice, and interactions (for example clip-higher with token-level loss) are not separated.
- Each number is one run on 30 AIME problems; avg@32 reduces sampling noise but not seed-to-seed training variance.
- Dynamic sampling gives the biggest step (+8), but it also changes how many samples each step sees, so part of the gain could be compute rather than method.
- Cleaner: leave-one-out from the full recipe, several seeds each, at matched generated tokens, with a second benchmark. VAPO later reports such a leave-one-out table for its own recipe.
- Connect
DAPO motivates clip-higher by entropy collapse, and the Entropy Mechanism paper studies the same symptom. Using the covariance view of entropy change, explain why raising ε_high raises entropy, and why entropy rising is not by itself evidence of better exploration.
What a strong answer covers
- Entropy falls when high-probability tokens get positive advantages (positive covariance between log-probability and advantage). Clip-higher lets low-probability tokens with positive advantage grow, a negative-covariance contribution that raises entropy.
- The Entropy Mechanism paper reports that clip-higher helps early but can become unstable, and that its added tokens have slightly negative average covariance.
- DAPO itself warns that too-high entropy goes with gibberish and repetition; entropy should stay in a range, not be maximized.
- Useful exploration means trying different strategies that sometimes succeed. Measure strategy diversity and pass@k, not token entropy alone.
- Design
You adapt DAPO to RL-train a deep-research agent that issues search calls and must answer within a 40-call budget. Map each of the four DAPO techniques onto this setting, and say which one you expect to matter most and how you would test that.
What a strong answer covers
- Overlong shaping becomes a soft penalty on tool calls or total tokens past a threshold, so running out of budget is not treated the same as a wrong answer.
- Token-level loss over model-generated tokens only (retrieved text masked), so long failed trajectories are fully penalized.
- Dynamic sampling filters questions the agent always or never answers; with expensive search calls, cache retrieval results to make oversampling affordable.
- Clip-higher matters if the policy collapses onto one search pattern; check query diversity per group.
- Test with leave-one-out runs at matched search calls, reporting accuracy, calls per question and the zero-variance group rate.