TRL is the alignment toolkit
trl (Transformer Reinforcement Learning) is the canonical Python library for: SFT (we covered this), DPO (Direct Preference Optimization), KTO, GRPO, and other preference / RL methods. IPO lives on as a DPO loss type, and PPO (Proximal Policy Optimization for RLHF) and ORPO have moved to trl.experimental. The dominant 2026 default for alignment is DPO — it skips the reward-model + PPO loop and trains directly on preference pairs.
DPO in 30 seconds
DPO takes pairs (prompt, chosen, rejected). The objective increases probability of chosen relative to rejected using a closed-form bound that mirrors RLHF without the RL. Training looks like SFT with a different loss; converges fast; doesn't need a separate reward model.