liveBook · Manning

Chapter 4: Instruction fine-tuning

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

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

After this chapter you will be able to

Section by section

Introduction

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

Key terms: next-token prediction, instruction fine-tuning, instruction–response format, text-to-text, prompting, in-context learning, instruction–response examples, instruction fine-tuning (IFT), supervised fine-tuning (SFT), preference data collection

4.1 Chat templates and the structure of instructions

This section explains how chat templates turn role-labeled conversations into token sequences that instruction-tuned language models can continue.

Key terms: pretrained language model, chat template, post-training, system, user, assistant, system prompts, chat markup, <|im_start|>assistant, <|im_end|>

4.2 Best practices for instruction tuning

This section identifies the data choices that matter most in instruction tuning and explains why they should be judged in the context of the full post-training process.

Key terms: instruction tuning, quantization, small, focused datasets, synthetic datasets, high-quality data, completions, prompts, downstream tasks, diminishing returns, overall optimization

4.3 Implementation details

This section explains how instruction fine-tuning keeps pretraining’s autoregressive loss while changing batch sizes, masking, and learning rates.

Key terms: batch size, global batch size, per-device batch size, SFT, autoregressive loss, prompt masking, prompt tokens, responses, multiturn masking, final-turn only

4.4 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 3: Training overview Chapter 5: Reward modeling →

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.