moe-training

Train Mixture of Experts (MoE) models using DeepSpeed or HuggingFace. Use when training large-scale models with limited compute (5× cost reduction vs dense models), implementing sparse architectures like Mixtral 8x7B or DeepSeek-V3, or scaling model capacity without proportional compute increase. Co

By orchestra-research · 766 installs

npx skills add orchestra-research/ai-research-skills --skill moe-training

Source repository · Upstream listing

MoE Training: Mixture of Experts When to Use This Skill Use MoE Training when you need to: Train larger models with limited compute (5× cost reduction vs dense models) Scale model capacity without proportional compute increase Achieve better performance per compute budget than dense models Specialize experts for different domains/tasks/languages Reduce inference latency with sparse activation (only 13B/47B params active in Mixtral) Implement SOTA models like Mixtral 8x7B, DeepSeek V3, Switch Transformers Notable MoE Models : Mixtral 8x7B (Mistral AI), DeepSeek V3, Switch Transformers (Google), GLaM (Google), NLLB MoE (Meta) Installation Quick Start Basic MoE Architecture DeepSpeed MoE Training Core Concepts 1. MoE Architecture Key Components: Experts : Multiple specialized FFN networks (typically 8 128) Router/Gate : Learned network that selects which experts to use Top k Routing : Activate only k experts per token (k=1 or k=2) Load Balancing : Ensure even expert utilization 2. Routing Mechanisms Top 1 Routing (Switch Transformer): Top 2 Routing (Mixtral): Expert Choice Routing: 3. Load Balancing Auxiliary Loss: Router Z Loss (Stability): 4. Expert Parallelism Training Configuration DeepSpeed MoE Config Training Script Advanced Patterns Mixtral 8x7B Architecture PR MoE (Pyramid Residual MoE) Best Practices 1. Expert Count Selection 2. Capacity Factor Tuning 3. Learning Rate Guidelines 4. Loss Coefficient Tuning 5. Avoid Common Pitfalls Inference Optimization Sparse Inference Resources DeepSpeed MoE Tutorial : https://www.deepspeed.ai/tutorials/mixture of experts nlg/ Mixtral Paper : https://arxiv.org/abs/2401.04088 Switch Transformers : https://arxiv.org/abs/2101.03961 HuggingFace MoE Guide : https://huggingface.co/blog/moe NVIDIA MoE Blog : https://developer.nvidia.com/blog/applying mixture of experts in llm architectures/ See Also references/architectures.md MoE model architectures (Mixtral, Switch, DeepSeek V3) references/training.md Advanced training techniques and optimization references/inference.md Production deployment and serving patterns