# TRL

框架 · https://godooo.ai/zh/framework/trl

> TRL 是 Hugging Face 出品的开源 AI 开发框架，2020 年推出，面向开发者。

用 SFT、DPO、GRPO 等方法对语言模型做后训练的库。

主打：模型微调。开源，可以免费使用。使用方式：自部署、本地离线运行、命令行。

## 速览

- **类别:** [框架](https://godooo.ai/zh/browse#framework)
- **出品方:** [Hugging Face](https://godooo.ai/zh/org/hugging-face)
- **推出于:** 2020
- **所属星系:** [模型与 API](https://godooo.ai/zh/galaxy/builders)
- **是否开源:** 是 · Apache-2.0
- **源代码:** [github.com/huggingface/trl](https://github.com/huggingface/trl)
- **GitHub 星标:** 19,377
- **使用方式:** 可自部署 · 可离线本地运行 · 命令行
- **适合谁:** 开发者
- **官网:** [hf.co](https://hf.co/docs/trl)
- **别名:** Transformers Reinforcement Learning

## 能做什么

- **[模型微调](https://godooo.ai/zh/capability/fine-tuning)** — 主打, _由机器提出，尚待校准_. “TRL is a cutting-edge library designed for post-training foundation models using advanced techniques like Supervised Fine-Tuning (SFT), Group Relative Policy Optimization (GRPO), and Direct Preference Optimization (DPO).” (摘自 [github.com](https://github.com/huggingface/trl)，2026-09-24)
- **[模型训练](https://godooo.ai/zh/capability/model-training)** — 支持, _由机器提出，尚待校准_. “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.” (摘自 [huggingface.co](https://huggingface.co/docs/trl/index)，2026-09-24)

## 平替与同类

- **[nanoGPT](https://godooo.ai/zh/framework/nanogpt)** (开源免费): 同样能做：模型微调、模型训练
- **[Kohya's GUI](https://godooo.ai/zh/product/kohya-ss)** (开源免费): 同样能做：模型微调、模型训练
- **[LlamaFactory](https://godooo.ai/zh/framework/llamafactory)** (开源免费): 同样能做：模型微调、模型训练
- **[Unsloth](https://godooo.ai/zh/framework/unsloth)** (开源免费): 同样能做：模型微调、模型训练
- **[Axolotl](https://godooo.ai/zh/framework/axolotl)** (开源免费): 同样能做：模型微调
- **[MLX](https://godooo.ai/zh/framework/mlx)** (开源免费): 同样能做：模型训练、模型微调
- **[PEFT](https://godooo.ai/zh/framework/peft)** (开源免费): 同样能做：模型微调
- **[Hugging Face](https://godooo.ai/zh/product/huggingface)** (免费版 + 付费升级): 同样能做：模型微调、模型训练
- **[ModelScope](https://godooo.ai/zh/product/modelscope)** (开源免费): 同样能做：模型微调、模型训练
- **[Sentence Transformers](https://godooo.ai/zh/framework/sentence-transformers)** (开源免费): 同样能做：模型微调、模型训练
- **[Together AI](https://godooo.ai/zh/product/together)** (付费): 同样能做：模型微调、模型训练
- **[Modal](https://godooo.ai/zh/product/modal)** (付费): 同样能做：模型微调、模型训练

## 关系

- **应用了:** [RLHF](https://godooo.ai/zh/concept/rlhf)
- **基于…构建:** [Transformers](https://godooo.ai/zh/framework/transformers)

## 常见问题

### TRL 是什么？

TRL 是 Hugging Face 出品的开源 AI 开发框架，2020 年推出，面向开发者。用 SFT、DPO、GRPO 等方法对语言模型做后训练的库。

### TRL 免费吗？

免费。TRL 是开源软件（Apache-2.0）。

### TRL 开源吗？

开源，许可证是 Apache-2.0。源代码在 https://github.com/huggingface/trl。

### TRL 能本地运行吗？

能，可以在自己的电脑上离线运行。也可以部署在自己的服务器上。

### TRL 能做什么？

主打：模型微调。也能做：模型训练。

### TRL 是谁开发的？

由 Hugging Face 开发。

### TRL 有哪些开源替代品？

开源的有：nanoGPT、Kohya's GUI、LlamaFactory、Unsloth、Axolotl、MLX、PEFT、ModelScope。其他：Hugging Face、Together AI、Modal。

## 来源

- [github.com](https://github.com/huggingface/trl) — 核实于 2026-09-24
- [huggingface.co](https://huggingface.co/docs/trl/index) — 核实于 2026-09-24
- [hf.co](https://hf.co/docs/trl)

---

最后更新 2026-09-24 · 来源核实于 2026-09-24 · 这是 https://godooo.ai/zh/framework/trl 的 Markdown 版本。本站每个页面都有：在地址后面加 .md。
