Skip to content

Performance improvements and optimizer fixes - #467

Open
gbesposito wants to merge 3 commits into
moefrom
moe_fixes
Open

gbesposito wants to merge 3 commits into
moefrom
moe_fixes

Conversation

@gbesposito

Copy link
Copy Markdown
Collaborator

What does this PR do?

This PR fixes and speeds up the EP integration for MoE models

General Changes

  • Device mesh: EP folded into dp_shard; expert mesh (efsdp, ep) built via _unflatten; EP + TP/PP/CP rejected for now.
  • FSDP: experts FSDP-sharded with the correct gradient divide factor, fp32 master weights and explicit prefetching.
  • Token dispatch and experts: a single host sync per layer and a GPU-side token permutation; grouped_mm expert backend).
  • MoE model: dropless routing by default; fixed capacity formula (now includes top_k) and expert init.
  • Global-batch load balancing
  • EPAdamW removed: standard AdamW with param groups split by mesh, a per-mesh gradient clipper, and the standard DCP path
  • MoE MFU Calculator (active params only) and a qwen_moe init group.

Breaking Changes

  • expert_parallel_degree now divides dp_shard instead of multiplying the world size.
  • ep_adam_w is removed; use adam_w.
  • The ep_wrapped component no longer takes mixed_precision_settings.
  • TransformerBlock.aux_loss is removed. MoECrossEntropyLoss takes device_mesh.
  • moe_capacity_factor defaults to None (dropless).
  • Use model_type: qwen_moe for init and the moe MFU calculator.

Checklist before submitting final PR

  • My PR is minimal and addresses one issue in isolation
  • [x ] I have merged the latest version of the target branch into this feature branch
  • [ x] I have reviewed my own code w.r.t. correct implementation, missing type hints, proper documentation, etc.
  • [x ] I have run a sample config for model training
  • [ x] I have checked that all tests run through (python tests/tests.py)
  • I have updated the internal changelog (CHANGELOG_DEV.md)

@gbesposito
gbesposito requested a review from rrutmann October 14, 2026 11:18

This branch has not been deployed

No deployments
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