Skip to content

Reject invalid ZenFlow top-k ratio endpoints - #8274

Open
tandede wants to merge 1 commit into
deepspeedai:masterfrom
tandede:agent/reject-zenflow-topk-boundaries
Open

Reject invalid ZenFlow top-k ratio endpoints#8274
tandede wants to merge 1 commit into
deepspeedai:masterfrom
tandede:agent/reject-zenflow-topk-boundaries

Conversation

@tandede

@tandede tandede commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • require zenflow.topk_ratio to be strictly between 0 and 1
  • add regression coverage for both invalid endpoints

Why

ZenFlow's automatic update path normalizes selected gradients by topk_ratio and unselected gradients by 1 - topk_ratio in both the ZeRO-1/2 and ZeRO-3 implementations. The previous inclusive constraints accepted 0 and 1, so either endpoint could trigger division by zero after training had already initialized.

Rejecting the endpoints during configuration parsing provides an immediate, actionable validation error while preserving all usable selective-update ratios.

Testing

  • python -m pytest -q tests/unit/runtime/zero/test_zero_config.py tests/unit/runtime/zenflow/test_zf_config.py tests/unit/runtime/zenflow/test_zf.py::test_split_affinity (19 passed)
  • pre-commit run --files deepspeed/runtime/zenflow/zenflow_config.py tests/unit/runtime/zenflow/test_zf_config.py

Signed-off-by: tandede <1090179959@qq.com>
@tandede
tandede force-pushed the agent/reject-zenflow-topk-boundaries branch from 9d6ed9a to 0bbc0ef Compare August 19, 2026 01:17
@tandede
tandede marked this pull request as ready for review August 19, 2026 11:28
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

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.

1 participant