Repository navigation
Fix FP16 gradient unscaling on loss scale growth steps - #8662
Open
taking-lying-flat wants to merge 1 commit into
Open
taking-lying-flat wants to merge 1 commit into
taking-lying-flat wants to merge 1 commit into
Conversation
taking-lying-flat
requested review from
loadams,
tjruwase and
tohtana
as code owners
September 25, 2026 11:48
taking-lying-flat
force-pushed
the
fix/fp16-scale-growth-step
branch
from
November 15, 2026 01:27
cb4933c to
0ccd91b
Compare
Signed-off-by: taking-lying-flat <1615405@qq.com>
taking-lying-flat
force-pushed
the
fix/fp16-scale-growth-step
branch
from
November 15, 2026 01:37
0ccd91b to
b2cc171
Compare
This branch has not been deployed
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.
When dynamic FP16 loss scaling grows, gradients are unscaled with the new scale instead of the one used for backward. A true gradient of 2 scaled by 8 becomes 1 if the scale grows to 16 before unscaling.
Keep the backward scale through norm computation, clipping and parameter updates; advance it only after a successful step. Overflow still lowers the scale and skips the update. This covers both FP16 wrappers and standard ZeRO stages 1–3.
The patch retains #8638's invalid-norm handling and leaves the shared ZeRO-3 cleanup helper unchanged for SuperOffload/ZenFlow. That fix handles invalid norms; this one handles successful scale-growth steps.