What DAPO is
GRPO (see the GRPO tab) works, but Yu et al. found that it falters on long chains of reasoning. The policy's entropy collapses, many groups teach nothing, long answers are under-weighted, and truncated answers add noise to the reward. DAPO (decoupled clip and dynamic sampling policy optimisation) keeps GRPO's groups and rule-based rewards and makes four changes: a higher upper clip bound (clip-higher), dynamic sampling of groups, a token-level loss, and overlong reward shaping. It also drops the KL penalty to the reference model.
This page runs DAPO on the GRPO tab's setting: Qwen2.5-0.5B-Instruct, GSM8K, groups of 8 answers sampled at temperature 1 with up to 320 tokens, the same rewards and sampling seeds, a learning rate of , 4 rounds of 2 updates. Each change sits beside GRPO's choice on the same data. Each batch holds 3 groups: rows 1 and 3, the GRPO tab's problems, then further test rows in order.
Dynamic sampling
If every answer in a group gets the same correctness, their advantages are all (nearly) zero and the group adds no gradient, only cost. DAPO drops such groups and samples the next problem until the batch holds enough groups with mixed results:
The Dynamic sampling panel shows each round's groups. In round 2 the group for row 2 got all 8 answers wrong and was dropped, and row 5 took its place. In round 4 the same happened to row 7, replaced by row 9. GRPO trains on whatever it sampled. Round 1's groups for rows 1 and 3 are the GRPO tab's round-1 groups, token for token.
Overlong reward shaping
An answer cut off at the length limit has no final answer and scores 0, even when its reasoning was sound, which makes the reward noisy. DAPO adds a soft length penalty instead. With a limit and a buffer :
Answers longer than 256 tokens lose up to 1 point, linearly, reaching −1 at the 320-token limit; this is TRL's soft overlong punishment, added to the correct and boxed rewards. Overlong shaping → advantage counts the penalised answers in the selected group. Its bars show each answer's advantage with the term, and the ticks show it without, as the GRPO tab computes it.
Clip-higher
PPO and GRPO clip the probability ratio to . For a token with a positive advantage, that caps its rise at 1.2 times its old probability. A token at probability 0.01 can then only reach 0.012, while one at 0.9 can grow almost freely. So the clip protects the likely tokens and starves the unlikely ones, and the policy's entropy collapses. DAPO decouples the two bounds:
In the Clip-higher, token-level loss panel, the selected answer's tokens are shaded by , and a table counts the tokens clipped under GRPO's range and under DAPO's. With a positive advantage a token can now reach 1.28 times its old probability. On the second update of each round (the first only reuses , so every ratio is 1), 45, 34, 33 and 30 tokens of the batch sat in that extra room.
Token-level loss, no KL
GRPO averages each answer's tokens first and then averages over answers, so every answer weighs the same however long it is. A token of a 300-token answer counts a tenth as much as a token of a 30-token one, and a long, rambling wrong answer is penalised little per token. DAPO averages over all the tokens in the batch at once:
The table shows each token's weight both ways: per answer against for the round-1 batch. There is no term. Yu et al. argue that a long-reasoning model is meant to move far from its starting point, so the KL penalty only holds it back; the GRPO tab shows how much one token's KL term can also dominate an update.
Against GRPO
The Against GRPO table lists, round by round, how many groups were dropped and the mean reward of DAPO's batch beside the GRPO tab's. DAPO's mean is over its kept groups and includes the overlong term; GRPO's is over rows 1 and 3 without it. The rows are therefore side by side, not like for like, and every round's samples also mix the policy's change with sampling luck. Re-scored after the 8 updates, 7 of round 1's 8 kept answers with became more likely, and all 16 with became less likely. TRL's own loss on one micro-batch of update 2 matches the page's loop to .
Where DAPO came from
DAPO (Yu et al., 2025) was released as an open-source system, with its training code and data. With Qwen2.5-32B base it reached 50 points on AIME 2024, more than DeepSeek-R1-Zero's recipe on the same model, in half the training steps. Liu et al.'s Dr. GRPO, from the same months, also removes GRPO's per-answer length normalisation and its division by the group's standard deviation. TRL implements DAPO's token-level loss and asymmetric clipping as options of its GRPOTrainer, which the page uses with dynamic sampling and overlong shaping added as a loop.
Papers
- DAPO: An Open-Source LLM Reinforcement Learning System at Scale Introduces DAPO: clip-higher, dynamic sampling, the token-level loss and overlong reward shaping, with no KL term.
- DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models GRPO, the algorithm DAPO modifies (see the GRPO tab).
- Proximal Policy Optimization Algorithms PPO’s symmetric clipped ratio, which clip-higher makes asymmetric.
- Understanding R1-Zero-Like Training: A Critical Perspective Dr. GRPO: the length and standard-deviation biases in GRPO’s objective, a parallel fix to DAPO’s token-level loss.
- Training Verifiers to Solve Math Word Problems GSM8K, the problems both this page and the GRPO tab sample.
- Qwen2.5 Technical Report The Qwen2.5 family, including Qwen2.5-0.5B-Instruct, the policy here and the base of the paper’s Qwen2.5-32B runs.