Reinforcement Learning and Language Model Alignment (VTR UGE 21), day 5 of 5
Prof. Dr. Utku Kose, Süleyman Demirel University
Part A repeats a calculation of the lecture step by step: the loss of direct preference optimisation (DPO) for one pair. Part B repeats a win rate with its interval and sample size step by step. Part C is an evaluation desk with 400 real outputs of four policies, judges and intervals. Part D reads the intervals of six comparisons. Part E computes a win rate and its interval by hand. Part F evaluates the safety of two models by two failure rates with their intervals. Part G makes you the judge of sixteen comparisons and shows your own position bias.
The worked example of the lecture: The policy and the reference give the winner and the loser of a pair their log-probabilities, and DPO turns them into a margin, a loss and a gradient weight. The sliders set the four log-probabilities and \(\beta\). Values are rounded to three decimals.
Back to the lecture: From the optimum to DPO. The lecture continues there with Section 2 of the Colab notebook: Open it from the next orange box.
The calculation of the lecture for a comparison of model A with model B: the win rate with ties counted as half a win, the half-width of the 95 percent interval, the decision and the number of comparisons that a decision would need. The sliders set the wins, the ties and the losses of A.
Back to the lecture: Intervals, sample size and seeds, where the text continues after the box of this part.
The desk holds 400 real outputs of each of four policies, with their gold reward, reward-model score and length. Three policies come from the notebook of this day: the model after supervised fine-tuning (SFT), the policy trained by reinforcement learning from human feedback (RLHF) with a weight of 0.2 on the Kullback-Leibler (KL) penalty, and the policy trained by DPO with beta 0.1. The fourth is the RLHF policy that Day 4 trained without the KL penalty. Choose two policies, a judge, a rule for ties and a number of comparisons. The desk pairs outputs at random, computes the win rate of A over B and a bootstrap interval, and keeps a log of every evaluation you run. An evaluation is decided at the 5 % level when its 95 % interval does not contain one half.
| A | B | Judge | Ties | n | Win rate | Interval | Decided |
|---|
Back to the lecture: Intervals, sample size and seeds, where the text continues after the box of this part.
Each line reports the win rate of model A against model B with its 95 percent interval.
Back to the lecture: Intervals, sample size and seeds, where the text continues after the box of this part.
Model A met model B 400 times: A won 230 comparisons, 40 were ties and A lost 130.
Back to the lecture: Intervals, sample size and seeds. The lecture continues there with Section 5 of the Colab notebook: Open it from the next orange box.
The safety evaluation of the lecture: Two models answer the same fixed test set, a list of harmful requests and a list of harmless requests that resemble harmful ones. A judge marks every harmful completion and every refusal of a harmless request. The sliders set the counts of the two models. The intervals use the formula of the lecture, and a count of zero uses the rule of three.
Back to the lecture: Evaluating safety. The lecture continues there with Section 6 of the Colab notebook: Open it from the next orange box.
Here you judge pairs of sentences from the grammar of Day 4. Each of eight pairs appears twice, once in each order, in sixteen verdicts in all: Choose the better sentence, or no difference when you see none. Judge by your own taste, without looking back at your earlier verdicts. The lab then shows how often you chose the sentence in the first position, how many pairs you judged the same way in both orders, and the win rate of the sentence of each pair with the higher gold reward. It gives this win rate with ties counted as half, with its interval, and with the remedy of the lecture for position bias, by which a pair counts as a win only when both of its verdicts agree, and as a tie otherwise. Then answer the questions below by hand.
By hand: A jury prefers dish A in 120 of 200 tastings in which A is served first and in 70 of 200 tastings in which B is served first. There are no ties.
Back to the lecture: Your judge. The lecture continues there with Section 7 of the Colab notebook: Open it from the next orange box.
Answer each question, rate your confidence and check the answer. Results stay in this browser.
Write a short answer to each question. The text is saved in this browser and is included when you export the learning log.