Skip to content

Fix FP16 gradient unscaling on loss scale growth steps - #8662

Open
taking-lying-flat wants to merge 1 commit into
deepspeedai:masterfrom
taking-lying-flat:fix/fp16-scale-growth-step
Open

taking-lying-flat wants to merge 1 commit into
deepspeedai:masterfrom
taking-lying-flat:fix/fp16-scale-growth-step

Conversation

@taking-lying-flat

@taking-lying-flat taking-lying-flat commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

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.

@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added the skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. label Nov 14, 2026
@taking-lying-flat
taking-lying-flat force-pushed the fix/fp16-scale-growth-step branch from cb4933c to 0ccd91b Compare November 15, 2026 01:27
@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. and removed skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. labels Nov 15, 2026
Signed-off-by: taking-lying-flat <1615405@qq.com>
@taking-lying-flat
taking-lying-flat force-pushed the fix/fp16-scale-growth-step branch from 0ccd91b to b2cc171 Compare November 15, 2026 01:37
@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. and removed skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. labels Nov 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant