Privacy note: We capture your IP address to provide customised and focused services. See our Privacy Policy.

Generative AI & Large Language Models — Alpha School

Lesson 7: How Models Learn from Human Feedback

A pretrained model can continue text brilliantly and still be a terrible assistant: it may answer a question with another question, give a rude reply, or write a confident paragraph that is entirely made up. The step that turns it into something people actually want to talk to is learning from human feedback — and the most widely used method is reinforcement learning from human feedback, or RLHF. It is the method behind the polite, helpful tone of the chatbots you know, and it is worth understanding because it explains both their strengths and their blind spots.

RLHF works in three stages. First, people write good example answers to a range of prompts — this is the supervised fine-tuning you met in Lesson 5. Second, the model generates several answers to each prompt, and people rank them from best to worst. Those rankings are used to train a second model, the reward model, whose job is to predict how much people will like an answer. Third, the language model is trained to earn higher rewards from the reward model: it generates answers, the reward model scores them, and the language model adjusts itself towards the answers that score well. It is learning by trial and error, with human taste as the scoreboard.

What RLHF does well — and what it rewards by accident

RLHF is remarkably good at teaching manners and format: clear structure, a helpful tone, admitting uncertainty, refusing requests that are genuinely harmful. It is also the reason chatbots often sound so similar — they have all been steered towards the same approved style. But the method has a weakness that follows from its design: the reward model is a stand-in for human judgement, and the language model learns to please the stand-in, not the humans. If people giving feedback tend to reward long, confident answers, the model learns to be long and confident — even when it should be short, or unsure. Researchers call this reward hacking: finding the easiest way to score well, rather than the way that is actually best.

There is a second weakness: the feedback itself. The people who rank answers bring their own judgements, tastes and blind spots, and the model absorbs them. If the rankers prefer a certain style, a certain politics, or a certain level of caution, the model will drift in that direction. That is why the same underlying model can behave differently depending on who trained it and what they valued. It also means RLHF is not a neutral technical step: it is a set of human choices about what good behaviour looks like, baked into the model.

A newer alternative: learning directly from preferences

RLHF is powerful, but it is also complicated: it needs a reward model, a reinforcement learning step, and careful tuning to keep the language model from drifting too far from its original behaviour. A newer method, called direct preference optimisation, or DPO, skips the middle step. Instead of training a reward model and then training the language model to please it, DPO trains the language model directly on pairs of answers — one preferred, one rejected — teaching it to make the preferred kind of answer more likely and the rejected kind less likely. It is simpler, cheaper, and often works as well as RLHF for the same task. The deeper point is that the field is still young and its methods are still changing: RLHF was the standard for only a few years before simpler alternatives appeared. What stays constant is the idea itself — that a model becomes an assistant by learning from human judgements about its answers — and that idea will outlive any particular method for implementing it.

Newer methods try to improve on RLHF — for example, by training directly on pairs of preferred and rejected answers instead of building a separate reward model — but the core idea remains: a model becomes an assistant by learning what people want from it, through their judgements. When you use a chatbot and notice it is too wordy, too cautious, or too eager to agree with you, you are seeing RLHF at work. And when you give a chatbot feedback — a thumbs up or down — you are taking part in the same process, on a small scale.

Key Terms

Reinforcement learning from human feedback (RLHF)
Training a model by having people rank its answers, learning a reward model from those rankings, and training the model to earn higher rewards.
Reward model
A model trained to predict how much people will like an answer, used as the scoreboard in RLHF.
Supervised fine-tuning
Training on examples of good answers written or checked by people, the first stage before RLHF.
Reward hacking
When a model learns the easiest way to score well from the reward model, rather than the behaviour people actually wanted.
Ranking
People ordering several of a model's answers from best to worst, providing the data RLHF learns from.
Alignment
Steering a model towards behaviour people want: helpful, honest and safe.

Discussion Questions

  1. If people giving feedback tend to reward long, confident answers, what kind of model will RLHF produce — and what is wrong with that?
  2. Two companies train the same base model with different groups of rankers. Why might the two finished models behave differently?
  3. When you press thumbs-up or thumbs-down on a chatbot's answer, what are you taking part in?

Practice Questions

  1. What are the three stages of RLHF?
  2. What is a reward model?
  3. What is reward hacking?
  4. Why does RLHF make different chatbots sound similar?
  5. Why is RLHF not a neutral technical step?
Show answers
  1. Supervised fine-tuning, training a reward model from human rankings, then training the language model to earn higher rewards. People write good answers, rank the model's answers, and the model learns to please the reward model.
  2. A model trained to predict how much people will like an answer. It acts as the scoreboard that the language model is trained to satisfy.
  3. When a model finds the easiest way to score well rather than the behaviour people actually wanted. If rankers reward long, confident answers, the model learns to be long and confident even when it should be short or unsure.
  4. Because they are all steered towards the same approved style: clear, polite and helpful. The method teaches manners and format, so models converge on a similar tone.
  5. Because it bakes in the judgements, tastes and blind spots of the people who ranked the answers. The model absorbs what its rankers valued, so the same base model can behave differently under different trainers.
Keep reading to complete this lesson