[BUG] ZeRO-2 deadlocks at step 1 training HF MixtralForCausalLM (native experts) with 2-GPU data parallel
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
调研方向
Start by comparing the backward and engine.step() stack locations with DeepSpeed’s ZeRO-2 gradient reduction path, especially stage_1_and_2.py and runtime/utils.py. The issue provides a two-GPU Mixtral reproduction configuration, but says the cause is not identified and a standalone script will follow. First minimize the repro and trace collective ordering across ranks; done when step 1 completes or fails with a clear error under the reported setup.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
An unmodified Hugging Face MixtralForCausalLM (native expert loop, no AutoEP and no deepspeed.moe) trained with ZeRO-2 under plain data parallelism on 2 GPUs completes step 0, then hangs in step 1. GPUs stay at 100% utilization, with no error or timeout for more than 9 minutes.
Stack dumps (faulthandler) show the two ranks in different places:
- One rank has finished backward and is in
engine.step()→stage_1_and_2.pystep→check_overflow→has_overflow_partitioned_grads_serial→runtime/utils.py:has_inf_or_nan. It is blocked on device sync. - The other rank is still inside
engine.backward()(autograd engine).
This looks like the gradient-reduction collective sequence diverging between ranks during step 1. The root cause has not been identified yet.
To Reproduce
transformers.MixtralConfig(vocab_size=32000, hidden_size=1024, intermediate_size=1024, num_hidden_layers=12, num_attention_heads=16, num_key_value_heads=4, num_local_experts=16, num_experts_per_tok=2, output_router_logits=True, router_aux_loss_coef=0.01, tie_word_embeddings=False, use_cache=False, attn_implementation="sdpa"), random init.- DeepSpeed config: bf16,
zero_optimization.stage=2, AdamW (torch_adam: true),gradient_clipping: 1.0,train_micro_batch_size_per_gpu: 8, WarmupCosineLR. - Inputs: packed SFT batches, seq 1024,
labelswith prompt tokens masked to -100;loss = engine(input_ids=x, labels=y).loss;engine.backward(loss);engine.step(). deepspeed --num_gpus 2 ...
Under the same config, the same model with its MoE blocks replaced by AutoEP (expert_parallel.enabled, EP=2) or by deepspeed.moe.layer.MoE (EP=2) trains for 400 steps without hanging.
Expected behavior
Training proceeds, or fails with an error, instead of deadlocking.
System info
- 2× NVIDIA H100 80GB HBM3, driver 595.112.07, CUDA 12.9
- torch 2.8.0+cu129, transformers 5.23.0, DeepSpeed 0.20.1+5420b75de (master), Python 3.12, Ubuntu 24.04
Additional context
Found while collecting MoE baselines for roadmap #8672. Not yet minimized; a smaller standalone repro script will follow in a comment. AI assistance (Claude Code) was used to run the experiment and draft this report.
- 主要语言
- Python
- 星标
- 43.3k
- 派生
- 5.1k
- 平均合并
- 5 天 10 小时
- 30 天内合并 PR
- 85
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
deepspeedai/DeepSpeed 的其他 Issue
-
[Bug] DeepSpeedEngine.step leaves _running_engine_step=True permanently on exception, corrupting is_gradient_accumulation_boundary()可能已有人在做 @its-amann 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
deepspeedai/DeepSpeed#9190 · 1 条评论 ·
维护者通常 2 天内回复
-
[Bug] PipelineEngine._exec_reduce_grads and _exec_optimizer_step leave _force_grad_boundary=True permanently after any exception可能已有人在做 @bantianyue 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
deepspeedai/DeepSpeed#9183 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
deepspeedai/DeepSpeed#9019 · 2 条评论 ·
维护者通常 2 天内回复
-
fp16 `hysteresis: 0` (or negative) makes DynamicLossScaler never lower the loss scale, so every overflowing step is skipped forever可能已有人在做 @damienen 于 26 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
deepspeedai/DeepSpeed#8982 ·
维护者通常 2 天内回复
-
[BUG] OneCycle applies the minimum momentum to the first Adam update可能已有人在做 @ai-yang 于 30 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
deepspeedai/DeepSpeed#8951 ·
维护者通常 2 天内回复
查看 deepspeedai/DeepSpeed 的全部 Issue
相似的 Issue
-
area/auth comp/agent P3 type/bug
难度 2/5 1-3 小时 新手友好度 88/100
NousResearch/hermes-agent#161417 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 75/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
Dao-AILab/flash-attention#3251 ·
维护者通常 2 天内回复
-
[New Check]: sqlserver_public_network_access_disabled可能已有人在做 @pouria-l 今天认领。 未关闭feature-request status/needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
prowler-cloud/prowler#13607 · 1 条评论 ·
维护者通常 1 天内回复
-
external langchain
难度 1/5 1 小时以内 新手友好度 90/100
langchain-ai/docs#8184 ·
维护者通常 1 天内回复