[megatron, sglang, ckpt, recipe] feat: add MiMo-7B MTP training on Ascend - #7446
Closed
RordChang wants to merge 2 commits into
Closed
[megatron, sglang, ckpt, recipe] feat: add MiMo-7B MTP training on Ascend#7446RordChang wants to merge 2 commits into
RordChang wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an Ascend NPU synchronous MiMo-7B MTP training path that performs direct Megatron→SGLang weight updates via paired HCCL process groups, plus CPU-side unit tests and documentation/recipe updates to support the new backend.
Changes:
- Introduces the
sglang_hcclcheckpoint engine + a dedicated manager to build persistent paired (2-rank) HCCL groups and stream full HF-keyed tensors in bounded buckets. - Updates the actor worker weight-update path to re-offload parameters to CPU after non-naive checkpoint sync when parameter offload is enabled.
- Extends the canonical MiMo-7B MTP Megatron launcher + docs to support
DEVICE=npu, and adds CPU tests for bucketing/topology/HTTP error handling and global-step propagation.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| verl/workers/engine_workers.py | Re-offloads actor parameters after checkpoint-engine sync when param offload is enabled. |
| verl/checkpoint_engine/sglang_hccl_checkpoint_engine.py | Adds direct paired HCCL Megatron→SGLang weight sync engine + custom manager. |
| verl/checkpoint_engine/README.md | Documents the new sglang_hccl backend in the supported backends table. |
| verl/checkpoint_engine/init.py | Exposes the new engine and manager from the checkpoint engine package. |
| tests/checkpoint_engine/test_sglang_hccl_on_cpu.py | Adds CPU unit tests for bucketing, derangement mapping, HTTP handling, and group setup wiring. |
| tests/checkpoint_engine/test_global_steps_on_cpu.py | Adds CPU coverage for param re-offload after checkpoint-engine send. |
| examples/mtp_trainer/run_mimo_7b_mtp_megatron.sh | Extends the canonical MiMo-7B MTP launcher with Ascend mode and HCCL sync configuration. |
| examples/mtp_trainer/README.md | Documents how to run the Ascend synchronous training mode via DEVICE=npu. |
| docs/advance/mtp.md | Updates MTP dependency guidance for SGLang and Megatron-Bridge references. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
755
to
+759
| return metrics or {} | ||
| per_tensor_param, _ = self.actor.engine.get_per_tensor_param() | ||
| metrics = await self.checkpoint_engine.send_weights(per_tensor_param, global_steps=global_steps) | ||
| if self.actor.engine.is_param_offload_enabled: | ||
| self.actor.engine.to("cpu", model=True, optimizer=False, grad=False) |
Comment on lines
+231
to
+237
| elapsed = time.monotonic() - started | ||
| print( | ||
| "SGLang direct HCCL weight sync complete: " | ||
| f"step={global_steps}, tensors={tensor_count}, buckets={bucket_count}, " | ||
| f"bytes={total_bytes}, seconds={elapsed:.3f}", | ||
| flush=True, | ||
| ) |
Comment on lines
+329
to
+335
| ray.get(init_refs) | ||
| self._group_initialized = True | ||
| print( | ||
| "SGLang direct HCCL groups initialized: " | ||
| f"groups={trainer_world_size}, world_size_per_group=2, backend={self.process_group_backend}", | ||
| flush=True, | ||
| ) |
| |naive|torch.distributed|all_gather|NVIDIA/AMD/Ascend|Very High|NA|On-policy training<br>- Actor/rollout colocated | ||
| |nccl|NCCL|all_gather+broadcast|NVIDIA GPU & NCCL|Very High|Low: rebuild nccl group|Off-policy training<br>- Actor/rollout disaggregated<br>- Fixed clusters | ||
| |hccl|HCCL|all_gather+broadcast|Ascend NPU & HCCL| High|Low: rebuild hccl group|Off-policy training<br>- Actor/rollout disaggregated<br>- Fixed clusters | ||
| |sglang_hccl|HCCL|paired broadcast into SGLang|Ascend NPU & HCCL|High|Low: rebuild paired groups|On-policy training<br>- Actor/SGLang colocated<br>- Rollout TP 1 |
…cend Signed-off-by: RordChang <13223981771@163.com>
Remove test-only changes following reviewer feedback while retaining the reported validation results in the PR description. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: RordChang <13223981771@163.com>
RordChang
force-pushed
the
feat/mtp-megatron-sglang-ascend
branch
from
August 19, 2026 04:35
3422425 to
3bee0f8
Compare
wucong25
reviewed
Aug 19, 2026
| @@ -0,0 +1,345 @@ | |||
| # Copyright (c) 2026 Huawei Technologies Co., Ltd. All Rights Reserved. | |||
Collaborator
There was a problem hiding this comment.
hccl checkpoint engine的设计是和推理后端无关的,这里单独写了一个sglang的hccl checkpoint engine,建议复用原来的hccl checkpoint engine
Collaborator
|
统一先提到verl-ascend-recipe:verl-ascend-recipe哈,此pr暂时关闭 |
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.
What does this PR do?
Adds MiMo-7B-RL MTP training on Ascend NPU with Megatron/MindSpeed for training, SGLang for rollout, and direct HCCL weight synchronization between the two sides.
sglang_hcclcheckpoint engine for direct Megatron-to-SGLang weight updates.Related task: verl-project/verl-ascend-recipe#20
Checklist Before Starting
[{modules}] {type}: {description}.Test
pre-commit run --all-files --show-diff-on-failure --color=always: all hooks passed.bash -n examples/mtp_trainer/run_mimo_7b_mtp_megatron.sh: passed.Experiment Results
Platform: 4 x Ascend 910B.
At step 100, each SGLang replica received 451 tensors in 12 buckets (15.67 GB) in 1.32-1.37 seconds; checkpoint tracking reached step 100.
Full redacted 100-step training log:
training_100step_sanitized.log
API and Usage Example
DATA_ROOTshould containtrain.parquetandtest.parquet. Additional Hydra overrides can be appended to the command.The recipe trains the MTP auxiliary head (
enable_train=True) while SGLang performs rollout; rollout-side MTP acceleration remains disabled for this training configuration.Design & Code Changes
SGLangHCCLCheckpointEngineprepares per-pair HCCL endpoints and streams complete named tensors without splitting a model parameter.SGLangHCCLCheckpointEngineManagerbuilds a cyclic derangement between trainer ranks and rollout replicas, initializes the SGLang update groups, and coordinates memory/generation state.ActorRolloutRefWorker.update_weightsreturns offloaded actors to CPU after checkpoint-engine synchronization when parameter offload is enabled.sglang_hcclonly forDEVICE=npu; existing CUDA behavior remains unchanged.Checklist Before Submitting
pre-commit install && pre-commit run --all-files --show-diff-on-failure --color=always.ci-requestchannel or the Feishu group.recipesubmodule is not changed, so no submodule reference update is required.AI assistance disclosure: AI tools assisted with implementation, validation, and documentation preparation. The author reviewed the complete diff and takes responsibility for the submission.