MLCrack

    LLMS & TRANSFORMERS · INTERVIEW QUESTION

    What is DPO (Direct Preference Optimization)? How does it compare to RLHF?

    🟡 intermediate · RLHF & Alignment

    Hint: DPO eliminates the reward model. Think about the loss function.

    Answer

    DPO directly optimizes a language model on preference pairs without training a separate reward model or using RL. The insight: the optimal policy under RLHF's KL-constrained reward maximization has a closed-form solution that maps reward to log-probability ratios. DPO's loss: L = -log σ(β log(π_θ(y_w|x)/π_ref(y_w|x)) - β log(π_θ(y_l|x)/π_ref(y_l|x))) where y_w is the preferred and y_l is the dispreferred response. Advantages over RLHF:

    1. No reward model training
    2. No RL optimization (simpler)
    3. More stable training
    4. Lower compute.

    Limitations: may be less expressive than RL, sensitive to data quality, doesn't explicitly learn a reward function for other uses.