openrlhf
Use OpenRLHF for Ray/vLLM/DeepSpeed RLHF workflows, including dataset preparation, SFT/RM/DPO training, PPO-family RL and agent training, runtime operations, reward serving, LoRA merging, and troubleshooting.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- openrlhf
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use OpenRLHF for Ray/vLLM/DeepSpeed RLHF workflows, including dataset preparation, SFT/RM/DPO training, PPO-family RL and agent training, runtime operations, reward serving, LoRA merging, and troubleshooting.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/repo-provenance.md2.1 KB
- 参考文档references/repo-routing-metadata.json560 B
- 参考文档references/troubleshooting.md3.1 KB
03 SKILL.md 正文
OpenRLHF
Use this repo skill when a user asks about OpenRLHF, a Ray + vLLM + DeepSpeed RLHF framework for supervised fine-tuning, reward modeling, preference optimization, PPO-family reinforcement learning, custom rewards, multi-turn agents, and distributed training operations.
OpenRLHF workflows are usually GPU/distributed and can trigger model downloads, Ray clusters, long training runs, or service processes. Prefer planning, validating, and generating commands first; run expensive operations only after confirming the user wants execution and the environment is ready.
Fast Routing
- Dataset schemas and validation: use
sub-skills/data-preparation/for SFT records, reward-model chosen/rejected pairs, DPO preferences, PPO prompt datasets, chat templates, mixed dataset probabilities, VLM image placeholders, and the bundled dataset validator. - SFT, reward-model, and DPO/IPO/cDPO training: use
sub-skills/supervised-preference-training/fortrain_sft,train_rm,train_dpo, LoRA/packing/DeepSpeed/checkpoint/logging flags, and safe command skeleton generation. - PPO, REINFORCE++, GRPO/RLOO, Ray/vLLM, custom rewards, and agents: use
sub-skills/rl-agent-training/fortrain_ppo_ray, hybrid engine placement, async rollout, single-turn reward functions, multi-turn agents, VLM agents, and OpenAI-compatible agent executors. - Installation, diagnostics, serving, LoRA merge, and utilities: use
sub-skills/operations-and-utilities/for dependency/runtime checks, CUDA/flash-attn/Ray/NCCL issues, reward-model serving, LoRA adapter merging, DeepSpeed checkpoint conversion, and Docker/system caveats.
Start Safely
- Identify the user’s target workflow: data preparation, supervised/preference training, RL/agent training, or runtime utility operations.
- Check whether the request requires execution or only a plan, command, script, config review, or troubleshooting answer.
- If execution is requested, classify safety first: local schema validation is usually safe; full training, Ray/vLLM startup, reward serving, Docker/NVIDIA setup, model downloads, and checkpoint conversion are expensive or stateful.
- Route to the nearest sub-skill and read its linked references before giving detailed commands.
- For cross-cutting failures, read
references/troubleshooting.mdand then the workflow-specific troubleshooting file in the owning sub-skill.
Minimal Package Facts
- Distribution name:
openrlhf. - Import module:
openrlhf. - Version represented by this skill:
0.10.4. - Python requirement from packaging metadata: Python 3.10 or newer.
- Core dependency stack: PyTorch, Transformers, DeepSpeed, Ray, vLLM-related optional extras, flash-attn, datasets, PEFT/LoRA tooling, logging integrations, and CUDA-capable GPU infrastructure for realistic training.
A top-level import openrlhf only proves package metadata/import visibility. It does not prove CUDA, flash-attn, DeepSpeed, Ray, vLLM, model download, or distributed training readiness. Use the operations sub-skill for runtime checks.
Common Workflows
- Prepare SFT data: route to
data-preparation, validate keys and chat-template assumptions, then usesupervised-preference-trainingto generate atrain_sftcommand. - Train a reward model: route to
data-preparationfor chosen/rejected pairs, usesupervised-preference-trainingfortrain_rm, and useoperations-and-utilitiesif the reward model will be served over HTTP. - Run DPO/IPO/cDPO: route to
supervised-preference-training; verify prompt/chosen/rejected fields throughdata-preparationfirst. - Run PPO or REINFORCE++ with Ray/vLLM: route to
rl-agent-training; useoperations-and-utilitiesfor Ray cluster, NCCL, CUDA, and vLLM runtime readiness. - Add custom reward or multi-turn agent logic: route to
rl-agent-trainingand generate a bundled template before adapting user logic. - Diagnose install or runtime failures: route to
operations-and-utilities; check optional dependency and GPU/backend status before changing training flags.
References
references/repo-provenance.md: source commit, package version, evidence paths, dirty-state notes, and refresh baseline.references/troubleshooting.md: cross-cutting install/import/backend/routing issues shared by all sub-skills.
Boundaries
This skill is a self-contained guide distilled from repository source, docs, examples, scripts, and tests. Do not depend on the original checkout at runtime. If a user needs a reusable helper, use the bundled scripts under this skill or adapt their contents into the user’s project.
Do not run original OpenRLHF training examples or system scripts as smoke tests by default. Treat them as evidence for command shape unless the user explicitly asks to run them and the environment, GPUs, data, models, credentials, and time budget are suitable.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).