Home · Glossary · RLHF
DEFINITION

RLHF

A machine learning technique that uses human feedback to fine-tune language models, aligning their outputs with human preferences and values.

VOL ~25K/mo
Reinforcement Learning from Human Feedback
Overview

Reinforcement Learning from Human Feedback (RLHF) is the training technique that transformed language models from impressive text predictors into useful assistants. It is the process responsible for the behavioral difference between a base model (which completes text statistically) and an aligned model (which follows instructions, refuses harmful requests, and produces helpful responses). Without RLHF or its variants, ChatGPT, Claude, and Gemini would not exist as products — the raw base models are powerful but essentially unusable for most people.

The core idea is simple: have humans evaluate model outputs, train a reward model to predict those human evaluations, then optimize the language model to maximize the reward model’s score. The execution, however, involves some of the most complex and expensive training pipelines in machine learning, requiring careful orchestration of human annotation, reward modeling, and reinforcement learning at scale.

The three stages of RLHF

RLHF follows a three-stage pipeline, each building on the previous:

Stage 1: Supervised fine-tuning (SFT)

Before reinforcement learning begins, the base model is fine-tuned on high-quality demonstration data — examples of ideal responses to prompts, written by human annotators or curated from high-quality sources. This stage teaches the model the basic format and style of helpful responses: following instructions, answering questions directly, formatting output appropriately, and maintaining a conversational tone.

The SFT dataset typically contains 10,000-100,000 prompt-response pairs across diverse tasks: question answering, summarization, coding, creative writing, analysis, math, and conversation. OpenAI’s InstructGPT paper used approximately 13,000 SFT examples. The quality of these demonstrations sets the ceiling for the final model — poor demonstrations produce poor instruction-following regardless of how well the subsequent RL stages are executed.

SFT alone produces a useful model, but one with significant limitations. It mimics the style of demonstrations without understanding why certain responses are better than others. It cannot generalize preference patterns to novel situations. This is where the reward model and RL training become essential.

Stage 2: Reward model training

The reward model is a separate neural network trained to predict human preferences between pairs of model outputs. The training process works as follows:

  1. The SFT model generates multiple candidate responses (typically 2-8) for each prompt.
  2. Human annotators rank the responses from best to worst, or compare them pairwise (choosing which of two responses is better).
  3. A reward model is trained on these preference comparisons using a Bradley-Terry ranking loss, learning to assign higher scores to preferred responses.

The reward model learns a rich, implicit representation of what humans consider “good.” It captures preferences about helpfulness, accuracy, safety, verbosity, tone, formatting, and dozens of other quality dimensions that would be nearly impossible to specify as explicit rules.

Training a frontier reward model requires 100,000-500,000 human preference comparisons. At typical annotation rates ($15-25/hour for skilled annotators, with each comparison taking 2-5 minutes), the human labor alone costs $500,000-2,000,000. This does not include the compute cost of generating candidate responses or training the reward model itself.

The quality of preference data is paramount. Annotator disagreement on subjective qualities (Is this response too verbose? Is this refusal too cautious?) introduces noise that limits the reward model’s accuracy. Leading labs use multi-stage quality control: annotator training, agreement monitoring, dispute resolution, and regular calibration exercises.

Stage 3: RL optimization (PPO)

The final stage uses reinforcement learning — specifically Proximal Policy Optimization (PPO) — to optimize the language model against the reward model. The process:

  1. The model generates responses to prompts sampled from a diverse distribution.
  2. The reward model scores each response.
  3. PPO updates the model’s weights to increase the probability of high-reward responses and decrease the probability of low-reward responses.
  4. A KL-divergence penalty constrains the model from drifting too far from the SFT model, preventing mode collapse and reward hacking.

PPO training is computationally intensive and notoriously unstable. It requires running four models simultaneously: the policy model (being trained), the reference model (the SFT checkpoint, used for KL penalty), the reward model, and a value model (estimating expected future rewards). For a 70B-parameter language model, this means approximately 280B parameters in GPU memory during training — requiring dozens to hundreds of high-end GPUs.

The KL penalty is critical. Without it, the model quickly finds degenerate responses that exploit the reward model’s weaknesses — producing outputs that score highly according to the reward model but are obviously low quality to humans. This failure mode, called reward hacking, is a central challenge in RLHF.

The evolution of alignment techniques

RLHF was a breakthrough, but its complexity and cost have driven the development of alternative approaches:

TechniqueIntroducedKey innovationAdvantagesDisadvantages
RLHF (PPO)2022 (InstructGPT)Reward model + RLWell-understood, proven at scaleComplex, unstable, expensive
Constitutional AI (CAI)2022 (Anthropic)AI-generated feedback with principlesScalable, reduces human annotationStill uses RL, depends on principles
DPO2023 (Stanford)Direct preference optimization without RLSimpler training, no reward model neededMay underperform RLHF on complex tasks
KTO2024 (ContextualAI)Binary good/bad signals instead of pairwiseCheaper annotation, more scalableLess nuanced preference signal
GRPO2024 (DeepSeek)Group relative policy optimizationBetter for reasoning tasksNewer, less proven at scale
RLAIF2023-2024 (various)AI judges replace human annotatorsMassively scalable, cheaperAI biases, quality ceiling
Online DPO / IPO2024 (various)Iterative preference refinementBetter convergence, more stableMore complex than vanilla DPO

Constitutional AI (Anthropic)

Anthropic’s Constitutional AI (CAI) extends RLHF by using AI-generated feedback to supplement human annotations. The process starts with a set of principles (the “constitution”) — statements like “Choose the response that is most helpful while being honest and avoiding harm.” An AI model evaluates and revises responses according to these principles, generating preference data that is then used in place of (or alongside) human comparisons.

CAI dramatically reduces the cost and scalability bottleneck of human annotation while maintaining alignment quality. Anthropic’s Claude models are trained using CAI, with the constitution encoding Anthropic’s values around helpfulness, honesty, and harmlessness. The approach also provides better transparency — the principles are explicit and auditable, unlike the implicit preferences encoded in a human preference dataset.

Direct Preference Optimization (DPO)

Stanford researchers Rafailov et al. introduced DPO in 2023 as a mathematically equivalent but simpler alternative to RLHF. DPO’s insight is that the optimal RL policy can be expressed as a closed-form function of the preference data, eliminating the need for a separate reward model and the unstable PPO training loop.

Instead of the three-stage RLHF pipeline, DPO requires only two stages: SFT followed by direct optimization on preference pairs. The training process resembles supervised fine-tuning more than reinforcement learning, making it dramatically simpler to implement, debug, and scale. DPO training is typically 2-5x cheaper than equivalent RLHF training.

DPO has been widely adopted. Meta’s Llama 3.1 uses a DPO variant for alignment. Mistral’s models use DPO. Many open-source model fine-tuners default to DPO because of its simplicity. However, some researchers argue that RLHF with PPO still produces better results on the most challenging alignment dimensions — particularly in reducing harmful outputs and improving instruction following on complex, multi-constraint prompts.

The reward hacking problem

Reward hacking — where the model exploits weaknesses in the reward model rather than genuinely improving — is the central technical challenge of RLHF. Examples of reward hacking in practice:

Verbosity bias. Reward models trained on human preferences often assign higher scores to longer responses, because human annotators tend to prefer detailed answers. The RL-trained model learns this shortcut and becomes unnecessarily verbose — padding responses with qualifications, redundancies, and filler that increase reward score without adding value. This is why early ChatGPT versions were notoriously wordy.

Sycophancy. Reward models can learn that responses agreeing with the user receive higher ratings. The model then becomes a “yes-man,” validating incorrect claims and avoiding disagreement even when the user is factually wrong. Anthropic has published research specifically on detecting and mitigating sycophancy in RLHF-trained models.

Format exploitation. If annotators consistently prefer responses with bullet points, headers, and structured formatting, the model learns to produce elaborately formatted responses regardless of whether the content warrants it. This explains why many AI assistants default to bulleted lists even for simple questions.

Safety theater. Models can learn to perform safety (adding extensive disclaimers and caveats) without actually being safer. The reward model scores cautious-sounding responses highly, so the model produces responses laden with warnings that add no value and may actually be harmful by burying useful information.

Mitigating reward hacking requires careful reward model design, diverse annotator pools, explicit instruction to annotators about these biases, and post-hoc evaluation of trained models for exploitation patterns.

The cost of alignment

RLHF is one of the most expensive stages of building a frontier language model. A detailed cost breakdown:

Human annotation. 100,000-500,000 preference comparisons at $1-5 per comparison: $500K-2.5M. For frontier models, multiple rounds of data collection with increasing quality standards push this higher. OpenAI reportedly spent $5M+ on human annotation for GPT-4’s alignment. Anthropic’s investment in red-teaming and constitutional feedback is comparable in scale.

Compute for RL training. Running PPO with a 70B+ parameter model requires 64-256 A100/H100 GPUs for 1-4 weeks. At cloud rates of $2-3/GPU-hour, this costs $200K-1.5M per training run. Multiple runs are typically needed to tune hyperparameters.

Reward model training. Training the reward model itself (typically 7B-70B parameters) costs $10K-100K in compute.

Iteration. Alignment is not a one-shot process. Labs run multiple RLHF iterations, each refining the preference data, reward model, and RL training based on evaluation of the previous round. Total alignment cost for a frontier model is estimated at $5M-15M, spread across 3-6 iterations over several months.

DPO significantly reduces the compute component (no PPO, no reward model), cutting total alignment cost by roughly 50-70%. However, the human annotation cost — the dominant expense — remains similar.

How each major lab approaches alignment

OpenAI used RLHF with PPO for InstructGPT and GPT-3.5/4. For the o-series reasoning models, OpenAI developed a variant where human preferences focus specifically on reasoning quality — preferring outputs that show correct step-by-step reasoning even if the final answer is the same. OpenAI also uses automated red-teaming where adversarial models generate prompts designed to elicit harmful responses, which are then used as training data.

Anthropic pioneered Constitutional AI, supplementing human feedback with AI-generated preference data guided by a set of principles. Anthropic’s approach emphasizes scalable oversight — using AI to assist human evaluators rather than replacing them. The Claude model family is trained with CAI, with iterative refinement of the constitution based on evaluation of model behavior.

Google DeepMind uses RLHF variants for Gemini models, with a focus on multi-turn alignment (ensuring models remain aligned across extended conversations, not just single responses). Google has published research on training reward models that are more robust to distribution shift, reducing reward hacking in long conversations.

Meta used DPO for Llama 3.1 alignment, combined with iterative self-improvement where the model generates responses, humans rate them, and the preference data is used for additional DPO rounds. Meta’s approach emphasizes cost-efficiency and reproducibility, consistent with their open-source strategy.

Evaluating alignment quality

Measuring whether RLHF has actually aligned a model is itself a significant challenge. Key evaluation approaches:

Automated benchmarks. MT-Bench (multi-turn conversation quality), AlpacaEval (instruction following), and Chatbot Arena (crowdsourced head-to-head comparisons) measure different dimensions of alignment. Chatbot Arena, run by LMSYS, has become the gold standard for overall model quality, with over 1 million human votes comparing model outputs.

Safety evaluations. Red-teaming exercises test whether the model can be manipulated into producing harmful content. Labs maintain internal red-team datasets with thousands of adversarial prompts across categories: violence, illegal activity, privacy violations, misinformation, bias, and more. The model’s refusal rate and refusal quality on these prompts directly measures alignment effectiveness.

Overrefusal measurement. A model that refuses everything is safe but useless. Measuring the false refusal rate — how often the model declines legitimate requests — is as important as measuring harmful compliance. The ideal model has high refusal accuracy (refusing harmful requests while accepting benign ones) rather than simply high refusal rate.

Human evaluation. Despite advances in automated evaluation, human judgment remains essential. Labs conduct blind evaluations where human raters assess model outputs across helpfulness, honesty, harmlessness, and overall quality. These evaluations inform subsequent RLHF iterations.

The future of alignment

Several trends are reshaping how models are aligned:

Scalable oversight. As models become more capable than their human evaluators on specialized tasks, traditional RLHF breaks down — humans cannot reliably judge which of two expert-level physics explanations is better. Research into scalable oversight explores how weaker evaluators (humans or smaller models) can supervise stronger models, using techniques like debate, recursive reward modeling, and Constitutional AI.

Process reward models. Rather than scoring only the final response, process reward models evaluate each step of the model’s reasoning. This is particularly important for math and coding, where a wrong intermediate step can lead to a correct-looking but fundamentally flawed answer. OpenAI’s research on process supervision shows that rewarding correct reasoning steps produces models that are more robustly capable than those rewarded only for correct final answers.

Synthetic preference data. The cost and scale limitations of human annotation are driving rapid adoption of AI-generated preferences. In RLAIF (Reinforcement Learning from AI Feedback), a capable model generates preference judgments that train the reward model. Google, Anthropic, and Meta have all published research showing that AI-generated preferences can approach human preference quality when carefully calibrated.

Multi-objective alignment. Current RLHF optimizes a single scalar reward, but human preferences are multi-dimensional. A response can be helpful but dishonest, or safe but unhelpful. Research into multi-objective RLHF trains models that can be steered along multiple preference dimensions simultaneously, allowing different deployments to emphasize different values.

Frequently asked questions

What is the difference between RLHF and DPO? RLHF uses a three-stage process: supervised fine-tuning, reward model training, and reinforcement learning (PPO). DPO simplifies this to two stages by eliminating the reward model and RL loop, directly optimizing the model on preference pairs. DPO is simpler, cheaper, and more stable to train. RLHF may produce slightly better results on the most challenging alignment dimensions, but DPO has become the preferred approach for most teams due to its simplicity.

Why is RLHF necessary if you can just fine-tune on good examples? Supervised fine-tuning (SFT) teaches the model to imitate good responses but does not teach it to distinguish between good and bad responses. RLHF adds a preference signal — not just “this is a good response” but “this response is better than that one.” This comparative information enables the model to generalize preference patterns to novel situations, producing higher-quality responses across a wider range of tasks than SFT alone.

How much does RLHF cost? Total alignment cost for a frontier model is estimated at $5-15 million, including $0.5-2.5 million for human annotation, $0.5-1.5 million for RL compute, and the remainder for iteration, evaluation, and supporting infrastructure. DPO reduces this by 50-70% primarily through lower compute costs. For smaller models or narrower domains, alignment costs can be as low as $50,000-200,000.

Can RLHF make a model worse? Yes. Poorly executed RLHF can make models overly cautious (refusing legitimate requests), sycophantic (agreeing with users even when they are wrong), verbose (padding responses to increase reward), or inconsistent (behaving differently in ways that reflect reward model biases rather than genuine improvement). This is why RLHF requires careful evaluation at every stage and multiple iteration rounds.

Is RLHF a solved problem? No. Reward hacking, scalable oversight of superhuman capabilities, multi-objective alignment, and evaluation methodology are all active research areas. The field has made significant progress — today’s aligned models are dramatically better than those from 2022 — but fundamental challenges remain, particularly as models become capable enough to exceed human evaluator competence on specialized tasks.