Implement Warmup-Stable-Decay (WSD) Learning Rate Schedule #2883
+193
−23
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.
Description
This PR implements the Warmup-Stable-Decay (WSD) learning rate schedule as a configurable option alongside the existing Cosine schedule. This allows users to choose between the standard cosine decay and a schedule that maintains a stable peak learning rate for the majority of training before a rapid decay.
Additionally, this implementation introduces a
wsd_decay_styleparameter, giving users the flexibility to choose the decay profile (linear or cosine) for the final annealing phase.Details and Context:
src/MaxText/configs/base.yml):lr_schedule_type(options:'cosine','wsd').wsd_learning_rate_final_fraction,wsd_decay_steps_fraction.wsd_decay_style: Supports'linear'(default, standard for WSD) or'cosine'decay for the final phase.src/MaxText/configs/types.py):LearningRateScheduleTypeandWsdDecayStyleEnums.Optimizerclass to include validation for these new fields.src/MaxText/maxtext_utils.py):create_learning_rate_scheduleto switch between Cosine and WSD logic.Linear Warmup->Constant Stable->Decay.optax.linear_scheduleand a custom cosine schedule based onwsd_decay_style.warmup_steps_fraction + wsd_decay_steps_fraction <= 1.0.Tests
I have added a comprehensive test suite,
TestLearningRateSchedules, intests/maxtext_utils_test.py.linearandcosinedecay styles.ValueError.To reproduce/test:
Fixes: #2882
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.