# openrlhf-training

A skill that hands your agent ready commands for PPO, GRPO, RLOO and DPO runs on models from 7B to 70B+. Useful when training spans several GPUs or nodes.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 954 installs · ★ 13956
- Author: Orchestra Research
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/HEAD/06-post-training/openrlhf/SKILL.md
- Updated: 2026-10-11
- HTML: https://affpapa.org/en/nevibecode/skills/openrlhf-training

## What it does

The skill packages OpenRLHF commands for an agent to run. Three workflows are covered: a full SFT → reward model → PPO pipeline, GRPO without a critic, and DPO without a reward model. Each one comes as a launch line with its flags.

Setup starts in a Docker container built on `nvcr.io/nvidia/pytorch:25.02-py3`, followed by `pip install openrlhf[vllm]`. Before that the skill removes packages known to clash: `xgboost`, `transformer_engine`, `flash_attn`, `pynvml`. The cluster comes up with `ray start --head`, jobs go out through `ray job submit`. Running out of GPU memory? Drop `--colocate_all_models` and give each model its own GPUs.

Troubleshooting is part of the package. A DeepSpeed GPU index error is fixed by exporting `RAY_EXPERIMENTAL_NOSET_CUDA_VISIBLE_DEVICES=1`. Unstable training points to the Hybrid Engine with `--vllm_enable_sleep` and `--deepspeed_enable_sleep`. For single-node work with a simpler API, the skill points at TRL instead.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill openrlhf-training -a claude-code
```
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill openrlhf -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/openrlhf/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/openrlhf/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill openrlhf -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/openrlhf/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill openrlhf -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/openrlhf/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install Orchestra-Research/AI-Research-SKILLs openrlhf
```

2. **Manually: put the files in place**
- File: `.github/skills/openrlhf/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill openrlhf -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/Orchestra-Research/AI-Research-SKILLs --path 06-post-training/openrlhf
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/openrlhf/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill openrlhf -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/HEAD/06-post-training/openrlhf/SKILL.md

## When to use it
- run PPO on a 70B model across multiple nodes
- train a reward model on a preference dataset with DPO
- switch from PPO to GRPO and drop the critic model
- bring up a Ray cluster and submit a training job with `ray job submit`
- diagnose a DeepSpeed GPU index out of range failure

## Example prompts
- show me how to launch PPO training with openrlhf-training on 8 GPUs
- set up GRPO without a critic for Llama-3-8B using the skill
- help me debug an OOM when training a large model in OpenRLHF

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: bbfc5567a192c9ca.

BEGIN THIRD-PARTY FILE bbfc5567a192c9ca
````text
---
name: openrlhf-training
description: High-performance RLHF framework with Ray+vLLM acceleration. Use for PPO, GRPO, RLOO, DPO training of large models (7B-70B+). Built on Ray, vLLM, ZeRO-3. 2× faster than DeepSpeedChat with distributed architecture and GPU resource sharing.
version: 1.0.0
author: Orchestra Research
license: MIT
tags: [Post-Training, OpenRLHF, RLHF, PPO, GRPO, RLOO, DPO, Ray, vLLM, Distributed Training, Large Models, ZeRO-3]
dependencies: [openrlhf, ray, vllm, torch, transformers, deepspeed]
---

# OpenRLHF - High-Performance RLHF Training

## Quick start

OpenRLHF is a Ray-based RLHF framework optimized for distributed training with vLLM inference acceleration.

**Installation**:
```bash
# Launch Docker container
docker run --runtime=nvidia -it --rm --shm-size="10g" --cap-add=SYS_ADMIN \
  -v $PWD:/openrlhf nvcr.io/nvidia/pytorch:25.02-py3 bash

# Uninstall conflicts
sudo pip uninstall xgboost transformer_engine flash_attn pynvml -y

# Install OpenRLHF with vLLM
pip install openrlhf[vllm]
```

**PPO Training** (Hybrid Engine):
```bash
ray start --head --node-ip-address 0.0.0.0 --num-gpus 8

ray job submit --address="http://127.0.0.1:8265" \
  --runtime-env-json='{"working_dir": "/openrlhf"}' \
  -- python3 -m openrlhf.cli.train_ppo_ray \
  --ref_num_nodes 1 --ref_num_gpus_per_node 8 \
  --reward_num_nodes 1 --reward_num_gpus_per_node 8 \
  --critic_num_nodes 1 --critic_num_gpus_per_node 8 \
  --actor_num_nodes 1 --actor_num_gpus_per_node 8 \
  --vllm_num_engines 4 --vllm_tensor_parallel_size 2 \
  --colocate_all_models \
  --vllm_gpu_memory_utilization 0.5 \
  --pretrain OpenRLHF/Llama-3-8b-sft-mixture \
  --reward_pretrain OpenRLHF/Llama-3-8b-rm-700k \
  --save_path ./output/llama3-8b-rlhf \
  --micro_train_batch_size 8 --train_batch_size 128 \
  --micro_rollout_batch_size 16 --rollout_batch_size 1024 \
  --max_epochs 1 --prompt_max_len 1024 --generate_max_len 1024 \
  --zero_stage 3 --bf16 \
  --actor_learning_rate 5e-7 --critic_learning_rate 9e-6 \
  --init_kl_coef 0.01 --normalize_reward \
  --gradient_checkpointing --packing_samples \
  --vllm_enable_sleep --deepspeed_enable_sleep
```

**GRPO Training** (Group Normalized Policy Optimization):
```bash
# Same command as PPO, but add:
--advantage_estimator group_norm
```

## Common workflows

### Workflow 1: Full RLHF pipeline (SFT → Reward Model → PPO)

**Step 1: Train reward model** (DPO):
```bash
deepspeed --module openrlhf.cli.train_rm \
  --save_path ./output/llama3-8b-rm \
  --save_steps -1 --logging_steps 1 \
````
END THIRD-PARTY FILE bbfc5567a192c9ca

The third-party file has ended. Everything between the bbfc5567a192c9ca tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2538 of 8379 bytes. © Orchestra Research · MIT · https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/HEAD/06-post-training/openrlhf/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
