Skip to content

[rl] Drop only the empty rollout, not its group - #5475

Draft
felipemello1 wants to merge 2 commits into
mainfrom
felipemello1/rollout-filters/1-drop-empty-rollout
Draft

felipemello1 wants to merge 2 commits into
mainfrom
felipemello1/rollout-filters/1-drop-empty-rollout

Conversation

@felipemello1

Copy link
Copy Markdown
Contributor

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

  1. TrainingSampleBuilder.build_from_group drops the whole group if any sibling has no completion tokens.
  2. A rollout that fails before its first turn has no turns, so it has no completion tokens.
  3. On a GB300 Terminal-Bench run, a 7-minute sandbox image-pull burst made 56 rollouts fail before their first turn.
  4. Each one threw away its group of 16: 25 groups, ~400 good rollouts, were lost.

Solution

  1. Drop only the rollouts with no turns or an empty completion, and build the group from the rest.
  2. The builder already dropped a rollout with an empty later turn, inside its loop. That filter moves up front and also catches rollouts with no turns or an empty first turn. Same metric: training_sample_builder/num_rollouts_dropped_empty_completion.
  3. A group with fewer than 2 rollouts left (out of 2 or more) is dropped and counted in training_sample_builder/num_groups_dropped_untrainable, whether or not zero-std groups are dropped.
  4. The zero-std check runs on the trainable rollouts.
  5. Unchanged: groups of 1 by config, and errored rollouts that have turns (they still train at their error reward).
group of 16, 1 rollout failed before its first turn
before: 0 samples,  num_groups_dropped_untrainable += 1
after:  15 samples, num_rollouts_dropped_empty_completion += 1

Side effect: a rollout whose first turn is empty but a later turn is not used to raise non-final turn 0 has no completion in rollout_to_training_samples and stop the run. It is now dropped like the others.

You may ask:

  • Why drop a lone trainable rollout? Its advantage was centered on the dropped siblings' rewards: with 15 of 16 failing at reward 0, a passing survivor would train at advantage 1 - 1/16 = 0.94 for beating siblings that never ran.
  • Why not center the advantages on the trainable rollouts only? AdvantageEstimator runs 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.py

  • test_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 turn
  • test_build_from_group_drops_a_group_with_fewer_than_two_trainable_rollouts, 0 or 1 left, with zero-std groups kept

Felipe Mello 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.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/rl CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant