[BUG] ZeRO-3 GPU memory spike and OOM with Qwen3.5 35B-A3B MoE on DeepSpeed 0.20.0; 0.19.0 works
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 8/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- distributed-systems, machine-learning
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 43.3k
- Fork
- 5.1k
- Merge trung bình
- 5 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 85
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của deepspeedai/DeepSpeed
-
[Bug] DeepSpeedEngine.step leaves _running_engine_step=True permanently on exception, corrupting is_gradient_accumulation_boundary()Có thể đã có người làm @its-amann đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
deepspeedai/DeepSpeed#9190 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug] PipelineEngine._exec_reduce_grads and _exec_optimizer_step leave _force_grad_boundary=True permanently after any exceptionCó thể đã có người làm @bantianyue đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deepspeedai/DeepSpeed#9183 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
deepspeedai/DeepSpeed#9019 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
fp16 `hysteresis: 0` (or negative) makes DynamicLossScaler never lower the loss scale, so every overflowing step is skipped foreverCó thể đã có người làm @damienen đã nhận 26 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
deepspeedai/DeepSpeed#8982 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG] OneCycle applies the minimum momentum to the first Adam updateCó thể đã có người làm @ai-yang đã nhận 30 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deepspeedai/DeepSpeed#8951 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của deepspeedai/DeepSpeed
Issue tương tự
-
area/auth comp/agent P3 type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#161417 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Dao-AILab/flash-attention#3251 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[New Check]: sqlserver_public_network_access_disabledCó thể đã có người làm @pouria-l đã nhận hôm nay. Đang mởfeature-request status/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
prowler-cloud/prowler#13607 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
external langchain
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
langchain-ai/docs#8184 ·
Maintainer thường phản hồi trong vòng 1 ngày