Skip to content

[muse_spark] Remove the unused moe_comm_backend parameter - #6031

Merged
fegin merged 1 commit into
mainfrom
fegin/stack/33
Nov 12, 2026
Merged

fegin merged 1 commit into
mainfrom
fegin/stack/33

Conversation

@fegin

@fegin fegin commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

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_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.

@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
@github-actions
github-actions Bot requested a review from pzhan9 November 11, 2026 18:23
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 11, 2026
@fegin
fegin marked this pull request as draft November 11, 2026 18:24
@fegin
fegin changed the base branch from fegin/stack/32 to main November 11, 2026 18:24
@pytorch-bot pytorch-bot Bot removed the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
@fegin
fegin changed the base branch from main to fegin/stack/32 November 11, 2026 18:24
@fegin
fegin marked this pull request as ready for review November 11, 2026 18:24
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
@fegin

fegin commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

@claude review this PR

@claude

claude Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @fegin's task in 41s —— View job


Verdict: Approve -- review posted: no other code reads moe_comm_backend, and every caller is updated.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_backend at HEAD finds nothing, so no recipe, test, README or RL caller is left behind. The DAPO recipe passes keyword arguments through build_rl_model_configs(build_muse_spark_model_config, ...), so removing the keyword there is enough.
  • Numerics: no change. The argument only fed a ValueError check and nothing downstream used it.
  • config.comm_backend = "standard" in torchtitan/experiments/transformers_modeling_backend/.claude/skills/add_moe_model/scripts/ belongs to a different model config and is outside this PR's scope.

@fegin
fegin marked this pull request as draft November 11, 2026 22:14
@fegin
fegin changed the base branch from fegin/stack/32 to main November 11, 2026 22:14
@pytorch-bot pytorch-bot Bot removed the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
@fegin
fegin changed the base branch from main to fegin/stack/32 November 11, 2026 22:14
@fegin
fegin marked this pull request as ready for review November 11, 2026 22:15
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
@fegin
fegin marked this pull request as draft November 11, 2026 22:19
@fegin
fegin changed the base branch from fegin/stack/32 to main November 11, 2026 22:19
@pytorch-bot pytorch-bot Bot removed the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
@fegin
fegin changed the base branch from main to fegin/stack/32 November 11, 2026 22:19
@fegin
fegin marked this pull request as ready for review November 11, 2026 22:19
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
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
fegin changed the base branch from fegin/stack/32 to main November 11, 2026 22:25
## 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
fegin marked this pull request as draft November 11, 2026 23:14
@pytorch-bot pytorch-bot Bot removed the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
@fegin
fegin marked this pull request as ready for review November 11, 2026 23:15
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
@fegin
fegin merged commit 1568307 into main Nov 12, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/fake-pg Run 1-GPU Fake PG integration tests CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants