verl RL Training
Orchestra-Research/AI-Research-SKILLs
Trains LLMs with reinforcement learning using verl, from ByteDance's Seed team, with GRPO, PPO and other algorithms and swappable training and rollout backends.
Reference for post-training language models with TRL: which trainer and dataset format to use for SFT, DPO, GRPO, KTO and reward models, and how to add LoRA.
$ npx skills add huggingface/skills --skill trl-training -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install huggingface/skills trl-training --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/huggingface/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/trl-training .claude/skills/trl-training && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "trl-training" agent skill from https://github.com/huggingface/skills/tree/main/skills/trl-training into .claude/skills/trl-training/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "trl-training", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/huggingface/skills/tree/main/skills/trl-trainingType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add huggingface/skills --skill trl-training -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install huggingface/skills trl-training --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/huggingface/skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/trl-training .agents/skills/trl-training && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "trl-training" agent skill from https://github.com/huggingface/skills/tree/main/skills/trl-training into .agents/skills/trl-training/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "trl-training", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add huggingface/skills --skill trl-training -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install huggingface/skills trl-training --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/huggingface/skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/trl-training .cursor/skills/trl-training && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "trl-training" agent skill from https://github.com/huggingface/skills/tree/main/skills/trl-training into .cursor/skills/trl-training/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "trl-training", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/huggingface/skills.git --path skills/trl-training--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add huggingface/skills --skill trl-training -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install huggingface/skills trl-training --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/huggingface/skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/trl-training .gemini/skills/trl-training && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "trl-training" agent skill from https://github.com/huggingface/skills/tree/main/skills/trl-training into .gemini/skills/trl-training/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "trl-training", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install huggingface/skills trl-trainingInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add huggingface/skills --skill trl-training -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/huggingface/skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/trl-training .github/skills/trl-training && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "trl-training" agent skill from https://github.com/huggingface/skills/tree/main/skills/trl-training into .github/skills/trl-training/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "trl-training", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add huggingface/skills --skill trl-training -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install huggingface/skills trl-training --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/huggingface/skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/trl-training .opencode/skills/trl-training && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "trl-training" agent skill from https://github.com/huggingface/skills/tree/main/skills/trl-training into .opencode/skills/trl-training/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "trl-training", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
trl-trainingReference for post-training language models with TRL: which trainer and dataset format to use for SFT, DPO, GRPO, KTO and reward models, and how to add LoRA.
Each TRL method pairs a `*Trainer` class with a `*Config` dataclass, and the skill maps them to the data they expect: `SFTTrainer` for language-modeling or prompt-completion data, `DPOTrainer` for chosen and rejected pairs, `GRPOTrainer` for prompts plus reward functions, `KTOTrainer` for unpaired labels, `RewardTrainer` for a scalar reward model and `DistillationTrainer` for on-policy distillation with a teacher. Less stable trainers sit in `trl.experimental`.
Practical rules follow. Pass the model as a string and put loading options in `model_init_kwargs`, let the chat template apply itself to conversational datasets, and give a `LoraConfig` through `peft_config` for LoRA. SFT settings such as `max_length` and `packing` are explained. GRPO reward functions receive keyword arguments including `prompts` and `completions`, should accept extra keyword arguments for dataset columns they ignore, and return one float per completion.
Read from SKILL.md and the folder at commit ca0325b. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are python).
From the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
huggingface.coFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
TRL Post-Training loads about 1.1k tokens when it runs. Until then it costs about 52 tokens; SKILL.md has 301 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from huggingface/skills at commit ca0325b, republished under its Apache-2.0 licence (© huggingface). 301 words, ~1,078 tokens.
.claude/skills/trl-training/SKILL.md (or your agent's skills folder).Each method pairs a *Trainer class with a *Config dataclass. Configs extend transformers.TrainingArguments, so all of its arguments work in any trainer config.
| Trainer | Dataset type |
|---|---|
SFTTrainer | language modeling or prompt-completion |
DPOTrainer | preference (chosen/rejected pairs) |
GRPOTrainer | prompt-only + reward function(s) |
DistillationTrainer | prompt-only + a teacher model (on-policy distillation) |
KTOTrainer | unpaired preference (per-sample bool label) |
RewardTrainer | preference (chosen/rejected pairs); trains a scalar reward model, not a policy |
Many more trainers (OnlineDPO, ORPO, CPO, GKD, …) live in trl.experimental with unstable APIs: https://huggingface.co/docs/trl/experimental_overview
from datasets import load_dataset
from trl import SFTConfig, SFTTrainer
trainer = SFTTrainer(
model="Qwen/Qwen2.5-0.5B", # model ID or a PreTrainedModel instance
args=SFTConfig(output_dir="Qwen2.5-0.5B-SFT"),
train_dataset=load_dataset("trl-lib/Capybara", split="train"),
)
trainer.train()Pass model as a string and route loading kwargs through model_init_kwargs (e.g. {"dtype": "bfloat16", "attn_implementation": "kernels-community/flash-attn2"}) instead of calling from_pretrained yourself. The tokenizer/processor is inferred from the model; pass processing_class only when it differs. For LoRA, pass peft_config=LoraConfig(...).
Conversational: {"messages": [{"role": ..., "content": ...}]} (language modeling) or {"prompt": [...], "completion": [...]}. The chat template is applied automatically — never apply it yourself. Extra columns are allowed; GRPO forwards them to reward functions. Reference: https://huggingface.co/docs/trl/dataset_formats
SFTConfig(
max_length=1024, # truncation length; None disables truncation
packing=True, # pack sequences into max_length blocks: fewer pad tokens, higher throughput
padding_free=True, # flatten batch, no padding; requires FlashAttention; implied by packing
use_liger_kernel=True, # fused Liger kernels, reduces peak memory
assistant_only_loss=True, # loss only on assistant turns (conversational datasets)
)def reward_len(completions, **kwargs):
return [-abs(20 - len(c[0]["content"])) for c in completions]
trainer = GRPOTrainer(
model="Qwen/Qwen2.5-0.5B-Instruct",
reward_funcs=reward_len, # or a list; rewards are summed
args=GRPOConfig(output_dir="Qwen2.5-0.5B-GRPO", max_completion_length=512),
train_dataset=load_dataset("trl-lib/DeepMath-103K", split="train"),
)Reward functions are called with keyword arguments prompts, completions, completion_ids, trainer_state, plus every extra dataset column — accept **kwargs for the ones you ignore. Return list[float], one reward per completion. With conversational data, completions is a list of message lists, not strings.
The generation batch is per_device_train_batch_size × num_processes × steps_per_generation (or set generation_batch_size directly) and must be divisible by num_generations (default 8). Generation is the usual bottleneck — enable vLLM with use_vllm=True: vllm_mode="colocate" shares the training GPUs (size with vllm_gpu_memory_utilization); vllm_mode="server" uses a separate trl vllm-serve --model <model_id>.
AsyncGRPOTrainer (trl.experimental.async_grpo) implements the same algorithm with generation decoupled from training: a background worker streams completions from a vLLM server while the training loop consumes them, so the two overlap instead of alternating.
Flags mirror the config fields: trl sft --model_name_or_path Qwen/Qwen2.5-0.5B --dataset_name trl-lib/Capybara. YAML via --config; distributed presets via --accelerate_config zero3 (Python scripts: accelerate launch train.py).
© huggingface, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/trl-training of huggingface/skills.
Open the folder on GitHubat commit ca0325b
We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in huggingface/skills, which our catalogue first saw on October 7, 2026.
TRL Post-Training next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| TRL Post-Training this skillhuggingface/skills | 11k | 1 repos | ~1.1k | Automated safety check: Pass | Apache-2.0 | |
| verl RL TrainingOrchestra-Research/AI-Research-SKILLs | 13k | 3 repos | ~2.4k | Automated safety check: Pass | MIT | |
| bitsandbytes Model QuantizationOrchestra-Research/AI-Research-SKILLs | 13k | 3 repos | ~2.5k | Automated safety check: Pass | MIT | |
| Hugging Face Transformers Usagedavila7/claude-code-templates | 32k | 12 repos | ~1.2k | Automated safety check: Pass | MIT | |
| Huggingface LLM Trainerwaybarrios/opencode-power-pack | 533 | — | ~3k | Automated safety check: Pass | Apache-2.0 | |
| SimPO Preference TrainingOrchestra-Research/AI-Research-SKILLs | 13k | 5 repos | ~1.5k | Automated safety check: Pass | MIT |
Orchestra-Research/AI-Research-SKILLs
Trains LLMs with reinforcement learning using verl, from ByteDance's Seed team, with GRPO, PPO and other algorithms and swappable training and rollout backends.
Orchestra-Research/AI-Research-SKILLs
Loads large language models in 8-bit or 4-bit with bitsandbytes so they fit smaller GPUs, and sets up QLoRA fine-tuning on a 4-bit base model.
davila7/claude-code-templates
Loads pre-trained Hugging Face Transformers models for text, vision and audio tasks, runs inference with pipelines and fine-tunes on custom datasets.
waybarrios/opencode-power-pack
Train or fine-tune language models with TRL or Unsloth on Hugging Face Jobs, including SFT, DPO, GRPO, reward models, and GGUF conversion.
Orchestra-Research/AI-Research-SKILLs
Walks through aligning language models with SimPO, a reference-free preference optimization method, using accelerate configs for Mistral 7B, Llama 3 8B and math-focused models.
Orchestra-Research/AI-Research-SKILLs
Guides reinforcement-learning research with torchforge, Meta's PyTorch-native library that keeps RL algorithms apart from infrastructure, including GRPO math-reasoning runs.
huggingface/skills
Finds or validates a usable SageMaker execution role before deploying or training, so scripts do not try to create IAM roles they lack permission to create.
huggingface/skills
Chooses the right serving container and current image URI for deploying a Hugging Face model to a SageMaker endpoint, preferring Hugging Face images over generic ones.
huggingface/skills
Trains or fine-tunes language and vision models with TRL or Unsloth on Hugging Face Jobs cloud GPUs, then converts the results to GGUF.
huggingface/skills
Routes a sentence-transformers training task to the right model type and required reference docs and example scripts, covering bi-encoders, rerankers, sparse and multi-vector models.
huggingface/skills
Sets up an isolated Python environment with a supported interpreter and current boto3 before any SageMaker deployment, training or AWS automation code runs.
huggingface/skills
Runs evaluations of Hugging Face Hub models on local hardware with inspect-ai or lighteval, and helps choose between vLLM, Transformers and accelerate backends.
Works with
Categories
Reference for post-training language models with TRL: which trainer and dataset format to use for SFT, DPO, GRPO, KTO and reward models, and how to add LoRA. Each TRL method pairs a `*Trainer` class with a `*Config` dataclass, and the skill maps them to the data they expect: `SFTTrainer` for language-modeling or prompt-completion data, `DPOTrainer` for chosen and rejected pairs, `GRPOTrainer` for prompts plus reward functions, `KTOTrainer` for unpaired labels, `RewardTrainer` for a scalar reward model and `DistillationTrainer` for on-policy distillation with a teacher.experimental`.
TRL Post-Training fits situations like: writing a TRL script for supervised fine-tuning or preference tuning; debugging dataset format or reward function errors in GRPO training; choosing between DPO, KTO and reward-model training for the data you have.
Run `npx skills add huggingface/skills --skill trl-training -a claude-code`. Or copy the skill folder (skills/trl-training in huggingface/skills) into .claude/skills/trl-training in your project. Claude Code loads it when a task matches its description.
Run `npx skills add huggingface/skills --skill trl-training -a codex`. Or copy the skill folder (skills/trl-training in huggingface/skills) into .agents/skills/trl-training in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add huggingface/skills --skill trl-training -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/trl-training, .gemini/skills/trl-training, .github/skills/trl-training and .opencode/skills/trl-training in your project.
SKILL.md names no scripts, command-line tools or credentials: TRL Post-Training is instructions for the agent only. Our summary lists: Python with `trl`, `transformers` and `datasets` installed.
SKILL.md names 1 domain. As links in the text: huggingface.co. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
TRL Post-Training is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.1k tokens (SKILL.md is roughly 4.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with TRL Post-Training: verl RL Training (Orchestra-Research/AI-Research-SKILLs, 13k stars), bitsandbytes Model Quantization (Orchestra-Research/AI-Research-SKILLs, 13k stars), Hugging Face Transformers Usage (davila7/claude-code-templates, 32k stars) and Huggingface LLM Trainer (waybarrios/opencode-power-pack, 533 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
huggingface (a GitHub organization, an official publisher) maintains it in huggingface/skills, which has 11,148 GitHub stars. The repository holds 25 skills in this directory. The repository was last updated on October 1, 2026.
Source: huggingface/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.