Skip to content

feat(recipe): add MiMo-7B MTP Megatron SGLang NPU recipe - #87

Open
RordChang wants to merge 2 commits into
verl-project:mainfrom
RordChang:feat/mtp-megatron-sglang-ascend-recipe
Open

feat(recipe): add MiMo-7B MTP Megatron SGLang NPU recipe#87
RordChang wants to merge 2 commits into
verl-project:mainfrom
RordChang:feat/mtp-megatron-sglang-ascend-recipe

Conversation

@RordChang

@RordChang RordChang commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

交付内容

  • verl_ascend_practice 中新增 MiMo-7B-RL MTP Ascend recipe。
  • 训练侧使用 Megatron + MBridge,rollout 侧使用 SGLang-Ascend。
  • 按 maintainer 意见复用 verl 现有的通用 HCCLCheckpointEngine,不新增 SGLang 专用 checkpoint engine。
  • 提供一个最小 verl patch:启用参数 offload 时,在 checkpoint-engine 权重同步完成后将 actor 参数重新 offload 到 CPU。
  • 默认提供 4 NPU、100 steps、checkpoint/resume 和时间戳日志配置。

关联任务:#20

关键配置

actor_rollout_ref.model.mtp.enable=True
actor_rollout_ref.model.mtp.enable_train=True
actor_rollout_ref.model.mtp.enable_rollout=False
actor_rollout_ref.model.mtp.mtp_loss_scaling_factor=0.1
actor_rollout_ref.rollout.name=sglang
actor_rollout_ref.rollout.checkpoint_engine.backend=nccl
model_engine=megatron

下载 XiaomiMiMo/MiMo-7B-RL 后,将模型 config.json 中的 max_position_embeddings 设为 32768。数据目录应包含:

/path/to/math/train.parquet
/path/to/math/test.parquet

运行方式:

cd /path/to/verl
git apply /path/to/verl-ascend-recipe/verl_ascend_practice/patches/mtp_checkpoint_engine_reoffload.patch

DEVICE=npu \
MODEL_PATH=/path/to/MiMo-7B-RL \
DATA_ROOT=/path/to/math \
NPUS_PER_NODE=4 \
TOTAL_TRAINING_STEPS=100 \
bash /path/to/verl-ascend-recipe/verl_ascend_practice/run_mimo_7b_mtp_megatron_npu.sh

脚本允许通过环境变量调整模型、数据、并行度、batch、序列长度、MTP loss scaling、checkpoint 和日志目录,也允许在命令末尾追加 Hydra overrides。

实验结果

环境:Atlas 800T A2,4 x Ascend 910B;CANN 9.0、Python 3.11.15、torch/torch-npu 2.8、SGLang 0.5.10、Megatron Core/MindSpeed 0.16.0、MBridge 0.15.1。

指标 结果
连续训练步数 100 / 100
reward 前 10 步均值 -0.8080
reward 后 10 步均值 0.0891
reward 变化 +0.8971
MTP loss 前 10 步均值 0.5979
MTP loss 后 10 步均值 0.3559
四卡端到端吞吐 533.3 token/s
四卡稳态吞吐 801.9 token/s

完整训练日志:training_100step.log

检查

  • bash -n verl_ascend_practice/run_mimo_7b_mtp_megatron_npu.sh
  • git diff --check upstream/main...HEAD
  • git apply --check verl_ascend_practice/patches/mtp_checkpoint_engine_reoffload.patch(在 verl main 工作树执行)

This contribution was developed with assistance from OpenAI Codex. The human submitter remains responsible for review and submission.

Closes #20

Signed-off-by: RordChang <13223981771@163.com>
Copilot AI lite review requested due to automatic review settings August 20, 2026 12:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This change was developed with assistance from OpenAI Codex.

Signed-off-by: RordChang <13223981771@163.com>
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.

[社区任务7] 基于Megatron+sglang完成MiMo-7B-的MTP训练

2 participants