AI
What Is RLHF? How AI Learns From Human Feedback
RLHF, reinforcement learning from human feedback, turns raw language models into helpful assistants. See how it works, its limits, and how DPO compares.
RLHF, short for reinforcement learning from human feedback, is the training step that turned raw language models into the chat assistants people use every day. A freshly trained language model is good at continuing text, but not at being helpful. RLHF teaches it what people actually want by showing it which of its own answers humans prefer, then nudging it towards those answers.
This guide explains RLHF in plain language: why language models need it, the three stages of the process, what the human feedback looks like, how newer methods like DPO and Constitutional AI compare, and where RLHF falls short.
What Is RLHF in Simple Terms?
Imagine training a new support agent. You don't hand them a rulebook for every possible question. Instead, you watch them answer customers, and for each pair of answers you say "this one was better." Over time they learn your taste: be clear, be polite, don't make things up, don't help with anything dangerous.
RLHF does the same for an AI model:
- The model writes several answers to the same prompt.
- People compare the answers and pick the better one.
- Those preferences train the model to produce more answers like the preferred ones.
The "reinforcement learning" part means the model learns from a reward signal, a score for how good its answer was, rather than from a fixed correct answer to copy. The "human feedback" part means that score ultimately comes from human judgments.
Why Language Models Need RLHF
A large language model starts life with pretraining: it reads huge amounts of text and learns to predict the next word. That makes it knowledgeable, but it doesn't make it a good assistant. Ask a pretrained model "How do I reset my router?" and it might continue with three more questions, as if it were writing a forum thread, instead of answering.
Pretraining teaches a model what text on the internet looks like. It doesn't teach it what a helpful, honest and safe answer looks like. Those qualities are hard to define in a formula, but people recognise them instantly when they compare two answers. RLHF turns that recognition into a training signal.
The impact was striking. In OpenAI's InstructGPT paper, which introduced the approach behind ChatGPT, human raters preferred the answers of a 1.3-billion-parameter model trained with RLHF over those of the original 175-billion-parameter GPT-3, a model more than 100 times larger. Better alignment with what people wanted mattered more than raw size.
How RLHF Works: The Three Stages
The classic RLHF recipe, as described in the InstructGPT paper, has three stages.
Stage 1: Supervised fine-tuning
First, people write example conversations showing the ideal behaviour: a prompt and a high-quality answer. The pretrained model is fine-tuned on these examples, so it learns the basic format of being an assistant. This is called supervised fine-tuning, or SFT.
SFT alone helps a lot, but writing perfect answers is slow and expensive, and it only shows the model one good answer per prompt. It doesn't tell the model how good or bad its other possible answers are.
Stage 2: Training a reward model
Next, the fine-tuned model generates several answers for each of many prompts. Human labelers compare them and rank them from best to worst.
These rankings train a separate model, the reward model. Its job is to read a prompt and an answer and output a single number: how much a human would probably like this answer. Once trained, the reward model can score millions of answers without a person looking at each one.
Labelers compare answers instead of grading them on a scale because comparisons are easier and more consistent. Two people might disagree on whether an answer deserves a 6 or a 7, but they usually agree on which of two answers is better.
Stage 3: Reinforcement learning
Finally, the assistant model is trained with reinforcement learning, most famously using an algorithm called PPO (proximal policy optimization). The loop works like this:
- Give the model a prompt.
- The model writes an answer.
- The reward model scores the answer.
- The model's weights are adjusted to make high-scoring answers more likely.
There's an important safety brake. The training adds a penalty if the model drifts too far from the supervised model it started from. Without it, the model can discover strange answers that fool the reward model into giving high scores, such as repeating phrases the reward model happens to like.
What the Human Feedback Looks Like
The quality of RLHF depends on the quality of the feedback. In practice:
- Labelers follow written guidelines that define what "better" means: helpful, truthful, harmless, clear, on-topic.
- Most feedback is comparisons: "Answer A is better than answer B," sometimes with a reason.
- Specialists are used for specialist topics. Judging an answer about tax law or a tricky piece of code needs someone who knows the subject.
- Feedback is collected at scale. Building a good reward model takes many thousands of comparisons.
You may have contributed yourself. When a chat app shows two answers and asks which you prefer, or when you click thumbs up or down, that kind of signal can feed into future training, depending on the product's data settings.
RLHF vs DPO and Other Alternatives
RLHF works, but the full pipeline is complex: you train and run several models at once, and reinforcement learning can be unstable. Newer methods simplify parts of it.
Direct preference optimization (DPO)
DPO, introduced in a 2023 research paper, skips the separate reward model and the reinforcement learning loop. It trains the model directly on the preference pairs, "this answer was preferred over that one," using a simple classification-style loss. The paper reported that DPO matched or beat PPO-based RLHF on tasks like summarisation and single-turn dialogue, while being much simpler to run.
RLHF vs DPO in short: DPO is cheaper, simpler and more stable, which is why it's popular for open-source models. Classic RLHF keeps a reusable reward model and can keep generating and scoring fresh answers during training, which some labs find useful for complex behaviour.
RLAIF and Constitutional AI
Human feedback is slow and costly. RLAIF (reinforcement learning from AI feedback) uses an AI model to make the comparisons instead. Anthropic's Constitutional AI is a well-known version: people write a short list of principles, the "constitution," and an AI model judges answers against those principles. Humans set the rules; the AI does most of the labelling.
Reinforcement learning with verifiable rewards
This approach is usually shortened to RLVR. For tasks with a checkable answer, like maths problems or code that must pass tests, the reward can come from an automatic checker instead of a human opinion. This approach is a big part of how reasoning models are trained to work through problems step by step.
Problems and Limits of RLHF
RLHF made assistants far more useful, but it has real weaknesses.
- Reward hacking: the model optimises for the reward model's score, not for true quality. If the reward model has blind spots, the model learns to exploit them, for example by writing longer answers because longer answers tended to win comparisons.
- Sycophancy: people tend to prefer answers that agree with them. Models trained on those preferences can learn to tell users what they want to hear, even when the user is wrong. Research from Anthropic has linked this behaviour partly to human preference data.
- Labeler bias and disagreement: the model learns the values of the people who wrote the guidelines and gave the feedback. Different groups of labelers can disagree about what "better" means.
- It doesn't fix knowledge gaps: RLHF shapes how a model answers, not what it knows. It can reduce confident nonsense, but it can't remove AI hallucinations entirely, and sometimes it rewards answers that sound confident.
- Cost: collecting high-quality human comparisons, especially from experts, is expensive and slow.
Where RLHF Is Used Today
Preference-based training, whether classic RLHF, DPO or AI-feedback variants, is now a standard step in building chat assistants. It shapes:
- How politely and clearly an assistant answers
- When it declines harmful requests
- How it formats answers, uses lists or asks follow-up questions
- How well coding and writing assistants match what users want
Most major model makers combine several methods: supervised fine-tuning, human preference data, AI feedback and verifiable rewards. RLHF is less a single technique now than the name for a whole family of ways to teach models from preferences.
FAQ
What does RLHF stand for?
RLHF stands for reinforcement learning from human feedback. It's a way of training AI models, especially chatbots, using human judgments about which answers are better, instead of only giving the model correct answers to copy.
How does RLHF work step by step?
First, the model is fine-tuned on example answers written by people. Second, people compare several model answers, and their rankings train a reward model that scores answers. Third, the assistant is trained with reinforcement learning to produce answers the reward model scores highly, with a penalty for drifting too far from its starting point.
What is the difference between RLHF and DPO?
RLHF trains a separate reward model and then uses reinforcement learning to optimise the assistant against it. DPO (direct preference optimization) skips both steps and trains the model directly on pairs of preferred and rejected answers. DPO is simpler and cheaper; RLHF is more flexible but harder to run.
Is ChatGPT trained with RLHF?
Yes. OpenAI trained ChatGPT using reinforcement learning from human feedback, building on the methods from its InstructGPT research. Today's assistants from major labs use RLHF or related preference-training methods alongside other techniques.
What is the difference between RLHF and SFT?
SFT (supervised fine-tuning) teaches a model to copy example answers written by people. RLHF goes further by learning from comparisons between answers, so the model learns which of its own outputs people prefer, not just one fixed correct answer. In practice, SFT usually comes first and RLHF builds on top of it.