The tilted distribution: the optimum of reward minus a KL penalty

Fine-tune a model to earn reward without wandering far from where it started: maximize E[r] − β·KL(π‖πref). The answer has a closed form, and it is the reference model multiplied, response by response, by er/β. Here the “responses” are the points of a single line, so the whole distribution fits in one picture.

reward:
β
The KL-regularized optimum on a line of responses Three stacked plots over one axis of responses. Top: the reference model's probability density. Middle: the reward. Bottom: the tuned model, which is the reference multiplied by e to the reward over beta and renormalized. Two draggable markers A and B compare two responses. At right, the expected reward against the KL divergence from the reference as beta varies.