Self-Rewarding Language Models

A language model writes answers, scores them itself, and trains on its own scores. Three models in a row, M1 to M3, took Llama 2 70B from a 9.94% win rate to 20.44% against GPT-4 Turbo.

Learn how one model can be the student, the teacher and the exam marker at once, why that can work, and what the paper does and does not prove.

Press M2 and then M3. Watch the model write better answers and, at the same time, judge answers more like a human does. Then we build, piece by piece, the judge prompt, the self-made training data, the DPO loss and the loop that ties them together.

You need a feel for what a language model does (it reads text and writes the next words) and a little Python for the code. We teach the rest from zero.

Paper: Self-Rewarding Language Models by Weizhe Yuan, Richard Yuanzhe Pang, Kyunghyun Cho, Xian Li, Sainbayar Sukhbaatar, Jing Xu and Jason Weston (Meta and NYU), arXiv 2401.10020. It is a reading for MIT MAS.S62 AI4AI; the lecture it belongs to is Model Evolution. All ideas here are re-taught in our own words and devices.

Turn the loop

All numbers are the paper’s: win rates are AlpacaEval 2.0 against GPT-4 Turbo judged by GPT-4 (Table 1); agreement is pairwise accuracy against human rankings on a held-out set (Table 4); the SFT baseline mark is 65.1%. The shaded band spans GPT-4 0613 (15.76%), Gemini Pro (16.85%) and Claude 2 (17.19%); the tick is GPT-4 0314 (22.07%). Pair counts are from Section 3.1.3.

Chapter 0

Why a Model Should Grade Itself

See how human labels and a frozen judge cap a model, and meet a judge that improves with the model

Picture a writing teacher with thirty essays to mark tonight. She reads each one, picks the better of two drafts, and hands the pile back. Her students improve. After a year the best of them write essays she can still mark, but only just. After two years the best essays are better than anything she could write herself. Her marks have stopped telling the students what “better” means.

Training a chatbot looks a lot like this. A raw language model can finish any sentence, but it does not reliably answer a request. To make it useful, builders show it good answers and then teach it which of two answers people prefer. The teacher is a pile of human labels. The paper asks what happens when the student outgrows the teacher, or when the teacher is simply too slow and too costly.

The usual recipe, in plain words

Instruction following means a model does what a request asks: “summarise this”, “write a poem about rain”. Alignment means shaping the model toward answers that people judge helpful and safe. The standard tool is human feedback: people read two answers to the same request and mark the better one.

A number is easier to train on than a mark. So the usual recipe, RLHF (reinforcement learning from human feedback), trains a second model, the reward model, to turn any answer into a score that matches what people would say. Then it freezes the reward model, which means its weights never change again, and uses its scores to steer the chatbot. Chapter 1 builds this slowly. For now, hold on to one picture: a chatbot on one side, a fixed marking machine on the other.

Two bottlenecks the paper names

The abstract states the problem in two parts. First, the reward model learns from human preferences, so it is “bottlenecked by human performance level”. If you want a model better than people at some task, human marks are a weak signal for it. Second, the reward model is frozen. It cannot get better while the chatbot gets better.

The authors argue that both limits come from one design choice: using two separate models. Their answer is to use one. The chatbot also does the marking. Because the same weights do both jobs, any gain in one job can spill into the other. The paper calls this a Self-Rewarding Language Model.

What the paper actually does

Start from a Llama 2 70B model (70 billion weights) and a small human seed set. Each round, the model invents new requests, writes four answers to each, scores its own answers, and keeps the best and worst of each four as a training pair. It then trains on those pairs and repeats with the improved model. The paper runs three models in a row, called M1, M2 and M3.

The headline numbers are the ones in the hero. On AlpacaEval 2.0, a leaderboard where a judge compares your answers with GPT-4 Turbo’s, the win rate climbs from 9.94% to 15.38% to 20.44%. The third model beats Claude 2 (17.19%), Gemini Pro (16.85%) and GPT-4 0613 (15.76%) on that table. The judging skill also rises: agreement with human rankings goes from 78.7% to 80.4% to 81.7%.

Hold both facts together. The model got better at writing and better at marking, and nobody supplied extra marking data after the seed set. That second fact is the surprising one, and most of this lesson explains why it is plausible and where it can break.

Feel the difference between a frozen and a living judge

The device below compares two worlds. In the first, the judge that creates each round’s training data is frozen at the quality of M1. In the second, each model judges its own work, as in the paper. The bars show how often each judge agrees with human rankings.

Freeze the judge, or let it learn

Each bar is the judge that makes the training data for the next round. Choose a world, then drag the round to see how far the judge has moved from where it began.

3

The self-rewarding bars are the paper’s pairwise accuracy against human rankings (Table 4): M1 78.7%, M2 80.4%, M3 81.7%, and the SFT baseline mark at 65.1%. The frozen bars are illustrative: they hold M1’s 78.7% fixed by construction. The paper did not run a frozen-judge version of this experiment.

Look at the gap. It is small: 3.0 percentage points by round 3. The paper does not claim a huge jump in judging skill. It claims a steady one, and that a steadier judge produces better pairs, which produce a better writer, which in turn gives a better judge.

The road

This paper is one of the readings for the lecture on model evolution, Model Evolution. The lecture asks how a system can change its own model. Here the model is changed by training, and the model itself supplies the reward. The chapters follow the method in the order the data flows.

  1. Preferences, reward models and DPO: the usual recipe and the part that stays frozen.
  2. One model, two jobs: the human seed data that builds M1.
  3. The judge prompt: how a writer becomes a scorer.
  4. Making training data from the model alone: prompts, four answers, three judgements, one pair.
  5. Training on pairs with DPO: the loss, derived.
  6. The loop: M1, M2, M3: how the rounds chain.
  7. What the tables show: every main table and figure.
  8. Ablations and reasons to doubt: what the paper tested and what it left open.
  9. Field guide: numbers, checklist, code and next steps.
The paper names two limits of the standard recipe. Which pair is right?

Chapter 1

Preferences, Reward Models and DPO

Learn how models are normally aligned, and find the one part of that pipeline that never changes

You ask a chatbot: “Why is the sky blue? Answer in two sentences.” It gives you two different drafts. One is two clean sentences. The other is a long ramble that never says the word “scattering”. You do not need a rulebook to see which is better. You just pick.

That pick is the raw material of alignment. Every method in this paper, and every method it argues against, starts from the same small unit: a request and two answers, with one marked as better. This chapter builds that unit, the two classic ways to learn from it, and the one place where this paper changes the plan.

The preference pair

A prompt is the request, written x. An answer (the paper says response) is the text the model writes back, written y. A preference pair is a triple: the prompt x, a winning answer yw and a losing answer yl. In code it is three strings. Nothing more.

Why pairs and not scores? People are bad at saying “this answer is a 7.3”. They are good at saying “this one is better than that one”. A pair also keeps working when the model improves, because you can always compare two new answers.

How likely is an answer?

A language model gives every possible answer a probability. It builds the answer one token at a time (a token is a word or a piece of a word). At each step it gives the next token a probability, and the answer’s probability is the product of those steps. Write it π(y | x): the probability that the model π writes answer y when given prompt x.

Products of many small numbers get tiny, so everyone works with logarithms (the exponent that gives the number). A log turns a product into a sum. A three-token answer with step probabilities 0.5, 0.2 and 0.1 has probability 0.5 × 0.2 × 0.1 = 0.01, so its log-probability is ln 0.5 + ln 0.2 + ln 0.1 = −0.693 − 1.609 − 2.303 = −4.605. Training changes the weights so that good answers get a higher log-probability. Chapter 5 uses this idea directly.

Way one: a reward model, then reinforcement learning

The first classic method is RLHF. It works in two stages. Stage one trains a reward model: a network that reads a prompt and an answer and outputs one number, the score. It is trained so that, on each human pair, the winner scores above the loser. Stage two freezes the reward model and uses reinforcement learning (learning by trial and reward) to push the chatbot toward answers that score high. The usual algorithm is PPO, proximal policy optimisation, which makes small, safe updates.

The paper stresses two things about this setup. The reward model is distilled from human data, so a human ceiling sits above it. And it is frozen, so it learns nothing new while the chatbot changes. If the chatbot finds answers that fool the frozen scorer, nothing corrects the scorer. That worry returns in Chapter 8 as reward hacking.

Way two: skip the reward model

DPO, direct preference optimization (Rafailov et al., 2023), drops stage one. It trains the chatbot on the human pairs directly. The loss makes the winner more likely and the loser less likely, measured against a copy of the model from before training. Chapter 5 derives it. The paper uses DPO as its training step, so you will meet its formula twice.

DPO removes the separate scorer, but not the human bottleneck. The pairs still come from people. In the paper’s words, both RLHF and DPO are “bottlenecked by the size and quality of the human preference data”.

Where AI feedback fits

Using a model to give feedback is older than this paper. The related-work section lists three neighbours. Constitutional AI (Bai et al., 2022b) asks a model for feedback and trains a reward model on it, which is then fixed. Lee et al. (2023) compare AI feedback with human feedback and find the two roughly equal, again with a fixed scorer. Pairwise Cringe Optimization (Xu et al., 2023) trains in rounds, as this paper does, but with a fixed reward model.

So each neighbour shares one trait with this paper and differs in the other. Self-Rewarding Language Models take the iteration and the AI feedback, and then remove the fixed scorer. The model that writes is the model that scores, and its weights change every round.

One more neighbour is worth naming: SPIN (Chen et al., 2024b). It trains with human answers as winners and the model’s own last-round answers as losers. It needs a human answer for every prompt, and it stalls once the model matches the human level. The paper contrasts this with its own need for no extra human answers after the seed set.

Compare who does the judging

Each box is a part of the system. Pink is human, warm is the model that learns, dashed grey is a part that never changes. Choose a method and read what is frozen.

A simplified sketch of Section 1 and Section 4 of the paper. RLHF is shown with PPO, as the paper describes it; the self-rewarding box shows one set of weights playing two roles.

Notice what the third picture changes. Only one thing moves: the grey dashed box disappears, and the human box shrinks to a seed. Everything else you already know. That is why the rest of the lesson can stay close to ordinary instruction tuning and DPO.

In standard RLHF, which part stays fixed while the chatbot is trained with PPO?

Chapter 2

One Model, Two Jobs

Build the starting model M1 from human answers and human-ranked judging examples

Think of an apprentice chef. She learns to cook from a cookbook of 3,200 recipes. Then her teacher adds a second lesson: taste a dish, write two lines on what is right or wrong, and give it a mark out of five. Cooking and tasting are different skills. Chefs who can do both get better faster, because tasting sharpens what they cook.

The paper builds its starting model the same way. It teaches a pretrained model two skills at once, using two small human-made seed sets. This chapter shows what each set contains, how the second one is made, and why the result, called M1, is the starting line for everything else.

Job one: follow instructions

The base model, M0, is Llama 2 70B straight out of pretraining. It predicts text well, but it does not reliably answer requests. The first fix is supervised fine-tuning (SFT): show the model many pairs of (request, good answer) and train it to write the good answer. The loss counts only the answer tokens, not the request, so the model learns what to write and not what to ask.

The paper calls this data IFT, instruction fine-tuning data. It comes from the human-written Open Assistant dataset. Following earlier work, the authors keep 3,200 examples: first turns only, English only, and only the answer that humans ranked best (rank 0). A model trained on these alone is the paper’s SFT baseline. Training uses a learning rate of 5.5e−6 that decays to 1.1e−6, batch size 16 and dropout 0.1.

Job two: judge answers

The second seed set is called EFT, evaluation fine-tuning data. An EFT example looks like this. The input is the judge prompt of Chapter 3, filled in with a request and one answer. The target is a short written justification followed by a score out of 5. The model learns to read an answer and grade it.

Open Assistant gives many ranked human answers per prompt (2.85 on average), but no written justifications or scores. So the authors make the targets with the SFT baseline. They ask it to grade each answer and keep the output only if the ranking of its scores agrees with the human ranking. This is a filter with a human anchor: the model writes the explanation, and people decide which explanations are trustworthy by their order.

There is one more repair. The SFT baseline likes the score 4, so the surviving data would be lopsided. The authors throw away some of the most common score. The result is 1,630 training examples and 541 evaluation examples, with no overlap with the IFT data.

The acceptance test, by hand

Take one prompt with three human answers, ranked best to worst: A, B, C. The SFT baseline grades each. Say it gives A a 5, B a 4 and C a 2. The score order matches the human order, so the example is kept. Say instead it gives A a 4, B a 4 and C a 2. Now A and B tie, so the scores do not reproduce the human order. In the toy rule below, that example is dropped.

The paper says only that the score ranking must “agree” with the human ranking. It does not say how it treats ties. The device uses the strict reading, where every step down in human rank must be a step down in score, so you can see how demanding the test is.

Pass the ranking test

Humans ranked answer A best, B second and C worst. Set the three scores the judge gave. The example is kept only if the scores fall as the human ranks fall.

5
4
2

Toy rule, labelled as such: strict agreement, so ties fail. Under it, 10 of the 125 possible score triples pass. The paper does not state its treatment of ties. The seed numbers (3,200; 1,630; 541; 2.85 answers per prompt) are the paper’s, from Section 3.1.1.

The counts make the point. A grader that scored at random would pass this strict test about 8% of the time (10 of 125). So the filter keeps judgements that carry real signal about human taste, and it discards the rest.

What the training example looks like

Here is the data flow, with shapes. An IFT example is a pair of token lists: prompt[Lp] → answer[La]. An EFT example is longer on the input side: rubric + prompt + answer [Lr+Lp+La] → justification + score [about 100 words + 1 digit]. Both are plain text in, plain text out. Both are trained with the same next-token loss. The model does not know it has two jobs; it sees two kinds of requests.

ONE EFT TRAINING EXAMPLE (illustrative wording; format from the paper) INPUT Review the user’s question and the response using the additive 5-point scoring system ... User: Why is the sky blue? <response> Sunlight scatters off air molecules, and blue light scatters most. </response> TARGET The response is relevant and gives a correct core reason, but it is brief and skips why violet is not seen. Score: 3

Why train the judging job at all?

The paper notes that EFT is “not strictly necessary”: a model trained on IFT alone already has some judging ability, since judging is just another instruction. But EFT helps a great deal. Agreement with human rankings rises from 65.1% to 78.7% when EFT is added (Table 4). Chapter 7 shows the full table.

Adding the judging job also does not hurt the writing job. In a head-to-head test judged by GPT-4, the model trained on IFT plus EFT wins 30.5% of prompts and the IFT-only model wins 30.9%. That is an even match. The paper reads this as good news: the ability to self-reward does not cost the model its other skills. The IFT plus EFT model is called M1, and it is the seed model of the loop.

How are the targets for the EFT (judging) seed data made, and which ones are kept?

Chapter 3

The Judge Prompt

Turn a model into a scorer with a five-point additive rubric, and see why the wording matters so much

A teacher has two ways to mark an essay. In the first, she reads it and picks one of five boxes: “poor”, “weak”, “fair”, “good”, “excellent”. In the second, she walks down a checklist and gives one point each time the essay clears a bar: on topic, covers most of the question, answers the basics, well organised, expert. The second way is slower and also steadier. Two teachers using it will often agree, because each step is a small question.

The judge prompt in the paper is the second kind. This chapter reads it line by line, shows how a score is parsed, and then looks at the single most striking number in the ablations: the same model, trained on the same data, agrees with humans 65.1% of the time with this prompt and only 26.6% with a multiple-choice one.

The additive rubric

The prompt (Figure 2 of the paper) tells the model to review a question and its response with an additive 5-point system. Additive means the points pile up. Each criterion adds one point if the response satisfies it. The five criteria, in order, are:

  1. Relevance. One point if the response is relevant and gives some information about the request, even if incomplete.
  2. Coverage. Another point if it addresses a substantial part of the question but does not fully resolve it.
  3. Usefulness. A third point if it answers the basic elements of the question in a useful way.
  4. Clarity. A fourth point if it is clearly written from an AI assistant’s perspective, direct, comprehensive and well organised.
  5. Expertise. A fifth point if it is tailored to the question, has no extra content, shows expert knowledge and is insightful.

After the rubric, the prompt shows the user’s request and the response inside tags. Then it gives two orders: briefly justify the total score in up to 100 words, and finish with the exact line “Score: <total points>”. The reply is therefore a short piece of reasoning followed by one parseable line.

Writing the reasoning before the score matters. A model that reasons first has already looked at each criterion by the time it writes the number. This is the same chain-of-thought idea used for maths: think in text, then answer.

One judge call, as code

The data flow is short. Input: one string made by pasting the request and the response into the template. Output: a string of about 100 words ending with a score. A small function pulls the score out.

THE CALL (sketch; the template text is the paper’s Figure 2) prompt = RUBRIC.format(instruction=x, response=y) # one string reply = model.generate(prompt, T=0.7, top_p=0.9) # ~100 words + a last line score = int(re.search(r"Score:\s*([0-5])", reply).group(1))

The sampling settings are the paper’s: temperature 0.7 and top-p 0.9. Because sampling is random, one judgement is noisy. So the paper asks for three judgements and averages them, which Chapter 4 does by hand. If the line “Score:” is missing, the judgement is unusable and the example is skipped.

Tick the criteria yourself

Below, a pretend response is graded by the rubric. You decide which criteria the response clears. The score is simply how many you tick, in order. The bars underneath show the paper’s result for the two prompt styles.

Build a score, one point at a time

Tick each bar the response clears. The staircase shows the running total. The two bars below compare the additive prompt with a multiple-choice prompt on the same trained model.

The staircase is a teaching device: in the paper a model, not a person, decides which criteria a response clears. The two accuracy bars are the paper’s Table 5: 65.1% for the additive prompt and 26.6% for the multiple-choice prompt of Li et al. (2024), both on the model trained on 3,200 IFT examples alone.

Reading the judge’s report card

The paper scores a judge by how well its marks match human rankings on a held-out set of 541 examples, with 2.85 ranked answers per prompt on average. It reports five numbers:

MetricWhat it countsAdditive promptMultiple choice
Pairwise accuracyFor every pair of answers to one prompt, does the judge order them like the humans?65.1%26.6%
5-best %How often an answer the judge scores a perfect 5 is also the humans’ top answer.39.6%23.5%
Exact match %How often the judge’s whole ordering of a prompt’s answers equals the humans’.10.1%1.1%
Spearman correlationAgreement of the two rank orders, from −1 (reverse) to 1 (same).0.25−0.18
Kendall τLike Spearman, but built from pair agreements.0.23−0.16

Look at the last two rows of the multiple-choice column. They are negative. That prompt did not merely judge poorly: it matched the human order on only about a quarter of pairs, and its rank correlations point the wrong way. The paper explains it plainly: the model had to treat the task as multiple choice, and found it hard to split that into sub-problems about different aspects of quality.

Failure mode: a judge with no taste

Here is the symptom. A model trained on IFT data only is asked to judge its own answers. It often ignores the output format, and when it does give scores they pile up on 4. The measurement is in Appendix A.3: from the same number of prompts, the IFT-only run could keep just 541 pairs for round one, against 3,964 for the full method. The fix is the EFT seed data of Chapter 2, which teaches both the format and a wider use of the scale.

Why does the paper ask the judge for a written justification before the final “Score:” line?

Chapter 4

Making Training Data From the Model Alone

Follow one prompt through four answers, three judgements each and one preference pair

Imagine a debate coach with no new topics and no new judges. She asks her own team to invent fresh topics, has each student argue four different ways, then has the team score the arguments three times each. At the end she keeps the clearest win and the clearest loss from each topic, and drills the team on the gap between them. The team only ever uses its own voices, yet the drill still teaches a lesson.

That is the data engine of the paper, called self-instruction creation. It has three steps: make a new prompt, write candidate answers, and judge them. This chapter follows one prompt through all three, with the real settings, and then lets you see why judging three times is safer than judging once.

Step 1: make a new prompt

The model needs requests it has not seen. The paper makes them with few-shot prompting: show a model a handful of example requests and ask it to write another. For each new prompt, eight examples are shown: six drawn from the human IFT data and two from earlier generated prompts. The settings are temperature 0.6 and top-p 0.9. This follows Self-Instruct (Wang et al., 2023), including its filters: a ROUGE-L similarity check against existing prompts, a keyword filter and a length filter.

One detail is easy to miss. The prompt maker is not the model being trained. In the main experiments it is a fixed model, Llama 2-Chat 70B. A footnote says so, and Appendix A.5 tests the alternative: the newly trained models can also write prompts in all 30 cases checked by hand, though M2 and M3 sometimes write a few instructions, then a separator, and then start answering them, which needs cleanup.

Step 2: write four answers

For each prompt x, the model being trained writes N = 4 candidate answers, by sampling at temperature 0.7 and top-p 0.9. Sampling means the model draws the next token at random from its probabilities instead of always taking the top one. That makes the four answers differ, which is the point: a comparison needs variety.

Step 3: judge, three times each

The same model grades each of its four answers with the Chapter 3 prompt. Judging is sampled too, so a single score is noisy. The paper therefore judges each answer three times and averages. That is 4 × 3 = 12 judge calls per prompt. The averaged score for answer n is written rin and lies between 0 and 5.

Step 4: keep one pair

From the four averaged scores, take the highest and the lowest. The answer with the highest score is the winner yiw. The lowest is the loser yil. If their scores are equal, the prompt is thrown away, because a pair with no gap teaches nothing. Otherwise the triple (xi, yiw, yil) joins the training set, called AIFT, AI feedback training data.

Here is one prompt, worked by hand. These numbers are illustrative.

AnswerThree judge scoresAverageRole
y14, 4, 54.33kept out
y23, 3, 43.33kept out
y35, 4, 54.67winner
y42, 3, 22.33loser

The pair kept is (x, y3, y4), with a gap of 2.33 points. Note what is discarded: y1 and y2, even though y1 is nearly as good as y3. Using only the extremes gives the cleanest contrast. Appendix A.4 also shows what happens if you keep only the top-scoring answers and fine-tune on them: nothing improves. The loser carries real information.

The data flow, with shapes

ONE ROUND OF DATA CREATION prompts list of strings [n_prompts] candidates 4 sampled answers per prompt [n_prompts, 4] judgements 3 sampled judge replies per answer [n_prompts, 4, 3] scores mean of the 3 parsed scores [n_prompts, 4] pairs (x, y_best, y_worst), ties dropped [n_pairs] with n_pairs ≤ n_prompts

The paper reports the final sizes: 3,964 pairs form AIFT(M1), used to train M2, and 6,942 pairs form AIFT(M2), used to train M3. The text does not state how many prompts went in, so we do not know what fraction survived the filters and the tie rule.

Why average three judgements?

A judge that samples is a noisy instrument. If it can mistake a good answer for a great one on one draw, the winner of a single round may be the wrong answer, and a wrong winner trains the model toward worse behaviour. Averaging cuts the noise. The device below lets you test this. Four hidden answers have fixed true quality; the judge reports each quality plus noise, rounded to a whole score from 0 to 5.

Judge four answers, then pick the pair

Each dot is one judgement. The tick is the average. Green ring is the winner, red ring the loser. Raise the noise, change how many times each answer is judged, then press Judge again.

0.8
3

Illustrative: hidden qualities 4.4, 3.4, 4.7 and 2.3 (answer 3 is truly best, answer 4 truly worst); noise is Gaussian, scores are rounded and kept between 0 and 5. The paper uses 4 answers and 3 judgements. The percentage in the read-out comes from 400 fresh simulated prompts run in your browser each time you change a knob.

Try noise 1.2 with one judgement, then three, then five. With one judgement the chosen winner is often not the best answer. With five it is right far more often. The paper chose three as a cost balance: each extra judgement is another full model call for each of four answers.

For one prompt, the four averaged scores are 3.0, 3.0, 3.0 and 3.0. What does the paper’s procedure do?

Chapter 5

Training on Pairs With DPO

Derive the loss that pulls a model toward the winner and away from the loser

You are coaching a runner. You cannot tell her the perfect stride, but you can show her two videos of her own runs and say: “this one was better than that one”. She adjusts. She tries to move toward the good run and away from the bad one. She also keeps her old style in mind, so she does not change so much that she forgets how to run.

DPO, direct preference optimization, trains a language model the same way. It takes a pair of answers and nudges the model toward the winner and away from the loser, while tying it to where it started. This chapter derives the loss in four short moves, works one number through it, and shows the knob that controls how hard it pulls.

Move 1: two copies of the model

DPO keeps two models. The policy πθ is the model being trained; its weights θ change. The reference πref is a frozen copy of the model at the start of the round. For the step from M1 to M2, the standard choice is M1 itself. (The paper says it uses DPO as published and gives its hyperparameters, but does not restate this detail.)

Both models can score any answer. Chapter 1 showed how: the log-probability of an answer is the sum of its token log-probabilities. For a pair, that gives four numbers: the policy and the reference, each on the winner and on the loser.

Move 2: how far has each answer moved?

Define the log-ratio of an answer as how much more likely the policy finds it than the reference does. For the winner it is a = log πθ(yw|x) − log πref(yw|x). For the loser it is b likewise. At the start of training the two models are equal, so a = b = 0. Training should push a up and b down.

Move 3: turn the gap into a probability

Compare the two log-ratios. Their gap, a − b, says how much more the policy has moved toward the winner than toward the loser. Scale it by a constant β and push it through the sigmoid function σ(z) = 1 / (1 + e−z), which squeezes any number into the range 0 to 1. The result is read as the model’s own probability that the winner really is better.

L
The loss for one pair. Training lowers it, averaged over many pairs.
σ
The sigmoid. A margin of 0 gives 0.5, a large positive margin gives nearly 1, a large negative margin gives nearly 0.
β
A fixed constant that sets how sharply the gap is turned into confidence. The paper uses 0.1.
a
The winner’s log-ratio: how much more likely the policy finds the winner than the reference does.
b
The loser’s log-ratio, defined the same way. Training wants it to fall.
πθ
The policy, the model whose weights are trained.
πref
The frozen reference, a copy of the model before this round.

Move 4: minus the log

If the model assigns probability p to the right answer, the usual training loss is −log p. It is zero when p = 1 and grows without limit as p falls. Applying it here gives the formula above. This is the DPO loss from Rafailov et al. (2023), which the paper uses unchanged. It has the same shape as the loss used to train a reward model on human pairs. The difference is that the “reward” is now β times a log-ratio, so the language model plays its own reward model.

One pair, worked by hand

Start with both log-ratios at 0. The margin β(a − b) is 0. The sigmoid is 0.5. The loss is −ln 0.5 = 0.693. Now suppose some training raises the winner by 2.0 and lowers the loser by 3.0, so a = 2, b = −3. With β = 0.1 the margin is 0.1 × 5 = 0.5. The sigmoid of 0.5 is 0.6225, so the loss is −ln 0.6225 = 0.474. The loss fell, which is what we want.

The size of each update is also worth knowing. The gradient of the loss with respect to the margin is −(1 − σ(margin)). At margin 0 that weight is 0.5. At margin 0.5 it is 0.378. At margin 5 it is 0.007. So pairs the model already ranks correctly get a small push, and pairs it ranks wrongly get a strong one. Try it below.

Push the pair apart

The warm curve is the loss. The purple curve is how hard the update pushes. The dot is your pair. Raise the winner, lower the loser, and watch the dot slide toward zero loss.

0
0
0.10

The formula is DPO’s (Rafailov et al., 2023); the paper uses it with β = 0.1. The log-ratio values are toy numbers chosen to span a realistic range; real log-ratios depend on the answers’ lengths and the model.

Drag a to 20 and b to −20 with β at 0.1: the margin is 4.0 and the loss is 0.018. Now swap them, a = −20 and b = 20: the margin is −4.0 and the loss jumps to 4.018. The same pair, seen from the wrong side, has about 220 times the loss.

What β does

Beta sets the leash to the reference. A small β makes the margin small, so the model must move a long way in log-probability to get a confident result. A large β makes the margin large for a small move, so training can stop early. The paper uses β = 0.1 and does not report trying other values.

Training details from the paper

DPO runs with a learning rate of 1e−6 that decays to 1e−7, batch size 16 and dropout 0.1. The authors save a checkpoint every 200 steps and pick the one whose generations win most against the previous checkpoint. The judge for this early stopping is Claude 2, on 253 validation prompts, using the AlpacaEval comparison prompt. The core step is eight lines of code:

# logp_* are [B] tensors: sum of token log-probs over the ANSWER tokens only
def dpo_loss(logp_w, logp_l, ref_w, ref_l, beta=0.1):
    a = logp_w - ref_w                       # winner log-ratio  [B]
    b = logp_l - ref_l                       # loser log-ratio   [B]
    margin = beta * (a - b)                  # [B]
    return -torch.nn.functional.logsigmoid(margin).mean()
With β = 0.1, a pair has log-ratios a = 10 and b = −10. What are the margin and the direction of training?

Chapter 6

The Loop: M1, M2, M3

Chain the rounds so that each model makes the data for the next one

A potter makes a batch of bowls, lines them up, and picks the best and the worst. She studies the gap, then makes a new batch with better hands. Her next batch is different from the first, because she is different. If she kept studying the first batch forever, she would learn only what that batch could teach.

Iteration is the same idea applied to the data. Each round, the model that exists now writes and judges a fresh set of answers. The paper chains three models this way. This chapter lays out the chain, what each link is trained on, and why each round uses data from the latest model and not from the first one.

The model sequence

The paper defines four models. Read them as a relay, where each runner passes a baton of data to the next.

  1. M0 is the base pretrained Llama 2 70B. It has had no instruction training.
  2. M1 starts from M0 and is fine-tuned with SFT on the seed IFT and EFT data of Chapter 2.
  3. M2 starts from M1 and is trained with DPO on AIFT(M1): preference pairs that M1 wrote and judged. That is 3,964 pairs.
  4. M3 starts from M2 and is trained with DPO on AIFT(M2): pairs that M2 wrote and judged. That is 6,942 pairs.

The notation AIFT(Mt) means “AI feedback training data created by model Mt”. The subscript is the whole story. The model that makes the data is always the one just before the model that learns from it. The paper calls this procedure Iterative DPO. It was introduced by Xu et al. (2023) with a fixed external reward model; here the judge is the model itself.

Why not make all the data once?

Suppose M1 wrote and judged ten thousand pairs in one go, and you trained once. You would get a model that fixes M1’s visible mistakes. But M2 makes different mistakes, and a judge trained on M1’s world would not have seen them. By making fresh data from M2, the loop meets the new model’s own weak spots. Researchers call this on-policy data: data made by the model you are currently training.

There is a second reason, and it is the paper’s main bet. The judge is the same weights as the writer. When the writer improves, the judge may improve too, so the next round’s labels are better than the last round’s. Chapter 7 checks that with Table 4: pairwise accuracy rises with each model.

Cheap compared with online RL

Each round has a clean split: first create all the data, then train. The model is not asked to judge inside the training loop. The paper’s related-work section makes this contrast with Lee et al. (2023), who used a separate AI judge directly inside PPO and found it computationally costly. Here the judging is an offline step, run once per round.

The cost still adds up. One round needs, per prompt, 1 prompt generation, 4 answer generations and 12 judge generations, and then a DPO run. The paper does not report GPU hours, so we cannot give a total.

Walk the chain

The device below steps through the relay. Pick a model to see what it starts from, what it is trained on, and where its data goes next. A small packet slides along the arrow from one model to the next.

Walk the relay

Choose a model. The chain highlights it, and the packet shows the data it hands on. Below the chain is what it was trained on.

From Section 2.4 and Section 3.1.3 of the paper. The pair counts (3,964 and 6,942) are the paper’s. The paper stops at M3 after two rounds of DPO, so M3 hands its data to no one in these experiments.

Early stopping inside each round

Within one DPO run, training does not run to the end blindly. Every 200 steps the authors save a checkpoint and compare its generations with the previous step’s, using Claude 2 as the judge on 253 validation prompts. They keep the best one. That outside judge is only a stopping rule; it is not the reward in the loop. The reward still comes from the model alone.

A note on the prompts

Chapter 4 said the prompt maker is a fixed model. That means the loop only partly closes in the main experiments. The writing and the judging are self-contained, while the stream of new requests comes from outside. In a real product, the paper suggests, the requests would come from users.

How far can the relay run?

The paper stops at M3 and says so plainly: it ran three iterations in one setting, with one base model, and it calls understanding the limits of more rounds an open question. It also expects the gain to level off in real settings. Our reading, not a claim of the paper: a relay like this may not run forever on its own judgement, because a judge may only be able to teach what it can already recognise.

Which statement about M3 is correct?

Chapter 7

What the Tables Show

Read each main table and figure for what it proves, and for what it leaves open

A cook says her new recipe is better. Who decides? A friend who tastes both blind? A panel of food critics? The restaurant guide that ranks every kitchen in town? Each judge answers a slightly different question. A good paper uses several, and tells you which question each one answers.

This chapter reads every main table and figure of the paper in that spirit. For each one: what was measured, who or what judged, and what the numbers do and do not show. First the yardsticks, because the results only make sense once you know them.

The yardsticks

Head-to-head. Two models answer the same 256 test prompts. GPT-4 reads both answers and picks the better one, in both orders; if the two readings disagree, the result counts as a tie. AlpacaEval 2.0 is a public leaderboard: 805 prompts, and the score is the share of prompts where GPT-4 prefers your answer to GPT-4 Turbo’s. MT-Bench is a set of multi-turn questions graded out of 10 by GPT-4. And nine ordinary NLP benchmarks check that old skills survive.

The second axis is judging skill: the five reward-modelling metrics of Chapter 3, measured against held-out human rankings.

Figure 3: does each round beat the last?

Yes, in order. Against the SFT baseline, M1 wins 30.5% and loses 30.9%: a tie, as Chapter 2 said. M2 wins 49.2% and loses 14.5%. M3 wins 62.5% and loses 9.8%. Directly against each other, M2 beats M1 by 55.5% to 11.7%, and M3 beats M2 by 47.7% to 12.5%. Every step up the chain gives a clear win.

A human check supports this. The authors judged 50 instructions in blind pairs, with three annotators per pair and a majority vote. Later iterations showed a larger edge over the SFT baseline, in line with GPT-4. Note that the annotators were the authors, which limits how much weight the check can carry.

Table 1: the leaderboard

On AlpacaEval 2.0, the win rate against GPT-4 Turbo is 9.94% for M1, 15.38% for M2 and 20.44% for M3. That puts M3 above Claude 2 (17.19%), Gemini Pro (16.85%) and GPT-4 0613 (15.76%). It stays below GPT-4 0314 (22.07%) and Mistral Medium (21.86%). The authors point out the context: many of the models on that table use proprietary alignment data (over one million annotations for Llama 2-Chat) or targets distilled from stronger models. M3 started from 3,200 seed answers.

Figure 4: where do the gains come from?

The paper asked GPT-4 to sort the test prompts into categories, complexity levels and expected lengths. Win rates rise in most categories and on all response lengths. They rise most on moderately hard prompts (complexity 5, 6 and 7 out of 10). They do not rise for mathematics and logical reasoning. The authors read this as: the method helps the model use what it already knows better, and does not add new reasoning skill.

Read the results, one view at a time

Choose a view. Each shows the paper’s own numbers with the table or figure they come from.

Table 2: MT-Bench

The overall score moves from 6.78 for M1 to 7.01 for M2 and 7.25 for M3 (out of 10); the SFT baseline is 6.85. The math, code and reasoning group goes 3.83, 4.05, 4.17, much lower and flatter than the humanities, STEM, roleplay, writing and extraction group, which goes 8.55, 8.79, 9.10. The authors blame the Open Assistant seed prompts, which stress reasoning less. Remember also that the method only ever creates single-turn prompts, while MT-Bench is multi-turn. The gain holds up anyway.

Table 3: did it forget anything?

ModelARC-cHellaSwagGSM8KMMLUNQ
Llama 2 (base)57.4085.3056.8068.9025.30
SFT baseline55.9785.1750.7269.7634.35
M157.5184.9960.2769.3435.48
M254.5184.2759.2969.3133.07
M353.1383.2957.7069.3731.86

Most numbers stay close to the base model, so the method does not wreck old skills. But ARC-challenge slips from 57.51 (M1) to 53.13 (M3) and HellaSwag from 84.99 to 83.29. The authors link this to the “alignment tax” that InstructGPT reported. They also note that ARC-challenge and HellaSwag pick the answer with the highest log-probability, which is not what the training targets. So these two tests are a weak guide here.

Table 4: does the judge improve?

MetricSFT baselineM1M2M3
Training dataIFTIFT+EFT+AIFT(M1)+AIFT(M2)
Pairwise accuracy65.1%78.7%80.4%81.7%
5-best %39.6%41.5%44.3%43.2%
Exact match %10.1%13.1%14.3%14.3%
Spearman0.2530.2790.3310.349
Kendall τ0.2330.2530.3150.324

This table is the heart of the paper. The judge is never given more judging data after M1, yet M2 beats M1 on all five metrics, and M3 beats M2 on three: pairwise accuracy, Spearman and Kendall. The 5-best number dips from 44.3% to 43.2%, and exact match ties at 14.3%. The authors guess that better general instruction following spills over into better judging. The paper offers this as a hypothesis, not a proof.

Which result in the paper is the strongest evidence that the judge improves, not just the writer?

Chapter 8

Ablations and Reasons to Doubt

Test which parts matter, and mark the claims that still need more evidence

A good experiment does not only show that something works. It also takes the recipe apart and removes one ingredient at a time, to see which ones were doing the work. Then it lists, honestly, what the cook did not test. This chapter does both for the paper: four things it removed or changed, and six things it left open.

Ablation 1: change the judge prompt

The paper first tried the five-point prompt of Li et al. (2024), which lists the five scores as multiple-choice quality buckets. On the SFT baseline, its pairwise accuracy against humans was 26.6%. The additive prompt of Chapter 3 gave 65.1%. Same model, same data, a different way to ask the question. This is the single biggest effect in the appendix.

The lesson for a builder: a judge is a prompt plus a model. Changing the prompt can matter as much as changing the model, so a judge prompt deserves its own evaluation set.

Ablation 2: take out the judging seed data

Is EFT necessary? Appendix A.3 trains a parallel chain, called M1′, M2′, M3′, from IFT data alone. Here is the failure as symptom, measurement and fix.

  1. Symptom. Without EFT, the models often cannot score in the requested format, and when they do, the scores usually converge to 4.
  2. Measurement. From the same number of generated prompts, the IFT-only chain could keep only 541 usable pairs for round one and 429 for round two. The full method kept 3,964 and 6,942.
  3. Fix. Train the judging task explicitly with EFT. The paper reports that EFT gives better performance in the same number of iterations, and that the gap between the two chains widens in later iterations.

Ablation 3: train on the winners only

Why build pairs at all? A simpler idea, used by other self-training work, is to keep the best answers and fine-tune on them. Appendix A.4 tries it. The authors add 11,254 answers that the model scored a perfect 5 to the SFT data, and tune the mixing weight. The result, compared head to head with the SFT baseline, is 29% wins against 30% wins: no improvement. The authors could not find a setting where it helped. Preference pairs do help, as Figure 3 shows.

Ablation 4: who writes the prompts?

In the main runs a fixed model writes the new prompts, to save time. Appendix A.5 checks the alternative with 30 hand-made few-shot prompts. All three trained models still write novel instructions in all 30 cases. For M2 and M3 there is a catch: they may write several instructions, then a separator, and then begin answering them, so the output needs post-processing. It is a small test, but it supports closing the loop completely in principle.

Four ablations on one board

Take the recipe apart

Choose an ablation, or the length check. Each shows what the change did to one number.

The length question

Look at the last view. Average AlpacaEval answer length grows from 1,092 (M1) to 1,552 (M2) to 2,552 (M3), while the win rate also rises. There is a known link between length and judged quality: judges, human or model, often prefer longer answers. The paper says this plainly and calls for a deeper study. It did not run a length-controlled test. So the true gain from self-rewarding could be smaller than the win rates suggest, or not; the paper cannot say.

Where could length come from in the loop? Possibly from the judge itself. The rubric rewards comprehensive answers, so the judge may score longer answers higher, the pair builder picks them as winners, and DPO pushes toward them. That chain is a plausible story, not a result the paper proves.

What the paper leaves open

  1. Only three iterations, one setting. The authors call for studying “scaling laws” of the effect with more rounds and other base models. They expect the gain to level off.
  2. Reward hacking. A model rewarded by itself might learn to please its own judge in ways that do not help users. The paper says it is not yet known if or when this happens in this framework.
  3. Same family of judges. A model judges training data, and GPT-4 judges the final results. They are different models, but the authors note that this still calls for a deeper check.
  4. Authors as human evaluators. The human check used the authors as blind annotators, which is useful but limited.
  5. Safety. No safety evaluation was done. The authors suggest using the judge to score safety directly, and hope later iterations might catch harder cases.
  6. Skills that did not move. Maths and logical reasoning gained little. The seed prompts, from Open Assistant, may be one cause.

One more reading of the numbers is ours, not the paper’s. M1’s judge agrees with humans on 78.7% of pairs, so about one pair in five is ordered differently from the human ranking. Human raters also disagree with each other, so that is not all error. But it shows that DPO is being fed labels with real noise, and it makes the averaging of Chapter 4 more than a detail.

Appendix A.4 fine-tunes on 11,254 answers that the model scored 5 out of 5, with no preference pairs. What is the result, and what does it show?

Chapter 9

Field Guide

Keep the numbers, the checklist, the core code and the way onward

Here is the whole paper in one breath. A model starts from a small human seed set and learns two skills: answering and judging. Each round, it writes four answers to each new prompt, judges every answer three times, and keeps the best and worst answer as a preference pair. It trains on those pairs with DPO, and the next round starts from the improved model. Three models in a row lifted Llama 2 70B from 9.94% to 20.44% against GPT-4 Turbo on AlpacaEval 2.0, and the judge’s agreement with humans rose from 78.7% to 81.7%.

The numbers to keep

WhatValueWhere
Base modelLlama 2 70BSection 3.1
Seed answers (IFT)3,200 Open Assistant examples, first turn, English, rank 0Section 3.1.1
Seed judging data (EFT)1,630 train and 541 evaluation examplesSection 3.1.1
New prompts8-shot (6 human, 2 generated), T = 0.6, top-p 0.9, fixed Llama 2-Chat 70BSection 3.1.3
Candidates and judgementsN = 4 answers per prompt, 3 judgements each, T = 0.7, top-p 0.9Section 3.1.3
AIFT sizes3,964 pairs for M2, 6,942 pairs for M3Section 3.1.3
DPO settingslearning rate 1e−6 to 1e−7, batch 16, dropout 0.1, β = 0.1Section 3.1.3
AlpacaEval 2.0 win rateM1 9.94%, M2 15.38%, M3 20.44%Table 1
Judge pairwise accuracySFT 65.1%, M1 78.7%, M2 80.4%, M3 81.7%Table 4
MT-Bench overallSFT 6.85, M1 6.78, M2 7.01, M3 7.25Table 2
Judge prompt ablationadditive 65.1% vs multiple choice 26.6%Table 5
Average answer length1,092 (M1), 1,552 (M2), 2,552 (M3)Section 3.2.1

The terms to keep

TermPlain meaning
IFT, EFT, AIFTHuman answers, human-ranked judging examples, and the model’s own preference pairs.
LLM-as-a-JudgeAsking a language model, by prompt, to grade an answer.
Iterative DPORounds of DPO where each round uses fresh data from the latest model.
Pairwise accuracyHow often a judge orders two answers like humans do.
Reward hackingA model learning to please its scorer in ways that do not serve users.

The core as code

This sketch follows Sections 2 and 3 of the paper. The judge prompt text is the paper’s Figure 2. The helper functions sft and dpo stand for ordinary fine-tuning and the loss of Chapter 5. One line, marked as an assumption, covers a case the paper does not describe.

import re, statistics

def judge(model, x, y, samples=3):
    """Average of 3 sampled 'Score: n' replies from the additive 5-point prompt."""
    scores = []
    for _ in range(samples):
        reply = model.generate(RUBRIC.format(instruction=x, response=y), temperature=0.7, top_p=0.9)
        m = re.search(r"Score:\s*([0-5])", reply)
        if m: scores.append(int(m.group(1)))
    return statistics.mean(scores) if scores else None

def make_pairs(model, prompts, n=4):
    pairs = []
    for x in prompts:
        ys = [model.generate(x, temperature=0.7, top_p=0.9) for _ in range(n)]   # [4]
        rs = [judge(model, x, y) for y in ys]                                  # [4] averaged scores
        if None in rs: continue                                                 # assumption: skip unparsable judgements
        hi = max(range(n), key=rs.__getitem__); lo = min(range(n), key=rs.__getitem__)
        if rs[hi] == rs[lo]: continue                                           # no gap, no lesson
        pairs.append((x, ys[hi], ys[lo]))
    return pairs

def self_rewarding(m0, ift, eft, new_prompts, rounds=2):
    m = sft(m0, ift + eft)                         # M1: answers + judging, loss on target tokens only
    for t in range(rounds):                       # M2, then M3
        pairs = make_pairs(m, new_prompts(t))      # AIFT(M_t), written and judged by the current model
        m = dpo(init=m, ref=m, pairs=pairs, beta=0.1, lr=1e-6)
    return m

Check your own build

Tick each piece you could now build from this lesson. The device tells you whether the loop can run yet.

Is your loop complete?

Nine pieces, in the order the data flows. The loop runs when pieces 1 to 8 are all in place; the ninth tells you whether it worked.

A checklist for you, not a result from the paper. Piece 9 stands for both head-to-head tests and the judge-accuracy test of Table 4; without it you cannot tell a better loop from a longer one.

Where it sits in the field

The idea sits between several neighbours. Against RLHF, it drops the frozen reward model. Against DPO on human pairs, it creates its own pairs. Against Constitutional AI and other AI-feedback work, it keeps the judge inside the model that is being trained. Against Self-Instruct and Instruction Backtranslation, it adds a learned preference step on top of generated data. Against SPIN, it needs no human answer for every prompt. Against Pairwise Cringe Optimization, it uses the same iterative shape but removes the fixed reward model. The authors call the result preliminary and list many open questions.

Keep going

The takeaway. A frozen judge caps a model at the judge’s level. A judge that is the model itself can improve as the model improves, so long as it can still recognise better answers (our reading). The paper shows this for three rounds on one model, and it marks length bias, reward hacking and safety as open.

Go back to the loop at the top and turn it again: back to the instrument. Then open Teach and explain the loop on a whiteboard, from seed data to M3. Credit: Weizhe Yuan, Richard Yuanzhe Pang, Kyunghyun Cho, Xian Li, Sainbayar Sukhbaatar, Jing Xu and Jason Weston, Self-Rewarding Language Models (Meta and NYU, arXiv 2401.10020, v3 March 2025). All explanations, devices and the code sketch here are our re-telling.

Which sentence best states what the paper shows, and what it leaves open?
Self-Rewarding Language Models
Read the paper · Back to the lecture, Model Evolution · Back to Gleams