TRL
🤗 TRL – Transformer Reinforcement Learning
A library for training language models after pretraining: supervised fine-tuning (SFT), preferences (DPO), and reinforcement learning such as PPO and GRPO.
Basic information
| Name | TRL |
|---|---|
| Full name | 🤗 TRL – Transformer Reinforcement Learning |
| Category | Generative AI |
| Developer | Hugging Face |
| Release year | Not specified |
| Official website | github.com/huggingface/trl |
| GitHub repository | huggingface/trl |
| Official documentation | Not specified |
| Package on PyPI | trl |
| License | Apache-2.0 (PyPI license_expression) |
| Project status | Active Had a release in the last 12 months |
| Latest version | 19 November 2026 (version 1.18.2) |
| Programming language | Python |
| Operating systems | OS Independent (as declared by the package on PyPI) |
| Required Python version | >=3.11 |
| Difficulty level | Advanced |
Data last checked: 21 November 2026 — source: PyPI JSON API (2026-11-21)
Overview
TRL offers ready trainers (SFTTrainer, DPOTrainer, GRPOTrainer and others) built on Transformers, with PEFT and distributed training support, for alignment and instruction-tuning stages.
It requires an understanding of preference data and training settings, and suitable GPU resources.
When to choose it? Choose it for instruction tuning and alignment once the base model is chosen.
Uses
Main uses
- Supervised instruction tuning (SFT)
- Preference training (DPO)
- Preference training (DPO)
- Reinforcement learning from rewards
- Reinforcement learning from rewards
Scientific fields
- Language models
- Language models
Suitable project types
- An Arabic chat model tuned with instructions
- An Arabic chat model tuned with instructions
Research applications
- Experiments with alignment and preference methods
- Experiments with alignment and preference methods
Technical features
A feature is shown as "Supported" only if it is documented in the library's official documentation; anything we have not verified is shown as "Not specified".
| CPU support | Partial or through an add-onOnly possible for very small experiments. |
|---|---|
| GPU support | Supported |
| CUDA compatibility | Supported |
| Distributed training or computing | Supported |
| Automatic differentiation (Autodiff) | SupportedThrough PyTorch. |
| Model deployment | Not applicable |
| Pre-trained models | Not applicable |
| Supported data types | Models, text and datasets |
| Integration with other libraries | Hugging Face Transformers, PEFT, Unsloth, vLLM |
| Flexibility (editorial estimate) | High |
| Performance (editorial estimate) | Good |
| Community (editorial estimate) | Large |
| Documentation quality (editorial estimate) | Good documentation |
Installation and running
pip install trlCompatibility: Python >=3.11 — according to the package data on PyPI, checked on 21 November 2026
Compatibility: Python >=3.11 — according to the package data on PyPI, checked on 21 November 2026
Installing inside a virtual environment (venv or conda) is recommended. If you need compatibility with a specific CUDA version or operating system, refer to the official documentation, because this information changes with every release.
Pros
- Ready implementations of modern alignment methods
- Integration with PEFT
Limitations
- Requires GPU resources
- Changes quickly as new methods appear
References and verification
- Package page on PyPI (source of the version, licence and release date) Checked directly
https://pypi.org/project/trl/
Checked on: 21 November 2026 — version checked: 1.18.2 — reviewed by: the DLArabic team
- Official website A link the package officially declares on PyPI
https://github.com/huggingface/trl
Checked on: 21 November 2026 — reviewed by: the DLArabic team
- Official repository A link the package officially declares on PyPI
https://github.com/huggingface/trl
Checked on: 21 November 2026 — reviewed by: the DLArabic team
- Package page on PyPI (source of the version, licence and release date) Checked directly
https://pypi.org/project/trl/
Checked on: 21 November 2026 — version checked: 1.18.2 — reviewed by: the DLArabic team
- Official website A link the package officially declares on PyPI
https://github.com/huggingface/trl
Checked on: 21 November 2026 — reviewed by: the DLArabic team
- Official repository A link the package officially declares on PyPI
https://github.com/huggingface/trl
Checked on: 21 November 2026 — reviewed by: the DLArabic team
History of verified versions
| Version | Release date | Checked on |
|---|---|---|
| 1.18.2 | 19 November 2026 | 21 November 2026 |
Page information last reviewed: 21 November 2026. The description was written originally for the encyclopedia and is not copied from the official websites.
