[BUG] ZeRO-3 GPU memory spike and OOM with Qwen3.5 35B-A3B MoE on DeepSpeed 0.20.0; 0.19.0 works
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 8/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Activo
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 43.4k
- Forks
- 5.1k
- Merge medio
- 5 d 10 h
- PR fusionados (30 d)
- 85
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de deepspeedai/DeepSpeed
-
[Bug] DeepSpeedEngine.step leaves _running_engine_step=True permanently on exception, corrupting is_gradient_accumulation_boundary()Posiblemente ocupada @its-amann la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
deepspeedai/DeepSpeed#9190 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
[Bug] PipelineEngine._exec_reduce_grads and _exec_optimizer_step leave _force_grad_boundary=True permanently after any exceptionPosiblemente ocupada @bantianyue la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
deepspeedai/DeepSpeed#9183 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
deepspeedai/DeepSpeed#9019 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
fp16 `hysteresis: 0` (or negative) makes DynamicLossScaler never lower the loss scale, so every overflowing step is skipped foreverPosiblemente ocupada @damienen la tomó hace 26 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
deepspeedai/DeepSpeed#8982 ·
Los mantenedores suelen responder en 2 días
-
[BUG] OneCycle applies the minimum momentum to the first Adam updatePosiblemente ocupada @ai-yang la tomó hace 30 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
deepspeedai/DeepSpeed#8951 ·
Los mantenedores suelen responder en 2 días
Todos los issues de deepspeedai/DeepSpeed
Issues similares
-
area/auth comp/agent P3 type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
NousResearch/hermes-agent#161417 ·
Los mantenedores suelen responder en 1 día
-
accepted
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
future-agi/future-agi#4737 ·
Los mantenedores suelen responder en 1 día
-
Fix URL validation, get_version_url, and implement robust parse_url for Launchpad backendPosiblemente ocupada @patelshivani2283-lab la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
fedora-infra/anitya#2278 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Dao-AILab/flash-attention#3251 ·
Los mantenedores suelen responder en 2 días