Add expert-parallelism example: SFT of 100B-753B MoE models - #6869
Draft
qgallouedec wants to merge 17 commits into
Draft
Add expert-parallelism example: SFT of 100B-753B MoE models#6869qgallouedec wants to merge 17 commits into
qgallouedec wants to merge 17 commits into
Conversation
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.
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.
Companion to #6846's 1M-context example, for the other axis: model size. Two things:
docs/source/distributing_training.md: expert parallelism viaDistributedConfig(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) andexamples/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_nllloss, gradient checkpointing:(Step times are update cadence, not 64-GPU throughput: the expert-parallel group shares one batch, so an
ep=32 x fsdp=2step processes 2 sequences / ~4k tokens.)ep=8ep=32 × fsdp=2ep=16ep=32 × fsdp=2Real 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.
Assumptions
The example needs branches that have not landed yet:
Until they do, install:
TRL itself needs nothing beyond main. Draft until the branches above land or the install block is confirmed.