Skip to content
NEURAVIK

What Is RLHF? How Human Feedback Trains AI Models

What is RLHF? A plain guide to reinforcement learning from human feedback: the three-stage pipeline, preference data, DPO and RLAIF, limits and best practice.

By · Published · 9 sources

What Is RLHF? How Human Feedback Trains AI Models

Quick answer

RLHF (reinforcement learning from human feedback) is a way to train AI models using human judgement. People rank a model's responses, a reward model learns to predict those preferences, and reinforcement learning, typically PPO, tunes the model to produce answers the reward model scores highly, while a penalty keeps it close to its starting point.

In this article

RLHF (reinforcement learning from human feedback) is a training method in which people compare a model's answers, a second model learns to predict which answers people prefer, and the original model is then optimised to score well on that learned judgement. It is the technique behind the shift from raw text predictors to assistants that follow instructions, and it runs on one raw material: carefully collected human preference data.

This guide explains what RLHF is, how each stage works, what the data looks like, how newer methods such as DPO and RLAIF change the recipe, where RLHF falls short, and how to run an RLHF data project that produces signal rather than noise.

What is RLHF, in plain terms?

RLHF replaces a hand-written scoring rule with human judgement. Many things we want from an AI model, such as "helpful", "polite" or "safe", are hard to write down as a formula. RLHF sidesteps that by asking people which of two or more outputs is better and learning a reward from their answers.

The idea predates chatbots. In 2017, Christiano et al. trained agents on Atari games and simulated robot locomotion from non-expert human preferences between pairs of short behaviour clips, with feedback on "less than one percent of our agent's interactions with the environment". They showed that new behaviours could be taught "with about an hour of human time".

The method became famous with language models. In 2022, OpenAI's InstructGPT paper (Ouyang et al.) fine-tuned GPT-3 with RLHF and reported that outputs from the 1.3B-parameter InstructGPT model were preferred to outputs from the 175B GPT-3, despite having 100x fewer parameters. A 2023 survey of the field (Casper et al.) describes RLHF as the main technique for fine-tuning leading large language models.

How does RLHF work? The three-stage pipeline

RLHF for language models usually has three stages: supervised fine-tuning, reward modelling and reinforcement learning. The InstructGPT paper (Ouyang et al., 2022) is the clearest public description, and most later work follows the same shape.

Diagram of the three RLHF stages: supervised fine-tuning on demonstrations, a reward model trained on ranked outputs, and reinforcement learning with PPO on prompts, with an optional loop back for new comparisons
The RLHF pipeline. Source: based on Ouyang et al., 2022 and Bai et al., 2022

Stage 1: Supervised fine-tuning (SFT)

Supervised fine-tuning teaches a pretrained model the format of a good answer. Labelers write example responses to prompts, and the model is trained to imitate them. In InstructGPT, the SFT dataset contained about 13k training prompts drawn from the OpenAI API and written by labelers (Ouyang et al., 2022).

Stage 2: Training a reward model from human preferences

A reward model is a separate model that takes a prompt and a response and outputs a single score. It is trained on human comparisons: the SFT model produces several answers to the same prompt, and labelers rank them. InstructGPT showed labelers between K = 4 and K = 9 responses to rank per prompt, used a reward model dataset of 33k training prompts, and used a 6B-parameter reward model even for its 175B policy (Ouyang et al., 2022).

Why rankings rather than scores out of ten? Hugging Face's 2022 explainer notes that when humans assign scalar scores directly, "the differing values of humans cause these scores to be uncalibrated and noisy" (Lambert et al., Hugging Face). Relative judgements are easier to make consistently.

Stage 3: Reinforcement learning against the reward model

In the final stage, the model generates answers to fresh prompts, the reward model scores them, and a reinforcement learning algorithm, usually Proximal Policy Optimisation (PPO), updates the model to earn higher scores. InstructGPT's PPO dataset had 31k training prompts and no human labels at all (Ouyang et al., 2022).

A penalty keeps the model honest to its starting point. The reward includes a Kullback-Leibler (KL) divergence term, which "penalizes the RL policy from moving substantially away from the initial pretrained model"; without it the model can drift into gibberish that still fools the reward model (Hugging Face, 2022).

Teams often repeat the loop. Anthropic's 2022 helpful-and-harmless work updated its preference models and policies weekly with fresh human feedback (Bai et al.).

What does RLHF preference data look like?

Preference data is a set of records, each holding a prompt and two or more responses with a human judgement of which is better. In its simplest form, as documented in Hugging Face's TRL library, a record has three fields: prompt, chosen and rejected (Hugging Face TRL docs). The same "preference" format feeds both reward model training and Direct Preference Optimisation in that library, and an "unpaired" variant stores a single completion with a true or false label instead.

In a production project, a record usually carries more than the raw choice. For example, a well-designed comparison task might capture:

  • the prompt and every candidate response, with model and version IDs
  • the preference itself, either a pairwise choice or a full ranking
  • the strength of preference ("much better", "slightly better", "tie")
  • per-criterion judgements, such as accuracy, helpfulness and safety
  • a short written rationale from the annotator
  • annotator ID, guideline version and time spent, for quality control

The rationale and per-criterion fields are what let you audit the data later. When InstructGPT's labelers ranked outputs for training, they were told to prioritise helpfulness to the user, while in final evaluations they were asked to prioritise truthfulness and harmlessness (Ouyang et al., 2022). Decisions like that live in the guidelines, and they shape the model.

Why do data quality and annotator guidelines matter so much?

In RLHF, the reward model learns exactly what your annotators reward, including their mistakes. The InstructGPT authors are explicit that the process aligns the model to "the stated preferences of a specific group of people (mostly our labelers and researchers), rather than any broader notion of 'human values'" (Ouyang et al., 2022).

Three findings from the published work show why this deserves management attention:

  1. Annotators disagree, even when trained. InstructGPT's training labelers agreed with each other 72.6 ± 1.5% of the time, and held-out labelers 77.3 ± 1.3% (Ouyang et al., 2022). The 2023 survey by Casper et al. reports agreement rates from 63% to 77% across major RLHF studies.
  2. Selection matters. OpenAI hired about 40 contractors and selected them using a screening test on sensitive content and agreement with researchers on a task with detailed instructions (Ouyang et al., 2022).
  3. Evaluators miss things on hard tasks. Casper et al. (2023) note that humans make mistakes under limited time and attention, that per-example pay creates incentives to cut corners, and that people struggle to judge outputs they cannot fully verify.

The practical lesson: for specialised content such as clinical notes, contracts or code, generalist raters may reward answers that merely sound right. That is where domain experts for AI training and evaluation become part of the data design, not an optional extra.

What are the alternatives to RLHF: DPO, RLAIF and Constitutional AI?

The two best-known variants change either the optimisation step or the source of the preferences. Both still depend on a clear definition of "better".

Comparison table of RLHF, DPO and RLAIF or Constitutional AI by preference source, whether a separate reward model is used, and whether there is an RL step
RLHF compared with DPO and RLAIF. Source: Ouyang et al., 2022; Rafailov et al., 2023; Bai et al., 2022

  • Direct Preference Optimisation (DPO). Introduced in 2023 by Rafailov et al., DPO reframes the RLHF objective so it can be solved with "a simple classification loss" directly on preference pairs. It needs no separate reward model and no sampling from the model during fine-tuning. The authors report it matched or improved response quality versus PPO-based RLHF on summarisation and single-turn dialogue, and was substantially simpler to implement and train.
  • Constitutional AI and RLAIF. Anthropic's 2022 Constitutional AI paper (Bai et al.) replaced human harmlessness labels with AI feedback: a model compares pairs of responses against a written list of principles, and a preference model trained on those AI judgements supplies the reward. The authors call this "RL from AI Feedback" and trained the assistant "without any human labels identifying harmful outputs".
  • RLAIF at scale. A 2023 study (Lee et al.) found that RLAIF "achieves comparable performance to RLHF" on summarisation, helpful dialogue and harmless dialogue.

These methods reduce labelling volume or engineering complexity, but they move the human effort rather than remove it. DPO still needs a preference dataset. RLAIF still needs people to write the principles and to check that the AI judge agrees with expert judgement on the cases that matter.

What are the limitations of RLHF?

RLHF works well enough to underpin today's assistants, but its weaknesses are well documented. The 2023 survey by Casper et al. groups them by where they arise:

Where it breaksWhat goes wrong
Human feedbackEvaluators make mistakes, can be misled by confident-sounding answers, and can poison data
Reward modelA single reward cannot represent diverse people; the model can learn the wrong proxy
PolicyOptimising hard against an imperfect reward leads to "reward hacking"
OutputsRLHF can contribute to sycophancy and reduce the diversity of outputs ("mode collapse")

There is also a performance cost. The InstructGPT team observed an "alignment tax": regressions on some public benchmarks such as SQuAD and DROP after RLHF. Mixing pretraining updates into PPO (which they called PPO-ptx) greatly reduced, but did not fully remove, those regressions (Ouyang et al., 2022). Anthropic, by contrast, reported in 2022 that its alignment training "improves performance on almost all NLP evaluations" (Bai et al.). The results depend on model size and setup.

The compute cost, on the other hand, can be modest. Training InstructGPT's 175B PPO-ptx model required 60 petaflops/s-days, against 3,640 petaflops/s-days to train GPT-3 (Ouyang et al., 2022). For many teams, the bottleneck is the quality of human data, not the GPUs.

How do you run an RLHF data project well?

A good RLHF data project treats preference labelling as a measured production process. These steps reflect the practices described in the papers above:

  1. Define "better" before you collect anything. Write guidelines that rank your criteria (for example, accuracy over tone) and say how to handle conflicts such as a harmful request. Version the guidelines and record the version on every label.
  2. Sample prompts that match real use. Casper et al. (2023) recommend data that is diverse, adversarial and focused on cases the reward model is uncertain about.
  3. Choose annotators for the task. Screen them with a test set and check their agreement with researcher or expert answers, as InstructGPT did. For regulated or technical domains, use qualified professionals.
  4. Use comparisons, with room for nuance. Rank several responses rather than scoring one, and allow ties and strength-of-preference labels.
  5. Measure agreement continuously. Track inter-annotator agreement and accuracy on gold questions. Disagreement is information: separate genuinely ambiguous prompts from guideline gaps.
  6. Run multi-stage QA. Review a sample of every batch, escalate disputed items to senior reviewers, and feed findings back into the guidelines.
  7. Hold out evaluators and data. InstructGPT checked generalisation with held-out labelers who produced no training data (Ouyang et al., 2022). Do the same before trusting a reward model.
  8. Iterate on the latest model. Collect fresh comparisons on the current model's outputs, as Anthropic did with weekly updates (Bai et al., 2022).

If you are still deciding whether your organisation is ready for this kind of work, start with an AI readiness assessment. For more on labelling and evaluation, browse our data annotation and AI training articles.

How Neuravik can help

Neuravik provides data annotation services for AI teams, including RLHF and preference data collected against documented guidelines with multi-stage quality assurance. Through our expert network, we can bring doctors, lawyers, engineers and analysts into training and evaluation tasks that generalist raters cannot judge reliably. To discuss a preference data project, contact our team.

Frequently asked questions

What is the difference between RLHF and supervised fine-tuning?+

Supervised fine-tuning trains a model to imitate example answers written by people. RLHF goes further: people compare several model answers, a reward model learns their preferences, and the model is optimised to score well on that reward. In practice, supervised fine-tuning is usually the first stage of an RLHF pipeline.

Is RLHF used in ChatGPT?+

OpenAI's InstructGPT paper (2022) describes fine-tuning GPT-3 with RLHF to follow instructions, and a 2023 survey by Casper et al. describes RLHF as the primary strategy for fine-tuning leading language models, citing OpenAI among others. For details of a specific product version, check the provider's own documentation.

What is the difference between RLHF and DPO?+

RLHF trains a separate reward model and then uses reinforcement learning such as PPO to optimise against it. Direct Preference Optimisation (DPO), introduced in 2023, trains directly on chosen-versus-rejected pairs with a simple classification loss, with no separate reward model or RL loop. Both need high-quality preference data.

What is RLAIF?+

RLAIF means reinforcement learning from AI feedback. Instead of people labelling which response is better, an AI model makes the comparisons, often guided by a written set of principles, as in Anthropic's Constitutional AI. A 2023 study found it achieved performance comparable to RLHF on summarisation and dialogue tasks.

How much human feedback does RLHF need?+

It varies by project. For InstructGPT, OpenAI used about 13k prompts for supervised fine-tuning and 33k prompts for reward model training, with labelers ranking 4 to 9 responses per prompt. Quality and coverage of the data matter as much as raw volume.

Sources

  1. Training language models to follow instructions with human feedback · arXiv (Ouyang et al., OpenAI)
  2. Deep reinforcement learning from human preferences · arXiv (Christiano et al.)
  3. Illustrating Reinforcement Learning from Human Feedback (RLHF) · Hugging Face
  4. Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedback · arXiv (Bai et al., Anthropic)
  5. Constitutional AI: Harmlessness from AI Feedback · arXiv (Bai et al., Anthropic)
  6. Direct Preference Optimization: Your Language Model is Secretly a Reward Model · arXiv (Rafailov et al.)
  7. RLAIF vs. RLHF: Scaling Reinforcement Learning from Human Feedback with AI Feedback · arXiv (Lee et al.)
  8. Open Problems and Fundamental Limitations of Reinforcement Learning from Human Feedback · arXiv (Casper et al.)
  9. Dataset formats and types · Hugging Face