chapter eight

8 Preference optimization: Teaching your model to judge

 

This chapter covers

  • Training Direct Preference Optimization (DPO) on preference pairs using the Transformer Reinforcement Learning (TRL) library’s DPOTrainer
  • Evaluating base, SFT, and DPO models with the progressive evaluation pipeline
  • Why SFT plateaus on style, helpfulness, and safety boundary tuning
  • Comparing Group Relative Policy Optimization (GRPO), Reinforcement Learning from Human Feedback (RLHF), and Reinforcement Fine-Tuning (RFT) tradeoffs
  • Testing safety regression after preference tuning

In chapter 6, we saw that the SFT model improved quality substantially across the target domain. On the IT help-desk evaluation, Token-F1 moved only a little (from 0.153 base to 0.168 SFT on the held-out test split). Still, the model learned to follow your system prompt, produce concise answers, and match the formatting conventions in your training data (format adherence jumped from 0% to 100%). But some quality dimensions resist supervised learning entirely. Two responses can both be factually correct, and yet one is clearly better: more helpful, better structured, more appropriately detailed. SFT cannot teach this distinction because it only sees positive examples. Preference optimization addresses this gap by training the model on response pairs (one better, one worse), so it learns to judge rather than merely imitate.

8.1 When fine-tuning plateaus

8.2 Direct preference optimization (DPO): Deep dive

8.2.1 Building preference data

8.2.2 Preference data sources: A taxonomy

8.2.3 Training with DPOTrainer

8.2.4 Interpreting DPO training metrics

8.2.5 How DPO works

8.2.6 End-to-end pipeline summary

8.2.7 Evaluating DPO: Three-way comparison

8.2.8 Where DPO wins: A conciseness demonstration

8.2.9 Go/no-go criteria for shipping a DPO model

8.2.10 Monitoring preference-tuned models in production

8.2.11 DPO variants: When to consider alternatives

8.3 GRPO: Group relative policy optimization

8.3.1 How GRPO works

8.3.2 When GRPO excels

8.3.3 GRPO in practice

8.4 RLHF: Why most enterprises skip it

8.4.1 The RLHF pipeline

8.4.2 Why enterprises skip it

8.4.3 When RLHF is unavoidable

8.5 Reinforcement fine-tuning (RFT) with verifiable rewards

8.5.1 Enterprise applications of RFT

8.5.2 How RFT works

8.5.3 The 2025 RLVR findings

8.5.4 Key challenge: Reward hacking

8.5.5 Cost and applicability

8.6 Cold-start SFT + RL: The DeepSeek-R1 pattern