chapter seven

7 Reinforcement learning from human feedback

 

This chapter covers

  • Bridging evaluation metrics into training signals
  • Post-training of AI models via supervised fine-tuning and reinforcement learning
  • Learning reward functions from human preferences
  • Engineering rewards beyond preference models

In chapter 6, we ended with an observation that will shape everything in part 3 of this book. Evaluation metrics produce scalar scores, which can drive training. When we compute faithfulness, answer relevance, or context precision for a RAG system, those scores are structurally the same kind of signal that a reinforcement learning algorithm consumes when it updates a policy. Whether they actually work as training signals, and what to do when they do not, is the central question of this chapter.

The answer begins with a paper Christiano and colleagues published at OpenAI in 2017. They asked a simple question: what if we could train AI systems by asking humans which of two outputs they prefer, rather than asking them to demonstrate the correct output from scratch? Their paper,Deep reinforcement learning from human preferences[1] showed that a simulated robot could be taught to do a backflip and an Atari agent could be taught to play competitive Pong using only about a thousand labeled pairs of human comparisons. This empirical result became Reinforcement Learning from Human Feedback, or RLHF.

7.1 From evaluations to alignment

7.1.1 Verifiable and open-ended rewards

7.1.2 Alignment is multi-dimensional

7.2 Training of foundation models from pre-training to reinforcement learning

7.2.1 Pre-training

7.2.2 Supervised fine-tuning

7.3 Reinforcement learning with language models

7.3.1 The reinforcement learning training loop

7.3.2 From classical RL to language models

7.4 Preference learning

7.4.1 Why automated metrics fail as rewards

7.4.2 Learning a reward from human preferences

7.4.3 Adapting the recipe to language models

7.5 Scaling RLHF to production with InstructGPT

7.5.1 The three-stage pipeline

7.5.2 Stage 1: SFT on labeler demonstration

7.5.3 Stage 2: Training the reward model

7.5.4 Stage 3: PPO with a KL penalty

7.5.5 Results and the alignment tax

7.5.6 What carried forward and what replaced PPO

7.5.7 Using the reward model beyond PPO

7.5.8 RLAIF: Scaling preferences with AI labelers

7.6 Reinforcement learning failure modes in practice

7.6.1 Reward hacking in production

7.6.2 Annotation quality and population bias

7.6.3 Credit assignment problem

7.6.4 Where RLHF leads next