alibaba/ROLL

GitHub: alibaba/ROLL

ROLL 是一个面向大语言模型的高效分布式强化学习扩展库,旨在利用大规模 GPU 资源加速 LLM 的对齐、推理和 Agent 交互训练。

Stars: 3315 | Forks: 300

ROLL Logo # ROLL:面向大规模学习的强化学习优化

🚀 一个用于大语言模型强化学习的高效且易用的扩展库 🚀

License GitHub issues Repo stars WeChat QR Ask DeepWiki X QR

ROLL 是一个高效且易用的强化学习(RL)库,专为利用大规模 GPU 资源的大语言模型(LLMs)设计。它显著提升了 LLM 在人类偏好对齐、复杂推理和多轮 Agent 交互场景等关键领域的性能。 ROLL 利用基于 Ray 的多角色分布式架构实现灵活的资源分配和异构任务调度,并集成了 Megatron-Core、SGLang 和 vLLM 等前沿技术,以加速模型训练和推理。 ## 📢 新闻 ## | 📣 更新 | |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **[16/06/2026]** 🎉 我们的 OSDI’26 RollArt 论文现已可在 [arxiv](https://arxiv.org/abs/2512.22560) 上查阅。 | **[03/06/2026]** 🎉 我们支持了 Qwen3.5 [Dense](examples/qwen3.5-35BA3-rlvr_megatron/rlvr_megatron_80GB.yaml) 和 [MoE](examples/qwen3.5-35BA3-rlvr_megatron/rlvr_megatron_80GB.yaml) 系列模型以及 [on-policy distill](docs_roll/i18n/zh-Hans/docusaurus-plugin-content-docs/current/User%20Guides/Pipeline/on_policy_distill_pipeline_start.md)。欢迎体验! | | **[02/03/2026]** 🎉 我们发布了 FSDP2 策略、Megatron 结合 LoRA、GPU 部分重叠、Qwen3-Omni 支持等特性。更多详情请参阅发布说明。欢迎体验! | | **[01/01/2026]** 🎉 我们的 [Let It Flow: Agentic Crafting on Rock and Roll](https://arxiv.org/abs/2512.24873) 报告发布!介绍了 ALE 生态系统和 ROME,一个采用全新 IPA 算法的开源 Agent 模型。 | | **[11/08/2025]** 🎉 我们的 [ROCK: Reinforcement Open Construction Kit](https://github.com/alibaba/ROCK) 已发布,探索新能力! | | **[10/23/2025]** 🎉 我们的论文已发布,请见 [Asymmetric Proximal Policy Optimization: mini-critics boost LLM reasoning](https://arxiv.org/abs/2510.01656) 和 [Attention Illuminates LLM Reasoning: The Preplan-and-Anchor Rhythm Enables Fine-Grained Policy Optimization](https://arxiv.org/abs/2510.13554)。 | | **[10/14/2025]** 🎉 我们的论文已发布,请见 [Part II: ROLL Flash -- Accelerating RLVR and Agentic Training with Asynchrony](https://arxiv.org/abs/2510.11345)。 | | **[09/28/2025]** 🎉 支持 Ascend NPU —— 请见 [使用指南](https://alibaba.github.io/ROLL/docs/User%20Guides/Hardware%20Support/ascend_usage)。 | | **[09/25/2025]** 🎉 我们的论文已发布,请见 [RollPacker: Mitigating Long-Tail Rollouts for Fast, Synchronous RL Post-Training](https://arxiv.org/abs/2509.21009) | | **[09/24/2025]** 🎉 支持 [Wan2_2 Reward FL pipeline](examples/wan2.2-14B-reward_fl_ds/reward_fl_config.yaml)。探索新能力! | | **[09/23/2025]** 🎉 ROLL 对齐了 GEM 环境定义,提供 Agent 式 Tool Use 训练能力,[ToolUse 文档](docs_roll/docs/English/UserGuide/agentic/Tool_Use.md)。 | | **[09/16/2025]** 🎉 支持 Qwen3-Next 模型训练,请参阅[配置](examples/qwen3-next-80BA3B-rlvr_megatron/rlvr_config.yaml)。 | | **[09/04/2025]** 🎉 ROLL 支持 vLLM 动态 FP8 rollout 和 remove_padding 加速。 | | **[08/28/2025]** 🎉 ROLL 支持 SFT pipeline,请参阅[配置](examples/qwen2.5-7B-sft_megatron/sft_config.yaml)。 | | **[08/13/2025]** 🎉 ROLL 支持开箱即用的 AMD GPU Docker 镜像、Dockerfile 以及 `examples/` 目录下的特定 yaml。请参阅[安装指南](https://alibaba.github.io/ROLL/docs/Getting%20Started/Installation/)。 | | **[08/11/2025]** 🎉 我们的论文已发布,请见 [Part I: Tricks or Traps? A Deep Dive into RL for LLM Reasoning](https://arxiv.org/abs/2508.08221)。 | | **[08/10/2025]** 🎉 Agentic RL 支持[步进式学习](examples/qwen2.5-0.5B-agentic/agent_val_frozen_lake_gigpo.yaml),如 [GiGPO](https://arxiv.org/abs/2505.10978);Distill 支持 [VLM](examples/qwen2.5-vl-7B-distill/distill_vl_megatron.yaml)。探索新能力! | | **[08/06/2025]** 🎉 ROLL PPT 现已可用,[幻灯片](assets/ROLL%20高效且用户友好的大模型RL训练框架.pdf)。 | | **[07/31/2025]** 🎉 重构 Agentic RL 设计。支持 Agentic RL [异步训练](examples/qwen2.5-0.5B-agentic/agent_val_frozen_lake_async.yaml)。探索新能力! | | **[07/31/2025]** 🎉 支持 [DistillPipeline](examples/qwen2.5-7B-distill_megatron/run_distill_pipeline.sh)/[DpoPipeline](examples/dpo_examples/run_dpo_pipeline.sh)。支持 [lora](examples/qwen2.5-7B-rlvr_megatron/rlvr_lora_zero3.yaml)。支持 [GSPO](https://arxiv.org/abs/2507.18071) | | **[06/25/2025]** 🎉 支持用于环境扩展的 thread env,并支持 [qwen2.5 VL agentic pipeline](examples/qwen2.5-vl-3B-agentic/agentic_val_sokoban.yaml)。 | | **[06/13/2025]** 🎉 支持 [Qwen2.5 VL rlvr pipeline](examples/qwen2.5-vl-7B-rlvr/rlvr_megatron.yaml) 并将 mcore 升级至 0.12 版本。 | | **[06/09/2025]** 🎉 ROLL 技术报告现已上线!在[此处](https://arxiv.org/abs/2506.06122)访问报告。 | | **[06/08/2025]** 🎉支持 Qwen3([8B](examples/qwen3-8B-rlvr_megatron/rlvr_config.yaml)/14B/32B)、Qwen3-MoE([30A3](examples/qwen3-30BA3B-rlvr_megatron/rlvr_config.yaml)/[235A22](examples/qwen3-235BA22B-rlvr_megatron/rlvr_config.yaml))、Qwen2.5([7B](examples/qwen2.5-7B-rlvr_megatron/rlvr_config.yaml)/14B/32B/72B) LLM 模型。 | | **[05/30/2025]** 🎉 使用 ROLL 训练 [RLVR](examples/qwen2.5-7B-rlvr_megatron/rlvr_config.yaml) 和 [Agentic RL](examples/qwen2.5-0.5B-agentic/agent_val_frozen_lake.yaml) 现已可用!探索新能力。 | ## 🚀 快速开始 [文档](https://alibaba.github.io/ROLL/) ### 快速入门 [安装](https://alibaba.github.io/ROLL/docs/Getting%20Started/Installation/) [配置系统说明](https://alibaba.github.io/ROLL/docs/User%20Guides/Configuration/config_system) [调试指南](https://alibaba.github.io/ROLL/docs/Getting%20Started/Debugging%20Guide/debug_guide) [跟踪器和指标](https://alibaba.github.io/ROLL/docs/User%20Guides/Tracker%20&%20Metrics/trackers_and_metrics) [Checkpoint 保存与恢复指南](https://alibaba.github.io/ROLL/docs/User%20Guides/Advanced%20Features/checkpoint_and_resume) [将 MCoreAdapter 模型转换为 Hugging Face 格式](https://alibaba.github.io/ROLL/docs/User%20Guides/Advanced%20Features/megatron_convert_2_hf) [快速开始:单节点部署指南](https://alibaba.github.io/ROLL/docs/Getting%20Started/Quick%20Start/single_node_quick_start) [快速开始:多节点部署指南](https://alibaba.github.io/ROLL/docs/Getting%20Started/Quick%20Start/multi_nodes_quick_start) [快速开始:使用阿里云函数计算 DevPod 进行快速开发](https://alibaba.github.io/ROLL/docs/Getting%20Started/Quick%20Start/aliyun_serverless_devpod_quick_start) [常见问题解答](https://alibaba.github.io/ROLL/docs/Getting%20Started/FAQ/qa_issues) ### 用户指南 #### Pipeline 分步指南 [RLVR Pipeline](https://alibaba.github.io/ROLL/docs/User%20Guides/Pipeline/rlvr_pipeline_start) [Agentic Pipeline](https://alibaba.github.io/ROLL/docs/User%20Guides/Pipeline/agentic_pipeline_start) [Agentic 综合指南](https://alibaba.github.io/ROLL/docs/User%20Guides/Pipeline/agent_pipeline_start) [Distill Pipeline](https://alibaba.github.io/ROLL/docs/User%20Guides/Pipeline/distill_pipeline_start) #### 算法 [Reinforce++](https://alibaba.github.io/ROLL/docs/User%20Guides/Algorithms/Reinforce_Plus_Plus) [TOPR](https://alibaba.github.io/ROLL/docs/User%20Guides/Algorithms/TOPR) [GiGPO](https://alibaba.github.io/ROLL/docs/User%20Guides/Agentic/agentic_GiGPO) [PPO](https://alibaba.github.io/ROLL/docs/User%20Guides/Algorithms/PPO) [Lite PPO](https://alibaba.github.io/ROLL/docs/User%20Guides/Algorithms/LitePPO) [GRPO](https://alibaba.github.io/ROLL/docs/User%20Guides/Algorithms/GRPO) [GSPO](https://alibaba.github.io/ROLL/docs/User%20Guides/Algorithms/GSPO) [RAFT++](https://alibaba.github.io/ROLL/docs/User%20Guides/Algorithms/RAFT_Plus_Plus) [StarPO](https://alibaba.github.io/ROLL/docs/User%20Guides/Agentic/agentic_StarPO) [RewardFL](https://alibaba.github.io/ROLL/docs/User%20Guides/Algorithms/Reward_FL) #### 后端 [FSDP2](https://alibaba.github.io/ROLL/docs/User%20Guides/Configuration/fsdp2) [Megatron](https://alibaba.github.io/ROLL/docs/User%20Guides/Configuration/megatron) [vLLM](https://alibaba.github.io/ROLL/docs/User%20Guides/Configuration/vllm) [SGLang](https://alibaba.github.io/ROLL/docs/User%20Guides/Configuration/sglang) #### 高级特性 [异步并行 Rollout](https://alibaba.github.io/ROLL/docs/User%20Guides/Advanced%20Features/async_parallel_rollout) [异步训练特性](https://alibaba.github.io/ROLL/docs/User%20Guides/Advanced%20Features/async_training) #### 性能优化与资源管理 [资源配置](https://alibaba.github.io/ROLL/docs/User%20Guides/Configuration/device_mapping) [GPU 时分复用控制](https://alibaba.github.io/ROLL/docs/User%20Guides/Advanced%20Features/offload_reload_control) #### ROLL x Ascend [Ascend 使用指南](https://alibaba.github.io/ROLL/docs/User%20Guides/Hardware%20Support/ascend_usage) ## ✨ 核心特性 * **多任务 RL 训练(RLVR):** 涵盖数学、代码、通用推理、开放问答、指令遵循等。 * 灵活的 `domain_batch_size` 分配控制。 * **Sample 级别的异步并行 Rollout**、异步奖励计算和动态采样。 * 支持实现异步训练。 * **Agentic RL:** 面向游戏、多轮对话、工具使用等的多轮交互能力。 * 环境级别的**异步并行 rollout**。 * 支持**异步训练**。 * 多轮交互 rollout 支持**本地调试**,提升多轮交互业务开发效率。 * 支持 **TrajectoryWise (StarPO)** 和 **StepWise (GiGPO)** 训练范式。 * **对算法友好:** 默认提供灵活且丰富的 RL 策略配置。 * 超过 20 种丰富的强化学习策略选项,如奖励归一化、奖励裁剪、各种优势估计方法等。 * 开箱即用的强化学习算法支持,如 **PPO、GRPO、Reinforce++、TOPR、RAFT++、GSPO** 等。 * **丰富的训练和推理引擎:** 基于 Ray 的多角色分布式架构;策略抽象统一了各种后端,能够轻松实现从单机到千卡集群的运行。 * 推理/生成支持 vLLM、SGLang。 * 训练支持 FSDP2、Megatron-LM 5D 并行(mcore-adapter、dp/tp/pp/cp/ep)。 * 极致的 offload/reload 能力。 * 支持 [LoRA](https://alibaba.github.io/ROLL/docs/User%20Guides/Configuration/lora) 训练。 * 支持 FP8 rollout(支持以 FP8 推理运行 LLM 作为 Judge,结合 BF16 训练的 FP8 rollout 正在开发中)。 * **AutoDeviceMapping:** 支持为不同角色自定义设备映射,灵活管理混合部署和分离式部署。 * **可观测性:** 集成 SwanLab / WandB / TensorBoard,跟踪各个领域和奖励类型的性能表现。 * **丰富的后训练技术支持:** * Agentic RL LLM & VLM * RLVR LLM & VLM * Distill Pipeline LLM & VLM * DPO Pipeline * SFT Pipeline 开发中 ## 🏆 基于 ROLL 的知名工作 - [Freshness-Aware-PER](https://arxiv.org/abs/2604.16918):一个用于 LLM/VLM 强化学习的感知新鲜度的优先经验回放框架,结合奖励幅度与指数级年龄衰减(`reward_fresh` 优先级)以及异步全缓冲区刷新,为步级和轨迹级 Agentic RL 提供更新鲜、信号更强的 off-policy 样本。[代码](https://github.com/Vision-CAIR/Freshness-Aware-PER) - [ComplementaryRL](https://arxiv.org/abs/2603.17621):互补强化学习是一个学习框架,通过在 RL 优化循环中实现经验提取器和策略执行器的无缝共同进化,使智能体能够有效地从经验中学习。 - [RLix](https://github.com/rlops/rlix):RLix 是一个 RL 作业管理器,通过跨作业共享 GPU 算力,让更多 RL 作业并发运行而减少等待时间,同时保持每个 pipeline 的训练行为并提高 GPU 利用率。 - [TurningPoint-GRPO](https://arxiv.org/abs/2602.06422):一个用于文本生成图像领域 Flow Matching 模型的 GRPO 框架,通过对步级增量奖励进行建模来缓解逐步奖励稀疏性,并通过转折点检测明确捕捉长期效果,为每个去噪动作提供密集的学习信号。 - [SocioReasoner](https://github.com/AMAP-ML/SocioReasoner):一种用于城市社会语义分割的视觉语言方法,采用通过 RL 优化的“渲染与精炼”机制,利用卫星和地图数据识别抽象的社会实体。 - [STAgent](https://arxiv.org/abs/2512.24957):一个专为了解时空和复杂任务(如受限 POI 发现和行程规划)而定制的 Agentic LLM,具有 1:10,000 过滤比的层级数据整理和级联训练(种子 SFT + 难度感知 SFT + RL)特性,在 TravelBench 上取得强劲表现的同时保留了通用能力。 - [IPRO](https://arxiv.org/abs/2510.14255):一个全新的视频生成扩散框架,利用强化学习增强以人为中心的 I2V 生成中的身份保持性,结合人脸身份评分器和 KL 散度正则化优化扩散模型。 - [TaoSRHE](https://arxiv.org/abs/2510.07972):用于淘宝搜索相关性研究的步进式混合检验强化学习框架,包含 SRPO(混合奖励模型 + 离线验证器)、多样化数据过滤和多阶段课程学习。 - [EARL](https://arxiv.org/abs/2510.05943):面向 LLM 的高效 Agentic RL 系统,引入了动态并行选择器和布局感知数据分发器来提升吞吐量,减少内存和数据移动瓶颈,在不受硬性上下文长度限制的情况下实现稳定的大规模 Agentic RL。 - [LiveThinking](https://arxiv.org/abs/2510.07685):通过拒绝采样微调将 670B 教师大模型蒸馏到 30B MoE(3B 激活参数)中,然后使用 GRPO 压缩推理,实现 AI 直播的实时推理;提供亚秒级延迟和约 30 倍的计算量减少,并在回答正确率(3.3%)、有用性(21.8%)以及淘宝直播 GMV 上均有所提升。 - [TaoSR-AGRL](https://www.arxiv.org/abs/2510.08048):用于基于 LLM 的电商相关性研究的自适应引导强化学习,引入了规则感知的奖励塑造和自适应引导重放,以提高淘宝搜索中的长周期推理、规则遵循和训练稳定性;已部署在主搜索中,服务数亿用户。 - [RecGPT](https://www.arxiv.org/abs/2507.22879):一个将用户意图置于推荐系统核心的下一代 LLM 驱动框架,旨在培育一个更加可持续且互利共赢的生态系统。 - [TaoSR1](https://arxiv.org/abs/2508.12365):一个直接部署思维链推理用于电商查询与商品相关性预测的全新 LLM 框架,克服了部署挑战以实现卓越性能。 - [AIGB-Pearl](https://www.arxiv.org/abs/2509.15927):一种集成了生成式规划和策略优化的全新自动出价方法,利用 LLM 增强的轨迹评估器迭代完善出价策略,以实现最先进的广告投放效果。 ## 🙏 引用与致谢 ROLL 的设计受到了 OpenRLHF、VeRL、Nemo-Aligner 和 RAGEN 的启发。 该项目由阿里巴巴淘天集团和阿里巴巴集团联合开发。代码在 Apache License (Version 2.0) 下分发。本产品包含了在其它开源许可证下分发的各种第三方组件。更多信息请参阅 `NOTICE` 文件。 以下代码库已以接近原生的形式或作为灵感来源在 ROLL 中被使用: * [NVIDIA/Megatron-LM](https://github.com/NVIDIA/Megatron-LM) * [microsoft/DeepSpeed](https://github.com/microsoft/DeepSpeed) * [sgl-project/sglang](https://github.com/sgl-project/sglang) * [vllm-project/vllm](https://github.com/vllm-project/vllm) * [modelscope/DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio) 如果您在您的研究或项目中使用了 ROLL,请考虑引用我们: ``` @article{wang2025reinforcement, title={Reinforcement Learning Optimization for Large-Scale Learning: An Efficient and User-Friendly Scaling Library}, author={Wang, Weixun and Xiong, Shaopan and Chen, Gengru and Gao, Wei and Guo, Sheng and He, Yancheng and Huang, Ju and Liu, Jiaheng and Li, Zhendong and Li, Xiaoyang and others}, journal={arXiv preprint arXiv:2506.06122}, year={2025} } ``` ## 🤝 关于 [ROCK & ROLL Team] ROLL 是由淘天未来生活实验室和阿里巴巴 AI 引擎团队联合开发的项目,致力于引领强化学习(RL)的未来。我们的使命是探索和塑造由先进 RL 技术驱动的未来生活的创新形态。如果您对 RL 的未来充满热情,并希望成为其演进历程的一部分,我们热烈欢迎您的加入!👇 WeChat QR X QR 我们正在招聘! - Post Training Infra 研发工程师 [JD 链接](https://talent-holding.alibaba.com/off-campus/position-detail?lang=zh&positionId=7000016304) - 大模型训练专家: - (社招)[JD 链接](https://talent.taotian.com/off-campus/position-detail?lang=zh&positionId=7000024203) - (校招)[JD 链接](https://talent.taotian.com/campus/position-detail?positionId=199900140053) - Infra 研究型实习生 [JD 链接](https://talent-holding.alibaba.com/campus/position-detail?lang=zh&positionId=59900004115)
我们欢迎社区的贡献!🤝
标签:Apex, DLL 劫持, 人工智能, 分布式训练, 大语言模型, 强化学习, 机器学习, 模型推理, 用户模式Hook绕过, 请求拦截, 逆向工具