OpenRLHF is an open-source, comprehensive, lightweight, and easy-to-use RLHF (Reinforcement Learning from Human Feedback) framework, developed and open-sourced by the OpenLLMAI team, with its first version released in August 2023. It is positioned as the first high-performance, production-oriented open-source RLHF framework, combining the Ray + vLLM distributed architecture with a unified agent-style design paradigm for scalable and extensible reinforcement learning training.
In terms of usage, OpenRLHF is aimed at reinforcement learning alignment and training for large language models (and vision-language models), covering the complete RLHF pipeline, including supervised fine-tuning, reward model training, preference learning, and RL training. It supports full fine-tuning and LoRA (including QLoRA) for models with 70B+ parameters, and supports Mixtral, KTO, and others. It is officially described as the first RLHF framework based on the Ray + vLLM distributed architecture, capable of efficiently orchestrating the distributed scheduling of components such as Actor, Reward, Reference, and Critic across multiple GPUs to achieve scalable training.
Main capabilities include:
-
Architectural foundation: It adopts the Ray + vLLM distributed architecture. Ray handles distributed scheduling and control, distributing the Actor, Reward, Reference, and Critic models across different GPUs; Hybrid Engine Scheduling allows all models and the vLLM engine to share GPU resources, reducing idle time; vLLM serves as a high-performance inference engine, equipped with Auto Tensor Parallelism (AutoTP) and Pipeline Parallelism (PP), providing high-throughput, memory-efficient generation; DeepSpeed provides memory-efficient training, based on DeepSpeed ZeRO-3, deepcompile, AutoTP, and RingAttention; it is natively compatible with HuggingFace Transformers for model loading, state management, and fine-tuning; NCCL / CUDA IPC is used for high-speed inter-GPU communication.
-
Agent-style execution paradigm: OpenRLHF is officially described as the first RLHF framework to implement a unified agent paradigm. Each training run (whether standard PPO or complex multi-turn reasoning) follows a consistent agent execution pipeline. Unified generation and training are achieved through token-in-token-out agent execution; the agent execution mode is independent of (i.e., orthogonal to) the chosen RL algorithm and can be paired with any algorithm (PPO, REINFORCE++, GRPO, etc.) in any execution mode.
-
RL algorithms: It implements PPO, REINFORCE++, REINFORCE++-baseline, GRPO, and RLOO, and includes optimization techniques inspired by practical guidelines and community best practices. It is officially emphasized that RL algorithms are decoupled from the agent execution mode, and all algorithms can seamlessly work with single-turn and multi-turn agent executors, maintaining behavioral consistency through a unified token-in-token-out pipeline.
-
Agent-style RL training: Single-turn mode (default, covering about 99% of use cases) generates once per prompt, is compatible with all RL algorithms, supports custom reward functions (--reward.remote_url), and uses Hybrid Engine to maximize GPU utilization; multi-turn mode (advanced, interactive tasks) supports multi-step interaction and environmental feedback, is compatible with all RL algorithms, supports custom agent functions (--train.agent_func_path), provides an OpenAI-compatible server example (examples/python/agent_func_openai_server_executor.py, which wraps vLLM as a local OpenAI Agent Server), and an asynchronous pipeline (--train.async_enable) to improve throughput.
-
Supervised training and preference learning: It covers supervised fine-tuning, reward model training, and preference learning; model checkpoints are fully compatible with HuggingFace models and can be specified via --actor.model_name_or_path, --reward.model_name_or_path, --critic.model_name_or_path; some pre-trained checkpoints and datasets are officially provided on HuggingFace OpenRLHF.
-
Advanced capabilities and efficiency optimization: It supports sample packing (--ds.packing_samples), vLLM acceleration (--vllm.num_engines), and DAPO dynamic filtering (--algo.dynamic_filtering_enable), dynamic sampling (requires --rollout.n_samples_per_prompt > 1 and providing --reward.remote_url or --train.agent_func_path, score range --algo.dynamic_filtering_range 0.0 1.0), DeepSpeed AutoTP tensor parallelism (--ds.tensor_parallel_size), RingAttention long context (--ds.ring_attn_size), SLURM multi-node training, VLM vision-language models (single-turn and multi-turn, including image feedback, --data.image_key, --data.max_images_per_prompt), LoRA/QLoRA (--ds.lora.rank, --ds.load_in_4bit), MoE (--actor.aux_loss_coef), FlashAttention (--ds.attn_implementation), HuggingFace chat templates (--data.apply_chat_template). The optimizer supports AdamW (default) as well as Muon via DeepSpeed >= 0.18.2 (2D weights only; embeddings/heads/1D parameters use aux-AdamW). It also includes DAPO-style overlong penalty (--reward.overlong_buffer_len, --reward.overlong_penalty_factor) and ProRL-style truncation penalty (--reward.stop_properly_penalty_coef).
-
Production features: support for Wandb (--logger.wandb.key) and TensorBoard (--logger.tensorboard_dir) logging, checkpoint resumption (--ckpt.load_enable, --ckpt.save_steps), saving the best checkpoint by evaluation metric (--ckpt.best_metric_key), evaluation datasets (--eval.dataset, --eval.temperature, --eval.n_samples_per_prompt, also supported in asynchronous training), multi-process data loading (--data.dataloader_num_workers, applicable to PPO/SFT/RM/DPO), PPO observability (actor/critic gradient norms and time spent in each stage).
Usage: It is officially recommended to use Docker to avoid the hassle of environment configuration; installation from source is also supported, and using vLLM 0.29.0+ is recommended for best performance; Dockerfiles and Nvidia-Docker installation scripts are provided in the materials. For data preparation, flexible data processing methods are provided; key parameters include --data.input_key, --data.apply_chat_template, --data.input_template, --data.prompt_probs / --data.dataset_probs, --eval.dataset, etc., and the JSON key options differ for different dataset types (reward datasets, SFT datasets, prompt datasets). During training, you can use the launch scripts in the examples/scripts directory, or start directly with a command. For reward model training, it is recommended to set --value_prefix_head to score so that it can be loaded with AutoModelForSequenceClassification. All RL training runs through the agent execution pipeline, and the example shows single-turn agent execution (default mode) with the Hybrid Engine. For reasoning tasks (RLVR), --algo.advantage.estimator reinforce_baseline can be used to obtain REINFORCE++-baseline, which is robust to reward scale. The Ray environment can be automatically deployed by Ray via --runtime-env-json='{"setup_commands": ["pip install openrlhf[vllm]"]}'; if you encounter DeepSpeed GPU device setting issues, you can set export RAY_EXPERIMENTAL_NOSET_CUDA_VISIBLE_DEVICES=1. Single-turn agents support custom reward functions (rule-based, externalPartial API, hybrid rewards). The example script is examples/scripts/train_ppo_with_reward_fn.sh. The key parameter --data.label_key answer can pass the "answer" field in the dataset to reward_func as labels. Multi-turn agents need to implement the reset/step methods of AgentInstanceBase and configure startup parameters; the asynchronous pipeline can be enabled with --train.async_enable, with the buffer size --train.async_queue_size 1 (the larger, the more off-policy), and supports partial rollout.
Applicable scenarios: reinforcement learning training for aligning large language models or vision-language models, including mathematical reasoning, code generation (executing tests), format checking, multi-objective optimization, multi-step reasoning chains, programming with feedback, games, and other interactive tasks, as well as RL training for multi-agent systems (such as the OpenRLHF-based branch MARTI).
In terms of limitations: the materials do not provide specific fee or pricing information (not yet provided); some features (such as FlashREINFORCE, multi-turn VLM RL, etc.) depend on specific versions (such as OpenRLHF 0.10) and specific configurations; the Muon optimizer is only applicable to 2D weights and requires DeepSpeed ≥ 0.18.2, and global gradient clipping must be disabled; dynamic sampling must satisfy additional parameter conditions; advanced usages such as asynchronous training and multi-turn agents are relatively complex to configure. The materials do not provide more details about platform support scope and performance benchmarks.