deepspeedai / deepspeedai/DeepSpeed

[REQUEST] 🚀 Direct Correspondence between Gradient and Optimizer States to Reduce Communication?

Open
#4,582 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello DeepSpeed team,

First of all, I'd like to express my appreciation for the excellent work you've done with DeepSpeed. I've been diving deep into ZeRO optimization, specifically the communication analysis of $P_{os + g}$, in the paper , and I had an observation that I'd like to discuss.

Problem

In the current ZeRO $P_{os + g}$ optimization, after forward and backward propagation, the gradients are partitioned and a ReduceScatter operation is performed to ensure that each gradient corresponds to its respective Optimizer states/Parameters. Post this, we update the parameters and then perform an AllGather operation to distribute the updated parameters. This makes the communication volume $2\times \Psi$.

Thoughts and viewpoints

Considering we know the relationship between each gradient and its model parameter, and also between the model parameter and its optimizer state (like $m$ and $v$ for Adam), couldn't we establish a direct correspondence between the gradient and optimizer state during partitioning? (What I mean is to put the corresponding Gradient and Optimizer State in the same partition.) This way, we might be able to bypass the ReduceScatter operation, directly update the parameters, and then only need the AllGather operation, effectively reducing the communication volume to just $\Psi$.

End

I understand that my analysis might have oversights, and I'm aware that there could be underlying engineering constraints or other performance issues that might limit this optimization. I'd like to discuss with you whether my analysis might be correct under certain conditions, or if there are preprocessing steps that could make this idea feasible. Has there been any consideration in the current codebase regarding this? If not, may I ask why?

I'm very much looking forward to your response! ✨

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

No files, tests, or entry points are named. Start by tracing the current ZeRO P_os+g gradient partitioning, ReduceScatter, optimizer-state update, and AllGather flow; done would require establishing whether direct gradient-to-optimizer-state correspondence is feasible and defining an implementation plan.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.