trl
by huggingface
TRL is a Python library from Hugging Face for post-training language models using methods such as supervised fine-tuning, preference optimisation and reinforcement learning. It is for adapting existing open models to your own data and behaviour.
- Stars
- 19.6k
- Licence
- Apache-2.0
- Runs on
- A gpu machine, with a GPU
- Setup
- Technical
- Language
- Python
- Age
- 2409 days
What you can do with it
- Fine-tune an open language model on your own dataset using supervised fine-tuning
- Align a model to human preferences using DPO or KTO training
- Train reasoning models with reward functions using GRPO
Make money with it
A freelancer could offer custom model fine-tuning services, training small open models on a client's own data for a fixed fee.
An idea, not financial advice. Check the licence before charging for anything built on it.
Ways a business could use it
- Fine-tune a small open model on your own support tickets or documents so it answers in your company's style without per-token API costs
- Build a specialised in-house model for a narrow task, such as classification or data extraction, to replace a more expensive hosted model
Can you use it commercially?
Free to use, change and sell, including in paid products. Keep the copyright notice.
Not legal advice. Read the project's licence file before building a product on it.
Getting it running
Install it with pip install trl, then write a short Python script (or use the command line interface) to run a trainer on a dataset.
Follow the official instructions in the project README.
Things to check
- Needs a GPU, and larger models need substantial and costly hardware
- Requires machine learning knowledge to get good results
- Base models and datasets carry their own licences that need checking before commercial use
Who's talking about it
Checked 01 Nov 2026. Summary drafted by AI from the project's README.