deepspeedai / deepspeedai/DeepSpeed

[REQUEST] Confusion about communication time reduction when sequence length increases

Open
#4,441 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 had some tests on Sequence Parallel of Megatron-DeepSpeed. When I fix all other hyperparameters (gpt350m, sp=8, dp=pp=tp=1, flash_attn=True, activation_ckpt=True) and only increase the sequence length, the results confuse me a lot.

  1. When use flash_attn, why are the all2all communication portion and its wall-clock time decrease when seq length increases? Does Flash Attention also help to reduce communication?

  2. When seq length=16k/32k, why turning on flash_attn even increases the communication time?

Testbed: Server with 8 A100 GPUs (80GB) with NVLink and 200Gbps InfiniBand. Some test results are below:

seq length flash_attn activation_ckpt ncclKernel_SendRecv Portion ncclKernel_SendRecv Time
16k True True 61.2% 111.4ms
16k False True 8.3% 52.1ms
32k True True 44.6% 106.8ms
32k False True 1.1% 67.4ms
40k True True 23.4% 58ms

I used the PyTorch Profiler with Tensorboard to get the above results.
image

Thanks for your time!

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 reproducing the reported sequence-parallel measurements with the listed Megatron-DeepSpeed settings and PyTorch Profiler/Tensorboard, then investigate the communication timing across sequence lengths and Flash Attention modes. Done means providing a supported explanation of the observed results.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning, performance
Issue type
Documentation
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.