deepspeedai / deepspeedai/DeepSpeed

[BUG]clip gradient not working

Open
#7,220 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug training
Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

Describe the bug
Hello, I used accelerate+deepspeed zero3 for distributed grpo training with 8 A800.
For clipping gradient: I set max_grad_norm=1.0 in training arguments and set gradient_clipping=1.0 in deepspeed3.yaml.
When training, many of the printed grad_norm values ​​are greater than 1.0。
It seems that the above parameters do not work.

Expected behavior
I think the grad_norm values should be less than max_grad_norm (or gradient_clipping)

System info (please complete the following information):
trl 0.16.0
deepspeed 0.15.4
accelerate 0.34.0
pytorch 2.5.1
transformers 0.49.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with the listed TRL, DeepSpeed, Accelerate, PyTorch, and Transformers versions using ZeRO-3 and the two clipping settings. Compare the printed grad_norm values with the actual clipping behavior; this issue is done when the discrepancy is explained or corrected and the expected behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.