Test-Time Alignment for Large Language Models via Textual Model Predictive Control

Kuang-Da Wang, Teng-Ruei Chen, Yu Heng Hung, Guo-Xun Ko, Shuoyang Ding, Yueh-Hua Wu, Yu-Chiang Frank Wang, Chao-Han Huck Yang, Wen-Chih Peng, Ping-Chun Hsieh

Overview

Aligning Large Language Models (LLMs) with human preferences typically requires resource-heavy training methods like Reinforcement Learning from Human Feedback (RLHF) or Direct Preference Optimization (DPO). When preferences change or tasks shift, these models must undergo costly retraining. Textual Model Predictive Control (TMPC) introduces a novel framework for aligning LLMs at inference time without any retraining. By treating text generation as a sequential decision-making problem and identifying high-quality "subgoals" in hindsight, TMPC bridges the gap between fragile token-level guidance and unstable response-level refinement.

The "Goldilocks" Problem in Test-Time Alignment

"Test-time alignment" offers a lightweight alternative to finetuning by guiding a frozen model during inference. However, existing methods face a fundamental trade-off:

  1. The Curse of Horizon: Token-level methods (like guided decoding) struggle to assign credit over long sequences. It is difficult to determine if a specific token choice made early on will lead to a high-quality paragraph later, making alignment fragile.
  2. The Curse of Dimensionality: Response-level methods (like iterative refinement) attempt to rewrite the entire output at once. The search space for a full response is so vast that improvements are often unstable or computationally prohibitive.
Trade-offs in Test-Time Alignment

TMPC seeks the "middle ground" by applying principles from control theory to manage these trade-offs, operating on intermediate text segments rather than individual tokens or entire responses.

The TMPC Framework

The authors draw inspiration from Model Predictive Control (MPC), a staple in robotics and industrial control, recasting text generation as a trajectory optimization problem. Standard MPC usually requires predefined segments, but TMPC is "text-aware"—it discovers its own planning steps dynamically.

The TMPC Architecture

The framework rests on two core principles inspired by hierarchical reinforcement learning:

  • Hindsight Subgoal Identification: After generating candidate responses (rollouts), the system retrospectively analyzes them using a reward model to find high-reward segments. These could be a particularly accurate sentence in a translation or a functional block of code. These segments are stored in a "subgoal buffer."
  • Subgoal-Conditioned Re-Generation: In the next iteration, the model is prompted with these successful subgoals. This anchors the generation, ensuring the model builds upon previously validated successes rather than starting from scratch or drifting into low-quality territory.

Crucially, TMPC requires no additional training. It uses a frozen LLM as the policy and an off-the-shelf reward model to evaluate the subgoals.

Experimental Validation

To test its generality, researchers evaluated TMPC across three diverse domains with distinct segmentation properties:

  • Paragraph-Level Machine Translation: Using the WMT’24 Discourse-Level Literary Translation benchmark (Chinese to English, German, and Russian).
  • Long-Form Response Generation: A subset of the HH-RLHF (Helpful and Harmless) dataset, focusing on long, complex prompts.
  • Program Synthesis: The MBPP (Mostly Basic Python Programming) dataset, where the reward is a concrete signal (passing unit tests).

Key Results

TMPC consistently outperformed both training-time baselines (like DPO) and other test-time strategies:

  • Translation: On Chinese-to-English translation, TMPC (using LLaMA-3.1-8B) outperformed GPT-4o. It achieved a 0.00 "Null Alignment" ratio, effectively eliminating common issues like omissions or semantic drift.
  • Code Generation: On the MBPP benchmark, TMPC reached a 61% pass rate, significantly higher than the base model (34%) and the iterative Test-time Preference Optimization (TPO) baseline (48%).
  • Human Preference: In GPT-4-based head-to-head evaluations for long-form responses, TMPC maintained a high win rate against DPO and Best-of-N sampling, proving its "planned" responses were more helpful and better structured.

By narrowing the search space around high-utility subgoals, TMPC achieves better results with fewer LLM calls than competing methods, sampling smarter rather than just sampling more.

Limitations and Future Work

While powerful, TMPC is ultimately constrained by the base model's capabilities. If a model is fundamentally incapable of generating a specific correct fact or code structure, test-time planning cannot "hallucinate" it into existence. Additionally, the method relies heavily on the quality of the reward model; if the reward model has blind spots, TMPC might reinforce those biases.

Future work will explore the co-optimization of reward models alongside TMPC and investigate how this test-time logic could be integrated with lightweight, on-the-fly fine-tuning to further push the boundaries of model alignment.

Summary updated

BibTeX
@inproceedings{wang2026test,
  author = {Kuang-Da Wang and Teng-Ruei Chen and Yu Heng Hung and Guo-Xun Ko and Shuoyang Ding and Yueh-Hua Wu and Yu-Chiang Frank Wang and Chao-Han Huck Yang and Wen-Chih Peng and Ping-Chun Hsieh},
  title = {{Test-Time Alignment for Large Language Models via Textual Model Predictive Control}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=DsS3xRPSs5},
}
Figure