Skip to content

Reinforcement Learning from Human Feedback (RLHF)

Reinforcement Learning from Human Feedback (RLHF) is a technique for aligning AI models with human preferences. It enables models to learn what humans want without requiring a hand-crafted reward function. Instead, a reward model is learned from human feedback.

RLHF belongs to a broader family of post-training techniques. Other approaches use AI-generated preferences, directly optimize preference pairs, or train against programmatically verifiable rewards.


In classical reinforcement learning, an agent maximizes a predefined reward function. But for complex tasks involving human values—like “write a helpful response” or “generate safe content”—defining a good reward function is extremely difficult.

RLHF solves this by learning the reward function from human preferences.

ChallengeTraditional RLRLHF
Reward SpecificationMust define explicit reward functionLearns reward from human feedback
Complex TasksStruggles with ambiguous objectivesExcels when tasks are “easy to judge but hard to specify”
Human ValuesDifficult to encodeCaptured through human comparisons

RLHF is sometimes used informally as a label for nearly all LLM post-training. That hides important differences.

MethodFeedback sourceWeight-update patternTypical use
RLHFHuman preference labels used to train a reward modelCommonly optimizes the learned reward with RLHelpfulness, style, and other subjective preferences
RLAIFPreferences or critiques generated by another AI systemCan feed RL or offline preference optimizationScalable feedback guided by principles or rubrics
RLVRProgrammatic or otherwise verifiable outcomesOptimizes environment rewards with RLMathematics, code, tool use, games, and agent tasks
DPOOffline preferred and rejected response pairsDirect offline optimization without RL rolloutsSimpler preference optimization

Reinforcement learning with verifiable rewards (RLVR) is especially relevant to LLM agents. Instead of asking a person which answer is better, an environment can run a test, check a mathematical result, inspect a game state, or verify whether a tool-driven task succeeded.

flowchart LR
    P["Policy attempts task"] --> E["Interactive environment"]
    E --> V["Programmatic verifier"]
    V --> R["Numeric reward"]
    R --> U["Policy update"]
    U --> P

RLVR does not eliminate human judgment. People still decide which tasks matter, how the environment behaves, and whether the verifier measures the intended outcome.

See RL Environments for LLM Agents for the complete interaction and training lifecycle.


A common PPO-based RLHF pipeline has three main phases:

Before RLHF, the base model is first fine-tuned on high-quality demonstration data.

AspectDetails
GoalTeach the model to follow instructions and engage in dialogue
Data(prompt, response) pairs created by humans
ScaleTypically tens of thousands of examples
ResultA model that generates plausible responses

Key Point: SFT alone shows the model what to do, but not how well it’s doing. The model needs feedback on response quality.


The reward model (RM) learns to predict human preferences.

Humans rank multiple responses to the same prompt:

PromptResponse AResponse BResponse C
”Explain quantum computing”[Response][Response][Response]

Humans rank: A > B > C

This creates pairwise comparisons: (A > B), (A > C), (B > C)

The RM is trained to output higher scores for preferred responses:

Loss = -log(σ(score_winning - score_losing))

Where σ is the sigmoid function. This loss ensures the RM assigns higher scores to responses humans prefer.

Data ScaleOften hundreds of thousands to millions of comparison pairs
Inter-rater agreementOften imperfect (commonly ~60-80% depending on task)
InitializationOften initialized from the base or SFT model

Why ranking instead of absolute scores? Humans are much better at comparing two options than assigning absolute scores.


This version of the final phase uses reinforcement learning to optimize the language model to generate responses that maximize the reward model’s scores.

RL ComponentLanguage Model Equivalent
StatePrompt + tokens generated so far
ActionNext token
PolicyThe language model itself
RewardRM score of the final response (plus KL penalty)

PPO (Proximal Policy Optimization) optimizes the language model to:

  • Maximize reward model scores
  • Stay close to the SFT model (via KL penalty to prevent drift)
  • Optionally preserve language capabilities (some recipes mix in a language-modeling loss, called “PPO-ptx”)
TermPurpose
RewardMaximize scores from the reward model
KL PenaltyPrevent the model from drifting too far from SFT behavior
LM Loss (optional)Preserve the model’s original language capabilities

Without the KL penalty, the model might exploit the reward model by generating responses that get high scores but are actually low quality (reward hacking). The KL penalty reduces (but doesn’t eliminate) this risk by keeping the model grounded in its original behavior.


1. PRETRAINING (Foundation model)
2. SUPERVISED FINE-TUNING
Learn: (prompt, response) pairs
Output: SFT Model
3. REWARD MODEL TRAINING
Learn: Human rankings of responses
Output: Reward Model
4. RL FINE-TUNING (PPO)
Optimize: Maximize reward model scores
Output: Final Aligned Model

ModelOrganizationNotes
InstructGPTOpenAIUsed human demonstrations, comparison data, a reward model, and PPO
Constitutional AI assistantAnthropicDemonstrated AI-generated feedback combined with RL
SparrowDeepMindUsed human preference judgments to train a dialogue reward model

These are publicly documented research examples. Current proprietary model families may use different or hybrid post-training recipes that are not fully disclosed.

According to OpenAI’s InstructGPT paper:

MetricGPT-3 (175B)InstructGPT (1.3B)
Human PreferenceBaseline+30% preferred
TruthfulnessBaselineImproved
ToxicityBaselineReduced

A smaller model with RLHF (1.3B) was preferred over a much larger model without it (175B).


Human preferences are diverse and sometimes contradictory. What one person considers a “good” response, another might dislike.

If the human labelers have biases, the reward model will learn and amplify those biases.

RiskDescription
Cultural biasLabelers from one culture may penalize responses from another
Demographic skewIf labelers aren’t representative, the model won’t serve all users equally

Models may learn to generate responses that score high on the reward model but aren’t actually good—similar to how students might learn to pass tests without understanding the material.

RLHF improves instruction-following and safety-style behavior, but it doesn’t guarantee factuality. Reducing hallucinations often requires retrieval, verification, or targeted training signals beyond basic RLHF.

ChallengeDetails
Human labelingExpensive, time-consuming
Reward model trainingRequires significant compute
PPO trainingMultiple forward/backward passes per update

RLAIF (Reinforcement Learning from AI Feedback)

Section titled “RLAIF (Reinforcement Learning from AI Feedback)”

Instead of humans providing feedback, AI systems generate preferences based on a set of rules or principles. Used in Anthropic’s Constitutional AI.

RLVR (Reinforcement Learning with Verifiable Rewards)

Section titled “RLVR (Reinforcement Learning with Verifiable Rewards)”

RLVR uses rewards that can be checked programmatically or against an executable environment.

Examples:

  • a mathematical answer matches a verified result
  • code passes hidden behavioral and regression tests
  • a tool-using agent reaches a required environment state
  • a game finishes in a win

RLVR works best where outcomes are easier to verify than to demonstrate. Its main risk is reward hacking: the model may exploit an incomplete verifier instead of learning the intended capability.

DPO directly optimizes the policy from offline preference pairs without training a separate reward model or running an interactive RL loop.

PPO and GRPO describe how a policy is updated. They are not alternative definitions of the reward source.

  • PPO commonly trains against a learned reward model in traditional RLHF pipelines.
  • GRPO, introduced in the DeepSeekMath paper, estimates relative advantages from groups of sampled outputs without requiring a separate value model in the same way as PPO.

Either algorithm can be connected to suitable reward functions and environments. The algorithm, reward source, and environment should be described separately.

MethodStrengthMain limitation
RLHFCaptures subjective human preferencesExpensive labels and a gameable learned reward
RLAIFScales feedback generationInherits judge-model and rubric weaknesses
RLVRUses objective, executable feedback where availableLimited by verifier quality and task coverage
DPOSimpler offline preference optimizationDoes not learn through environment interaction

  • RLHF aligns AI models with human preferences by learning a reward model from human comparisons
  • Common RLHF pipeline: SFT, reward-model training, then policy optimization such as PPO
  • Why it works: Humans are good at judging (“which response is better?”) even when they can’t define the objective function
  • Different feedback sources: RLHF uses human preferences, RLAIF uses AI feedback, and RLVR uses verifiable outcomes
  • DPO is different: It optimizes offline preference pairs without an interactive RL loop
  • Algorithm is not reward source: PPO and GRPO are policy-optimization methods
  • Limitations: Subjective preferences, bias amplification, reward hacking, high cost

RLHF teaches systems from human judgments. It is one post-training approach, not a synonym for all alignment, preference optimization, or reinforcement learning.


Diagram viewer