TL;DR
A language model is usually trained in several stages: first supervised fine-tuning (SFT) on good answers, then a preference step that uses pairs of answers, and a reference model is often needed for that second step. ORPO (Hong, Lee and Thorne, 2024) merges the two stages into one. It keeps the ordinary next-token loss on the chosen answer and adds a penalty based on the Log-Odds ratio between the chosen and rejected answers. The paper reports that Mistral-7B trained this way on UltraFeedback alone scores above the Zephyr-β model on AlpacaEval 2.0, which was trained in more stages.
Builds on: Log-Odds, Sigmoid Function, Autoregressive Model · Leads to: none yet in this graph
Why it mattered
The paper argues that preference alignment has been treated as a second stage after SFT, with a separate reference model to keep the training stable. That costs memory and compute, and it needs an extra training run. The reference-model recipes include RLHF and DPO. ORPO shows that a single stage can work, with no reference model and no separate preference stage after SFT.
The results are reported on AlpacaEval 2.0, a benchmark in which a judge model compares a model's answers with reference answers. The paper's Mistral-ORPO-β model scores 12.20% against 10.99% for the official Zephyr-β, and its Llama-2 (7B) model scores 9.44%, above the 7.70% of the official Llama-2 Chat 13B. These are the paper's own numbers under its training setup.
The problem
Supervised fine-tuning is a poor tool for telling good answers from bad ones. The paper's pilot study fine-tunes OPT-350M on the chosen answers only, from the HH-RLHF dataset. The likelihood of the rejected answers rises along with that of the chosen ones, and they end up at comparable levels (Figure 3). The fine-tuning step teaches the model the style of the training answers, including the styles people do not want, because nothing pushes the other styles down.
A penalty on rejected answers is therefore needed during SFT itself. The paper's question is what form the penalty should take, so that it adds to the ordinary loss without a reference model and without a second training stage. ORPO's answer is a penalty on the odds of the rejected answer relative to the odds of the chosen one.
How it works
Take one prompt with a chosen answer and a rejected answer . Write for the length-normalised probability of an answer: the exponential of its average per-token log-likelihood. Use , which is the value the paper uses for Mistral-ORPO-α.
- Start with the usual fine-tuning loss on the chosen answer. This is the negative log-likelihood, which is lower when the model gives the chosen answer more probability. Check: this term alone is ordinary SFT.
- Compute the probability of each answer. Say and . Check: each is between 0 and 1, and the chosen answer is the more likely one here.
- Turn each probability into odds. The odds are . For the chosen answer, . For the rejected answer, . Check: odds of 1 mean even chances, and odds above 1 mean more likely than not.
- Take the odds ratio. Divide the chosen odds by the rejected odds: . Check: the model thinks the chosen answer is three times as likely, in odds terms, as the rejected one.
- Wrap the Log-Odds ratio in a sigmoid. The log of 3 is . Its sigmoid is . The penalty is . Check: the penalty is small when the ratio is large.
- Combine the two terms. The full loss is the SFT term plus , which is here. Check: the rejected answer contributes only through this penalty, and with it is a weak signal.
flowchart LR C["Chosen answer y_w"] --> PW["P(y_w given x), then odds"] J["Rejected answer y_l"] --> PL["P(y_l given x), then odds"] PW --> OR["Odds ratio = odds_w / odds_l"] PL --> OR OR --> P["Penalty = -log sigmoid(log odds ratio)"] C --> N["SFT loss on chosen answer"] N --> T["Total = SFT + lambda times penalty"] P --> T
The penalty is a smooth function of the log odds ratio. Large positive values (the chosen answer is much more likely) give a loss near zero, and negative values (the rejected answer wins) give a large one:
- L_OR as a function of the log odds ratio
The math
For a prompt with a chosen answer and a rejected answer , the ORPO loss is , where is the negative log-likelihood of the chosen answer and
Here is the Sigmoid Function, and sets how strongly the penalty counts against the SFT term. The probability is the length-normalised one from the walkthrough.
Steps 2 and 3 in symbols: probability and odds
for an answer of tokens. The odds convert a probability in to a number in . In the walkthrough, and .
Steps 4 and 5 in symbols: the odds ratio and the penalty
The odds ratio is . Its log is , and the penalty is . Because , the penalty can also be written as . For the walkthrough, and .
Step 6 in symbols: the gradient
Write for the log odds ratio. Since , and since , the gradient of the penalty is
The first term pushes the chosen answer's probability up, and the second pushes the rejected answer's down. The factor is large when the model already prefers the rejected answer, so the update is strongest where it is most needed. No reference model appears anywhere in this formula.
Take and . Find the penalty.
- Odds: , and .
- Odds ratio: .
- Log: .
- Sigmoid: .
- Penalty: .
Interpretation: the penalty is small because the model already prefers the chosen answer by a wide margin.
Take and . The model has the preference the wrong way round.
- Odds: , and .
- Odds ratio: .
- Log: .
- Sigmoid: .
- Penalty: .
- Gradient weight: , so the update is large.
Interpretation: a penalty of 1.3 is much larger than the 0.061 of Example 1, and the gradient weight of 0.727 means training will act strongly on this pair.
The paper fine-tunes Phi-2 (2.7B) on UltraFeedback with . Each score is the AlpacaEval 2.0 win rate.
- Phi-2 after SFT only: 0.11%.
- Phi-2 after SFT and then DPO: 0.78%.
- Phi-2 with ORPO in one stage: 6.35%.
- Difference between ORPO and SFT followed by DPO: points.
Interpretation: on this benchmark, the single-stage method beats the two-stage pipeline by a wide margin for this model, under the paper's training setup.
Try it: Mistral-ORPO-β scores 12.20% on AlpacaEval 2.0, and the official Zephyr-β scores 10.99%. How many points higher is Mistral-ORPO-β? Answer: points.
Results
Single-turn instruction following (Table 1). On AlpacaEval 2.0, Mistral-ORPO-α scores 11.33% and Mistral-ORPO-β scores 12.20%, against 8.35% for Zephyr-α and 10.99% for Zephyr-β. The paper notes that the Mistral 7B models were trained for one epoch on UltraFeedback alone, while the Zephyr models use a 20K-example SFT stage on UltraChat before DPO. Llama-2 (7B) with ORPO scores 9.44%, against 4.96% and 7.70% for the official Llama-2 Chat models at 7B and 13B. The paper's controlled comparison of Llama-2 with SFT and with SFT then DPO produced outputs that could not be evaluated in the same way, so those baselines are absent from the table.
Against reward-model win rates (Table 2 and 3). The paper scores answers with a 1.3B reward model (RM-1.3B) on the HH-RLHF dataset and measures how often ORPO's answers win against those of other methods. Against SFT, ORPO's win rate is 84.0%, 82.7% and 78.0% for models of 125M, 350M and 1.3B parameters. Against PPO it is 66.1%, 79.4% and 65.9%. Against DPO it is 41.7%, 49.4% and 70.9%, so the win rate over DPO rises with model size and passes 50% only at the largest model.
Ablation on λ (Appendix E). A larger λ separates chosen from rejected log probabilities more strongly. At λ = 1.0, the chosen answers' probabilities also fall during training, and Mistral-ORPO performs worse on MT-Bench's extraction, math and reasoning categories than at λ = 0.1. The paper's choice of λ therefore matters.
Efficiency. The paper counts the forward passes needed for reference-model methods: a frozen reference model and the training model each run on both answers, four passes per batch in total. ORPO needs only the training model, so it uses less memory and fewer computations per batch (Section 7.3).
Limits. The main results use single-turn UltraFeedback. The paper does not claim that ORPO beats every method on every benchmark, and its Table 2 shows ORPO's win rate over DPO rising with model size, so the advantage is not uniform across scales.
Reading guide
- Abstract and Section 1 (Introduction): the motivation for a single-stage method and the three models trained. Needs DPO and RLHF for context.
- Section 2 (Related Works): the older alignment pipelines and their reference models. Needs Instruction Tuning.
- Section 3 (The Role of Supervised Fine-tuning): the pilot study and why SFT alone does not penalise rejected answers. Needs Autoregressive Model and Maximum Likelihood Estimation.
- Section 4 (ORPO): the odds, the odds ratio, the loss and its gradient, as in this lesson. Needs Log-Odds, Sigmoid Function and Log-Likelihood Ratio.
- Section 5 (Experimental Settings): the datasets, the λ values and the training recipes. Needs the Autoregressive Model definition of answer likelihood.
- Section 6 (Results and Analysis): AlpacaEval, win rates, lexical diversity. Read Table 1 and Table 2 with the Results section above.
- Section 7 (Discussion): the comparison with the probability-ratio penalty, and the efficiency argument. Needs Log-Likelihood Ratio.
- Appendix A: the full gradient derivation, of which the formula in this lesson is the summary.
Check yourself
QuestionRecall: what does ORPO add to the ordinary fine-tuning loss, and what does it leave out?Show answer
It adds a penalty built from the odds ratio between the chosen and rejected answers. It leaves out the reference model and the separate preference stage.
QuestionWith and , what is the odds ratio, and what is the penalty?Show answer
The odds of both answers are 1, so the odds ratio is 1. Its log is 0, and . The penalty is .
QuestionWhy does the paper argue that SFT alone cannot separate chosen from rejected answers?Show answer
SFT only raises the likelihood of the training answers. The pilot study shows that when only chosen answers are used, the likelihood of rejected answers rises too, to comparable levels, so nothing in the loss pushes the undesired styles down.
QuestionA team wants to align a model on a limited budget and has no spare memory for a reference model. Which method suits them, and what should they watch?Show answer
ORPO, because it needs no reference model. They should watch the choice of , since the paper finds that a larger value can reduce performance on tasks that need deterministic answers.
QuestionApplied scenario: a team sees that the rejected answer's probability is higher than the chosen one's for many training pairs. What does the ORPO gradient do in those cases?Show answer
The gradient weight is large when the odds ratio is small, so those pairs produce strong updates that raise the chosen answer's probability and lower the rejected one's. The team should check that the chosen answers are genuinely better, since the penalty acts on whatever labels it is given.