deepspeedai / deepspeedai/DeepSpeed

[BUG] mutil optimizer param group

Open
#5,063 0 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

hello, when I use zero2 to train model, I find if I split optimizer‘s params to 2 groups

params = {'params': []}
for module_ in model.modules():
        params['params'].extend(
                [p for n, p in list(module_._parameters.items())
                if p is not None and n != 'bias'])

param_count = len(params['params'])
first_half = params['params'][:param_count // 2]
second_half = params['params'][param_count // 2:]

first_half = {'params': first_half}
second_half = {'params': second_half}

optimizer = torch.optim.AdamW(params=[first_half, second_half])

and I will get different gradients on the condition that the same input、the same weight and the loss comparing with not doing this

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 running the provided ZeRO-2 reproduction with the optimizer parameters in one group and then in two groups, using the same input, weights, and loss. Compare the resulting gradients and trace the optimizer parameter-group handling to identify where they diverge. Done means the gradient discrepancy is resolved or its cause is isolated with a focused 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.