PR #5130 · follows
#5080 (the same flag for SingleController GRPO)
· permalinks pinned to ef9cc6c2
loss_fn.seq_logprob_error_in_loss: true for PPO at startup, so PPO always ran a separate policy-logprob forward just to find the bad rows.ppo.ppo_epochs: 1. No runtime code changes: setup, loss and workers already handled PPO. The legacy PPO trainer still refuses the flag.ppo.seq_logprob_error_threshold). Rejected rows get no policy gradient. PPO also trains a critic: a second model that predicts the future reward at each token. GAE uses those predictions to compute advantages. Dotted words have a short explanation: hover or tap them.With the flag off, SingleController runs an extra policy forward, finds rejected rows, and zeroes them in sample_mask before computing advantages
(advantage_stage.py).
Every later stage reads that mask: advantage normalization, the policy loss, and the critic's loss
(MseValueLossFn).
With the flag on, logprob_passes_required turns the extra forward off, and only the policy loss drops the row, from the training forward it already runs
(loss_functions.py).
So the policy gradient is the same, but the stages before and after the policy loss now see the rejected row.
One batch of 4 rows with 6, 5, 7 and 8 answer tokens (26 total). Row 1's sequence error is 2.9, over the 2.0 threshold.
The policy gradient is the same in both lanes: S / 21, the sum over kept tokens divided by the number of kept tokens. Two PPO stages differ, because they run outside the policy loss and read only sample_mask:
| Stage | Flag off | Flag on | Can it match? |
|---|---|---|---|
| Advantage normalization | rows {0, 2, 3} | rows {0, 1, 2, 3} | No: it runs before the loss sees row 1 |
| Critic training | rows {0, 2, 3} | rows {0, 1, 2, 3} | Yes: it runs after the policy step. Asked in C3. |
| Critic training, warmup steps | rows {0, 2, 3} | rows {0, 1, 2, 3} | Yes: run the separate pass on those steps. Asked in C3. |
The PR documents both in grpo.md.
Normalization can't match without the extra pass, so a doc note is enough there. GRPO has the same kind of gap: a rejected row still counts in its group's average reward.
The critic can match: it trains after the policy step
(_value_train_epochs),
when row 1's rejection is already known. A flag that only skips a pass shouldn't change what the critic learns from, so C3 asks the PR to hand the rejection to the critic.
Critic warmup (ppo.policy_training_start_step > 0) needs one more piece: those steps
skip policy training,
so with the flag on nothing ever rejects row 1. With the flag off, the separate pass still runs then. C3 asks to run it on warmup steps too. That costs one forward pass on warmup steps only; policy-training steps keep the speedup.
Review comment: C3 · critic trains on rejected rows — grpo.md:695
This mode needs force_on_policy_ratio: true: the ratio between the new and old policy is set to 1, so no old logprobs are needed. That is exact only for the first optimizer step on a batch, before the weights move. SingleController already maps one PPO epoch to one optimizer step
(config.py#L1829), so ppo.ppo_epochs: 1 is the whole condition.
Two checks reject more than one epoch, one for each reason: the existing force_on_policy_ratio rule
(config.py#L1567)
and the PR's new in-loss check
(grpo.py#L654).
Review comment: C2 · GRPO-only texts PPO now hits — grpo.py:637