Skip to content

Keep ZenFlow Adam step counters in float32 - #8496

Merged
sfc-gh-truwase merged 2 commits into
deepspeedai:masterfrom
vineethsaivs:fix/zenflow-fp32-step-counter-20260912
Sep 27, 2026
Merged

sfc-gh-truwase merged 2 commits into
deepspeedai:masterfrom
vineethsaivs:fix/zenflow-fp32-step-counter-20260912

Conversation

@vineethsaivs

@vineethsaivs vineethsaivs commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

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.

Signed-off-by: Vineeth Sai <vineethsai4444@gmail.com>
@vineethsaivs
vineethsaivs force-pushed the fix/zenflow-fp32-step-counter-20260912 branch from dfe734d to 4e23970 Compare September 13, 2026 03:23
Comment thread deepspeed/ops/adam/zenflow_torch_adam.py
@sfc-gh-truwase
sfc-gh-truwase added this pull request to the merge queue Sep 26, 2026
Merged via the queue into deepspeedai:master with commit 2f3632a Sep 27, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants