[BUG] ZeRO-3 GPU memory spike and OOM with Qwen3.5 35B-A3B MoE on DeepSpeed 0.20.0; 0.19.0 works
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 8/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
調査の方向性
Start from the trace: the ZeRO-3 pre-forward hook path (fetch_sub_module, then all_gather_coalesced, then torch.empty) during checkpoint recomputation of the MoE decoder layer. Compare how DeepSpeed 0.19.0 and 0.20.0 handle parameter gathering and release in that path. Done means finding the cause, or per-rank peak memory that matches the 0.19.0 run on a reproducer.
索引モデルが issue の本文から書いたものです。
説明
Description
When LoRA fine-tuning Qwen3.5-35B-A3B with LlamaFactory 0.9.6.dev and DeepSpeed ZeRO-3, GPU memory rises sharply in the first training batch and causes OOM on 8 × 72 GB RTX PRO 5000 Blackwell GPUs with DeepSpeed 0.20.0. After installing DeepSpeed 0.19.0 (and reinstalling the same Transformers, Accelerate and PEFT versions), the reporter says training works. This suggests a version-sensitive regression or interaction; the root cause is not yet established and transitive dependency changes have not been ruled out.
The reporter confirms the issue was reproduced on both A100 and RTX PRO 5000 GPUs, and also observed it with Qwen3.6 35B MoE. A100-specific failing logs and measurements are not yet included here. The specific run and stack trace below are for Qwen3.5; a separate Qwen3.6 trace is not available in this report.
Environment
- 8 × NVIDIA RTX PRO 5000 72GB Blackwell (SM 12.0), driver 580.126.20 (trace below)
- Also reproduced on NVIDIA A100 PCIe 40GB according to the reporter; the exact failing-run software versions and logs still need confirmation.
- DeepSpeed 0.20.0 failing; 0.19.0 reported working after the package change
- PyTorch 2.10.0+cu130, Python 3.12, Triton 3.6.0
- Transformers 5.8.0, Accelerate 1.11.0, PEFT 0.18.1
- LlamaFactory 0.9.6.dev, commit
673048c6a543cbbeaed5b8444b8223dc4e23c721 flash-attn,flash-linear-attention, andcausal-conv1dwere not installed in the failing run; Qwen linear attention logged that it fell back to the PyTorch implementation.
Steps to reproduce
- Install the versions above with DeepSpeed 0.20.0 and load
Qwen/Qwen3.5-35B-A3Bin LlamaFactory. - Launch 8 distributed ranks for multimodal SFT with BF16, LoRA rank 128 / alpha 256,
lora_target: all, batch size 1 per GPU, gradient accumulation 16, cutoff length 8192, image max pixels 1048576, and gradient checkpointing enabled. The training data consists of private multimodal examples, so this is not yet a standalone reproducer. - Enable ZeRO-3 without CPU offload. The relevant configuration is:
{
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"gradient_accumulation_steps": "auto",
"bf16": {"enabled": "auto"},
"zero_optimization": {
"stage": 3,
"overlap_comm": false,
"contiguous_gradients": true,
"sub_group_size": 1000000000,
"reduce_bucket_size": "auto",
"stage3_prefetch_bucket_size": "auto",
"stage3_param_persistence_threshold": "auto",
"stage3_max_live_parameters": 1000000000,
"stage3_max_reuse_distance": 1000000000,
"stage3_gather_16bit_weights_on_model_save": true
}
}
Observed
The log confirms Detected DeepSpeed ZeRO-3: activating zero.init() for this model. After model loading, nvidia-smi showed about 9.4 GiB per GPU; during the first training batch this grew to roughly 70 GiB per GPU, and the run failed before the first optimizer step. On rank 6, the recorded error was:
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 1.51 GiB.
GPU 6 has a total capacity of 71.12 GiB of which 1.20 GiB is free.
Including non-PyTorch memory, this process has 69.92 GiB memory in use.
Of the allocated memory 69.03 GiB is allocated by PyTorch,
and 277.58 MiB is reserved by PyTorch but unallocated.
The stack shows accelerator.backward → torch.utils.checkpoint.backward (recomputed forward) → Qwen3_5MoeDecoderLayer.forward / self.mlp → DeepSpeed ZeRO-3 pre-forward hook → fetch_sub_module → all_gather_coalesced → torch.empty. Other ranks also failed while concatenating parameter partitions. The all-gather is the failing allocation, not proof of what accounted for all previously allocated memory.
Expected
The run should fit in available memory, or memory usage should be comparable to the reported successful 0.19.0 setup. Is there a known change in ZeRO-3 parameter gathering or retention in 0.20.0 that might explain this behavior? Guidance on collecting useful per-rank memory traces or constructing a minimal reproduction would be appreciated.
Version comparison limitations
The reporter changed packages with pip install transformers==5.8.0 deepspeed==0.19.0 accelerate==1.11.0 peft==0.18.1 and reports the issue resolved. The latter three versions other than DeepSpeed were already the same before the change, and the current environment confirms DeepSpeed 0.19.0 and PyTorch 2.10.0+cu130. A full before/after dependency lock and matched peak measurements are not yet available, so this is not a fully controlled bisect.
- 主要言語
- Python
- スター
- 43.3k
- フォーク
- 5.1k
- 平均マージ
- 5日 10時間
- マージ済み PR(30日)
- 85
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 日以内に返信