$npx skillfedfor your agent

fine-tuning-with-trl

This skill teaches post-training techniques for aligning language models to human preferences. It covers supervised fine-tuning, direct preference optimization (DPO), and online reinforcement learning methods like RLOO and GRPO, with complete workflows and practical examples.

fine-tuning-with-trl teaches you to align language models with human preferences using DPO, RLOO, and GRPO methods.

AI-generated summary based on this skill's SKILL.md

221,503 42,317 MITupdated by NousResearch

Decision gist · record as of 2026-07-28

fine-tuning-with-trl teaches you to align language models with human preferences using DPO, RLOO, and GRPO methods. This skill teaches post-training techniques for aligning language models to human preferences. It covers supervised fine-tuning, direct preference optimization (DPO), and online reinforcement learning methods like RLOO and GRPO, with complete workflows and practical examples.

manual: git clone https://github.com/NousResearch/hermes-agent → cp -r hermes-agent/optional-skills/mlops/training/trl-fine-tuning ~/.claude/skills/trl-fine-tuning
optional-skills/mlops/training/trl-fine-tuning/SKILL.md · version e1f1cd0d

Use it when

  • fine-tuning-with-trl teaches the full RLHF workflow: starting with supervised fine-tuning (SFT) on instruction data.
  • Yes.

Verify before relying

Read SKILL.md below before installing (7 files). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

NousResearch/hermes-agent/trl-fine-tuning · repository language: Python

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What does fine-tuning-with-trl teach about DPO for LLM alignment?

fine-tuning-with-trl covers Direct Preference Optimization (DPO) as a key method for aligning language models with human preferences. DPO trains models directly on preference pairs without requiring a separate reward model, making it more efficient than traditional RLHF. The skill includes practical examples and implementation guidance for applying DPO to your models.

How do I implement a complete RLHF pipeline using fine-tuning-with-trl?

fine-tuning-with-trl teaches the full RLHF workflow: starting with supervised fine-tuning (SFT) on instruction data, then training a reward model to score outputs based on preference data, and finally running online RL using methods like RLOO or GRPO. The skill provides step-by-step guidance and code examples for each stage.

Can fine-tuning-with-trl help me train a reward model?

Yes. fine-tuning-with-trl covers reward model training to score language model outputs based on human preference data. This is a critical component of preference alignment pipelines. The skill explains how to prepare preference datasets and train models that effectively distinguish between better and worse outputs.

What alignment methods does fine-tuning-with-trl compare?

fine-tuning-with-trl covers SFT (supervised fine-tuning), DPO (direct preference optimization), RLOO (online reinforcement learning), and GRPO (group relative policy optimization). The skill helps you choose between these methods based on your use case, considering factors like computational efficiency, data requirements, and alignment quality.

How does fine-tuning-with-trl address training instability and memory issues?

fine-tuning-with-trl includes troubleshooting guidance for common preference alignment challenges like out-of-memory errors, poor output quality, and training instability. The skill provides practical solutions and best practices to help you debug and optimize your alignment training workflows.

What is the license for fine-tuning-with-trl?

fine-tuning-with-trl is released under the MIT license, allowing free use, modification, and distribution for both commercial and personal projects.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

TRL - Transformer Reinforcement Learning

Quick start

TRL provides post-training methods for aligning language models with human preferences.

Installation:

pip install trl transformers datasets peft accelerate

Supervised Fine-Tuning (instruction tuning):

from trl import SFTTrainer

trainer = SFTTrainer(
    model="Qwen/Qwen2.5-0.5B",
    train_dataset=dataset,  # Prompt-completion pairs
)
trainer.train()

DPO (align with preferences):

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

(truncated - see the full file via the links below)

File tree — 7 files
optional-skills/mlops/training/trl-fine-tuning/SKILL.md
optional-skills/mlops/training/trl-fine-tuning/references/dpo-variants.md
optional-skills/mlops/training/trl-fine-tuning/references/grpo-training.md
optional-skills/mlops/training/trl-fine-tuning/references/online-rl.md
optional-skills/mlops/training/trl-fine-tuning/references/reward-modeling.md
optional-skills/mlops/training/trl-fine-tuning/references/sft-training.md
optional-skills/mlops/training/trl-fine-tuning/templates/basic_grpo_training.py

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Learn how to align language models with human preferences using DPO, RLOO, or GRPO”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

fine-tuning-with-trl
by Orchestra-Research · Orchestra-Research/AI-Research-SKILLs

Fine-tuning with TRL provides post-training methods to align language models with human preferences through multiple approaches. Train models on instruction data with SFT, optimize for preference alignment via DPO without a separate reward model, or run full RLHF pipelines combining supervised fine-tuning, reward modeling, and PPO optimization. GRPO offers memory-efficient online reinforcement learning for resource-constrained setups.

MITupdated Jun 2026
★ 11,165repo stars
fine-tuning-with-trl
by moltis-org · moltis-org/moltis

This skill teaches you to apply reinforcement learning techniques for aligning language models with human preferences. It covers supervised fine-tuning for instruction following, direct preference optimization for preference alignment, PPO and GRPO for reward-based training, and reward model development—all integrated with HuggingFace Transformers.

MITupdated Jul 2026
★ 2,795repo stars
llamafactory
by Prism-Shadow · Prism-Shadow/penguin-harness

LlamaFactory streamlines LLM fine-tuning through YAML-driven configs, supporting LoRA, QLoRA, and full-parameter training methods like SFT and DPO. Register datasets, train your model, merge adapters, and export for standalone deployment or API serving. The skill guides you through GPU requirements, base model selection, and inference setup.

Apache-2.0updated Jul 2026
★ 205repo stars
unsloth-fine-tuning
by synthetic-sciences · synthetic-sciences/openscience

Unsloth accelerates LLM fine-tuning on consumer and datacenter GPUs through optimized LoRA and QLoRA training, cutting both speed and memory requirements dramatically. It handles supervised fine-tuning, reinforcement learning with GRPO, vision model adaptation, and TTS training across 300+ model architectures, with direct export to GGUF for deployment on Ollama and llama.cpp.

Apache-2.0updated Jul 2026
★ 2,896repo stars
llm-fine-tuning
by BagelHole · BagelHole/DevOps-Security-Agent-Skills

Configure end-to-end LLM fine-tuning from single-GPU LoRA to multi-node distributed training. This skill covers QLoRA quantization for large models on consumer hardware, Axolotl framework setup, DeepSpeed ZeRO optimization, DPO alignment, and adapter merging for production deployment.

MITupdated May 2026
★ 44repo stars
hugging-face-model-trainer
by synthetic-sciences · synthetic-sciences/openscience

Fine-tune language models on managed Hugging Face infrastructure without local GPU setup using TRL's supervised fine-tuning, preference optimization, and reinforcement learning methods. The skill handles dataset preparation, hardware selection, real-time monitoring via Trackio, and automatic model persistence to the Hub, with built-in support for GGUF conversion to deploy trained models locally.

Apache-2.0updated Jul 2026
★ 2,896repo stars

More skills huggingface-llm-trainer (Apache-2.0)

Tags
instruction-tuningpolicy-optimizationhuman-feedback-learningmodel-alignmentreward-scoringonline-reinforcement-learningpreference-datallm-training-pipelinememory-efficient-trainingloss-function-variants