Loading lesson page...
Capstone Lesson 40: Direct Preference Optimization from Scratch
BuildPython (torchnumpy)No prerequisitesReward models and PPO are the classical RLHF stack. DPO collapses that stack into a single supervised loss that fits a policy directly against preference pairs. This lesson derives the DPO loss from the reward-difference identity, ships a...