Variational Best-of-N Alignment

Afra Amini, Tim Vieira, Elliott Ash, Ryan Cotterell
7/8/2024
cs.CLcs.AIcs.LG

No official code found. Best implementation: rycolab/vbon (7 stars, MIT, last commit 2025-02-19).

Abstract

Best-of-N (BoN) is a popular and effective algorithm for aligning language models to human preferences. The algorithm works as follows: at inference time, N samples are drawn from the language model, and the sample with the highest reward, as judged by a reward model, is returned as the output. Despite its effectiveness, BoN is computationally expensive; it reduces sampling throughput by a factor of N. To make BoN more efficient at inference time, one strategy is to fine-tune the language model to mimic what BoN does during inference. To achieve this, we derive the distribution induced by the BoN algorithm. We then propose to fine-tune the language model to minimize backward KL divergence to the BoN distribution. Our approach is analogous to mean-field variational inference and, thus, we term it variational BoN (vBoN). To the extent this fine-tuning is successful and we end up with a good approximation, we have reduced the inference cost by a factor of N. Our experiments on controlled generation and summarization tasks show that BoN is the most effective alignment method, and our variational approximation to BoN achieves the closest performance to BoN and surpasses models fine-tuned using the standard KL-constrained RL objective. In the controlled generation task, vBoN appears more frequently on the Pareto frontier of reward and KL divergence compared to other alignment methods. In the summarization task, vBoN achieves high reward values across various sampling temperatures.

View on arXivView PDF

Code Implementations(1)

rycolab/vbonCommunity58%
MIT

This repository contains code for our ICLR paper titled "Variational Best-of-N Alignment".

70Shell, PythonFeb 17, 20251 years agoMIT

Similar Papers

Cite this paper

@article{amini2024variational,
  title  = {Variational Best-of-N Alignment},
  author = {Afra Amini and Tim Vieira and Elliott Ash and Ryan Cotterell},
  year   = {2024},
  eprint = {2407.06057},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2407.06057v3},
  journal = {ICLR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2407.06057.svg)](https://codeofpaper.com/paper/2407.06057)

Discussion