ms-swift icon indicating copy to clipboard operation
ms-swift copied to clipboard

Qwen3.5多节点SFT训练主Loss异常上下震荡问题

Open sampleargmax opened this issue 8 months ago • 5 comments

Checklist / 检查清单

  • [x] I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。

Bug Description / Bug 描述

多机loss抖动示例: 8 x 8 H20-141G训练的主loss曲线: Image

8x2节点,8x4节点都有这个问题,但是8x1节点的Loss是正常平滑下降的。

目前团队里面多人都已复现出了上述训练结果,怀疑Swift在处理多机梯度更新时是否存在梯度异常等问题?单机看起来是正常的;训练的基座模型为Qwen3.5-35B-A3B模型;

另外,对齐训练超参数和训练数据,对比单独的megartron训练的Qwen3.5-35B-A3B,在多机训练下就没有上述问题,已经排除了"tool_call" role、训推模版等问题,怀疑属于多节点梯度收集异常

How to Reproduce / 如何复现

版本:https://github.com/modelscope/ms-swift/commit/27ae5991b601174cd9124447cbf50b6d0e269d0e,main分支; 运行环境:linux 复现步骤:相同数据、相同megatron并行设置配置、单机和多机即可看到差异(因此怀疑Data Parallel有点问题?)

Additional Information / 补充信息

No response

sampleargmax avatar Mar 31 '26 13:03 sampleargmax

group_by_length导致的,或者你使用packing就没有这个问题了

Jintao-Huang avatar Apr 01 '26 08:04 Jintao-Huang

group_by_length导致的,或者你使用packing就没有这个问题了

谢谢我们试试,另外这个属于符合预期,不算一个bug么

sampleargmax avatar Apr 02 '26 06:04 sampleargmax

我们尝试了这个设置,loss震荡的情况有所缓解,但是训练的效果不如用deepspeed的后端效果好,请问有什么建议吗

bingnoi77 avatar Apr 03 '26 02:04 bingnoi77

This issue has been inactive for over 3 months and will be automatically closed in 7 days. If this issue is still relevant, please reply to this message.

github-actions[bot] avatar Jul 03 '26 00:07 github-actions[bot]

This issue has been automatically closed due to inactivity. If needed, it can be reopened.

github-actions[bot] avatar Jul 11 '26 00:07 github-actions[bot]