What problem does it solve? Aligning language models with human preferences requires complex RLHF pipelines involving supervised fine-tuning, reward modeling, and reinforcement learning, which are difficult to implement correctly from scratch. ## Core Features & Use Cases - Supervised Fine-Tuning (SFT): Train base models on instruction-following datasets with chat templates, packing, and LoRA support. - Preference Alignment with DPO: Align models using chosen/rejected preference pairs without training a separate reward model, with 10+ loss variants including IPO, hinge, and robust DPO. - Online RL with PPO and GRPO: Optimize policies against reward models or custom reward functions, with GRPO offering memory-efficient training. - Reward Model Training: Train Bradley-Terry reward models on preference data for use in full RLHF pipelines. - Use Case: Take a base Qwen model, run SFT on instruction data, train a reward model on UltraFeedback preferences, then apply PPO to produce a human-aligned chat model. ## Quick Start Ask the AI to fine-tune a Qwen model with DPO on a preference dataset using TRL and save the aligned model to an output directory.