TRL documentation

TRL - Transformers Reinforcement Learning

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

TRL - Transformers Reinforcement Learning

TRL is a full stack library where we provide a set of tools to train transformer language models with methods like Supervised Fine-Tuning (SFT), Group Relative Policy Optimization (GRPO), Direct Preference Optimization (DPO), Reward Modeling, and more. The library is integrated with 🤗 transformers.

🎉 What’s New

⚡ AsyncGRPOTrainer is now stable: AsyncGRPOTrainer graduates to the stable API. It runs GRPO much faster by decoupling generation from training: a vLLM server streams rollouts while the trainer updates the model.

Taxonomy

Below is an overview of TRL trainers, organized by maturity and method type.

Online methods

Reward modeling

Offline methods

Knowledge distillation

Experimental

You can also explore TRL-related models, datasets, and demos in the TRL Hugging Face organization.

Learn

Learn post-training with TRL and other libraries in 🤗 smol course.

Contents

The documentation is organized into the following sections:

  • Getting Started: installation and quickstart guide.
  • Conceptual Guides: dataset formats, training FAQ, and understanding logs.
  • How-to Guides: reducing memory usage, speeding up training, distributing training, etc.
  • Integrations: DeepSpeed, PEFT, etc.
  • Examples: example overview, community tutorials, etc.
  • API: trainers, utils, etc.

Blog posts

thumbnail

Published on November 13, 2026

AsyncGRPOTrainer is stable: async RL in TRL

thumbnail

Published on September 10, 2026

Async GRPO with LoRA across HF Jobs: a bucket, a proxy, and no NCCL

thumbnail

Published on May 27, 2026

Shipping a Trillion Parameters With a Hub Bucket: Delta Weight Sync in TRL

thumbnail

Published on April 12, 2026

Distilling 100B+ Models 40x Faster with TRL

thumbnail

Published on March 31, 2026

TRL v1.0: Post-Training Library Built to Move with the Field

thumbnail

Published on March 10, 2026

Keep the Tokens Flowing: Lessons from 16 Open-Source RL Libraries

thumbnail

Published on March 9, 2026

Ulysses Sequence Parallelism: Training with Million-Token Contexts

thumbnail

Published on October 29, 2025

Unlocking On-Policy Distillation for Any Model Family

thumbnail

Published October 23, 2025

Building the Open Agent Ecosystem Together: Introducing OpenEnv

thumbnail

Published on August 7, 2025

Vision Language Model Alignment in TRL ⚡️

thumbnail

Published on June 3, 2025

NO GPU left behind: Unlocking Efficiency with Co-located vLLM in TRL

thumbnail

Published on May 25, 2025

🐯 Liger GRPO meets TRL

thumbnail

Published on January 28, 2025

Open-R1: a fully open reproduction of DeepSeek-R1

thumbnail

Published on July 10, 2024

Preference Optimization for Vision Language Models with TRL

thumbnail

Published on June 12, 2024

Putting RL back in RLHF

thumbnail

Published on January 10, 2024

Make LLM Fine-tuning 2x faster with Unsloth and 🤗 TRL

thumbnail

Published on September 29, 2023

Finetune Stable Diffusion Models with DDPO via TRL

thumbnail

Published on August 8, 2023

Fine-tune Llama 2 with DPO

thumbnail

Published on April 5, 2023

StackLLaMA: A hands-on guide to train LLaMA with RLHF

thumbnail

Published on March 9, 2023

Fine-tuning 20B LLMs with RLHF on a 24GB consumer GPU

thumbnail

Published on December 9, 2022

Illustrating Reinforcement Learning from Human Feedback

Talks

Update on GitHub