deepspeedai / deepspeedai/DeepSpeed

[REQUEST] Does sequence parallel need all-reduce for gradients before optimizer.step()?

Open
#4,548 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

Hi,
I am reading the implementation code of sequence parallelism recently and didn't find the all-reduce of gradients after backward finishes. Because the sequence is split to sub-sequences before fed into network, I wonder should there be an all-reduce for gradients before optimizer.step()? Similar to data parallelism?

In https://github.com/microsoft/Megatron-DeepSpeed/blob/main/megatron/training.py#L638:
dcf7a9afd4e5e0fdf6b759a6f490451

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 at the referenced megatron/training.py line 638 and trace sequence-parallel gradient handling through backward completion and optimizer.step(). Compare that path with data-parallel gradient synchronization; done means establishing whether an all-reduce is required and documenting the conclusion or identifying the implementation change needed.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.