liveBook · Manning

Chapter 15: Regularization

What you will learn in chapter 15 of Reinforcement Learning from Human Feedback

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

After this chapter you will be able to

What it builds on

Section by section

Introduction

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

Key terms: regularization, over-optimization, reference model, Kullback–Leibler (KL) distance, KL divergence, current policy, reference policy, generated samples

15.1 KL divergence in RL optimization

Introduces KL divergence as a measure of drift from a reference policy and contrasts the two KL directions used in RL optimization.

Key terms: KL divergence, reference policy, reverse KL, KL penalty, Monte Carlo estimate, reference model, KL direction, distillation, behavioral cloning

15.1.1 Reference model to generations

Explains how a KL penalty keeps an RL-trained model’s generations close to a static reference model.

Key terms: KL penalties, static reference model, instruction-tuned model, previous RL checkpoint

15.1.2 Implementation example

This subsection shows how to approximate KL divergence from sampled model completions and compute it from policy and reference-model log-probabilities.

Key terms: sequence-level KL, expectation, generative distribution, reference model, generate(), forward(), per-token logits, log-probabilities, policy sequence log-probability, reference sequence log-probability

15.2 Implicit regularization

The section contrasts deliberately added regularization with the resistance to memorization and forgetting that can emerge from on-policy RL post-training.

Key terms: explicit regularization, implicit regularization, on-policy optimization, memorization, catastrophic forgetting

15.2.1 SFT memorizes, RL generalizes

This section uses a controlled comparison to show that RL generalizes to changed task rules while supervised fine-tuning can improve on the training distribution yet fail under those changes.

Key terms: out-of-distribution (OOD) generalization, GeneralPoints, V-IRL, action space, supervised fine-tuning (SFT), RL, in-distribution, out-of-distribution (OOD) performance, spatial reasoning

15.2.2 Retaining by doing: On-policy data mitigates forgetting

The section explains why on-policy RL can retain prior knowledge better than SFT by connecting their objectives to opposite directions of KL divergence and examining how those directions affect a multimodal policy.

Key terms: forward KL, SFT cross-entropy loss, target distribution, negative log-likelihood, KL-regularized RL objective, reverse KL, reward-tilted distribution, partition function, reference policy, mode covering

15.2.3 RL’s razor: Why online RL forgets less

Explains RL’s razor: on-policy training tends to find high-reward policies with less KL drift from the initial model, which is associated with less forgetting.

Key terms: RL’s razor, on-policy methods, KL divergence, forgetting, new task data, initial policies, on-policy, offline data, negative gradients, SFT

15.3 Other types of regularization

The section introduces setup-specific regularization methods and cautions that examples from leading models are not universal recipes.

Key terms: regularization, post-training setups, stable optimization

15.3.1 Pretraining gradients

This subsection explains how language-modeling losses can regularize RLHF and DPO training so preference optimization does not undermine text quality.

Key terms: pretraining gradients, autoregressive next-token prediction loss, pretraining corpus, DPO logistic loss, negative log-likelihood penalty, winning completion, reference model, length-normalized

15.3.2 Margin-based regularization

This subsection introduces a rating-derived margin for reward model training and places it alongside other approaches to regularization in RLHF.

Key terms: margin loss, reward models, margin, numerical scale, quantified ranking method, Likert scales, standard contrastive loss function, KL divergence, β parameter, reward margins

15.4 Summary

Concepts explained in this chapter

← Chapter 14: Over-optimization Chapter 16: Evaluation →

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.