OpenRLHF
OpenRLHF / OpenRLHF
基于 Ray + vLLM 的 RLHF 训练框架:PPO、GRPO、DPO、KTO 与多机多卡编排。A Ray + vLLM RLHF framework: PPO, GRPO, DPO, KTO and multi-node orchestration.
为什么选Why choose it
- 把推理、奖励、训练分成可扩展的 Ray actor。Splits inference, reward and training into scalable Ray actors.
- 支持 vLLM 加速 rollout,适合大规模对齐。vLLM-accelerated rollout for large-scale alignment.
- 配置化程度高,社区案例多。Highly configurable with many community examples.
不适合Not for
单卡小实验,直接用 TRL 更简单。For small single-GPU experiments, TRL is simpler.
需要 Ray 集群经验,调试门槛不低。Requires Ray cluster experience; debugging is not trivial.
最小上手Minimum setup
- 按官方脚本跑一个单机 PPO 小实验,确认 Ray 与 vLLM 版本。Run the official single-node PPO example and pin Ray and vLLM versions.
- 记录 rollout 与训练的 GPU 分配,避免两边抢显存。Record GPU allocation between rollout and training so they do not fight for VRAM.
- 用固定偏好数据对比 DPO 与 PPO 的评测差异。Compare DPO and PPO on fixed preference data with the same eval set.
依赖与成本Dependencies and cost
Python + PyTorch/CUDA + Ray;rollout 需要 vLLM;多机要共享存储与高速网络。Python + PyTorch/CUDA + Ray; rollout needs vLLM; multi-node needs shared storage and high-speed network.
许可与使用边界License and usage boundaries
代码 Apache-2.0;模型、偏好数据与奖励模型各有许可。Code is Apache-2.0; models, preference data and reward models carry their own licenses.
开源不等于可商用:GPL / AGPL 有传染性;代码许可、模型许可、生成内容许可要分开看。上线前读仓库 LICENSE 与模型卡,必要时让法务确认。Open source is not automatically commercial-use friendly: GPL / AGPL are copyleft; code, model and output licenses are separate. Read the LICENSE and model card before launch, and involve legal when needed.
替代与相邻Alternatives and neighbors
- TRL — 生产可用Production,Hugging Face 的强化学习与对齐训练库:SFT、DPO、PPO、GRPO、奖励模型都能接。Hugging Face's RL and alignment training library: SFT, DPO, PPO, GRPO and reward models.
- verl — 规模 / 性能Scale / performance,字节跳动的 RL 训练框架:面向 LLM Agent 与推理任务,支持 PPO/GRPO 与多轮工具调用。ByteDance's RL training framework for LLM agents and reasoning tasks, with PPO/GRPO and multi-turn tool use.
下一步Next steps
- 打开 GitHub,先读 README、LICENSE、最近 release 与 issue。Open GitHub and read the README, LICENSE, latest release and issues first.
- 按“部署依赖 / 显存 / 数据 / 网络 / 权限”列一张上手清单。Make an onboarding checklist for deployment dependencies, VRAM, data, network and permissions.
- 用一个小样本跑通,再决定是否进生产;不要直接上生产数据。Run a small sample first, then decide on production; never start with production data.
GitHub 仓库 ↗GitHub repository ↗ 文档 ↗Docs ↗ 加入对比Add to compare