mindspore-ai / mindspore-ai/hyper-parallel
master中添加RL训推功能
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 53
- Forks
- 63
- Avg merge
- 23h 45m
- Merged PRs (30d)
- 63
Description
🚀 功能描述
希望在 HyperParallel master 中新增 Hyper-RL 同步强化学习训推功能,复用现有模型加载和分布式并行能力,结合 vLLM 推理引擎,打通采样、奖励计算、训练更新及权重同步流程。
本次主要支持:
- 模型:支持 Qwen3-4B dense 模型的训练与推理接入。
- 算法:支持 GRPO 和 PPO,提供 Actor、Reference、Critic 与 Rollout 角色及对应训练流程。
- 推理侧:
- Native-vLLM:使用 vLLM 原生 Qwen3 模型实现进行采样。
- Hyper-vLLM:将 Hyper 模型实现注册到 vLLM,复用 vLLM 的调度与推理服务能力。
- 训推权重同步:
- full_gather:训练侧聚合完整参数,由推理侧加载并按目标布局切分。
- direct_reshard:根据训练侧与推理侧的参数切分布局进行直接映射和传输。
- 支持训练更新后的策略发布,使后续采样使用更新后的模型权重。
现有替代方案
可以分别使用 HyperParallel 训练能力和 vLLM 推理能力,通过独立脚本组织强化学习流程。
但该方式需要自行维护模型接入、采样与训练编排、参数布局转换及权重同步逻辑,存在重复实现和维护成本。
希望将上述能力统一接入 master,提供可配置、可测试的训练与推理流程。
与DFX相关性DF
涉及训练与推理流程的可观测性和可靠性:
- 记录奖励、训练损失、梯度及采样和权重同步耗时。
- 检查权重发布状态,确保更新后的策略正确用于后续采样。
- 提供 checkpoint 保存与恢复能力。
- 对支持的 Hyper-vLLM 组合提供训推一致性检查。
- 补充异常退出与分布式资源清理的回归测试。
提议的新API
在 hyper_parallel/rl 中新增 RL 配置与训练入口,主要提供以下配置能力:
- 算法选择:GRPO / PPO。
- 模型配置:Qwen3-4B 模型路径及训练侧并行策略。
- 推理后端选择:Native-vLLM / Hyper-vLLM。
- 权重同步策略选择:full_gather / direct_reshard。
- 训练、采样、评估及 checkpoint 保存与恢复配置。
在 hyper_parallel/models/qwen3 中提供 Qwen3 模型接入及运行时适配,复用共享模型构建、FSDP 和 TP 能力。
具体配置字段及接口定义以实现和接口评审结果为准。
是否影响现有API
本次以新增 RL 功能和 Qwen3 模型适配为主,不计划删除或替换现有公共 API。
功能代码主要位于:
- hyper_parallel/rl/
- hyper_parallel/models/qwen3/
复用现有共享框架能力,不修改共享 core、platform 和 trainer 框架代码;相关兼容性通过回归测试验证。
补充信息
首阶段验证范围为单节点 Ascend NPU、Qwen3-4B 模型和 GSM8K 数据集,不将其他模型、异步训练或未测试的并行组合作为本次验收范围。
预期验收标准:
- GRPO/PPO 能完成采样、奖励计算、训练更新及策略发布。
- Native-vLLM 和 Hyper-vLLM 均能在对应支持配置下完成采样及权重更新。
- full_gather 和 direct_reshard 均能完成训推权重同步,后续采样使用更新后的策略。
- checkpoint 保存后能够恢复并继续训练。
- 提供对应 UT/ST、运行配置、使用文档及可追溯的测试结果。
schema_version: 1
source: gitcode
gitcode_repo: mindspore/hyper-parallel
gitcode_issue: 391
source_url: https://gitcode.com/mindspore/hyper-parallel/issues/391
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin by reviewing the existing shared model, FSDP, and TP capabilities, then inspect the proposed entry areas in hyper_parallel/rl/ and hyper_parallel/models/qwen3/. The first-stage completion target is the documented single-node Ascend NPU Qwen3-4B GSM8K flow, with GRPO/PPO, both vLLM modes, both weight-sync strategies, checkpoint recovery, and corresponding UT/ST, configuration, and usage documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100