Chapter 10. Alignment and Preference Optimization
Your fine-tuned model from Chapter 9 knows medical terminology. It can rattle off symptoms of various illnesses, and it’s meeting the tone of voice from your Q&A dataset.
But this is just the start of communicating effectively; a model that has memorized the right facts can still deliver them in the wrong tone. Supervised fine-tuning (SFT) teaches the model what to say. Alignment teaches it how to say it.
This chapter introduces the techniques that bridge that gap: Reinforcement Learning from Human Feedback (RLHF) and its modern, more practical successor, Direct Preference Optimization (DPO). By the end, you’ll understand why alignment is a separate stage from fine-tuning, how to build the preference datasets that drive it, and how to run a DPO training loop on your medical Q&A model—all without significant hardware investments! It’s a light introduction to a massive topic, but hopefully will be enough to help you understand how impactful strong ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access