Keep ZenFlow Adam step counters in float32 - #8496
Merged
sfc-gh-truwase merged 2 commits intoSep 27, 2026
Merged
sfc-gh-truwase merged 2 commits into
sfc-gh-truwase merged 2 commits into
Conversation
vineethsaivs
requested review from
loadams,
tjruwase and
tohtana
as code owners
September 13, 2026 00:41
Signed-off-by: Vineeth Sai <vineethsai4444@gmail.com>
vineethsaivs
force-pushed
the
fix/zenflow-fp32-step-counter-20260912
branch
from
September 13, 2026 03:23
dfe734d to
4e23970
Compare
ebarkhordar
reviewed
Sep 13, 2026
sfc-gh-truwase
approved these changes
Sep 26, 2026
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.
ZenFlow's selective Adam counter stops advancing at 256 in BF16 and 2048 in FP16, freezing bias correction.
Initialize counters in float32. Direct optimizer
load_state_dict()also promotes old FP16/BF16 counters, preserving float64 counters and saved values. This restore coverage is for the selective optimizers used through PyTorch's API: DeepSpeed's engine does not currently checkpoint their separate state.Test:
DS_ACCELERATOR=cpu PYTHONPATH=. python -m pytest tests/unit/runtime/zenflow/test_zf.py -k counter -q. All 13 counter tests pass on Apple M2 Pro CPU, including direct state restoration and resumed updates. Previously lost step counts cannot be reconstructed.