Language models are great, but aligning them to human preferences usually requires expensive retraining—and it's impossible when model weights are private. We introduce QAlign, a test-time alignment method that uses extra compute during inference to make models more aligned, without any training or access to model internals.
As we scale test-time computation, QAlign converges to sampling from the optimal aligned distribution for each specific prompt. Unlike existing methods (best-of-n, majority voting) that degrade as you scale compute due to reward model over-optimization, our approach keeps getting better.
Results: When applied to Tūlu3-8B-SFT with a reward model trained on Tūlu3 preference data, QAlign outperforms DPO (which requires training!) as well as best-of-n, majority voting, and weighted majority voting across GSM8K, MATH500, MMLU-Redux, TruthfulQA, and IFEval—achieving a 47.84% increase in average accuracy compared to single-generation sampling.
Bottom line: You can now align off-the-shelf language models at test time by simply spending more compute, without degradation. No training required.
Average error rate across multiple evaluation datasets (GSM8K, MATH500, MMLU-Redux, TruthfulQA, and IFEval) as a function of the floating point operations (FLOPS) in log scale. We compare QAlign method with Tülu3-8B-SFT against four baselines: majority vote (MV) Tülu3-8B-DPO, and applied to Tülu3-8B-SFT the methods best-of-n (BoN), MV, and weighted MV (WMV). All experiments use temperature 1.0 with reasoning included in model outputs. Note that Tülu3-8B-DPO model is the result of doing preference finetuning on the Tülu3-8B-SFT with 271k preference pairs. The costs associated with this process are not accounted for in this plot.
@misc{faria2024sample,
title={Sample, Don't Search: Rethinking Test-Time Alignment for Language Models},
author={Gonçalo Faria and Noah A. Smith},
year={2025},
eprint={2504.03790},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2504.03790},
}