Skip to content

Prevent untrainable-batch stalls in RL training - #4548

Merged
wwwjn merged 2 commits into
pytorch:mainfrom
wwwjn:fix/rl-debug-zero-std-rewards
Sep 9, 2026
Merged

wwwjn merged 2 commits into
pytorch:mainfrom
wwwjn:fix/rl-debug-zero-std-rewards

Conversation

@wwwjn

@wwwjn wwwjn commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

The Qwen3.5 debug integration test in https://github.com/pytorch/torchtitan/actions/runs/34312737649/job/102342893821 generated rollouts indefinitely without producing a training step. Random-init policies can give every rollout in a group the same reward. With drop_zero_std_reward_groups=True, every such group is discarded, so the generator keeps replenishing work while the trainer waits forever for a batch.

This is the same invariant addressed for earlier debug configs in #3802; the Qwen3.5 debug config added in #3957 omitted the override.

What

  • Set drop_zero_std_reward_groups=False for the Qwen3.5 debug config.
  • Add the corresponding CLI override centrally to every command produced by the RL CI integration-test launcher, including multi-run tests.
  • Record consecutive untrainable groups at the batcher boundary:
    • each complete batch-sized block of untrainable groups emits a warning;
    • any trainable group resets the count;
    • 10 consecutive untrainable batches raise RuntimeError instead of hanging indefinitely.
  • Remove the resolved silent-hang TODO and add regression tests for the CI override, warnings, reset behavior, and terminal error.

This follows Prime-RL’s generalized no-progress protection: https://github.com/PrimeIntellect-ai/prime-rl/blob/main/src/prime_rl/orchestrator/train_sink.py

Testing

  • python -m pytest torchtitan/experiments/rl/tests/test_async_controller.py torchtitan/experiments/rl/tests/test_rollout_utils.py -q (27 passed)
  • Targeted watchdog tests after the final naming change (3 passed).
  • Targeted pre-commit hooks passed (Pyrefly skipped because RL experiments/tests are excluded by repository configuration and the configured local PyTorch tree is unavailable).
  • Python compilation passed for all changed files.
  • Validated that all 8 commands currently produced by the RL CI launcher contain the override.

The focused launcher pytest could not be collected locally because this checkout environment lacks grain; CI installs the project requirements.

@pytorch-bot pytorch-bot Bot added the ciflow/rl label Sep 9, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 9, 2026
@wwwjn wwwjn changed the title Fail fast on zero-variance filtering for random-init RL [ci] Fail fast on zero-variance filtering for random-init RL Sep 9, 2026
@wwwjn wwwjn changed the title [ci] Fail fast on zero-variance filtering for random-init RL [ci][RL} Fail fast on zero-variance filtering for random-init RL Sep 9, 2026
@wwwjn wwwjn changed the title [ci][RL} Fail fast on zero-variance filtering for random-init RL [ci][RL] Fail fast on zero-variance filtering for random-init RL Sep 9, 2026
@wwwjn
wwwjn requested review from felipemello1, shuhuayu and tianyu-l and removed request for felipemello1 September 9, 2026 18:34
@wwwjn
wwwjn force-pushed the fix/rl-debug-zero-std-rewards branch from 7c73bcf to 4912fbe Compare September 9, 2026 18:45
@wwwjn wwwjn changed the title [ci][RL] Fail fast on zero-variance filtering for random-init RL Keep zero-variance reward groups in RL CI Sep 9, 2026

@shuhuayu shuhuayu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, we do not need to consider loss convergence of ci tests targeting model enablement.

@wwwjn
wwwjn force-pushed the fix/rl-debug-zero-std-rewards branch from 4912fbe to ddb8dcd Compare September 9, 2026 18:58
@wwwjn wwwjn changed the title Keep zero-variance reward groups in RL CI Prevent zero-variance reward stalls in RL CI Sep 9, 2026
@wwwjn
wwwjn force-pushed the fix/rl-debug-zero-std-rewards branch from ddb8dcd to b041576 Compare September 9, 2026 19:03
@wwwjn wwwjn changed the title Prevent zero-variance reward stalls in RL CI Prevent silent zero-output stalls in RL training Sep 9, 2026
@wwwjn wwwjn changed the title Prevent silent zero-output stalls in RL training [wip] Prevent silent zero-output stalls in RL training Sep 9, 2026
@wwwjn
wwwjn force-pushed the fix/rl-debug-zero-std-rewards branch 2 times, most recently from 46fe07a to d1b6142 Compare September 9, 2026 19:19
@wwwjn
wwwjn force-pushed the fix/rl-debug-zero-std-rewards branch from d1b6142 to cf4965f Compare September 9, 2026 19:23
@wwwjn wwwjn changed the title [wip] Prevent silent zero-output stalls in RL training Prevent untrainable-batch stalls in RL training Sep 9, 2026


_KEEP_ZERO_STD_REWARD_GROUPS = (
"--async-loop.training-sample-builder.no-drop-zero-std-reward-groups"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the "no" in front of it a way to set it to false?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in tyro CLI, if you wanto set a boolean flag to be false, add a "no-" to the name

@felipemello1

Copy link
Copy Markdown
Contributor

thank you!

@wwwjn
wwwjn force-pushed the fix/rl-debug-zero-std-rewards branch from f45c7e8 to d640be6 Compare September 9, 2026 20:04
@wwwjn
wwwjn force-pushed the fix/rl-debug-zero-std-rewards branch from d640be6 to 58b0625 Compare September 9, 2026 20:08
@wwwjn
wwwjn merged commit f95969a into pytorch:main Sep 9, 2026
6 checks passed
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.

4 participants