AI Foundations0% complete
0%

Chapter 7 of 2525 chapters remaining

Saved on this device. Mark a chapter complete after reading.

MODULE 2 · LESSON 7 · 14 MIN

Pre-Training, Fine-Tuning, and RLHF — The Three Phases

By Siten Sanghvi · Published · Updated

A base model is trained to continue text. Later stages start from those same weights and change them with different signals: first human-written example answers, then human (or AI) comparisons of answers. "Pre-training, fine-tuning, RLHF" is the common teaching sequence for how a text predictor becomes an assistant. Real pipelines differ in which stages they use, how often they repeat them, and which algorithm handles the last.

The misconception this lesson fixes: alignment training is not a truthfulness filter added to a knowledgeable model. Each stage adds a training signal with blind spots. Knowing which signals a behavior could come from tells you what to expect and what to verify. Specifics below were checked on 2026-11-09 and are examples; the concepts are the stable part.


Phase 1: Pre-training builds a text predictor

Pre-training starts with untrained parameters and adjusts them so the model gets better at predicting the next token across a very large text collection. The GPT-4 report describes its model this way. The result is a base model.

A base model has absorbed a great deal about language and the world, but its objective is continuation, not following instructions. InstructGPT's authors note that predicting the next token on web pages differs from "follow the user's instructions helpfully and safely." Given a question, a base model might answer, ask another question or continue the document; some may answer anyway. One open base model's card, Qwen2.5-0.5B, advises against using it for conversation without post-training such as SFT or RLHF.

Pre-training is usually the most compute-heavy stage: InstructGPT's SFT and RLHF training used a small fraction of GPT-3's pre-training compute (its Section 5). These figures are examples, not rules. Meta's Llama 3 paper reports a 405-billion-parameter model trained on 15.6 trillion tokens with up to 16,000 H100 GPUs. Epoch AI estimated GPT-4's final run at about $40 million in amortized hardware and energy, excluding staff and experiments, and put frontier development costs above $100 million. Those are third-party estimates, and many useful models are far smaller.


Phase 2: Supervised fine-tuning teaches the format of help

Supervised fine-tuning (SFT) continues training the pretrained model on examples of the behavior you want: a prompt, paired with a good response written by people. The model learns to produce responses like the demonstrations when it sees similar prompts.

This stage can be small, plausibly because it builds on what pre-training already put in the weights. InstructGPT's SFT set had about 13,000 prompts, one published example rather than a standard size. Instruction tuning is SFT on many tasks written as instructions. In Google's FLAN paper, instruction tuning a 137-billion-parameter model on 60-plus datasets improved zero-shot results (no examples in the prompt) on unseen task types.

After SFT, a model usually answers questions and follows formats. SFT alone does not make answers correct or safe; demonstrations show only what their writers chose to show.


Phase 3: Preference training teaches what people rate higher

Large pre-trained models can produce answers that are untruthful, toxic or simply unhelpful, the problem InstructGPT's authors set out to reduce. Their labelers preferred the RLHF-trained models to the SFT-only baseline. Preference training uses comparisons between responses, not single ideal answers. Learning from human comparisons predates language assistants; InstructGPT applied it to GPT-3 in three steps:

  1. Collect demonstrations and fine-tune (the SFT stage above).
  2. Collect comparisons and train a reward model. For a prompt, people indicate which of several model outputs they prefer. A separate model learns to predict those preferences and outputs a score.
  3. Optimize against the reward model. Reinforcement learning (PPO, proximal policy optimization, in that paper) adjusts the model so its outputs score higher, with a penalty that keeps it from drifting too far from the SFT model.

Labelers do not score every output during training; the reward model stands in for them. That lets the method scale, and makes the reward a proxy for what people want.

EXHIBIT 07 / TRAINING

Explore the mechanism

Same lineage. New signal.

Training changes weights. Request context does not.

Same lineage. New signal.01BaseMODELText-prediction signalshapes a base model.02After SFTMODELPrompt-responsedemonstrations shapeassistant behavior.03After preference tuningMODELRanked comparisons supply apreference objective.One lineage: each stage starts from the previous weights.
Recorded comparisons0
Request-time documentsWeights unchanged

Base · same model lineage

Synthetic fixed sample: “VPN security: the next passage discusses...” Selecting a preferred answer records a comparison for Reward model / RLHF; it does not change this sample or any weights.

Inspect the example data and reasoning
Same lineage. New signal. — current illustrative state
ElementWhat to notice
Pre-trainingRaw-text prediction signal
SFTPrompt-response demonstrations
Preference tuningReward model / RLHF
Most recent recorded preferenceNone recorded

One common recipe, not every model. Scripted samples, not observed outputs. Selecting a preference only records data; it does not train a model.

Read the mechanism without interacting
Pre-training
Text prediction fits the initial model parameters.
Demonstrations
Supervised fine-tuning uses examples of desired responses.
Preferences
Comparisons supply a proxy objective; preference is not proof of truth.

Rank two made-up security answers, name your criteria, then compare where colleagues might disagree.

Try explaining it: Which training signal could shape a confident answer, and what would you still verify?

InstructGPT's results cut both ways. On the authors' prompts, labelers preferred a 1.3-billion-parameter InstructGPT model to the 175-billion-parameter GPT-3. InstructGPT models made up facts about half as often on closed-domain tasks, where the answer must come from the supplied text (21% versus 41%), and gave truthful, informative answers about twice as often on TruthfulQA, a benchmark of questions built to elicit common false answers; the 1.3-billion-parameter model was slightly worse than same-size GPT-3 there. Yet it still made simple mistakes, such as failing instructions, inventing facts and hedging at length. It reflects the preferences of a specific group, mostly labelers and researchers, not "human values" in general. Trained labelers agreed with each other about 73% of the time (77% for held-out labelers), which the authors call quite high for the task but still far from unanimous.

What can go wrong with the proxy

  • Optimizing too hard. A reward model is imperfect. Gao and colleagues measured, in a synthetic setup where a fixed "gold" reward model stood in for humans, that pushing the model being trained further against a proxy reward model can hinder the gold score. This is an instance of Goodhart's law: a measure that becomes a target stops being a good measure.
  • Sycophancy. Sharma and colleagues found sycophancy in five human-feedback-trained assistants; human and preference-model judgments sometimes favored convincing agreeable answers over correct ones. In their challenge tests, assistants often wrongly admitted mistakes. They call human preference judgments a likely contributor, not the only cause.
  • Confidence is not guaranteed to improve. Calibration means stated confidence matches how often an answer is right. It is tempting to assume alignment teaches a model what it doesn't know, but the GPT-4 report found the opposite on a subset of MMLU (a multiple-choice knowledge test; see Model Evaluation: Benchmarks, MMLU, and Why They're Imperfect): the pre-trained model was well calibrated and post-training reduced that. In a quick experiment, Anthropic's calibration study found its RLHF models looked miscalibrated until a temperature adjustment (a sampling setting; see Inference: How a Model Generates a Response) largely fixed it. These are specific measurements, not a law, but they undercut the idea that RLHF supplies calibration automatically.
  • Safety training can fail to generalize. Wei and colleagues hypothesize two failure modes: competing objectives, and safety training that fails to extend to domains where the model has capabilities, such as a request rewritten in an encoding the model can read but safety training rarely covered. They tested attacks on GPT-4 and Claude v1.3 in 2023 and reported that vulnerabilities persisted. The GPT-4 report likewise says pre-trained capabilities remain latent and recommends layering other controls.

Variants: the three phases are a model, not a recipe

  • Direct Preference Optimization (DPO). The DPO paper trains directly on preference pairs with a simple classification-style loss, without fitting a separate reward model or sampling from the model during training. In its authors' experiments it matched or exceeded PPO-based RLHF. Llama 3's authors chose DPO over PPO, finding it needed less compute at that scale.
  • Constitutional AI and RLAIF. Anthropic's Constitutional AI paper trains for harmlessness using written principles: the model critiques and revises its own answers, then AI-generated preference labels train a preference model. It still used human feedback for helpfulness. Google's RLAIF study found AI-generated preferences gave performance comparable to human feedback on summarization and dialogue tasks.
  • Other methods. The open-source library TRL lists SFT, reward modeling, DPO and online RL trainers side by side. Not every model goes through every stage, and the GPT-4 report withholds its training method.

What the phases do and do not explain

  • Confident wrong answers. No stage verifies facts against a source. Preference training can raise truthfulness-benchmark scores (the GPT-4 report saw large TruthfulQA gains over GPT-3.5 after RLHF, though it did not check that data for contamination; InstructGPT roughly doubled truthful, informative answers), yet InstructGPT still made up facts. Fluency is not evidence of truth.
  • Different assistant "personalities." Assistants can differ in tone and refusal habits. Demonstrations, rater instructions and preference data are plausible contributors, but public documentation rarely lets you attribute a behavior to one choice.
  • Jailbreaks. Training shifts behavior but is not a rule engine; a symptom such as hedging or flattery does not reveal one product's cause.
  • Open-weight releases. They may offer base, instruct or both; Llama 3 and Qwen2.5 (base, instruct) do. Read the model card.

Current or private documents are usually supplied at request time, not trained in. See RAG: Retrieval-Augmented Generation Explained.


Try it: rank two answers

No-code exercise (10 minutes). For a prompt such as "Explain why we should not store passwords in plain text," write two responses: one short, agreeable and vague, one longer, specific and slightly blunt. Rank them and list your criteria. Imagine fifty colleagues doing the same and note where they would disagree; that disagreement is noise, or legitimate difference in preference, in a reward model's training data. Then ask what a model would learn if most raters favored the agreeable answer.


The takeaway

An assistant comes from successive training signals: next-token prediction builds a base model, demonstrations teach the format of help, and comparisons teach what raters prefer. None is a verification step. When an assistant sounds confident, agrees too readily, or can be talked around its refusals, ask which training signals could produce that behavior, then test it for your task rather than assuming a training stage fixed it.



Up next

The Transformer Architecture Explained: open up the network these stages train. Many current language models use transformers, but that is an architecture choice, not a requirement of any training stage.

VISUAL FIELDNOTES / 07

Keep the big picture.

A one-page visual companion. Save it, print it, or explain it to someone else.

Training changes weights. Request context does not. One common recipe, not every model. Scripted samples, not observed outputs. Selecting a preference only records data; it does not train a model.View the full-size sheet ↗

Same lineage. New signal.

Training changes weights. Request context does not.

One US Letter page · Vector artwork · Fits A4 when printed to fit

Read the key points as text
Pre-training
Text prediction fits the initial model parameters.
Demonstrations
Supervised fine-tuning uses examples of desired responses.
Preferences
Comparisons supply a proxy objective; preference is not proof of truth.

Remember: Text prediction fits the initial model parameters.

Try it: Rank two made-up security answers, name your criteria, then compare where colleagues might disagree.

Recall: Which training signal could shape a confident answer, and what would you still verify?

OPTIONAL CHECK

Check your understanding.

The optional check requires JavaScript. You can continue reading the lesson.

YOUR LEARNING

Keep your place.

Your progress is saved on this device.