Repository navigation
[rl] Drop only the empty rollout, not its group - #5475
Draft
felipemello1 wants to merge 2 commits into
Draft
felipemello1 wants to merge 2 commits into
felipemello1 wants to merge 2 commits into
Conversation
added 2 commits
October 17, 2026 19:14
`TrainingSampleBuilder.build_from_group` dropped the whole group when any sibling had no completion tokens. A rollout that fails before its first turn (e.g. a sandbox image pull error) has no turns, so it threw away its whole group of good siblings. Now the builder drops just that rollout and keeps building the group from the rest. The filter that already dropped a rollout with an empty later turn moves up front and also catches rollouts with no turns or an empty first turn, all counted by `training_sample_builder/num_rollouts_dropped_empty_completion`. A rollout whose first turn is empty but a later one is not used to raise in `rollout_to_training_samples` and stop the run; it is now dropped too. `num_groups_dropped_untrainable` still counts groups with no rollout left. The zero-std check now runs on the trainable rollouts, and a single rollout left of several counts as zero-std: it has no sibling to compare against. Advantages are still centered on the full group in the rollouter; a TODO marks it.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR: When one rollout in a group has no completion tokens, drop only that rollout, not its whole group. On a GB300 Terminal-Bench run, 56 empty rollouts threw away 25 groups (~400 good rollouts).
Problem
TrainingSampleBuilder.build_from_groupdrops the whole group if any sibling has no completion tokens.Solution
training_sample_builder/num_rollouts_dropped_empty_completion.training_sample_builder/num_groups_dropped_untrainable, whether or not zero-std groups are dropped.Side effect: a rollout whose first turn is empty but a later turn is not used to raise
non-final turn 0 has no completioninrollout_to_training_samplesand stop the run. It is now dropped like the others.You may ask:
AdvantageEstimatorruns in the rollouter, before the builder, and would need the same empty check. Until then, 1 of 16 dropped at reward 0, with about half the rest passing, shifts each kept advantage by about +0.03. A TODO marks it.NOTE: CPU unit tests only, no end-to-end run.
Test plan
pytest tests/rl/unit_tests/cpu/test_rollout_utils.pytest_build_from_group_drops_only_the_rollout_with_an_empty_completion, 4 cases: no turns, empty first turn, empty first of two turns, empty later turntest_build_from_group_drops_a_group_with_fewer_than_two_trainable_rollouts, 0 or 1 left, with zero-std groups kept