[BUG] Grad norm value differs significantly across DeepSpeed version
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Active
Research direction
No specific source file or test is named. Start by reproducing the reported comparison between DeepSpeed 0.16.4 and 0.18.3 with the Qwen2.5_VL script, ZeRO-2, and the listed torchrun environments; use ds_report to record the runtime configuration. Done means determining whether the grad_norm difference is expected and identifying the version change responsible if it is a bug.
Written by the indexing model from the issue text.
Description
Describe the bug
I observed a significant discrepancy in grad_norm values when upgrading from DeepSpeed 0.16.4 to 0.18.3. Under identical training configurations (same model, same hyperparameters, same script), the reported grad_norm drops by orders of magnitude (from ~11-15 to ~0.2).
I am finetuning Qwen2.5_VL with DeepSpeed ZeRO-2. When I am using DeepSpeed 0.16.4, the training log is:
{'loss': 1.7677, 'grad_norm': 11.14142894744873, 'learning_rate': 4.025044722719142e-07, 'epoch': 0.0}
{'loss': 2.2447, 'grad_norm': 11.526385307312012, 'learning_rate': 4.1144901610017893e-07, 'epoch': 0.0}
{'loss': 1.774, 'grad_norm': 12.301006317138672, 'learning_rate': 4.203935599284437e-07, 'epoch': 0.0}
{'loss': 2.0844, 'grad_norm': 15.470754623413086, 'learning_rate': 4.2933810375670843e-07, 'epoch': 0.0}
{'loss': 2.0122, 'grad_norm': 14.170842170715332, 'learning_rate': 4.3828264758497323e-07, 'epoch': 0.0}
{'loss': 2.106, 'grad_norm': 12.281550407409668, 'learning_rate': 4.47227191413238e-07, 'epoch': 0.0}
0%|▎ | 59/37254 [06:18<66:08:28, 6.40s/it]
After upgrading to DeepSpeed 0.18.3, the training log is:
{'loss': 1.958, 'grad_norm': 0.21968881785869598, 'learning_rate': 0.0, 'epoch': 0.0}
{'loss': 1.7761, 'grad_norm': 0.1559031903743744, 'learning_rate': 8.94454382826476e-09, 'epoch': 0.0}
0%| | 2/37254 [00:14<68:36:25, 6.63s/it]
Is this the expected behavior or a bug?
ds_report output
DeepSpeed C++/CUDA extension op report
--------------------------------------------------
NOTE: Ops not installed will be just-in-time (JIT) compiled at
runtime if needed. Op compatibility means that your system
meet the required dependencies to JIT install the op.
--------------------------------------------------
JIT compiled ops requires ninja
ninja .................. [OKAY]
--------------------------------------------------
op name ................ installed .. compatible
--------------------------------------------------
[WARNING] async_io requires the dev libaio .so object and headers but these were not found.
[WARNING] async_io: please install the libaio-dev package with apt
[WARNING] If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found.
async_io ............... [NO] ....... [NO]
fused_adam ............. [NO] ....... [OKAY]
cpu_adam ............... [NO] ....... [OKAY]
cpu_adagrad ............ [NO] ....... [OKAY]
cpu_lion ............... [NO] ....... [OKAY]
dc ..................... [NO] ....... [OKAY]
[WARNING] Please specify the CUTLASS repo directory as environment variable $CUTLASS_PATH
evoformer_attn ......... [NO] ....... [NO]
[WARNING] FP Quantizer is using an untested triton version (3.4.0), only 2.3.(0, 1) and 3.0.0 are known to be compatible with these kernels
fp_quantizer ........... [NO] ....... [NO]
fused_lamb ............. [NO] ....... [OKAY]
fused_lion ............. [NO] ....... [OKAY]
[WARNING] gds requires the dev libaio .so object and headers but these were not found.
[WARNING] gds: please install the libaio-dev package with apt
[WARNING] If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found.
gds .................... [NO] ....... [NO]
transformer_inference .. [NO] ....... [OKAY]
inference_core_ops ..... [NO] ....... [OKAY]
cutlass_ops ............ [NO] ....... [OKAY]
quantizer .............. [NO] ....... [OKAY]
ragged_device_ops ...... [NO] ....... [OKAY]
ragged_ops ............. [NO] ....... [OKAY]
random_ltd ............. [NO] ....... [OKAY]
[WARNING] sparse_attn requires a torch version >= 1.5 and < 2.0 but detected 2.8
[WARNING] using untested triton version (3.4.0), only 1.0.0 is known to be compatible
sparse_attn ............ [NO] ....... [NO]
spatial_inference ...... [NO] ....... [OKAY]
transformer ............ [NO] ....... [OKAY]
stochastic_transformer . [NO] ....... [OKAY]
utils .................. [NO] ....... [OKAY]
--------------------------------------------------
DeepSpeed general environment info:
torch install path ............... ['/home/users/xxx/envs/miniconda3/envs/xxx/lib/python3.12/site-packages/torch']
torch version .................... 2.8.0+cu128
deepspeed install path ........... ['/home/users/xxx/envs/miniconda3/envs/xxx/lib/python3.12/site-packages/deepspeed']
deepspeed info ................... 0.18.3, unknown, unknown
torch cuda version ............... 12.8
torch hip version ................ None
nvcc version ..................... 11.8
deepspeed wheel compiled w. ...... torch 0.0, cuda 0.0
shared memory (/dev/shm) size .... 503.76 GB
System info:
- OS: Ubuntu 22.04
- GPU count and types 1x 4090 for debug and 8x 5090 for training.
- Python version: both 3.10 & 3.12
- Any other relevant info about your setup
Launcher context
torchrun
- Dominant language
- Python
- Stars
- 43.3k
- Forks
- 5.1k
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 69
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from deepspeedai/DeepSpeed
-
[BUG] Universal checkpoint resume puts CPU `step` into fused/capturable optimizer statePossibly taken @ArjunPakhan claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
deepspeedai/DeepSpeed#8884 · 1 comment ·
Maintainers usually reply within 3 days
-
init_inference rejects dtype=torch.int8 on every acceleratorMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
deepspeedai/DeepSpeed#8577 ·
Maintainers usually reply within 3 days
-
[BUG] AutoTP checkpoint load raises AttributeError on a model containing nn.InstanceNorm1dPossibly taken @vineethsaivs claimed this 41 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
deepspeedai/DeepSpeed#8514 ·
Maintainers usually reply within 3 days
-
[BUG] Python checkpoint writers fail to reload full ZeRO-3 state with default torch.loadPossibly taken @ai-yang claimed this 42 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
deepspeedai/DeepSpeed#8500 ·
Maintainers usually reply within 3 days
-
[BUG] set_norm_for_param_grad_in_gpu's grad_accum fallback is dead in both accumulation modesPossibly taken @LOGO127 claimed this 51 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
deepspeedai/DeepSpeed#8371 ·
Maintainers usually reply within 3 days
All issues in deepspeedai/DeepSpeed
Similar issues
-
intake mcp-intake needs-ac needs-human-review priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Ikalus1988/MisakaNet#3848 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
521xueweihan/HelloGitHub#4105 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
igormcsouza/bookloud#54 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
aws-samples/sample-per-model-bedrock#526 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ok-oldking/ok-wuthering-waves#1802 ·
Maintainers usually reply within 2 days