liveBook · Manning

What you will learn in Reinforcement Learning from Human Feedback

Alignment and post-training of LLMs

by Nathan Lambert
Foreword by Thomas Wolf

Chapter by chapter

Chapter 1: Introduction

The introduction explains why RLHF arose and briefly traces its move from traditional reinforcement-learning applications to prominence with ChatGPT.

1.1 RLHF in three steps · 1.2 What does RLHF do? · 1.3 Walkthrough of an RLHF recipe · 1.4 An intuition for post-training · 1.5 How we got here · 1.6 Future of RLHF · 1.7 Summary

What you learn in chapter 1 →

Chapter 2: A tiny history of RLHF

This introduction explains why RLHF’s recent history matters for understanding its present-day pipeline.

2.1 Origins to 2018: RL on preferences · 2.2 2019 to 2022: RL from human preferences on language models · 2.3 2023 to the present: The ChatGPT era · 2.4 Summary

What you learn in chapter 2 →

Chapter 3: Training overview

This introduction frames RLHF training as a multi-model process centered on optimizing a proxy for human preferences while limiting distance from a reference.

3.1 Problem formulation · 3.1.1 A simple example: The thermostat · 3.1.2 Classic RL example: CartPole · 3.1.3 Manipulating the standard RL setup · 3.1.4 Fine-tuning and regularization · 3.1.5 Optimization tools · 3.1.6 Subtle advantages of RL in post-training language models · 3.2 Canonical training recipes · 3.2.1 InstructGPT · 3.2.2 Tülu 3 · 3.2.3 DeepSeek R1 · 3.3 Summary

What you learn in chapter 3 →

Chapter 4: Instruction fine-tuning

Introduces instruction fine-tuning as the supervised step that makes pretrained language models follow instructions and prepares them for RLHF.

4.1 Chat templates and the structure of instructions · 4.2 Best practices for instruction tuning · 4.3 Implementation details · 4.4 Summary

What you learn in chapter 4 →

Chapter 5: Reward modeling

This introduction explains why reward models make human preferences usable for RLHF optimization and how a learned reward model supplies the agent’s learning signal.

5.1 Training a Bradley–Terry reward model · 5.2 Implementation example · 5.3 Reward model variants · 5.3.1 Preference margin loss · 5.3.2 Balancing multiple comparisons per prompt · 5.3.3 K-wise loss function · 5.4 Outcome reward models · 5.5 Process reward models · 5.6 Comparing reward model types (and value functions) · 5.6.1 Inference across reward model types · 5.7 Generative reward modeling (a.k.a. LLM-as-a-judge) · 5.8 Further reading · 5.9 Summary

What you learn in chapter 5 →

Chapter 6: Reinforcement learning

Introduces the RLHF training loop in which a policy generates completions, a reward model scores them, and reinforcement learning repeatedly updates the policy.

6.1 The role of reinforcement learning in RLHF · 6.2 Policy gradient algorithms · 6.2.1 Deriving the policy gradient · 6.2.2 Vanilla policy gradient · 6.2.3 REINFORCE · 6.2.4 REINFORCE leave one out · 6.2.5 Proximal policy optimization · 6.2.6 Understanding the PPO objective · 6.2.7 Value functions and PPO · 6.2.8 Group relative policy optimization · 6.2.9 Group sequence policy optimization · 6.2.10 Clipped importance sampling policy optimization · 6.2.11 Comparing algorithms · 6.3 Implementation · 6.3.1 Policy-gradient basics · 6.3.2 Loss aggregation tradeoffs · 6.3.3 Asynchronous RL systems · 6.3.4 Truncated importance sampling · 6.3.5 Example: PPO · 6.3.6 Example: GRPO · 6.3.7 RLOO vs. GRPO · 6.4 Auxiliary topics · 6.4.1 Generalized advantage estimation · 6.4.2 Double regularization · 6.5 Further reading · 6.6 Summary

What you learn in chapter 6 →

Chapter 7: Reasoning and inference-time scaling

The introduction defines inference-time scaling and places reasoning models and RLVR in the context of RLHF.

7.1 The role of RLVR · 7.2 The origins of new reasoning models · 7.2.1 Why does RL work now? · 7.2.2 RL training vs. inference-time scaling · 7.2.3 The future (beyond reasoning) of RLVR · 7.3 Understanding reasoning training methods · 7.3.1 Reasoning research before OpenAI o1 or DeepSeek R1 · 7.3.2 Early reasoning models · 7.3.3 Common practices in training reasoning models · 7.4 Looking ahead · 7.5 Summary

What you learn in chapter 7 →

Chapter 8: Direct-alignment algorithms

The introduction presents direct-alignment algorithms as a simpler way to optimize the RLHF preference objective and identifies DPO as a prominent example.

8.1 Direct preference optimization · 8.1.1 How DPO works · 8.1.2 DPO derivation · 8.2 Numerical concerns, weaknesses, and alternatives · 8.3 Implementation details · 8.4 DAAs with synthetic preference data · 8.5 DAAs vs. RL: Online vs. offline data · 8.6 Summary

What you learn in chapter 8 →

Chapter 9: Rejection sampling

The introduction defines rejection sampling for preference fine-tuning and relates it to the statistical idea of sampling from a simpler distribution and filtering the results.

9.1 Training process, step by step · 9.1.1 Generating completions · 9.1.2 Scoring completions · 9.1.3 Fine-tuning · 9.2 Implementation details · 9.3 Related: Best-of-N sampling · 9.4 Summary

What you learn in chapter 9 →

Chapter 10: The nature of preferences

The introduction explains why RLHF centers human preferences when a reward function is difficult to specify.

10.1 When preference replaces correctness · 10.2 The origins of RLHF and preferences · 10.3 Specifying objectives: From logic of utility to reward functions · 10.4 Tools for optimizing utility · 10.5 Complexity of optimizing preferences · 10.6 Summary

What you learn in chapter 10 →

Chapter 11: Preference data

The introduction explains why preference data is central to RLHF and identifies two challenges in collecting it.

11.1 Why we need preference data · 11.2 Collecting preference data · 11.2.1 Interfaces · 11.2.2 Rankings vs. ratings · 11.2.3 Multiturn data · 11.2.4 Structured preference data · 11.2.5 Sourcing and contracts · 11.3 Bias: Things to watch out for in data collection · 11.4 Open questions in RLHF preference data · 11.5 Summary

What you learn in chapter 11 →

Chapter 12: Synthetic data

The introduction explains why early RLHF depended on human data and why improving AI models made synthetic data an attractive way to expand post-training research.

12.1 The roles of synthetic data · 12.2 Distillation with synthetic data · 12.3 The path to on-policy, teacher–student distillation · 12.3.1 Adapting knowledge-distillation for LMs · 12.3.2 From offline to on-policy distillation · 12.3.3 Modern OPD variants · 12.4 AI feedback · 12.4.1 Balancing AI and human feedback data · 12.4.2 Building specific LLMs for judgment · 12.5 Constitutional AI · 12.5.1 Further reading on CAI · 12.6 Rubrics: Prompt-specific AI feedback for training · 12.7 Summary

What you learn in chapter 12 →

Chapter 13: Tool use and function calling

The introduction explains why tools expand language-model capabilities, notes that tool use can be trained, and distinguishes tool use from function calling and code execution.

13.1 Tool-use overview · 13.2 Interweaving tool calls in generation · 13.3 Multistep tool reasoning · 13.4 Model Context Protocol · 13.5 Implementation details · 13.6 Summary

What you learn in chapter 13 →

Chapter 14: Over-optimization

Introduces over-optimization in RLHF: strong optimization can improve a feedback signal while making model behavior less aligned with the intended goal.

14.1 Qualitative over-optimization · 14.1.1 Managing proxy objectives · 14.1.2 Over-refusal and “too much RLHF” · 14.2 Quantitative over-optimization · 14.3 Misalignment and the role of RLHF · 14.4 Summary

What you learn in chapter 14 →

Chapter 15: Regularization

Introduces regularization as a way to limit harmful changes during RLHF, especially by comparing the current policy with a reference policy.

15.1 KL divergence in RL optimization · 15.1.1 Reference model to generations · 15.1.2 Implementation example · 15.2 Implicit regularization · 15.2.1 SFT memorizes, RL generalizes · 15.2.2 Retaining by doing: On-policy data mitigates forgetting · 15.2.3 RL’s razor: Why online RL forgets less · 15.3 Other types of regularization · 15.3.1 Pretraining gradients · 15.3.2 Margin-based regularization · 15.4 Summary

What you learn in chapter 15 →

Chapter 16: Evaluation

Introduces evaluation as benchmark-based measurement of model quality and traces how evaluation priorities have changed alongside RLHF and post-training.

16.1 Prompting formatting · 16.1.1 Few-shot prompting and log-likelihood scoring · 16.1.2 Chain-of-thought prompting · 16.1.3 Zero-shot instruction following · 16.1.4 Reasoning-era evaluation prompts · 16.2 Why many external evaluation comparisons are unreliable · 16.3 How labs actually use evaluations internally to improve models · 16.4 Contamination · 16.5 Tooling · 16.6 Summary

What you learn in chapter 16 →

Chapter 17: Crafting model character and products

The introduction places RLHF and post-training in a product-development context, where their uses extend beyond research benchmarks.

17.1 Character training · 17.1.1 Persona vectors · 17.1.2 The assistant axis · 17.1.3 Persona subnetworks · 17.2 Model specifications · 17.3 Product cycles and what’s next for RLHF · 17.4 Summary

What you learn in chapter 17 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.