Repository navigation
Conversation
yulangz
requested review from
CormickKneey,
HwVanICI,
Le8r0nJames,
PrometheusComing,
daihaowz,
fishcrap,
garrett4wade,
geshi001 and
sitabulaixizawaluduo
as code owners
November 6, 2026 04:26
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
yulangz
changed the base branch from
sync/muon-weftmoe-main
to
feature/muon-optimizer-offload
November 6, 2026 06:10
This was referenced Nov 6, 2026
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.
Superseded by two focused PRs:
main: common WeftMoE integration, staged AdamW, AWEX/SGLang, and experiment screenshots.feature/muon-optimizer-offload: only the optional Muon writer/master hooks and associated tests/documentation.The replacement branches merge automatically and passed single-node 8-GPU AdamW/Muon BF16/FP8 adapter checks. Original description and review history are retained below.
Description
Integrate WeftMoE into AReaL's v1 colocated Megatron/SGLang path. Add a DAPO-Math launch script and configuration for baseline, WeftMoE BF16, and WeftMoE blockwise FP8.
The supported FP8 configuration uses CPU-staged Muon or AdamW, expert DP=1, and expert TP=1. AdamW requires distributed and precision-aware optimization and the matching WeftMoE #6. Each expert matrix must fit in one staging slot; the writer consumes the updated complete GPU FP32 matrix before that slot is recycled. DTE and v2 FP8 weight transfer are outside this PR.
AdamW support adds a master-writer callback, preserves whole selected matrices when building staging units, and skips BF16 parameter offload/reload for FP8-managed expert buffers in both extended and fallback buffer APIs. The optimizer update formula is unchanged. The example README includes the AdamW overrides; the supplied screenshots remain Muon runs.
Related Issue
Depends on #1743 (CPU-staged Muon), whose branch now includes
mainatde8ae341.This PR targets
feature/muon-optimizer-offloadand includes its updated tip386337dfas an ancestor. The Files changed tab now contains only the integration:22 files, 1,447 additions, 34 deletions, including the three supplied screenshots.
The lockfiles match the Muon base; unrelated package-index and dependency changes
have been removed.
After #1743 merges into
main, rebase/clean and retarget this PR tomain.The Muon branch itself was not changed by this cleanup.
Type of Change
Validation
The following tests ran with the existing Muon-capable Megatron environment: 247 passed, 2 skipped. The two skips are pre-existing async-save metric tests marked skipped for fixture isolation; CUDA IPC and GPU Muon tests ran.
Also loaded all three variant configurations and the 8K/65536-token override, checking actor/rollout flags and baseline dispatcher selection. Tests cover FP32 master callbacks with released BF16 storage, weight/scale mapping and IPC, receive-buffer rebinding across repeated updates, failed-transfer publication ordering, and non-flat storage restoration.
Also validated all three AdamW launch configurations. With the matching WeftMoE #6 code, single-node 8-GPU Megatron tests passed for staged AdamW BF16, staged AdamW FP8, staged AdamW FP8 with fallback buffer residency, and the Muon FP8 regression (TP2/EP8; two layers; hidden 3072, intermediate 1024, 256 experts, top-k 8, 128 tokens/rank; two optimizer updates and full recomputation). The tests check zero BF16 expert storage, exact FP8 W/W-transpose bytes, offload/reload, and ordinary BF16 updates after adapter close. WeftMoE lifecycle/validation unit tests: 22 passed.
Checkpoint checks cover inner AdamW master/m/v state restoration and BF16 model materialization, not a full Megatron distributed-checkpoint roundtrip. No new full-model or multi-node RL run was launched for the rebased PR. The screenshots below are from the previously recorded experiments, not a new run of this commit.
Checklist
pre-commit run --all-files)386337dfandmainatde8ae341create-prExperiment screenshots
All comparisons use DAPO-Math-17k, train split, GRPO, 32 prompts × 16 completions, temperature 1.0, top-p 1.0, and Muon CPU offload with learning rate 1e-6. Each run uses one node with 8× NVIDIA L20X (SM90, approximately 140 GiB/card). Training uses TP2 × DP4, EP8, ETP1, CP1, PP1, BF16 model parameters, and full-layer recomputation. No speculative decoding or MTP training is enabled.
The plots show token counters, task reward, update log-probability differences, and rollout/training/weight-update timers. The two 16K screenshots also include estimated training FLOPs/s. Baseline uses native Megatron Flex/DeepEP and native SGLang MoE; the other curves use WeftMoE BF16 or FP8 routed experts.
1. Qwen3.5-35B-A3B-Base — 8K
2. Qwen3.5-35B-A3B-Base — 16K
3. Qwen3.5-122B-A10B — 16K