Repository navigation
[muse_spark] Remove the unused moe_comm_backend parameter - #6031
Merged
Merged
Conversation
fegin
requested review from
acisseJZhong,
felipemello1,
shuhuayu,
tianyu-l and
wwwjn
as code owners
November 11, 2026 18:23
fegin
force-pushed
the
fegin/stack/33
branch
from
November 11, 2026 18:23
3b9abb5 to
1d62f6f
Compare
fegin
force-pushed
the
fegin/stack/32
branch
from
November 11, 2026 18:23
dd4c5e9 to
7fdf375
Compare
fegin
marked this pull request as draft
November 11, 2026 18:24
fegin
marked this pull request as ready for review
November 11, 2026 18:24
Contributor
Author
|
@claude review this PR |
Contributor
Contributor
There was a problem hiding this comment.
Verdict: Approve -- this removes a config knob that nothing reads, and it updates every caller.
What this PR does. Muse Spark's build_model_config took a moe_comm_backend: str = "standard" argument. The only thing that read it was a check that raised on any other value. This PR drops the argument from build_model_config, _debugmodel, _muse_spark_816b_a42b and _muse_spark_config, and from the 6 recipe call sites that passed "standard" explicitly. The token dispatcher is still chosen by config type (TokenDispatcherTransform), which is the convention in config.md.
Example.
# before
build_model_config("816B-A42B", parallelism=p, seq_len=s, moe_comm_backend="standard", attn_backend="flex")
# after
build_model_config("816B-A42B", parallelism=p, seq_len=s, attn_backend="flex")Details
- Callsite audit: searching the repo for
moe_comm_backendat HEAD finds nothing, so no recipe, test, README or RL caller is left behind. The DAPO recipe passes keyword arguments throughbuild_rl_model_configs(build_muse_spark_model_config, ...), so removing the keyword there is enough. - Numerics: no change. The argument only fed a
ValueErrorcheck and nothing downstream used it. config.comm_backend = "standard"intorchtitan/experiments/transformers_modeling_backend/.claude/skills/add_moe_model/scripts/belongs to a different model config and is outside this PR's scope.
tianyu-l
approved these changes
Nov 11, 2026
fegin
marked this pull request as draft
November 11, 2026 22:14
fegin
marked this pull request as ready for review
November 11, 2026 22:15
fegin
marked this pull request as draft
November 11, 2026 22:19
fegin
force-pushed
the
fegin/stack/33
branch
from
November 11, 2026 22:19
1d62f6f to
786e92e
Compare
fegin
marked this pull request as ready for review
November 11, 2026 22:19
fegin
added a commit
that referenced
this pull request
Nov 11, 2026
## Summary (human-written) Simplify the recipes by removing an unused argument, `moe_comm_backend`. ## Why Muse Spark's `build_model_config` takes `moe_comm_backend`, but the only accepted value is `"standard"`, and nothing reads it. No other model has this parameter. The token dispatcher is selected by config type (`TokenDispatcherTransform`), so this string is a dead knob. ## What changed - Mechanical: drop `moe_comm_backend` from Muse Spark flavors (`build_model_config`, `_debugmodel`, `_muse_spark_816b_a42b`, `_muse_spark_config`) and from every caller in `torchtitan_recipes/` (Muse Spark recipes, test recipes, the DAPO RL recipe, and the SLAKE SFT recipes). ## Numerics / performance No change. The parameter had one allowed value and no effect. ## Testing - `pytest tests/unit_tests/cpu --ignore=tests/unit_tests/cpu/quantization/test_quantization.py -k "dapo or muse"`: 190 passed, 2 skipped, 3 xfailed. - `pytest tests/rl/unit_tests/cpu/test_dapo_math.py tests/rl/unit_tests/cpu/test_model_defaults.py`: 23 passed, 3 skipped. `test_dapo_math.py` builds the Muse Spark DAPO recipe. - Building `muse_spark_816b_a42b_slake_lora_decoder_sft` and `muse_spark_816b_a42b_slake_lora_vision_decoder_sft` succeeds. `test_slake.py` does not build them. stack-info: PR: #6031, branch: fegin/stack/33
fegin
force-pushed
the
fegin/stack/33
branch
from
November 11, 2026 22:24
786e92e to
8a85662
Compare
## Summary (human-written) Simplify the recipes by removing an unused argument, `moe_comm_backend`. ## Why Muse Spark's `build_model_config` takes `moe_comm_backend`, but the only accepted value is `"standard"`, and nothing reads it. No other model has this parameter. The token dispatcher is selected by config type (`TokenDispatcherTransform`), so this string is a dead knob. ## What changed - Mechanical: drop `moe_comm_backend` from Muse Spark flavors (`build_model_config`, `_debugmodel`, `_muse_spark_816b_a42b`, `_muse_spark_config`) and from every caller in `torchtitan_recipes/` (Muse Spark recipes, test recipes, the DAPO RL recipe, and the SLAKE SFT recipes). ## Numerics / performance No change. The parameter had one allowed value and no effect. ## Testing - `pytest tests/unit_tests/cpu --ignore=tests/unit_tests/cpu/quantization/test_quantization.py -k "dapo or muse"`: 190 passed, 2 skipped, 3 xfailed. - `pytest tests/rl/unit_tests/cpu/test_dapo_math.py tests/rl/unit_tests/cpu/test_model_defaults.py`: 23 passed, 3 skipped. `test_dapo_math.py` builds the Muse Spark DAPO recipe. - Building `muse_spark_816b_a42b_slake_lora_decoder_sft` and `muse_spark_816b_a42b_slake_lora_vision_decoder_sft` succeeds. `test_slake.py` does not build them. stack-info: PR: #6031, branch: fegin/stack/33
fegin
marked this pull request as draft
November 11, 2026 23:14
fegin
force-pushed
the
fegin/stack/33
branch
from
November 11, 2026 23:14
8a85662 to
8b6d3db
Compare
fegin
marked this pull request as ready for review
November 11, 2026 23:15
fegin
added a commit
that referenced
this pull request
Nov 13, 2026
Stacked PRs: * __->__#6037 * #6032 * #6031 * #6030 --- --- --- ### [muse_spark] Support DeepEP expert parallelism ## Summary (human-written) As title. Enabling DeepEP for Muse Spark is trivial, performance is not verified though. ## Why `MuseSparkMoE.Config` rejects `DeepEPTokenDispatcher`, but nothing in Muse Spark needs that. The shared MoE code already supports DeepEP with an `output_postprocess`: - In training, DeepEP uses its compact, host-synced path. The routed rows match the received token counts, so there are no rows past the last expert offset, and the HybridEP mask from #6032 is not needed. - `RoutedExperts.forward` already applies the DeepEP routing scores after the postprocess, because Muse Spark's per-expert RMSNorm is nonlinear and must run first. DeepEP is the EP backend that `search_r1` uses for both its trainer and its CUDA-graphed generator (expand layout), so this should also unblock Muse Spark RL on Hopper. I have not run the generator's expand layout with Muse Spark. ## What changed - `MuseSparkMoE.Config` accepts `DeepEPTokenDispatcher`. `TorchAOTokenDispatcher` stays rejected. - `RoutedExperts.forward`: comment at the HybridEP mask gate on why DeepEP needs no mask. Training uses the compact layout, which has no rows past the last offset. The expand layout runs only without grad: `dispatch_tokens` forces the compact layout when grad is enabled, and the DeepEP kernel forbids backward in expand mode. - README: list DeepEP as supported, and add it to the CUDA graphs row: training needs graphs disabled. Note that DeepEP's combine kernel needs the MoE compressed dimension to be a multiple of 256. Add a TODO for the config-time check. The production flavors use 4096. `debugmodel` uses 128, so it cannot run with DeepEP. ## Alternatives considered - Add a `muse_spark_debugmodel_deepep` recipe and an integration test: `debugmodel` cannot run DeepEP (compressed dimension 128), and changing the debug flavor would change every Muse Spark debug run and golden loss. - Validate the hidden size in `DeepEPTokenDispatcher.Config`: today a bad size fails at the first forward with DeepEP's static assert ("Invalid hidden"). A config-time check belongs to DeepEP in shared code, so it is left for a separate PR. ## Numerics Muse Spark debug model with compressed dimension 256 (a local config change, see above), FSDP2 + TP2 (SP) + EP2 on 4x H100, seed 42, deterministic, 20 steps: | Step | AllToAll | DeepEP | | --- | --- | --- | | 1 | 7.75888 | 7.75888 | | 2 | 6.82995 | 6.83072 | | 10 | 4.81295 | 4.81803 | | 20 | 4.40471 | 4.39651 | Average over 20 steps: 5.18424 vs 5.18254. Step 1 matches. Later steps differ by the combine kernels' summation order, with no consistent sign. One-off unit check, the AllToAll comparison from the HybridEP tests run with DeepEP and an RMSNorm postprocess (2x H100): loss, input grad, and router, W13, W2, and norm weight grads match AllToAll within relative error 4.7e-3, below the 1.56e-2 bound. Loss and the expert and norm weight grads are bitwise equal. ## Performance Not reported. DeepEP's expected benefit is multi-node communication, and I only have single-node H100 runs, which would not show it. ## Testing - `pytest tests/unit_tests/gpu/distributed/test_deepep_activation_checkpoint.py -k DeepEP` with DeepEP v2 at the CI pin 01dc3aa: 2 passed. These tests already run with an RMSNorm postprocess and check the score order against a reference. - Muse Spark debugmodel with compressed_dim 256, FSDP2 + Ulysses CP2 + EP4 (4x H100), seed 42, deterministic, 20 steps. Loss at steps 1 / 10 / 20: DeepEP 7.74766 / 4.80887 / 4.40117, AllToAll 7.74766 / 4.80533 / 4.39565. - No new test. The existing DeepEP tests cover the postprocess path, and the unit check above was a one-off run. - `pytest tests/unit_tests/cpu/models/muse_spark tests/unit_tests/cpu/recipes/test_muse_spark.py`: 40 passed, 3 xfailed.
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.
Stacked PRs:
[muse_spark] Remove the unused moe_comm_backend parameter
Summary (human-written)
Simplify the recipes by removing an unused argument,
moe_comm_backend.Why
Muse Spark's
build_model_configtakesmoe_comm_backend, but the only accepted value is"standard", and nothing reads it. No other model has this parameter. The token dispatcher is selected by config type (TokenDispatcherTransform), so this string is a dead knob.What changed
moe_comm_backendfrom Muse Spark flavors (build_model_config,_debugmodel,_muse_spark_816b_a42b,_muse_spark_config) and from every caller intorchtitan_recipes/(Muse Spark recipes, test recipes, the DAPO RL recipe, and the SLAKE SFT recipes).Numerics / performance
No change. The parameter had one allowed value and no effect.
Testing
pytest tests/unit_tests/cpu --ignore=tests/unit_tests/cpu/quantization/test_quantization.py -k "dapo or muse": 190 passed, 2 skipped, 3 xfailed.pytest tests/rl/unit_tests/cpu/test_dapo_math.py tests/rl/unit_tests/cpu/test_model_defaults.py: 23 passed, 3 skipped.test_dapo_math.pybuilds the Muse Spark DAPO recipe.muse_spark_816b_a42b_slake_lora_decoder_sftandmuse_spark_816b_a42b_slake_lora_vision_decoder_sftsucceeds.test_slake.pydoes not build them.