moe-training

Train large-scale Mixture of Experts models with DeepSpeed or HuggingFace.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/hhhi21g/HealthCenter --skill moe-training-hhhi21g
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moe-training
Source: https://github.com/hhhi21g/HealthCenter/tree/main/.codex/skills/moe-training
Command: npx skills add https://github.com/hhhi21g/HealthCenter --skill moe-training-hhhi21g

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires deepspeed, transformers, torch, accelerate, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill allows you to train Mixture of Experts (MoE) models efficiently with limited compute resources, enabling you to scale model capacity without proportional increases in computation.

Core Features & Use Cases

  • Large-scale Model Training: Efficiently train models with deepspeed and transformers libraries.
  • Sparse Architectures: Implement sparse architectures like Mixtral 8x7B or DeepSeek-V3.
  • Routing Mechanisms: Explore MoE architectures, routing mechanisms, load balancing, and inference optimization.
  • Use Case: If you are working with large-scale language models and need to achieve better performance per compute budget than dense models, this skill is for you.

Quick Start

Use the moe-training skill to train a MoE model with the following configuration:

python train_moe.py \
  --num-layers 24 \
  --hidden-size 1024 \
  --num-attention-heads 16 \
  --seq-length 2048 \
  --max-position-embeddings 2048 \
  --micro-batch-size 4 \
  --global-batch-size 256 \
  --train-iters 500000 \
  --lr 0.0001 \
  --min-lr 0.00001 \
  --lr-decay-style cosine \
  --num-experts 128 \
  --moe-expert-parallel-size 4 \
  --moe-loss-coeff 0.01 \
  --moe-train-capacity-factor 1.25 \
  --moe-eval-capacity-factor 2.0 \
  --fp16

Frequently Asked Questions about moe-training

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I train Mixture of Experts models with limited compute resources?

Train Mixture of Experts models with limited compute by using DeepSpeed and HuggingFace transformers to scale model capacity without proportional increases in computation. This skill implements sparse architectures and expert parallelism to optimize training efficiency.

What is the best way to implement sparse architectures like Mixtral 8x7B?

Implement sparse architectures like Mixtral 8x7B or DeepSeek-V3 by configuring MoE routing mechanisms, load balancing, and expert parallelism using the integrated deepspeed and transformers libraries for efficient large-scale model training.

Does DeepSpeed work with HuggingFace transformers for MoE training?

DeepSpeed works with HuggingFace transformers for MoE training, providing the necessary infrastructure for expert parallelism, load balancing, and capacity factor optimization alongside torch and accelerate dependencies.

How do I configure load balancing and routing mechanisms for large-scale MoE models?

Configure load balancing and routing mechanisms for large-scale MoE models by setting parameters like moe-loss-coeff, moe-train-capacity-factor, and moe-expert-parallel-size in your training script to optimize expert utilization and inference performance.

What are the limitations of training MoE models compared to dense models?

Training MoE models compared to dense models requires careful tuning of routing mechanisms and load balancing to prevent expert underutilization, though it achieves better performance per compute budget by activating only a subset of parameters during inference.