Skip to main content
This guide covers methods to accelerate training in TRL. Each technique includes minimal examples with links to more comprehensive documentation.

vLLM for fast generation in online methods

Online methods such as GRPO or Online DPO require the model to generate completions, which is often the slowest step. vLLM speeds up generation significantly through PagedAttention and other optimizations. Install vLLM:
1

Start a vLLM server

2

Enable vLLM in your training config

Ensure that GPUs assigned for training and generation are separate to avoid resource conflicts. For example, with 8 GPUs total:
For full configuration options, see the vLLM Integration guide.

Optimized attention implementations

TRL supports optimized attention backends that speed up training while reducing memory usage.
Optimized attention works across all TRL trainers.

Liger Kernel

Liger Kernel is a collection of Triton kernels designed for LLM training. It can increase multi-GPU throughput by 20% and reduce memory usage by 60%.
For more details, see the Liger Kernel Integration guide.

Mixed precision training

Mixed precision training using bf16 or fp16 can speed up training and reduce memory usage with minimal impact on model quality.
Mixed precision is supported across all TRL trainers.