RLHF Reinforcement Learning from Human Feedback
RLHF (Reinforcement Learning from Human Feedback) is the key technology that turns a large model from "able to talk" into "able to talk well". Much of why ChatGPT impressed people is due to RLHF.
The problem it solves
A pretrained model only predicts the next word. If you ask it "how to lose weight", it may continue with "how to gain weight", because those two sentences often appear side by side in the corpus. It does not understand the task of "answering a question".
The three-stage pipeline
- Supervised fine-tuning (SFT): train on high-quality "question-answer" pairs written by humans, so the model learns the dialogue format
- Training the reward model (RM): for the same question, have the model generate multiple answers, have humans label which one is better, and train a small model that can assign scores
- Reinforcement learning optimization: using the PPO algorithm, let the main model keep generating answers, which the reward model scores, and optimize toward higher scores
Why a reward model is needed
It is impossible to have humans score every step in real time. A reward model acts as the "judge" in place of humans, which is what makes large-scale training feasible.
The core problems it solves
- Helpfulness: answers are on topic and sufficiently informative
- Honesty: say you do not know when you do not know, do not make things up
- Harmlessness: refuse to generate illegal, violent, or discriminatory content
- Style alignment: polite tone, clear structure, in line with human reading habits
Later evolution
The RLHF pipeline is complex and costly. Simpler alternatives later appeared:
- DPO (Direct Preference Optimization): skip the reward model and optimize directly on preference data, far simpler to implement
- RLAIF: use AI instead of humans for labeling, lowering the cost
- Constitutional AI: give the model a set of principles and let it critique and improve itself