huggingface/trl

Train transformer language models with reinforcement learning.

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 39 minutes ago
Added to GitGenius on September 3rd, 2026
Created on March 27th, 2020
Open Issues & Pull Requests: 329 (+0)
GitHub issues: Enabled
Number of forks: 2,967
Total Stargazers: 19,242 (+0)
Total Subscribers: 107 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

TRL is a library for training transformer language models with reinforcement learning.

TRL addresses the challenge of post-training foundation models by providing implementations of advanced techniques including Supervised Fine-Tuning, Group Relative Policy Optimization, and Direct Preference Optimization. The library wraps these methods in trainer classes that handle the complexity of reinforcement learning workflows, allowing developers to apply sophisticated alignment and optimization techniques without building infrastructure from scratch. It integrates with the Hugging Face ecosystem, particularly Transformers, Accelerate, and PEFT, to enable efficient training across different hardware configurations.

Teams should adopt TRL when post-training language models with preference-based or reinforcement learning methods. It suits projects ranging from single-GPU setups to multi-node distributed training, and supports parameter-efficient fine-tuning through quantization and LoRA integration. The library includes a command-line interface for users who prefer not to write training code. The README highlights that TRL can leverage Unsloth for accelerated training through optimized kernels and integrates with DeepSpeed for scaling.

The project receives issue reports from both core maintainers and external users, indicating adoption beyond the immediate team without an overwhelming support burden. Maintainers typically respond to new issues and pull requests within a day. Work in the issue tracker centers on bug fixes, the GRPO trainer implementation, and feature enhancements.