Skip to content

Add expert-parallelism example: SFT of 100B-753B MoE models - #6869

Draft
qgallouedec wants to merge 17 commits into
mainfrom
sft-moe-expert-parallel-example
Draft

Add expert-parallelism example: SFT of 100B-753B MoE models#6869
qgallouedec wants to merge 17 commits into
mainfrom
sft-moe-expert-parallel-example

Conversation

@qgallouedec

@qgallouedec qgallouedec commented Aug 22, 2026

Copy link
Copy Markdown
Member

Companion to #6846's 1M-context example, for the other axis: model size. Two things:

  • a "Training MoE Models at the 100B–753B Scale" section in docs/source/distributing_training.md: expert parallelism via DistributedConfig(tp_size=E, fsdp_size=D, enable_expert_parallel=True), the verified configurations, and what to expect operationally (loading, saving, memory);
  • examples/sft_glm_4_5_air_full_finetune/ (110B, every parameter) and examples/sft_glm_5_2_expert_parallel/ (753B, LoRA): one folder per training, each with a fixed-config script and its SLURM launcher.

Measured

H100 nodes, seq 2048, bf16, per-device batch 1, default chunked_nll loss, gradient checkpointing:

(Step times are update cadence, not 64-GPU throughput: the expert-parallel group shares one batch, so an ep=32 x fsdp=2 step processes 2 sequences / ~4k tokens.)

Model Training GPUs Config Step time Peak GPU memory
Qwen3-30B-A3B full FT 8 (1 node) ep=8 0.9 s 34 GB
GLM-4.5-Air (110B) full FT 64 (8 nodes) ep=32 × fsdp=2 3.7 s 41 GB
GLM-4.6 (357B) LoRA 16 (2 nodes) ep=16 4.4 s 73 GB
GLM-5.2 (753B) LoRA 64 (8 nodes) ep=32 × fsdp=2 3.1 s 56 GB

Real training, not just "it fits": GLM-5.2 loss 3.3 → 2.3 in 50 steps on tulu-3; Air full FT 3.35 → 2.13 in 20 steps, including the full 206 GiB model save.

image

Assumptions

The example needs branches that have not landed yet:

Until they do, install:

pip install git+https://github.com/huggingface/transformers@ep-fsdp-2d-mesh
pip install git+https://github.com/huggingface/accelerate@fsdp2-ep-integration
pip install git+https://github.com/huggingface/peft@fsdp2-dtensor-fixes

TRL itself needs nothing beyond main. Draft until the branches above land or the install block is confirmed.

Runnable example + docs section for training GLM-4.5-Air (110B, full FT)
through GLM-5.2 (753B, LoRA) with TRL's SFTTrainer via
DistributedConfig(tp_size=E, fsdp_size=D, enable_expert_parallel=True).
Split the combined example into examples/sft_glm_5_2_expert_parallel
(753B, LoRA) and examples/sft_glm_4_5_air_full_finetune (110B, full
fine-tuning), each with a fixed-config script and its SLURM launcher.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant