Explain a KL penalty using a two-action policy
Watch prefixes in words such as preferred and rejected. · 166 words
A drawing assistant can suggest either pencil or ink. A reference policy chooses each with probability one half. A new policy always suggests pencil. To measure the change, take an average under the new policy of the natural logarithm of the new probability divided by the reference probability. This particular direction of comparison is called forward KL divergence from the new policy to the reference. Only pencil appears in that average, so its value is the natural logarithm of two, about 0.693.
Suppose the training objective subtracts this divergence multiplied by 0.1 from an expected reward of one. The penalty is about 0.0693, leaving an objective value near 0.931. The penalty gives the optimizer a reason to preserve some of the old distribution when a reward signal favors a narrow set of suggestions. It cannot tell whether pencil actually suits the artist. The direction matters here. Reversing the two policies would include ink sampled from the reference, even though the new policy assigns ink probability zero.
Check your recall
With a penalty multiplier of 0.1, how much is subtracted from the reward of one?
Check your answer
Approximately 0.0693, obtained by multiplying the natural logarithm of two by 0.1.
Sources and credits
Original KeyTouch lesson. Background reading · Nathan Lambert · Reinforcement Learning from Human Feedback.