Agent skill · AI & Agents

fine-tuning-with-trl

Fine-tune LLMs using reinforcement learning with TRL - SFT for instruction tuning, DPO for preference alignment, PPO/GRPO for reward optimization, and reward model training. Use when need RLHF, align model with preferences, or train from human feedback. Works with HuggingFace Transformers.

Orchestra-Researchgithub.com/Orchestra-ResearchGitHub ↗
claude-codecodexMIT
Install
npx skills add Orchestra-Research/AI-Research-SKILLs --skill trl-fine-tuning --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 5
SKILL.md size: 11 KB
Bundled scripts: none
Version: 1.0.0
Declared author: Orchestra Research
Requires: [trl, transformers, datasets, peft, accelerate, torch]
Path: 06-post-training/trl-fine-tuning/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 11,391
Language: TeX
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# TRL - Transformer Reinforcement Learning ## Quick start TRL provides post-training methods for aligning language models with human preferences. **Installation**: ```bash pip install trl transformers datasets peft accelerate ``` **Supervised Fine-Tuning** (instruction tuning): ```python from trl import SFTTrainer trainer = SFTTrainer( model="Qwen/Qwen2.5-0.5B", train_dataset=dataset, # Prompt-completion pairs ) trainer.train() ``` **DPO** (align with preferences): ```python from trl import DPOTrainer, DPOConfig config = DPOConfig(output_dir="model-dpo", beta=0.1) trainer = DPOTrainer( model=model, args=config, train_dataset=preference_dataset, # chosen/rejected pairs processing_class=tokenizer ) trainer.train() ``` ## Common workflows ### Workflow 1: Full RLHF pipeline (SFT → Reward Model → PPO) Complete pipeline from base model to human-aligned model. Copy this checklist: ``` RLHF Training: - [ ] Step 1: Supervised fine-tuning (SFT) - [ ] Step 2: Train reward model - [ ] Step 3: PPO reinforcement learning - [ ] Step 4: Evaluate aligned model ``` **Step 1: Supervised fine-tuning** Train base model on instruction-following data: ```python from transformers import AutoModelForCausal

What's inside
Steps it walks through
  1. Quick start
  2. Common workflows
  3. Workflow 1: Full RLHF pipeline (SFT → Reward Model → PPO)
  4. Workflow 2: Simple preference alignment with DPO
  5. Workflow 3: Memory-efficient online RL with GRPO
  6. When to use vs alternatives
  7. Common issues
  8. Advanced topics
  9. Hardware requirements
  10. Resources
Ships with 4 files
  • references/dpo-variants.md
  • references/online-rl.md
  • references/reward-modeling.md
  • references/sft-training.md
Commands it runs
pip install trl transformers datasets peft accelerate
python -m trl.scripts.ppo \
trl dpo \
trl grpo \
More from AI-Research-SKILLs
All skills →
About this skill
What does the fine-tuning-with-trl skill do?

Fine-tune LLMs using reinforcement learning with TRL - SFT for instruction tuning, DPO for preference alignment, PPO/GRPO for reward optimization, and reward model training. Use when need RLHF, align model with preferences, or train from human feedback. Works with HuggingFace Transformers.

How do I install it?

Run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill trl-fine-tuning --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From Orchestra-Research/AI-Research-SKILLs, a repository with 11,391 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going