Tensor parallelism for Mixture of Experts#2074
Merged
siddharth9820 merged 55 commits intomasterfrom Aug 1, 2022
Merged
Conversation
Contributor
Author
awan-10
reviewed
Jul 15, 2022
awan-10
approved these changes
Jul 26, 2022
jeffra
reviewed
Jul 26, 2022
Collaborator
|
Let's add some functional unit tests to ensure the new code paths are triggered in our tests. This will ensure things are at least functionally working in the future. Would be great to have basic correctness unit tests as well but we can discuss that offline. |
Contributor
Author
|
@jeffra I have added some tests in |
jeffra
reviewed
Jul 29, 2022
jeffra
approved these changes
Jul 29, 2022
…ed into moe-tensor-parallelism
Hi, I tested the tensor parallelism for MoE, the loss curves still higher and then NAN after 600 millions of tokens |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Note: This PR is in conjunction with this PR on the Megatron-Deepspeed repo.
This PR adds tensor parallelism for non-experts. This combined with ZeRO-2 allows us to scale to roughly 2x larger base models than ZeRO-2. When tensor parallelism is enabled only for non-experts, there are duplicate tokens at each gate. It is important to drop the duplicates before they reach the experts, otherwise we run into convergence issues. In the current implementation, we drop tokens right before the AlltoAll and gather them right after the AlltoAll. These calls are done in
sharded_moe.pyUpdate: This PR now supports tensor parallelism for experts as well.