Validate rampup batch size settings in the Pydantic config - #4691
Open
Atishyy27 wants to merge 1 commit into
Open
Validate rampup batch size settings in the Pydantic config#4691Atishyy27 wants to merge 1 commit into
Atishyy27 wants to merge 1 commit into
Conversation
The legacy config path validates these in pyconfig_deprecated.validate_rampup_batch_size, but the Pydantic config has no equivalent, so an unusable combination is accepted silently. The schedule derivation in MaxTextConfig is guarded by 'if global_batch_size_to_load_increment > 0' and 'if num_increments > 0', so a non-positive increment, non-positive global_rampup_samples, or a start at or above per_device_batch_size falls through and leaves rampup_end_step = 0, disabling rampup with no diagnostic. When the batch size change is not a multiple of the increment, the floor division truncates and ramp-up finishes at a smaller batch size than configured. Add a model_validator on DatasetGeneral mirroring the legacy checks, and cover each rejection plus the disabled-rampup case in tests/unit/configs_value_test.py.
Atishyy27
requested review from
A9isha,
NuojCheng,
RissyRan,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
bvandermoon,
darisoy,
dipannita08,
gagika,
gobbleturk,
hengtaoguo,
huytransformer,
igorts-git,
jiangjy1982,
khatwanimohit,
richjames0,
shralex,
vipannalla and
xibinliu
as code owners
July 31, 2026 12:34
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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.
Closes #4690.
The legacy config validates the rampup batch size settings in
pyconfig_deprecated.validate_rampup_batch_size(src/maxtext/configs/pyconfig_deprecated.py:203). The Pydantic config has no equivalent, so an unusable combination is accepted and then silently degrades.The derivation in
MaxTextConfigis guarded byif self.global_batch_size_to_load_increment > 0:andif num_increments > 0:, so a non-positive increment, non-positiveglobal_rampup_samples, or a start at or aboveper_device_batch_sizefalls through and leavesrampup_end_step = 0. Rampup is off and nothing says so. When the change is not a multiple of the increment,num_increments = diff // incrementtruncates and ramp-up finishes below the configuredper_device_batch_size.Replicating the derivation arithmetic for 8 devices,
expansion_factor_real_data=1,gradient_accumulation_steps=1:per_device_batch_size=8, start=4, increment=2, samples=500increment=0global_rampup_samples=0start=8, per_device_batch_size=4per_device_batch_size=9, start=4, increment=2This adds a
model_validator(mode="after")onDatasetGeneralwith the same five checks as the legacy path, skipped entirely whenenable_rampup_batch_sizeis False.Tests in tests/unit/configs_value_test.py cover each rejection, a positive control asserting a well-formed config still produces
rampup_end_step > 0, and a case confirming the checks do not fire when rampup is disabled.