Test-Time Alignment of LLMs via Sampling-Based Optimal Control in pre-logit space
Sekitoshi Kanai, Tsukasa Yoshida, Hiroshi Takahashi, Haru Kuroki, Kazumune Hashimoto
TL;DR
The paper tackles the computational burden of RLHF by introducing a training-free test-time alignment method, AISP, which perturbs pre-logits with Gaussian noise and optimizes the mean perturbations to maximize rewards. It builds a stochastic control framework, derives a free-energy bound, and uses adaptive importance sampling to approximate the optimal perturbation distribution, connecting to BoN and softmax via a Gaussian pre-logit assumption. Empirical results show AISP achieves higher rewards with fewer samples than BoN and outperforms RE-Control, with Batched AISP offering scalable gains. The approach offers a practical, scalable pathway to better align LLMs at inference time without additional training data or fine-tuning.
Abstract
Test-time alignment of large language models (LLMs) attracts attention because fine-tuning LLMs requires high computational costs. In this paper, we propose a new test-time alignment method called adaptive importance sampling on pre-logits (AISP) on the basis of the sampling-based model predictive control with the stochastic control input. AISP applies the Gaussian perturbation into pre-logits, which are outputs of the penultimate layer, so as to maximize expected rewards with respect to the mean of the perturbation. We demonstrate that the optimal mean is obtained by importance sampling with sampled rewards. AISP outperforms best-of-n sampling in terms of rewards over the number of used samples and achieves higher rewards than other reward-based test-time alignment methods.
