Skip to content

[v5] Keep an explicit zero optimizer step out of the driver budget - #351

Draft
qychen2001 wants to merge 1 commit into
dev-swift-v5from
fix/v5-bug-1029
Draft

qychen2001 wants to merge 1 commit into
dev-swift-v5from
fix/v5-bug-1029

Conversation

@qychen2001

Copy link
Copy Markdown
Collaborator

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

Draft。今天的后续修改会继续推到这个分支。

问题

分离训练的 driver 用 commit(本次真正更新了几步) 决定还要不要继续。commit() 和 _train_pull() 原来都写成 int(steps) if steps else 1:没传步数和明确传入的 0 被当成同一件事,于是「这轮权重一次都没改」被记成 1 步。

梯度累积的第一次真正更新比一整批晚一个小批次。第 02 组每轮正好 8 个小批次,连续三轮的真实更新是 0、1、1。driver 记成 1、1、1,max_steps=3 提前结束,优化器只更新了 2 次。共置训练不经过这个 driver,所以不受影响。同步分离和异步走同一条 commit 路径,这个计数错误两边一样;差别只是样本允许用多旧的权重。

修复前实机(ms-swift 1666ec6dd + Twinkle 4e099040,第 02 组):history 只有 step 1 和 2,723 份 Adam 状态的 step 都是 2,cur_step=24。证据目录 scripts/phase1/output/20261029T025108Z-1474591/。

修改

缺省值仍按 1 步计。明确传入的 0 保持为 0,不占用 max_steps 预算。

Experiment results

  • CPU:5 个预算测试通过;staleness=0/1/2 的 driver 探针不再把 [0, 1, 1] 记成 3 步后停止。
  • 第 02 组同步分离,Twinkle 29503ffe:history=[1, 2, 3],GA=8,cur_step=25,Adam step=3,426 个权重张量变化,权重和优化器数值有限。scripts/phase1/output/20261029T040143Z-1561058/02_disaggregated_sync/
  • 第 03 组一步异步,同一提交:Adam step=3,cur_step=25,426 个权重张量变化,数值有限。version_span_mean、off_policy_consumed、partial_ratio 都是 0。这不证明采样和训练已经重叠,也不证明 partial resume。scripts/phase1/output/20261029T043047Z-1598498/03_one_step_off/

Made with Cursor

A reported 0 was treated as a missing count, so a batch with no optimizer update consumed one max_steps slot and disaggregated runs stopped early.

Co-authored-by: Cursor <cursoragent@cursor.com>
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