NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Test-Time Preference Optimization: On-the-Fly Alignment via Iterative Textual Feedback

Yafu Li, Xuyang Hu, Xiaoye Qu, Linjie Li, Yu Cheng

Introduction

Alignment techniques such as Reinforcement Learning from Human Feedback (RLHF) and Direct Preference Optimization (DPO) have become the standard for steering Large Language Models (LLMs) toward human-centric values. However, these methods are traditionally confined to a computationally intensive training phase. Once trained, the model's alignment is static, making it difficult to adapt to shifting preferences or specific safety constraints without further fine-tuning.

Test-Time Preference Optimization (TPO) introduces a dynamic alternative. Instead of updating model weights $\theta$, TPO treats alignment as an iterative optimization problem solved during the decoding process. By leveraging the model's own reasoning capabilities to interpret reward signals through natural language, TPO allows models to refine their outputs on the fly.

The TPO Framework: Textual Optimization

TPO operates by searching for an optimal "contextual parameter" $\phi$—the prompt and feedback history—that steers the fixed model parameters toward higher-reward responses. The framework follows a four-stage iterative loop:

  1. Initialization: The model generates $N$ candidate responses for a given prompt. These candidates are evaluated by an external Reward Model (RM).
  2. Textual Loss Calculation: The LLM acts as a critic, comparing the highest-scoring ("chosen") and lowest-scoring ("rejected") responses. It generates a "textual loss"—a natural language critique explaining why one response is superior to the other.
  3. Textual Gradient Computation: The model translates this critique into a "textual gradient," which consists of specific, actionable instructions to improve the current best response.
  4. Variable Optimization: Guided by these textual gradients, the model generates a new set of refined responses.

This process is repeated for $D$ iterations (depth). By the end of the cycle, the model has effectively "navigated" the response space toward a more aligned output using only textual feedback.

Experimental Evaluation

The authors evaluated TPO across several high-stakes benchmarks, including Arena-Hard and AlpacaEval 2 for instruction following, HH-RLHF for preference alignment, and MATH-500 for reasoning. The study primarily focused on the Llama-3.1-70B and Mistral-Small-22B architectures, comparing base (SFT) models against their officially aligned (Instruct/DPO) versions.

Key Results

  • Leapfrogging Aligned Models: A significant finding was that unaligned models equipped with TPO often outperformed their fine-tuned counterparts. For instance, Llama-3.1-70B-SFT achieved a 77.5% win rate on Arena-Hard using TPO (D5-N20), far exceeding the 59.0% win rate of the standard Llama-3.1-70B-Instruct model.
  • State-of-the-Art Performance: Mistral-Small-Instruct (22B) combined with TPO reached an AlpacaEval 2 LC score of 53.4%, placing it in the same performance tier as GPT-4 Turbo.
  • Compute Efficiency: TPO is remarkably efficient compared to training. The authors estimate that TPO requires less than 0.01% of the FLOPs necessary for a standard DPO training run on 64k instances.

Discussion and Insights

Interpretability and Stability

Unlike the "black box" nature of weight updates in traditional DPO, TPO offers a transparent audit trail. The textual losses and gradients provide a readable record of the model's "reasoning" for changing its output. Furthermore, TPO increases inference stability by reducing the variance in reward scores, leading to more consistently high-quality outputs.

The Reasoning Bottleneck

TPO's effectiveness is tied to the model's capacity for self-critique. The study found that smaller models, such as Llama-3-8B, struggled with TPO, sometimes showing degraded performance. This suggests a "reasoning floor" (approximately 20B+ parameters) required for a model to accurately interpret reward signals and follow its own textual gradients.

Scaling Depth vs. Width

TPO allows for flexible compute allocation. Increasing the "search depth" (more iterations) can be more effective than simply increasing the "search width" (more samples per step). This allows for high-quality alignment even with a limited number of samples per iteration.

Conclusion

Test-Time Preference Optimization demonstrates that the capabilities for high-quality, aligned responses are often already present in base or SFT models, needing only the right "steering" to emerge. While TPO introduces additional inference latency, its transparency and extreme compute efficiency relative to training make it a compelling framework for on-demand alignment. Future research may focus on "meta-training" models to specifically enhance their ability to perform textual self-optimization.

Summary updated

BibTeX
@inproceedings{li2025test,
  author = {Yafu Li and Xuyang Hu and Xiaoye Qu and Linjie Li and Yu Cheng},
  title = {{Test-Time Preference Optimization: On-the-Fly Alignment via Iterative Textual Feedback}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=ArifAHrEVD},
}
Figure