■ Change #81 · wiki.edited
RLHF and preference optimization (DPO): Normalize Markdown to canonical form
explainer.student
**What it is for.** A language model trained only to predict the next word of internet text will happily continue a prompt with something rude, wrong or unhelpful. Qualities people want, such as helpfulness or a suitable tone, cannot be checked by a program, so they cannot simply be scored. Reinforcement learning from human feedback (RLHF) turns human comparisons ("answer A is better than answer B") into a training signal.**Example.** For the prompt "explain photosynthesis to a ten-year-old", a labeller sees two model answers and picks the clearer one. Thousands of such choices become the data.**The three-stage recipe (InstructGPT, 2022).**− 1. *Supervised fine-tuning:* continue training the model on human-written example answers.− 2. *Reward model:* train a second network $r_\phi(x,y)$ that scores answer $y$ to prompt $x$. It uses the Bradley–Terry model, $P(y_w \succ y_l)=\sigma\big(r_\phi(x,y_w)-r_\phi(x,y_l)\big)$: the probability that the preferred answer wins is the logistic (S-shaped) function $\sigma$ of the score difference. Training adjusts $r_\phi$ until preferred answers get higher scores.− 3. *RL:* optimise the language model (the policy) with PPO to raise the reward, minus a penalty $\beta\,\mathrm{KL}(\pi_\theta\Vert\pi_{\text{ref}})$. The KL divergence measures how far the new model's word probabilities drift from the supervised model's; the penalty stops the model wandering into strange text that happens to fool the reward model.+ 1. _Supervised fine-tuning:_ continue training the model on human-written example answers.+ 2. _Reward model:_ train a second network $r_\phi(x,y)$ that scores answer $y$ to prompt $x$. It uses the Bradley–Terry model, $P(y_w \succ y_l)=\sigma\big(r_\phi(x,y_w)-r_\phi(x,y_l)\big)$: the probability that the preferred answer wins is the logistic (S-shaped) function $\sigma$ of the score difference. Training adjusts $r_\phi$ until preferred answers get higher scores.+ 3. _RL:_ optimise the language model (the policy) with PPO to raise the reward, minus a penalty $\beta\,\mathrm{KL}(\pi_\theta\Vert\pi_{\text{ref}})$. The KL divergence measures how far the new model's word probabilities drift from the supervised model's; the penalty stops the model wandering into strange text that happens to fool the reward model.+InstructGPT's labellers preferred a 1.3B-parameter model trained this way to the 175B-parameter GPT-3.**DPO.** Rafailov et al. (2023) showed that the best policy for the KL-penalised objective has a closed form, so the reward can be rewritten in terms of the policy itself, $r=\beta\log(\pi_\theta/\pi_{\text{ref}})+\text{const}$. Substituting this into the Bradley–Terry loss gives Direct Preference Optimisation: an ordinary supervised loss on preference pairs, with no separate reward model and no sampling during training. It is cheaper and simpler than PPO.**Open tension.** DPO learns from a fixed set of answers; PPO keeps sampling new answers from the current model and scoring them. Two careful comparisons (Xu et al., 2024; Ivison et al., NeurIPS 2024) found PPO ahead, by up to 2.5% in maths and 1.2% in general domains in the second, with preference-data quality mattering most.**Overoptimisation.** A reward model is only a proxy for what people want. Gao, Schulman and Hilton (2022) showed that optimising hard against a proxy first raises and then lowers true quality, a measured case of Goodhart's law: when a measure becomes a target, it stops being a good measure.
hash 6c12fe50abc37297d2c3944a938489b5be1f5c38b114c331e34d8979b5c6b487
previous 85f59746ded46b0380637907426ad19963c48e8fb3903515142c49db056c3a68