A Survey of RLHF

Nobody can write down a score for “carry the cup well”, but anyone can pick the better of two attempts. RLHF turns thousands of such picks into a reward, and then into a policy.

Learn how reinforcement learning from human feedback works: what feedback people give, how a reward model learns from it, how a policy is trained on that reward, and where the idea breaks.

Pick the run you prefer, six or seven times, and watch the reward model form a taste and the policy follow it. Then we build, piece by piece, everything underneath: the feedback, the human model, the loss, the questions, the policy training and the limits.

You need a rough idea of a probability (a number from 0 to 1) and a little Python for the code. We teach reinforcement learning from zero.

Based on “A Survey of Reinforcement Learning from Human Feedback” by Timo Kaufmann, Paul Weng, Viktor Bengs and Eyke Hüllermeier (arXiv 2312.14925, v3, December 2025). It is an assigned reading for Lecture 13, Multimodal Interaction of MIT MMAI, Multimodal AI (Spring 2026, Paul Liang). The authors wrote the survey; every idea is re-taught here in our own words and devices.

Teach a robot what good means

A robot carries a full cup across a room. Pick the run you prefer. After each pick, the reward model updates and the policy shifts.

Illustrative toy. Eight made-up behaviours are scored 0 to 100% on speed, care and tidiness. The reward model is a weighted sum of those three scores. Each pick nudges the weights with one step of the Bradley-Terry update (Chapter 4), and the policy picks behaviour i with probability proportional to exp(reward of i). The survey describes the method, not this toy.

Chapter 0

A Goal You Cannot Write Down

See why a person’s choices can teach a machine what a hand-written score cannot

Picture a robot arm that must carry a full cup of coffee across a room. You are the engineer. Your job is to write the score the robot will try to maximise.

You start with speed: more points for arriving sooner. The robot sprints, and the coffee flies out. So you add a penalty for each spill. Now the robot learns to carry an empty cup. You reward “cup still full at the end”, and the robot learns to carry the cup so slowly that the clock runs out. Each patch fixes one failure and opens another.

This is the core trouble of the survey you are about to read. In its words, designing an effective reward function “presents significant challenges”, because in real tasks success is hard to define and measure.

Reinforcement learning in two paragraphs

Reinforcement learning (RL) is learning by trial and error. An agent (the learner, here the robot) looks at the state of the world, picks an action, and the world changes. After each step, a number called the reward says how good that step was. The agent wants a high total reward over a whole run. We call a whole run a trajectory, and the total reward of a run its return.

The agent’s way of choosing actions is its policy. Think of it as the agent’s habits: given this state, how likely is each action? Training changes the policy so that high-return runs become more likely. The reward is the only teacher. If the reward is wrong, the policy learns the wrong lesson with total confidence.

When the score lies

The survey lists what goes wrong. Engineers add intermediate rewards to help the agent learn, a trick called reward shaping. But shaped rewards can pay for behaviour that merely correlates with the goal. The agent then maximises the score and misses the point. This is reward hacking: the behaviour scores high and deviates from what you meant.

The survey cites agents that exploit flaws in a simulator, agents that chase intermediate rewards without finishing the task, and an agent that quits a game early to avoid negative points. In a game, this is funny. The survey adds that in healthcare or driving, a misaligned reward could mean a care robot that injures someone.

Try the effect with a toy. The slider is optimisation pressure: how hard the policy pushes on a score. The warm line is a proxy score you can measure. The pink line is the quality you actually want.

Push on the proxy

Drag the pressure up. Watch the two lines. Then switch on Refresh the reward with new human picks and drag again.

4.0

Illustrative toy, not data from the survey. True quality is p − 0.09p². The proxy is p + 0.08p² (it pays for something that hurts quality), or p − 0.08p² once new human comparisons repair it. Each curve is scaled so its best value on 0 to 10 equals 100%.

Without the refresh, the proxy line rises all the way to the right. The quality line peaks near pressure 5.6 and then falls. The score keeps promising progress while the real thing gets worse. With the refresh, the proxy and the true quality peak almost together.

Look at the symptom, the measurement and the fix. The symptom is a reward curve that climbs while the behaviour looks wrong to a human. The measurement is a check against something the optimiser cannot see, here a person or the true quality. The fix, which the survey returns to again and again, is to keep a person in the loop so the reward keeps being repaired as the policy changes.

The idea of RLHF

Reinforcement learning from human feedback (RLHF) drops the hand-written reward. A person gives feedback instead, such as “this run is better than that one”. A model learns a reward from that feedback. A normal RL algorithm then trains the policy on the learned reward.

The idea is old. The survey traces it to preference-based RL (PbRL), introduced independently in 2011 by Akrour et al. and by Cheng et al. The name RLHF came later, from work that includes InstructGPT (Ouyang et al., 2022). The survey treats RLHF as the wider idea and PbRL as the part that uses comparisons.

The survey does something unusual for 2025. It does not only cover chatbots. It covers control and robotics in the most depth, plus a dedicated section on language models. That helps you here: the same loop trains a robot and a language model, and seeing both makes the mechanism clear.

The road

This lesson follows the survey’s own structure: the RL setting, the feedback, the label collection, the reward model, the policy, and the limits. The survey is a map, not a single experiment, so each chapter teaches one mechanism and says plainly which results come from the papers it cites.

  1. The loop: RL with the reward swapped for a person, and the survey’s generic algorithm.
  2. Kinds of feedback: six attributes that sort every way a person can teach.
  3. The human as a noisy chooser: the Bradley-Terry and Boltzmann models.
  4. Training the reward model: the loss, the data shapes and how to check the result.
  5. Choosing what to ask: active learning and the psychology of labelers.
  6. Training the policy on a learned reward: moving targets, overoptimisation and the KL leash.
  7. Language models as a special case: the bandit view, the three-step pipeline and DPO.
  8. What the survey maps, and where it stops: applications, benchmarks, theory and limits.
  9. The whole survey on one page: numbers, code and where to go next.
An agent’s proxy reward keeps climbing during training, yet people who watch it say its behaviour is getting worse. What is the best description?

Chapter 1

The Loop: RL With the Reward Swapped Out

Follow one cycle of reinforcement learning, then see exactly which part RLHF replaces with a person

Think of teaching a puppy a trick. The puppy tries something. You react. It tries again. Nothing is written down: the puppy’s habits shift because of your reactions. Standard RL has the same shape, except the “reaction” is a number from a formula someone wrote in advance.

The survey makes this precise with a Markov decision process (MDP), the standard model of a world an agent acts in. An MDP is a bundle of six things, and the survey writes them as (S, A, P, R, d0, γ).

“Markov” means the next state depends only on the current state and action, not on the longer past. That keeps the model small enough to learn from.

The return: adding up a whole run

A trajectory τ is the list of states and actions of one run, from the start to a terminal state. The agent does not care about one reward. It cares about the total over the run, discounted so that sooner is better. The survey calls this total the return.

R(τ)
The return of trajectory τ. The survey uses the letter R for both the return of a whole run and the reward of one step. Check the brackets to tell which.
∑h=0H−1
Add up the terms for step h = 0, then 1, and so on to the last step H − 1. H is the length of the run.
γh
The discount at step h. With γ = 0.9, step 0 counts fully, step 1 counts 0.9, step 2 counts 0.81.
R(sh, ah)
The reward the world pays for taking action ah in state sh.

1 + 0.9 × 1 + 0.81 × 1 = 2.71 (three steps of reward 1, with γ = 0.9)

The agent’s goal is a policy π that maximises the expected return J(π), the average return over many runs. The survey sorts RL methods into model-based ones (learn the physics P and R first) and model-free ones. Model-free methods split again. Value-based methods such as DQN learn a Q-function: how good each action is in each state. Policy search methods learn the policy directly. The common recipe is the actor-critic, where an actor (the policy) and a critic (a value estimate) learn together. PPO, TD3 and SAC are the survey’s examples.

What RLHF removes

Now remove R. In RLHF the agent has no reward function at all. The survey redraws the loop in its Figure 1. Panel (a) is the standard loop: the environment returns the next state and the true reward. Panel (b) is RLHF: the environment returns only the next state, and a reward model supplies an estimate r̂ in place of the true reward. The reward model is a neural network trained from human feedback. The survey’s key sentence is that this reward learning is “decoupled from policy learning and can happen fully asynchronously”.

The person is called the oracle or labeler. The agent sends a query qi, for example two short clips of behaviour. The person returns a label li, for example “the left one is better”. The pairs (qi, li) pile up in a dataset D.

The survey gives the whole procedure as its Algorithm 1, for an actor-critic learner. Read it as two phases inside one loop. The parameters are θ (the policy), φ (the critic) and ψ (the reward model).

  1. Reward learning. Generate queries from the replay buffer B (the stored runs). Ask the oracle. Add the answers to D. Update ψ on D.
  2. RL training. Add new runs from the current policy πθ to B. Update the actor θ and the critic φ using B and the reward model Rψ.

Step through it. Compare the two modes: the standard loop reads a reward every step, and the RLHF loop asks a person only now and then.

Step the loop

Choose a loop, then press Step. The lit arrows show what moves in that step. Press Run 5 loops to see how many human answers the RLHF loop uses.

Illustrative counts: each loop is 1,000 environment steps and, in the RLHF loop, 2 human comparisons. The survey describes the structure (its Figure 1 and Algorithm 1), not these numbers.

Why not just ask for rewards, or for demonstrations?

A person could, in principle, type a reward after every action. The survey gives three reasons this fails. It takes too much effort, at least once per episode. Rewards would be needed immediately, which slows learning. And people are poor at giving consistent absolute numbers.

A person could instead demonstrate the task, and the machine could infer the reward. That field is inverse RL. The survey lists four difficulties. The reward is generally not robustly identifiable from demonstrations. Good demonstrations are not always available. The agent struggles to beat the demonstrator. And people often do not demonstrate the behaviour they would prefer a machine to have. Interactive feedback avoids all four: it is easier to give, needs no expert skill, and asks about preferred behaviour.

What counts as RLHF here

The survey states its scope with four tests. The reward model is the only source of objective information. Humans define the objective. Feedback is collected interactively during learning. And feedback is scalable and asynchronous: the agent keeps learning while it waits for an answer. That last test is the reason the loop above is two loops, not one.

In the RLHF loop of Figure 1b, which statement is correct?

Chapter 2

Kinds of Feedback

Sort every way a person can teach a machine along six attributes, and see what each way costs and gives

A coach watches a runner. She can shout “good!” after a lap. She can say “that lap was better than the last one”. She can say “you ran faster at the end than at the start”. She can say “aim for speed, but keep your form”. She can wince, or she can grab the runner’s arm and fix her posture.

All six are feedback: a person conveys something about what they prefer. Section 3 of the survey makes a catalogue of them. The catalogue matters because the same learner behaves very differently depending on the kind of feedback it gets. Each kind costs the person a different effort and gives the machine a different amount of information.

Six attributes

The survey describes any feedback type with six attributes, adapted from Metz et al. (2023). Learn the six words and the catalogue becomes simple.

  1. Arity. Does the person judge one thing alone (unary, like a score) or against others (binary for two, n-ary for more)? A lone score has no anchor, so the person must stay consistent for days. A comparison has the anchor built in, but the two items must be comparable.
  2. Involvement. Does the person only watch (passive), produce the example (active, such as a demonstration), or share control (co-generative)? Watching is the easiest. Producing carries more information per example.
  3. Granularity. Is the judgement about a whole episode, a segment (a few seconds) or a single step? A coarse judgement gives context but blurs credit assignment, the question of which step earned the result. A fine one is easy to learn from and tedious to give.
  4. Abstraction. Is the judgement on the raw recording, or on features such as a car’s speed and the forces on passengers? Features are easier to learn from, but finding the right ones is hard.
  5. Explicitness. Does the person answer a question on purpose (explicit), or does the feedback leak out as a side effect, like a grimace (implicit)? Implicit feedback is plentiful and hard to read.
  6. Intent. Is the person evaluative (rating), instructive (telling what to do), descriptive (describing what matters) or literal (just acting to get the job done, with no teaching in mind)?

On intent, the survey cites Milli and Dragan (2020): people who teach on purpose act differently from people who only do the task. Even so, assuming the wrong intent can still give a better reward estimate. The lesson for a builder is to know which kind of person you are asking.

The common classes

Table 2 of the survey sorts the many published feedback types into a few classes by these attributes. Pick a class below to see its row. Cells with a warm bar are defining: they hold for every method in the class. Cells in grey italics vary between methods.

Read a class by its attributes

Press a class. Compare how many attributes it fixes, and which ones.

Cells follow the survey’s class descriptions in its Section 3.2 and Table 2. Where the text says a value is common but not required, the cell is marked as varying. The survey also lists natural language, e-stops, importance, feature traces and similarity queries; they are left out here to keep the table small.

Take critique first: the person watches a recording and says approve or disapprove. It is passive, explicit and evaluative, and it judges one thing at a time. Xiao et al. (2020) use binary feedback on single state and action pairs, and Wang et al. (2020) even use brain signals as noisy critiques.

Comparisons are the workhorse. Christiano et al. (2017) show pairs of short clips and ask which is better. The survey notes pairwise comparisons are easier to give than ratings, even when a foundation model gives them, and that they reduce bias, inconsistency and subjectivity. The price is that each label carries little information.

Inter-temporal feedback compares moments inside one run. It helps when starting conditions differ so two whole runs cannot be compared. Cabi et al. (2020) let people sketch a reward curve over time, and Abramson et al. (2022) let them mark where the agent made progress or lost ground. Labelers tend to mark short-term actions that are easy to judge, so long-horizon wishes get lost.

Proxy rewards are partial reward functions that hint at the task. Social behaviour means facial reactions and gestures, which Cui et al. (2021) ground by first giving people known goals. Improvements are corrections after the fact or interventions during the run. The survey stresses that for a correction you still hold the uncorrected run, but for an intervention you can only estimate it.

What one label looks like

To re-implement any of this, you need the shape of a single label. The records below are our own illustration, since the survey does not prescribe a format. Here T is the clip length in steps and d the size of one observation.

ClassOne recordWhat the learner gets
Critiqueclip [T, d] + label ∈ {+1, −1}1 bit about 1 clip
ComparisonclipA [T, d], clipB [T, d] + label ∈ {A, B}1 bit about a pair
Ranking of 44 clips [T, d] + order of 4up to log2(24) = 4.6 bits
Reward sketchclip [T, d] + curve [T]T numbers, one per step

The bit counts follow from counting outcomes: two answers is 1 bit, and 4! = 24 orders of four clips is log2 24, about 4.6 bits, at most. More bits per label sounds better. Yet the survey cites Askell et al. (2021), who found that binary comparisons, even ones extracted from rankings, performed better than rankings. Information per label is not the whole story: a richer answer is harder to give accurately.

When the cheap label misleads

Take the failure mode in order. The symptom: a policy trained on comparisons chases a feature that has nothing to do with what people wanted. The measurement: Tien et al. (2023) study this “causal confusion”. Because each label carries so little information, the reward model can credit noise or a side feature for the preference. The fix the survey points to: richer feedback, more varied queries (Chapter 5), or combining feedback types so each covers the other’s weakness.

Combining is common in practice. The survey notes it is typical to first initialise the reward model from rough active feedback such as demonstrations, and then refine it with passive feedback such as comparisons.

A person watches two robot runs and says which was better. Which attributes does that describe?

Chapter 3

The Human as a Noisy Chooser

Turn a person’s fuzzy picks into probabilities, and derive the formula nearly every RLHF system uses

Ask a friend which of two restaurants is better. If one is wonderful and one is awful, they answer the same way every time. If both are fine, they might answer differently on Tuesday and Friday. A person is not a lookup table. They are a noisy chooser, and the noise gets bigger as the two options get closer.

To learn a reward from picks, we need a model of that noise. The survey calls it the human feedback model. It is the bridge between the thing we want (a reward) and the thing we observe (a pick). Section 5.1 of the survey builds it in a few lines, and we can derive it ourselves.

Every label is a choice

The survey’s first move is to treat almost every feedback type as a choice. A query q defines a menu of possible answers, written m(q). A comparison of two clips has a menu of two: “left” or “right”. A ranking of four clips has a menu of 24 orders. The label l is the item the person picks from the menu.

Hidden utility plus noise

Now suppose each menu item l has a hidden score, its utility ul: how good the person would find it if they saw it clearly. The person does not read the true utility. They perceive ul plus a random wobble εl and choose the biggest. In symbols, P(l is chosen) = P(l = argmax ul + εl), where argmax means “the item with the largest value”.

Choose the wobble well and a clean answer appears. If every ε follows a standard Gumbel distribution (a skewed bell shape that arises as the largest of many random draws), the chance of choosing l is proportional to exp(ul). This is the Boltzmann distribution. Statisticians call it the multinomial logit model; for a menu of exactly two items it is the Bradley-Terry model (1952); for full rankings it connects to the Plackett-Luce model.

Derive the pair formula

Take two trajectories, τ1 and τ2. The survey sets the utility of preferring a trajectory equal to its return R. Boltzmann says the chance of picking τ1 is its exp-utility divided by the sum of both.

P(τ1 ≻ τ2)
The probability that the person says τ1 is better. The sign ≻ reads “is preferred to”.
eR(τ1)
The exp-utility of the first run. Exponentiating makes every score positive and makes a bigger return count disproportionately more.
1 / (1 + eR(τ2) − R(τ1))
The same number, after dividing top and bottom by eR(τ1). Only the gap in returns matters. This shape is the logistic (sigmoid) curve.

The last form is the one to remember. The pick depends only on the gap R(τ1) − R(τ2). A gap of zero gives 1/(1+1) = 0.5, a coin flip. A gap of 2 gives 1/(1+e−2) = 0.881. A gap of 4 gives 0.982. A small gap makes noisy picks and a big gap makes reliable ones, which matches the restaurant story.

The rationality dial

Some people are sharper than others. The survey adds a rationality coefficient β (beta) from 0 up: the chance of choosing l becomes proportional to exp(β · ul). A large β makes the person almost always pick the better item. A small β makes them nearly random. The plain Boltzmann model assumes β = 1. Ghosal et al. (2023) show that estimating β helps reward learning, but it needs calibration questions where the true utility is known, because otherwise β and the reward scale cannot be told apart.

A simpler alternative from Christiano et al. (2017): assume the person follows the Boltzmann model 90% of the time and otherwise clicks at random. Then P = 0.9 × 0.881 + 0.1 × 0.5 = 0.843 for a gap of 2. Try all three ideas below.

Ask a noisy labeler

The curve is the chance the labeler picks the first run. Drag the gap and the rationality. Then press Ask 20 labelers and see how well 20 real draws follow the curve.

2.0
1.00

The curve is exact: P = 1 / (1 + e−β·gap), or 0.9 of that plus 0.05 with the random-click toggle on (Christiano et al., 2017, as described in the survey). The 20 answers are real random draws in your browser, so they differ on every press.

Notice two things. With β = 4 the curve is a cliff: a gap of 1 already gives 98%. With β = 0.2 the same gap of 1 gives only 55%. And with the random-click toggle on, the curve never reaches 100% or 0%, however big the gap. A reward model trained on such data has to learn that the human sometimes just errs.

Why this model, and where it is weak

The survey gives three reasons for the exponential form. It has a closed form, so the gradient with respect to the utilities is easy. It satisfies Luce’s axiom of choice: adding or removing other options does not change the odds between two options. And Jeon et al. (2020) show it is the maximum-entropy choice distribution for a decision maker who is satisfied with near-optimal choices.

It also has critics. Humans are not fully rational, and the logistic link forces transitivity: if A usually beats B and B usually beats C, then A must usually beat C. Real people can make preference cycles. Knox et al. (2024) show that using the return as the utility can make the reward unidentifiable in some cases, and propose regret instead. Other link functions and the Thurstone (probit) model exist too. Any such link needs just two properties: it increases, and Φ(x) = 1 − Φ(−x).

The failure mode, in order. The symptom: the reward model looks accurate on your labels yet the policy misbehaves. The measurement: check whether pairs with nearly equal returns are labelled near 50/50, and whether the data show cycles. The fix: model the noise (a β, an error rate), or pick a link function that fits your labelers.

Run τ1 has return 3 and run τ2 has return 1. Under the plain Bradley-Terry model (β = 1), what is the chance the labeler prefers τ1?

Chapter 4

Training the Reward Model

Fit a scorer to a pile of verdicts, derive its loss and its update, and learn how to check that it is any good

Imagine a judge who reads a thousand verdicts of the form “A beat B” and must then invent a score for every contestant. The scores should explain as many verdicts as possible. That is reward model training. Chapter 3 gave us the model of the person; now we run it backwards, from picks to scores.

The loss, derived

We have a dataset D of N comparisons, each saying that run τ1i beat run τ2i. We have a reward model Rψ with weights ψ. The Bradley-Terry model says the chance of the observed verdict is 1/(1 + exp(Rψ(τ2) − Rψ(τ1))). The survey’s Equation 2 picks the ψ that makes the whole dataset most likely: maximum likelihood. The probability of all N independent verdicts is a product, and a product of many small numbers is awkward for a computer (it underflows toward zero), so we take the negative log, which turns the product into a sum, and minimise.

L(ψ)
The loss: a number that is small when the reward model explains the verdicts. The survey calls this equivalently a cross-entropy loss.
∑i=1N
Add over all N comparisons in D.
σ
The sigmoid, σ(x) = 1 / (1 + e−x). It turns a score gap into a probability.
Rψ(τ1i) − Rψ(τ2i)
The reward model’s gap between the winner and the loser of verdict i. Training widens this gap.

What does one step of learning do? Write p = σ(R1 − R2) for the model’s current chance that the winner wins. The derivative of −log σ(x) is −(1 − σ(x)). So gradient descent raises the winner’s score by (1 − p), lowers the loser’s score by the same amount, and scales both by a learning rate. If the model already agrees (p near 1), the nudge is tiny. If it is wrong, the nudge is large. A model learns most from its surprises.

Worked example, with learning rate 1 and both scores starting at 0. Step 1: p = σ(0) = 0.5, so winner +0.5, loser −0.5; the gap is now 1. Step 2: p = σ(1) = 0.731, the nudge is 0.269, so the gap becomes 1.54. Step 3: p = σ(1.54) = 0.823, the nudge is 0.177, so the gap becomes 1.89. The gap keeps growing, more slowly each time. This is exactly the update that ran in the hero when you picked a run.

From a clip to a score: the data flow

For control tasks, the reward model Rψ scores single steps, and the return of a clip is the discounted sum: Rψ(τ) = Σ γh Rψ(sh, ah). Here is the whole path with shapes. A batch holds B pairs; each clip has T steps; each step has d numbers (state plus action).

pythondef reward_loss(rm, clipA, clipB, y):
    # clipA, clipB: [B, T, d]    y: [B], 1.0 if A was preferred
    rA = rm(clipA).sum(dim=1)     # rm maps [B, T, d] to [B, T] step rewards; sum to [B] returns (gamma = 1)
    rB = rm(clipB).sum(dim=1)
    return F.binary_cross_entropy_with_logits(rA - rB, y)   # -log sigma(gap), averaged over B

Three lines carry the whole method. Note the loss never sees an absolute reward, only the gap rA − rB. For images, the survey says raw frames make the reward non-Markov, so Christiano et al. (2017) stack several frames; others use recurrent models or Transformers (Abramson et al., 2022). For language models, the input is text and the model usually starts from a pretrained language model (Appendix A, Chapter 7 here).

Watch a reward model learn

Below, six runs have hidden true utilities. A simulated labeler compares random pairs, using the Chapter 3 model. The reward model is just one number per run, trained by the loss above. Grow the number of comparisons and degrade the labeler.

Grow the dataset

Pink outlines are what a perfect fit would show. Warm bars are what the model learned. Drag the comparisons up, then try a sloppier labeler.

30

Toy: six runs with true utilities −2.0, −1.2, −0.3, 0.4, 1.3 and 2.0. Labels are drawn from the Bradley-Terry model with the chosen β, and the model is fit by 300 steps of gradient descent on the loss above, with a tiny pull toward zero. Because the data only fix score gaps scaled by β, the outlines show β times the true utility, centred on zero. A coin-flip model has loss 0.693. The survey describes the loss, not this toy.

With few comparisons the bars look wrong and the ranking misses pairs. With a hundred or more from a careful labeler, the bars hug the outlines. A sloppy labeler needs many more comparisons for the same quality, and its learned bars stay short: low β means the data carry less information per label.

How do we know the reward model is good?

Section 5.3 of the survey lists four ways. Rollout: train a policy on the learned reward and score it with the true reward. This is simple but needs the true reward and often cannot be run for medicine or driving. Off-policy evaluation: test on held-out data. For language models, Lambert et al. (2024) built RewardBench, which tests chat, safety, reasoning and preference tasks, including adversarial cases. Distance functions: Gleave et al. (2022) define the EPIC distance, which canonicalises two rewards (removing changes like potential shaping that do not change which policy is best), normalises them, and measures what is left; DARD and the STARC metrics extend it. Inspection: a human watches the trained agent, or another model acts as the evaluator.

Keep improving it online

A reward model trained once and frozen is a trap. Christiano et al. (2017) found it is important to improve the reward model online, and Gao et al. (2023) showed that over-optimising a reward model trained offline degrades performance. Abramson et al. (2022) found iterative improvement beat a reward model trained once, sometimes exceeding human performance. McKinney et al. (2022) add a warning: a reward model trained online with one policy may fail when a completely new policy is trained.

The survey lists fixes: update the reward model often with more on-policy queries, use ensembles (several reward models whose disagreement signals doubt; Eisenstein et al., Coste et al., 2024), average the weights of several models (Rame et al., 2024), or put extra weight on hard examples (Zheng et al., 2024). The ensemble idea comes back in the next chapter as a way to choose questions.

During training the reward model assigns the winning run a probability of 0.95 of winning. Compared with a verdict it gets wrong, how large is the update from this one?

Chapter 5

Choosing What to Ask

Spend a small budget of human answers on the questions that teach the most, and respect the limits of the people answering

A busy expert gives you ten minutes. You could ask ten easy questions whose answers you already guess. Or you could ask the ten questions that would change your mind the most. Human labels are the costly part of RLHF, so the survey spends a whole section on choosing the questions. The machinery is active learning: the learner picks what to ask.

RLHF has a twist. In ordinary active learning the data sit in a fixed pool. In RLHF the agent also controls which behaviour it produces, so it can shape the pool it asks about.

Where candidate questions come from

Most work simply takes runs from the replay buffer during training and pairs them at random. The survey names two upgrades. One uses the transitivity of preferences (if A beats B and B beats C, no need to ask about A and C; Hwang et al., 2023). The other has the agent generate runs on purpose to ask about, often with a learned model of the world to keep the cost low (Reddy et al., 2020; Liu et al., 2023b).

Scoring a question: the acquisition function

Candidate questions get a score called the acquisition function. The highest score is asked next. The survey calls uncertainty “one of the most important” ingredients. It means a specific kind: epistemic uncertainty, the part of doubt that more data removes. It contrasts this with aleatoric uncertainty, the randomness built into the system, which no amount of data removes.

How do you measure epistemic uncertainty? Either keep a Bayesian belief about the reward, or train an ensemble of several reward networks and watch where they disagree. A worked example with three networks scoring two pairs of clips:

PairNet 1 gapNet 2 gapNet 3 gapVerdict
Clip A vs clip B+1.5−0.4+0.9They disagree on the sign. Ask a person.
Clip C vs clip D+2.2+2.4+2.1All three agree. Skip it.

The gap is the first clip’s predicted score minus the second’s. For pair A and B the three networks give +1.5, −0.4 and +0.9: their spread is large, so a label would settle a real argument. For C and D the spread is small, so a label teaches almost nothing. The numbers are our illustration of the idea.

The survey lists other classic scores. Daniel et al. (2014) compared probability of improvement, expected improvement and upper confidence bound in a robotics task, finding that the last gave the best performance at a high cost in queries, while the first asked the fewest. Volume removal asks the question whose answer cuts away the most of the set of possible rewards, and information gain asks for the largest expected drop in uncertainty. Bıyık et al. (2019) show that volume removal has uninformative global optima, which is why they prefer information gain.

More than uncertainty

The survey is blunt that uncertainty alone is not enough. A good acquisition function may also weigh five more things: use on-policy data (what the current policy does), query simplicity (a person must be able to answer), trajectory quality, query diversity and query cost. The next device shows why. It runs two learners side by side on the same six runs from Chapter 4. The random learner asks random pairs. The disagreement learner trains four reward models on resampled answers and asks about the pair they disagree on most, dividing by how often it has asked that pair so it spreads its questions.

Random questions or the right questions

Both learners start with no answers and ask the same simulated labeler (β = 1). Drag the budget. Press New run a few times: one run can mislead.

20

Toy, computed live in your browser. Six runs, true utilities as in Chapter 4. The disagreement score is the spread of the pair’s predicted gap across four reward models fit on resampled answers, divided by one plus the times that pair was asked. Results change from run to run; neither learner wins every time. The survey does not report this experiment.

Run it a few times. Often the two curves are close, and sometimes random wins. That is not a bug. Near-ties in true utility look uncertain forever, because the labeler’s noise (aleatoric) hides the answer. Asking about them again and again buys little. A good acquisition function separates ignorance, which a label can fix, from noise, which it cannot.

The people answering are not machines

Section 4.2 of the survey turns to the labelers. Learners assume people have stable preferences waiting to be read out. Psychology says otherwise. Lichtenstein and Slovic (2006) found that preferences are often constructed at the moment of asking, and they shift with how you ask. The survey lists the culprits:

The failure mode in order. The symptom: a model gets more confident and more fluent, yet less truthful. The measurement: compare labels against an independent check on the hard-to-judge feature, such as factual accuracy. The fix: give labelers tools and time, design the interface to reduce framing and fatigue (Bıyık et al., 2019; Zhang et al., 2022 simplify queries), and do not assume synthetic feedback behaves like people. Kaufmann et al. (2023) link these psychological effects to RLHF and discuss why testing only on simulated labelers can hide them.

Which kind of uncertainty is it worth spending a human label on?

Chapter 6

Training the Policy on a Learned Reward

Use an imperfect, moving score to train an agent, and keep a leash on it so it does not exploit the score’s mistakes

A student learns from a grader. The grader is a tired assistant who has read only a few essays and still invents a rubric. The student studies the rubric hard, finds the one habit the assistant over-rewards, and writes only that. Marks go up. Quality goes down. This is the second half of RLHF: the policy trains on a reward model that is only an approximation.

Section 6 of the survey says any standard RL algorithm could train the policy, such as DQN, A3C, PPO or SAC. Two issues make plain use risky: the reward changes while the policy trains, and the reward is wrong, especially early on.

A reward that moves

RL theory assumes a fixed reward function. In RLHF the reward model is re-trained every so often, so the target moves. Christiano et al. (2017) argued that policy-gradient methods suit moving rewards better than value-based ones, and applied them unchanged. Ouyang et al. (2022) did the same for language models. Value-based methods also work with one trick: when the reward model updates, relabel the stored experiences in the replay buffer with the new rewards (Ibarz et al., 2018; Lee et al., 2021b). Gulcehre et al. (2023) go further with offline-RL techniques in a growing-batch setting, which reuse data and need fewer interactions.

Some methods are built for RLHF. Wu et al. (2023) propose Pairwise Proximal Policy Optimization (P3O), which skips the value function and is provably unaffected when the reward is replaced by an equivalent one, unlike PPO. Zhu et al. (2023b) replace PPO’s KL term with a squared error on log probabilities.

A reward that is wrong

The reward model is an approximation, so an optimiser will find its gaps. The survey calls this overoptimisation (Gao et al., 2023) or reward hacking. The standard defence is to keep the new policy close to a trusted one. The tool is the KL divergence, a measure of how much one probability distribution differs from another. Add a penalty for drifting away from a reference policy πref, such as the pretrained model or a policy cloned from human demonstrations (Jaques et al., 2017). The survey says this is particularly common for language model fine-tuning. Moskovitz et al. (2024) try constrained RL instead: maximise reward only up to a threshold.

Why does a leash work? Let us derive what the policy becomes. Take a single prompt and a set of possible responses y. The policy π gives each response a probability. We want to maximise the reward-model score minus a penalty:

J(π)
The score we want to be large: average reward-model score, minus a price for straying.
r̂(y)
The learned reward model’s score for response y. The hat marks an estimate.
β
The leash length (the weight on the penalty). A large β keeps the policy near the reference; a small one lets it chase the score. This is a different β from the labeler’s rationality in Chapter 3.
KL(π ‖ πref)
The sum over responses of π(y) log(π(y) / πref(y)). It is zero when the two policies are equal and grows as they differ.

The maximum has a closed form. It is a standard result, not one the survey derives, so we show it in three lines.

  1. Write the weight w(y) = πref(y) er̂(y)/β and its total Z = ∑ w(y). Then q(y) = w(y)/Z is a valid distribution.
  2. Expand: J(π) = −β · KL(π ‖ q) + β log Z. The second term does not depend on π.
  3. KL is never negative and is zero only when π = q. So the best policy is π*(y) = πref(y) er̂(y)/β / Z.

Read the result. The optimal policy is the reference policy, tilted toward high scores. A big β flattens the tilt, so the policy stays near the reference. A small β sharpens it, so the policy piles onto the top-scoring response, right or wrong. Try it with six candidate answers, where the reward model has one blind spot: it over-scores a confident but wrong answer.

Shorten the leash

Pink outlines are the reference policy. Purple bars are the tilted policy. Drag β down to let the policy chase the proxy score, and watch the true reward in the chart.

1.00

Illustrative toy, not data from the survey. Six answers with reference probabilities 0.30, 0.25, 0.15, 0.15, 0.05, 0.10, proxy scores 1.0, 1.2, 2.0, 0.2, 2.2, 0.0 and true values 1.2, 1.0, 2.4, 0.2, −1.5, 0.0. The policy is the closed form derived above, computed exactly.

At a long leash the policy is the reference and nothing improves. At a medium leash the policy shifts toward the answer that is both high-scored and truly good, and the true reward rises above the reference. Past the sweet spot the proxy score keeps rising while the true reward collapses, because the policy has found the blind spot. This is Chapter 0’s toy again, now with a dial you control.

Best-of-n: improve the policy without training it

There is a cheaper route in the single-answer setting. Draw n responses from the current model, score each with the reward model, and return the best. The survey calls it best-of-n sampling or rejection sampling (Nakano et al., 2022; Menick et al., 2022). It needs no policy training, reduces the risk of forgetting, and works as a one-step look-ahead search where the reward model plays the value function. The price is n times the compute at answer time.

How much does it gain? If the reward scores of samples were standard normal numbers, the expected best of n would be 0 for n = 1, 0.56 for n = 2, 1.03 for n = 4, 1.42 for n = 8 and 1.77 for n = 16. Gains keep coming but shrink fast, and a larger n also lets you find more of the reward model’s blind spots.

Exploration and collapse

For language models, Appendix A adds a point about exploration. The world is deterministic (the next state is just the text so far plus your token), so no exploring of physics is needed. But the policy must still explore the space of responses, and that space is huge. The KL penalty helps: it keeps the policy stochastic like the pretrained model. Without it, the model can overfit the reward model and give low-entropy predictions, which the survey calls entropy collapse (Nakano et al., 2022). The survey also notes that the KL term prevents catastrophic forgetting of pretrained knowledge, and that a pretrained model may never produce responses the reward model wants, such as abstaining.

In the KL-regularised objective, what happens as the leash weight β is made very small?

Chapter 7

Language Models as a Special Case

See how a chatbot fits the RLHF template, build its three-step pipeline with shapes, and derive DPO from the KL result

You ask a chatbot a question and it gives two answers side by side. You click the one you like. That click is a pairwise comparison, the very same label as the robot clips of Chapter 2. The survey’s Appendix A explains how this setting fits the general method, and which parts get simpler.

A one-turn game with a single reward at the end

In the survey’s MDP view of a language model, the state is the prompt plus the tokens written so far, and an action is the next token. A token is a piece of text, a word or part of one. The transition is trivial and deterministic: the new state is the old text with the token appended. Reward arrives only at the end, from the reward model, on the whole response. The survey calls it a single-turn interaction with sparse reward.

Because nothing random happens in the world, there is nothing to explore except the space of responses. The survey therefore also offers a second view in Section 6.2: treat the whole response as one action. The problem becomes a contextual preference-based bandit, in the dueling form: the prompt is the context, two responses are the two arms pulled, and a comparison comes back. The MDP view is token by token; the bandit view is response by response. Chan et al. (2024) show how to recover a denser reward even in the bandit view, by using the attention weights of a Transformer reward model to share the final reward over tokens.

The three-step pipeline, with shapes

Appendix A describes the usual recipe. Here it is as a data-flow table. Let Tp be the prompt length, T the response length, V the vocabulary size and d the hidden width of the model.

StageInputOutputWhat learns
Pretrainingtext tokens [T]next-token probabilities [T, V]Self-supervised on a huge corpus. Not aligned with the intended use.
Supervised fine-tuningprompt [Tp] + demo response [T]same model, now chat-shapedBehavioural cloning on a small labelled set. Often not enough alone (Stiennon et al., 2020).
Reward modelprompt + response [Tp + T]one score per response [1]Starts from a pretrained language model; trained with the Chapter 4 loss on comparisons.
RLprompt [Tp]sampled response [T], then a rewardThe policy, with a KL penalty to the pretrained policy (Chapter 6).

Two facts from Appendix A deserve attention. First, the reward model is generally initialised from a pretrained language model, because judging a response needs language understanding that a small preference set cannot teach. It often already contains knowledge of the desired behaviour, which fine-tuning then elicits. Second, the survey says the model likely already has the capability for tasks like being helpful, harmless or honest; fine-tuning elicits it. Producing one scalar from the last token’s hidden state is the usual implementation, not something the survey prescribes.

Why use a reward model at all, instead of training on more demonstrations? The survey cites Ramamurthy et al. (2023): a reward model trained on preferences, then used for policy optimisation, can be much more data-efficient than supervised fine-tuning. It adds that RLHF can teach a model to answer or to refuse according to what it actually knows, which is hard for supervised data, since the right label depends on the model’s own state of knowledge.

Skip the reward model: DPO

The survey’s Section 6.3 describes a way to learn straight from comparisons. Direct Preference Optimisation (DPO; Rafailov et al., 2023) “reparameterizes the reward model as a function of its optimal policy”. We already hold the pieces to see how.

From Chapter 6, the best policy under a KL leash is π*(y) = πref(y) er(y)/β / Z. Take logs and rearrange: r(y) = β log(π*(y) / πref(y)) + β log Z. Now put this into the Bradley-Terry formula from Chapter 3, where only the gap r(yw) − r(yl) matters. The β log Z term is the same for both responses, so it cancels. Replace the optimal policy by the one we train, πθ, and take the negative log-likelihood:

LDPO
The loss over a dataset D of triples: a prompt x, a preferred response yw (winner) and a rejected response yl (loser).
β log [πθ(yw|x) / πref(yw|x)]
How much more likely the trained model makes the winner than the reference does, on a log scale and scaled by β. It plays the role of the winner’s reward.
β log [πθ(yl|x) / πref(yl|x)]
The same for the loser. The loss falls when the winner’s ratio grows and the loser’s shrinks.

This is the survey’s Section 6.3 loss. No reward model and no RL loop are needed: it is a classification loss on log-probabilities of two responses, from the policy and a frozen copy of the reference. Move the dials.

Compute a DPO loss

The two sliders are how much the trained model has raised (positive) or lowered (negative) each response against the reference, as log(πθ / πref). The dot rides the loss curve.

+1.0
+0.5
0.10

The loss is exact: −log σ(β(a − b)) for log-ratios a (preferred) and b (rejected). The update weight is 1 − σ(β(a − b)), the share of the maximum push this example still gets, the same learn-from-surprises rule as Chapter 4. The sliders are set by hand; real training sets them by gradient steps on many pairs.

Play with it. Raise the preferred response and lower the rejected one: the loss falls and so does the push. Make the model prefer the rejected one by mistake: the loss climbs and the push grows toward its maximum. Note that β sets the scale. A small β means the log-ratios must move far before the loss improves, which keeps the policy near the reference, the same leash as before.

The survey lists many DPO variants (SLiC-HF, OPPO, DPPO, PRO, RSO, SRPO). ΨPO (Azar et al., 2024) is a general objective that recovers DPO and SLiC-HF as special cases. And some methods avoid RL and reward models entirely.

Reward model plus RL, or direct?

The survey does not crown a winner. For control, splitting reward learning from policy training is useful because the agent can collect many more samples for policy training than for reward training. For language models that benefit is smaller. But Xu et al. (2024) find that a well-tuned PPO can often outperform direct methods, partly because of distribution shift: direct methods train on a fixed set of answers, while reward-model methods keep sampling fresh ones and score them. The survey also notes that at least some on-policy data helps language model fine-tuning (Ziegler et al., 2020; Dong et al., 2024).

The failure mode in order. The symptom: a DPO-trained model does well on its training pairs and poorly on its own new outputs. The measurement: score the model’s fresh samples with a held-out judge. The fix: add online or on-policy preference data, or use a reward-model method that scores fresh samples.

One more extension from the survey’s Section 9.1: RLAIF, reinforcement learning from AI feedback, replaces the human labeler with a pretrained model (Bai et al., 2022b; Sun et al., 2024). A hybrid called assisted evaluation lets a model help a human, for example by writing critiques of an output (Saunders et al., 2022).

In the DPO loss, why does the normalising constant Z from the optimal policy disappear?

Chapter 8

What the Survey Maps, and Where It Stops

Read the survey’s tables and figures for what they show, collect the evidence it cites, and weigh the limits it admits

You now hold the mechanism. A survey is a map, so a good reader asks three questions of it. What is on the map? What evidence does it rest on? And where does the map end? This chapter answers all three. First, a fact that shapes how to read it: the authors ran no experiments of their own. Every result below is from a paper the survey cites.

What each table and figure shows

ItemWhat it showsWhere we used it
Figure 1The standard RL loop (a) beside RLHF with a reward model (b): a labeler, queries qi and labels li replace the reward the environment used to return.Chapter 1
Table 1Which feedback types belong to PbRL, to semi-supervised RL (SSRL) and to RLHF as the survey defines them. RLHF is the widest; PbRL covers relative feedback such as comparisons and rankings.Chapter 0
Figures 2 to 5The same RLHF diagram, with the component under discussion highlighted: feedback, label collection, reward model training, policy learning.The structure of Chapters 2 to 6
Table 2The common feedback classes and their defining attributes, grouped into primary classes (can learn a reward alone), supplementary classes (used with a primary class) and representation classes (learn features first).Chapter 2
Table 3An overview of query selection strategies used in RLHF approaches.Chapter 5
Tables 4 and 5Theory: approaches to online (Table 4) and offline (Table 5) policy learning, with their assumptions, goals and properties, and the regret and error bounds proved for them.This chapter
Table 6Prior surveys of human-in-the-loop RL and which of the survey’s criteria each one covers.Appendix B of the survey

Browse what is applied

Section 8 gathers applications, tools, benchmarks and datasets. The explorer below lists a sample, with each entry as the survey describes it. Filter by area. Notice how many entries are not chatbots.

Explore the map

Press an area. Each entry says who did it and what the survey says it did.

A selection taken from Sections 8.1 to 8.4 of the survey. The survey itself lists more, and says its coverage of language-model-specific techniques is less exhaustive than its coverage of control and robotics.

The evidence the survey collects

Because the survey has no ablations of its own, the nearest thing is the set of comparisons it reports from cited papers. These are the ones we used, each tied to a chapter. Treat each as one study’s finding, not a law.

FindingStudyChapter
RLHF matched agents trained on the true reward in games and simulated control, with a fraction of the feedback.Christiano et al., 20171, 4
Binary comparisons, even ones extracted from rankings, performed better than rankings.Askell et al., 20212
Estimating the labeler’s rationality coefficient improved reward learning.Ghosal et al., 20233
A reward model trained offline and over-optimised degraded performance.Gao et al., 20234, 6
Iterative reward model improvement beat a reward model trained once, sometimes exceeding human performance.Abramson et al., 20224
A generative model of human feedback performed worse than an inter-temporal Bradley-Terry model.Abramson et al., 20223
Pairwise-comparison reward models are prone to causal confusion: they credit noise for the preference.Tien et al., 20232
People favour assertive answers over factual ones when facts are hard to check.Hosking et al., 20245
A reward model on preference data can be much more data-efficient than supervised fine-tuning.Ramamurthy et al., 20237
A well-tuned PPO often outperformed direct methods such as DPO.Xu et al., 20247

The theory in one paragraph

Section 7 of the survey proves guarantees. Most theory models a comparison with a link function Φ of the utility gap, as in Chapter 3, which makes derivations simple. Its price is that it forces transitivity, so preference cycles cannot occur. A newer line drops that assumption and treats the problem as a game: two policies each propose a run and the goal is a policy that humans prefer to every other, a Nash equilibrium or von Neumann winner (Wang et al., 2023b; Munos et al., 2024; Ye et al., 2024, in a KL-regularised form). Other work compares preference and numerical feedback (Ji et al., 2023c) and shows how to reduce preference-based RL to standard RL (Wang et al., 2023b).

Where the map ends

Section 9.2 of the survey states its own limits, and they bound what you should trust.

The survey closes by calling RLHF “a domain in its infancy with many unanswered questions”. For a builder, the practical reading is a checklist: feedback you can get reliably, a human model that fits your labelers, a reward model you keep checking, a policy on a leash, and a way to see when the score stops meaning what you meant.

Which statement about the survey’s evidence is accurate?

Chapter 9

The Whole Survey on One Page

Keep the numbers, the checklist and the core code, and find the next lessons

RLHF replaces a hand-written reward with a person’s choices. A person compares two behaviours (Chapter 2). A noisy-chooser model, Bradley-Terry with a rationality dial, links the picks to hidden utilities (Chapter 3). A reward model is trained on the picks with a logistic loss (Chapter 4). Questions are chosen with care, because labels are costly and people are not machines (Chapter 5). A policy trains on the learned reward with a KL leash, because the reward is wrong in places (Chapter 6). Language models fit this template, and DPO folds the reward model into the policy (Chapter 7). The survey maps the field and names its limits (Chapter 8).

Numbers and terms to keep

Term or numberMeaningChapter
(S, A, P, R, d0, γ)The six parts of an MDP: states, actions, transitions, reward, start distribution, discount.1
R(τ) = Σ γh R(sh, ah)The return of a run. Three rewards of 1 at γ = 0.9 give 2.71.1
6 attributesArity, involvement, granularity, abstraction, explicitness, intent.2
P(τ1 ≻ τ2) = σ(R1 − R2)Bradley-Terry. A gap of 2 gives 88.1%; a gap of 0 gives 50%.3
β (rationality)The labeler’s sharpness: probability proportional to exp(β · utility). The default is 1.3
L(ψ) = −Σ log σ(Rψ(winner) − Rψ(loser))The reward model loss. A coin-flip model scores 0.693.4
4 ways to check a reward modelRollout, off-policy evaluation, distance functions such as EPIC, and inspection.4
Epistemic vs aleatoricDoubt that data removes, against noise that it does not. Spend labels on the first.5
π* = πref er/β / ZThe best policy under a KL leash of weight β.6
Best-of-n gainFor standard normal scores: 0, 0.56, 1.03, 1.42, 1.77 for n = 1, 2, 4, 8, 16.6
LDPO = −log σ(β(a − b))DPO, with a and b the log-ratios of the preferred and rejected responses.7
2017 to 2024The span of work the survey mainly covers, building on Wirth et al. (2017). PbRL was introduced in 2011.0, 8

A checklist before you build one

  1. Feedback. Pick a type a labeler can give reliably. Comparisons are the usual choice. Write down its six attributes.
  2. Human model. Start with Bradley-Terry. Ask whether your labelers show cycles or a different noise level, and whether you need a β or an error rate.
  3. Reward model. Train with the logistic loss. Hold out comparisons. Check it with at least one method that does not use the training labels.
  4. Questions. Choose queries by epistemic uncertainty, and also by simplicity, diversity and cost.
  5. Labelers. Control framing and order. Watch for fatigue. Check whether the easy-to-judge feature (assertiveness, a camera angle) is driving the labels.
  6. Policy. Keep a KL leash to a trusted reference. Pick β by watching a quantity the policy cannot see.
  7. Online. Refresh the reward model with comparisons on the policy’s own outputs. A frozen reward model gets hacked.
  8. Limits. Write down which tasks your labelers cannot judge, and whose preferences you are encoding.

The core as code

Five small functions hold the survey’s mechanism, each tied to a chapter. They are plain NumPy, our own sketch of the ideas, not code from the survey.

pythonimport numpy as np
sigmoid = lambda x: 1 / (1 + np.exp(-x))

# Ch 3: the human model. P(a beats b) = sigmoid(beta * (u[a] - u[b]))
def ask(u, a, b, beta, rng):
    return rng.random() < sigmoid(beta * (u[a] - u[b]))      # True if a wins

# Ch 4: a reward model, one score per item, trained on the Bradley-Terry loss
def fit_reward(n_items, comparisons, steps=300, lr=1.2, l2=0.01):
    r = np.zeros(n_items)
    for _ in range(steps):
        g = np.zeros(n_items)
        for w, l in comparisons:                           # w beat l
            p = sigmoid(r[w] - r[l])                       # model's chance that w wins
            g[w] -= (1 - p) / len(comparisons)               # surprise sets the push
            g[l] += (1 - p) / len(comparisons)
        r -= lr * (g + l2 * r)
    return r - r.mean()                                  # scores are only defined up to a shift

# Ch 6: the best policy under a KL leash of weight beta_kl
def tilted_policy(pi_ref, r_hat, beta_kl):
    logits = np.log(pi_ref) + r_hat / beta_kl
    p = np.exp(logits - logits.max())
    return p / p.sum()

# Ch 6: best-of-n, a policy gain with no training
def best_of_n(sample_fn, score_fn, n):
    return max((sample_fn() for _ in range(n)), key=score_fn)

# Ch 7: DPO loss for one pair; log-probs under the trained policy and the frozen reference
def dpo_loss(logp_w, logp_l, ref_w, ref_l, beta=0.1):
    margin = beta * ((logp_w - ref_w) - (logp_l - ref_l))
    return np.log1p(np.exp(-margin))                     # -log sigmoid(margin)

Where it sits, and where to go next

This survey is the broad map. It sits between three neighbours. Underneath is plain RL, which you can learn in our MDP lesson and policy gradients lesson. Beside it is reward learning from human choices, treated in our reward learning lesson and the bandits and preference learning lesson. Above it is the language-model recipe: SFT and RLHF, RLHF and DPO and DPO and alignment. For the multimodal angle, read Lecture 7 on alignment, our reward alignment lesson, and the lecture this paper belongs to, Lecture 13 on multimodal interaction.

The takeaway. RLHF is a loop with a person inside it. The person’s picks become a reward model through a noisy-chooser model and a logistic loss. A policy trains on that reward with a leash. Every stage can be wrong, and the survey’s advice is the same at each: keep the human close, check the score against something it cannot see, and know which judgements people cannot make.

Credit

All the ideas, tables and cited results here belong to the survey’s authors: Timo Kaufmann (LMU Munich), Paul Weng (Duke Kunshan University), Viktor Bengs (DFKI) and Eyke Hüllermeier (LMU Munich and DFKI). The paper is arXiv 2312.14925. This lesson re-teaches it with our own devices and examples. The toys, the numbers in the devices and the code are ours and are labelled as such.

Your policy’s reward-model score keeps rising, but your held-out human check says the answers are getting worse. Which step from the checklist do you reach for first?

Now press Present or Teach and explain one full turn of RLHF out loud, from memory: what a person is asked, how the picks become a score, how a policy is trained on that score, and why a leash is needed. Then go back to the robot at the top, make six picks that favour speed and six that favour care, and explain why the policy changes the way it does.

A Survey of Reinforcement Learning from Human Feedback
Read the paper (arXiv 2312.14925) · Lecture 13: Multimodal Interaction · Back to Gleams