fix(async): honor max_num_epochs in async GRPO - #3948
Open
bzantium wants to merge 1 commit into
Open
Conversation
async_grpo_train bounds itself with `while step < max_num_steps` and has no epoch loop, since it consumes the trajectory collector's buffer rather than iterating the dataloader. max_num_epochs therefore had no effect: a run configured for one epoch kept going until the collector reported an exhausted dataloader and raised. setup() already derives the epoch-equivalent step count for the Megatron scheduler budget. Clamp max_num_steps with it, which bounds the loop and keeps the scheduler horizon in agreement with the loop it schedules for. Multiple dataloaders are exempt: MultipleDataloaderWrapper is an infinite iterator, so an epoch has no length to derive a bound from. The exhaustion message also pointed at data.train.max_num_epochs, which nothing reads; the setting is grpo.max_num_epochs. Signed-off-by: ryan.u(류민호)/kakao <ryan.u@kakaocorp.com>
bzantium
force-pushed
the
fix/async-max-num-epochs
branch
from
September 1, 2026 11:50
0d5cc58 to
89af111
Compare
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.
What does this PR do ?
async_grpo_trainbounds itself withwhile step < max_num_stepsand has no epoch loop, since it consumes the trajectory collector's buffer rather than iterating the dataloader.grpo.max_num_epochstherefore had no effect on an async run: a config asking for one epoch kept going until the collector reported an exhausted dataloader and raised.setup()already derives the epoch-equivalent step count for the Megatron scheduler budget. This clampsmax_num_stepswith it, which bounds the loop and keeps the scheduler horizon in agreement with the loop it schedules for. Multiple dataloaders are exempt, sinceMultipleDataloaderWrapperis an infinite iterator and an epoch has no length to derive a bound from.The exhaustion message also pointed at
data.train.max_num_epochs, which nothing reads; the setting isgrpo.max_num_epochs.Issues
None closed.
Usage
Before your PR is "Ready for review"
Pre checks:
Additional Information
tests/unit/algorithms/test_grpo_max_num_steps.pycovers the clamp, a multi-epoch budget, an already-smaller step budget, the multiple-dataloader exemption and a non-positive epoch count.pytestin a full environment, so that box is left unchecked.