liveBook · Manning

Chapter 9: Rejection sampling

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

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.

After this chapter you will be able to

What it builds on

Section by section

Introduction

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.

Key terms: rejection sampling, candidate completions, reward model (RM), instruction tuning, target distribution, sampling distribution, current model

9.1 Training process, step by step

This section outlines the stages of rejection sampling training, from choosing prompts and a reward model to fine-tuning on selected completions.

Key terms: rejection sampling, RM, starting checkpoint, completions, SFT/IFT, prompts, supervised fine-tuning, instruction fine-tuning, overfitting

9.1.1 Generating completions

This subsection defines how multiple candidate completions are generated and organized for a set of prompts.

Key terms: prompts, completions, candidate completions, x_i, y_{i,j}

9.1.2 Scoring completions

This section shows how to score generated prompt–completion pairs and select completions either per prompt or across the entire batch.

Key terms: prompt–completion pairs, reward model, reward matrix, RM, top per prompt, max reward per prompt, argmax, top overall pairs, R_flat, top K

9.1.3 Fine-tuning

9.2 Implementation details

This section identifies practical rejection-sampling choices and a batching technique for efficient reward-model inference.

Key terms: RS, temperature, top-p, top-k, completions per prompt, RM, batch RM inference, tokenized completions, padding tokens, throughput

9.3 Related: Best-of-N sampling

This section explains best-of-N sampling as inference-time selection without fine-tuning, its use as a comparison baseline, and the equivalence of two selection rules when K=1.

Key terms: Best-of-N (BoN), rejection sampling (RS), inference time, baseline, Kullback–Leibler (KL) distance, online training methods, reward vector, argmax, top-K, K=1

9.4 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 8: Direct-alignment algorithms Chapter 10: The nature of preferences →

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.