deepspeedai / deepspeedai/DeepSpeed
[REQUEST] Support for Expert Optimizer State Partitioning with ZeRO Optimization in DeepSpeed MoE
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 43.1k
- Forks
- 5k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 112
Description
Is your feature request related to a problem? Please describe.
I am currently training a Transformer model using DeepSpeed's MoE (Mixture of Experts) layer. After enabling Expert Parallelism (EP) and ZeRO-2 optimization, the total activation size of the experts is 2B, and the total parameter count is 6B. Since the expert parameters account for the majority of the parameters (5B), while the shared parameters are minimal, I observed that the memory usage reduction after enabling ZeRO-2 is not significant. From my understanding, as mentioned in the DeepSpeed MoE documentation, in the EP + ZeRO-2 setup, only the gradients and optimizer states of non-expert parameters are partitioned, while the gradients and optimizer states of the MoE layer are not optimized. This results in a substantial memory overhead. As a comparison, I tested the training of a non-MoE 2B model. With almost the same activation size, the non-MoE model can use a batch size 6-7 times larger than the MoE model, and it also trains faster. Are there any plans to optimize the memory consumption of DeepSpeed MoE in the future? Alternatively, do you have any suggestions to help optimize the training process for my model?
Describe the solution you'd like
A clear and concise description of what you want to happen.
I would like DeepSpeed to extend ZeRO optimization to the MoE layer parameters, enabling more efficient memory usage and allowing the training of larger models with MoE architectures.
Describe alternatives you've considered
Enable zero optimization in Deepspeed moe layer parameters so that we can train larger model.
Additional context
Add any other context or screenshots about the feature request here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no implementation files, tests, or entry points. Start with the DeepSpeed MoE documentation and the described EP + ZeRO-2 behavior, then identify where expert parameters, gradients, and optimizer states are handled. Done means expert-layer state partitioning works without breaking distributed training and its memory benefit is validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- 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