Replace rampup batch size scheduler with custom step batch size schedules#4411
Merged
ko3n1g merged 2 commits intoNVIDIA:mainfrom Apr 21, 2026
Merged
Conversation
…ules (NVIDIA#3779) Co-authored-by: Deepak Narayanan <dnarayanan@nvidia.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
tdene
approved these changes
Apr 21, 2026
Re-add rampup_batch_size as a deprecated optional parameter to init_num_microbatches_calculator and reconfigure_num_microbatches_calculator. The parameter is ignored but logs a deprecation warning on rank 0. Switch all internal callers to keyword arguments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
43b2f0a to
f916fe8
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?
Re-lands #3779 (reverted in #4404) with backwards compatibility for the deprecated
rampup_batch_sizeparameter.Step batch size schedule
The new
--step-batch-size-scheduleargument accepts a string ofTHRESHOLD:BATCH_SIZEpairs that define arbitrary step-wise batch size changes during training. Thresholds support K/M/B/T suffixes and are interpreted as tokens when--seq-lengthis provided, otherwise as samples.Example:
This is implemented via a new
StepBatchsizeNumMicroBatchesCalculatorclass.Rampup batch size removal
The old
RampupBatchsizeNumMicroBatchesCalculatorand--rampup-batch-sizeargument are removed. Existing example configs are converted to equivalent step batch size schedules.Backwards compatibility
The
rampup_batch_sizeparameter is re-added toinit_num_microbatches_calculatorandreconfigure_num_microbatches_calculatoras a deprecated optional kwarg (defaultNone). If passed, a deprecation warning is logged on rank 0. The parameter is otherwise ignored. All internal callers are updated to use keyword arguments.Files changed
megatron/core/num_microbatches_calculator.py: AddedStepBatchsizeNumMicroBatchesCalculator, removedRampupBatchsizeNumMicroBatchesCalculator, added deprecatedrampup_batch_sizekwarg for backwards compatibility.megatron/training/config/training_config.py: Replacedrampup_batch_sizefield withstep_batch_size_schedule.megatron/training/arguments.py: Removed rampup-related assertions and help text.megatron/training/training.py: Updatedupdate_train_itersto handle step schedule for sample-based training.megatron/training/global_vars.py: Updatedinit_num_microbatches_calculatorcall to use keyword arguments.examples/,tests/functional_tests/: Converted rampup configs to step batch size schedules.tests/unit_tests/test_num_microbatches_calculator.py: Replaced rampup tests with step schedule tests, updated all calls to use keyword arguments.