RLHF
A post-training alignment pipeline that trains a Reward Model on human preference rankings and optimizes an LLM via reinforcement learning (e.g., PPO) to be helpful, honest, and harmless
Table of Contents
Structure Diagram
What is RLHF?
A post-training alignment pipeline that trains a Reward Model on human preference rankings and optimizes an LLM via reinforcement learning (e.g., PPO) to be helpful, honest, and harmless. It is a core concept in Training & Tuning within AI / ML.
Core Principles
A raw pre-trained LLM predicts next tokens rather than following user intent safely. RLHF aligns models through three stages: 1) Supervised Fine-Tuning (SFT) on demonstrations, 2) training a Reward Model (RM) on human pairwise rankings (chosen > rejected), and 3) optimizing the policy via RL (e.g., PPO) to maximize reward while a KL-divergence penalty keeps outputs close to the reference model.
Practical Takeaways
- Watch for Reward Hacking and sycophancy: Policies quickly exploit Reward Model flaws—such as verbosity bias or excessive flattery. Tune KL regularization and audit with blind human evaluations.
- Start with DPO before full online RLHF: Full PPO requires juggling policy, reference, reward, and critic models in VRAM. Use DPO for most enterprise alignment, reserving online RL for large-scale post-training or verifiable rewards (code/math).
- Invest in annotator rubric quality: Noisy preference labels poison the Reward Model; track inter-annotator agreement rigorously.
Notable Examples
- InstructGPT, ChatGPT & Claude: Pioneered RLHF and RLAIF (Constitutional AI) to turn base models into helpful, safe assistants.
- RL with Verifiable Rewards (RLVR): Replaces subjective reward models with automated unit tests or math verifiers (e.g., GRPO) to train reasoning models.
- Refusal Calibration: Balances blocking harmful prompts against avoiding unnecessary false refusals.