Overview

3 Training Overview

This chapter gives a broad introduction to reinforcement learning from human feedback by first grounding the reader in the basic reinforcement learning setup. It explains how a policy selects actions from a state, how the environment responds through transitions, and how reward is accumulated across a trajectory. Simple examples like a thermostat and CartPole are used to build intuition for the trial-and-error loop in which an agent improves its behavior over time by seeking higher return.

The chapter then shows how RLHF adapts that standard RL framework to language models. Instead of learning from an environment’s reward function and multi-step state transitions, RLHF usually starts from prompts, treats the completion as the action, and assigns reward at the level of the full response. A learned reward model stands in for the environment reward, and because the model is being fine-tuned from a pretrained base model rather than trained from scratch, regularization becomes essential. In particular, a KL penalty is used to keep the optimized policy close to the reference policy while still improving toward human preferences.

Finally, the chapter surveys the main optimization tools and canonical training recipes that appear throughout modern post-training. It introduces instruction fine-tuning, reward modeling, rejection sampling, policy gradients, and direct alignment methods as the core techniques used in RLHF pipelines. It also traces how these pieces were combined in influential systems such as InstructGPT, then expanded into more complex multi-stage recipes like Tülu 3 and DeepSeek R1, illustrating the field’s shift toward larger, more iterative, and more specialized training workflows.

Standard RL loop
figure
Each term in the trajectory distribution (equation 3.1) mapped to the thermostat RL example.
figure
CartPole environment showing state variables (\(x\), \(\dot{x}\), \(\theta\), \(\dot{\theta}\)) + and actions (\(\pm F\)).
figure
Standard RLHF loop
figure
A rendition of the early, three stage RLHF process with SFT, a reward model, and then optimization.
figure
A rendition of modern post-training with many rounds.
figure
A summary of the Tülu 3 recipe with target skills and multi-step training recipe. Lambert et al. 2024, License CC-BY.
figure

Summary

  • In reinforcement learning, an agent takes actions sampled from a policy given the current state to maximize cumulative reward – RLHF adapts this framework for language models.
  • RLHF builds on the standard RL setup but with key differences: a learned reward model replaces the environment reward function, there are no state transitions (prompts are sampled from a dataset), and rewards are assigned at the response level rather than per-step.
  • To prevent the model from drifting too far from its starting point, RLHF adds a KL divergence penalty between the current policy and a reference policy – colloquially, this optimization distance can be viewed as a budget to spend in more complex training setups.
  • This chapter also previews the main optimization tools used in post-training, including reward modeling, instruction fine-tuning, rejection sampling, policy gradients, and direct alignment algorithms.
  • The InstructGPT-era recipe established the canonical three steps: instruction tuning on  10K examples, training a reward model on  100K preference pairs, and optimizing the model with RL on  100K prompts.
  • Modern recipes like Tülu 3 involve many more stages and orders of magnitude more data, combining instruction tuning, on-policy preference data, and reinforcement learning with verifiable rewards (RLVR).

FAQ

What is the main goal of RLHF training in this chapter?RLHF aims to optimize a proxy reward that reflects human preferences, while keeping the policy close to its starting point through regularization such as a KL penalty.
How is RLHF related to traditional reinforcement learning?RLHF builds on the standard RL setup, but adapts it for language models: the “state” is usually a prompt, the “action” is a completion, rewards are often learned rather than environmental, and there is typically no state transition between prompts.
What is a trajectory in standard RL?A trajectory is the full sequence of states, actions, and rewards experienced by an agent over an episode, written as \( \tau = (s_0, a_0, r_0, s_1, a_1, r_1, \ldots, s_T, a_T, r_T) \).
Why does standard RL usually use a discount factor \(\gamma < 1\)?The discount factor helps balance near-term and future rewards, and it keeps objectives well-defined for long or continuing tasks.
How does the thermostat example illustrate reinforcement learning?The thermostat learns by trial and error: it observes the room temperature, chooses to turn the heater on or off, receives reward for staying near the target temperature, and improves its policy over repeated episodes.
What makes the CartPole task a useful RL example?CartPole is a classic benchmark with continuous state variables and physics-based dynamics, making it a richer example than the thermostat for showing how RL learns control policies.
What are the key differences between standard RL and RLHF for language models?RLHF typically starts from a pretrained language model, uses a learned reward or preference model, has no environment transition in the usual sense, treats a completion as the action, and usually assigns reward at the response level with no discounting.
Why is a KL divergence penalty used in RLHF?The KL penalty keeps the RL-trained policy from drifting too far from the reference policy, helping preserve the model’s original capabilities while still improving reward.
What optimization tools does the chapter say are used in post-training?The chapter highlights reward modeling, instruction fine-tuning, rejection sampling, policy gradients, and direct alignment algorithms.
What are the canonical training recipes discussed in the chapter?The chapter discusses InstructGPT, Tülu 3, and DeepSeek R1 as representative RLHF or post-training recipes, showing how modern systems combine instruction tuning, preference learning, RL, rejection sampling, and other stages in different ways.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Reinforcement Learning from Human Feedback ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Reinforcement Learning from Human Feedback ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Reinforcement Learning from Human Feedback ebook for free