LLMS & TRANSFORMERS · INTERVIEW QUESTION
Explain RLHF (Reinforcement Learning from Human Feedback). What are the key steps and challenges?
🔴 advanced · RLHF & Alignment
Hint: Think about the reward model, PPO, and the KL penalty.
Answer
RLHF aligns language models with human preferences through a three-stage pipeline.
Pipeline
Base Model → SFT → Reward Model → PPO → Aligned Model
Stage 1: Supervised Fine-Tuning (SFT)
Train on high-quality human-written demonstrations of ideal behavior.
Stage 2: Reward Model Training
Collect human preference comparisons (A vs B), train a reward model to predict which output humans prefer.
Stage 3: RL Optimization (PPO)
The KL penalty prevents the model from diverging too far from the SFT model.
Challenges
- Reward hacking: model exploits reward model weaknesses
- Distribution shift: reward model trained on narrow data
- Labeling inconsistency: humans disagree on preferences
- Computational cost: requires training 3 separate models
Alternatives
- DPO: directly optimizes on preference pairs, skips reward model — simpler and often competitive
- Constitutional AI: self-critique against principles
- RLAIF: AI feedback instead of human
Related questions
- What is DPO (Direct Preference Optimization)? How does it compare to RLHF?
- Explain the self-attention mechanism in detail. What are Q, K, V and why do we use scaled dot-product attention?
- Explain positional encoding in Transformers. Compare sinusoidal, learned, RoPE, and ALiBi.
- Explain the difference between LoRA, full fine-tuning, and prompt tuning. When would you use each?
- What is chain-of-thought prompting? Why does it improve reasoning?