feat(recipe): 新增 Qwen3-8B ReMax FSDP 昇腾训练脚本 - #100
Open
yukinotech wants to merge 2 commits into
Open
Conversation
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: yukinotech <yukinotech@gmail.com>
8 tasks
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: yukinotech <yukinotech@gmail.com>
yukinotech
marked this pull request as ready for review
August 31, 2026 11:23
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.
这个 PR 做了什么?
为昇腾 Atlas 800T A2/A3 平台补充 Qwen3-8B + ReMax + FSDP 训练脚本,并使用 verl 原生的 vLLM-Ascend 推理后端。该脚本是 verl 主仓库
examples/remax_trainer/run_qwen3_8b_fsdp.sh的昇腾版本。ReMax 对每个 prompt 既需要采样 rollout,也需要一个 greedy baseline。verl 主仓库已经通过 verl #6308 引入的内部
__do_sample__覆盖机制,将二者合并到同一个 agent-loop/vLLM 请求中。该流程与具体推理后端无关,可以直接在 vLLM-Ascend 上工作,因此本 PR 仅补充昇腾平台的启动和调优配置。新增的
remax/run_qwen3_8b_remax_fsdp_npu.sh包含以下配置:NPU 环境变量调优、trainer.device=npu、关闭 actor/reference 的 torch compile、针对 64 GB 显存设备启用参数和优化器 offload、使用较保守的 rollout 显存配置,以及开启 ACL Graph decode 加速。测试与性能报告
验证环境为 Atlas 800T A2,8 x Ascend 910B3 64 GB,CANN 25.5.1、torch_npu 2.9.0.post2、vLLM 0.18、vLLM-Ascend 0.18.1.dev41 和 transformers 5.3.0.dev0。
reward_kl_penalty和critic/advantages指标确认进入 ReMax advantage 计算流程;server 日志确认 greedy baseline 请求使用temperature=0。n=4、学习率1e-6和kl_coef=1e-3,在约 2 小时 25 分钟内完成 60 个 step。critic/score/mean从 step 1 的约 0.26 上升到 0.60-0.76 区间,最高达到 0.764。perf/throughput平均约为 381 tokens/s,范围为 337-425 tokens/s。response length 2048 的压力测试完成 3 个 step,未出现 OOM,吞吐为 343-411 tokens/s。bash -n remax/run_qwen3_8b_remax_fsdp_npu.sh、git diff --check和针对改动文件的 pre-commit 检查均已通过。Reward 曲线(
critic/rewards/mean):实测吞吐超过任务 Issue 要求的 100 tokens/s,reward 也呈现明显上升趋势。目前已有的 60-step 记录尚未单独满足 Issue 中“100 step 或 12 小时”的时长要求;如后续取得更长时间的验证日志,可以继续补充到任务 Issue。
使用方法
首先在 verl 主仓库中准备默认的 GSM8K 和 MATH 数据集:
然后在 verl 主仓库根目录运行 recipe:
MODEL_PATH=/data/models/Qwen3-8B \ bash /path/to/verl-ascend-recipe/remax/run_qwen3_8b_remax_fsdp_npu.sh \ 'trainer.logger=["console"]'脚本支持通过环境变量覆盖主要参数,也会继续向 verl 转发额外的 Hydra 参数:
设计与代码改动
本次属于配置级适配。参数和优化器 offload 会引入少量 HBM 与 CPU 之间的数据传输开销,但能够在 64 GB 显存设备上为同机部署的 vLLM-Ascend rollout engine 留出安全余量。ReMax 会同时生成采样 response 和 greedy baseline,因此 rollout 显存峰值高于普通 PPO 或 GRPO。对于显存更大的昇腾设备,可以重新调整 offload 和 rollout 显存参数,在显存余量与吞吐之间进行权衡。
AI 辅助说明
本次迁移使用了 AI 辅助,包括迁移已经验证过的脚本、执行本地检查,以及将原 PR 的性能报告和使用说明调整到当前仓库。人工提交者已审阅本次贡献,并对理解、测试和维护全部改动负责。
Closes #23