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

InfAlign: Inference-aware language model alignment

Ananth Balashankar, Ziteng Sun, Jonathan Berant, Jacob Eisenstein, Michael Collins, Adrian Hutter, Jong Lee, Chirag Nagpal, Flavien Prost, Aradhana Sinha, Ananda Theertha Suresh, Ahmad Beirami

TL;DR

Standard Reinforcement Learning from Human Feedback (RLHF) aligns models for simple sampling. However, in production, complex decoding strategies like "Best-of-N" are often used. InfAlign bridges this train/test mismatch by proving that any inference-time procedure can be optimized during training through a specific transformation of the reward function, leading to a 3-8% boost in win rates.

The Train/Test Mismatch in RLHF

The current gold standard for aligning Large Language Models (LLMs)—RLHF—has a fundamental limitation: it assumes the model will be used exactly as it was trained, typically via simple temperature sampling.

In real-world deployments, we rarely rely on a single sample. Instead, we use inference-time algorithms like Best-of-N (generating $N$ responses and picking the one with the highest reward), tree search, or chain-of-thought reasoning to extract better performance. This creates a significant "train/test mismatch." If a model is destined to be served using a Best-of-N strategy, the standard RLHF objective is mathematically sub-optimal. The authors pose a critical question: Can we align a language model specifically for the way it will be served?

Methods: The InfAlign Framework

To address this, the authors introduce InfAlign, a framework that shifts the optimization goal from maximizing the reward of a single sample to maximizing the inference-time win rate.

The InfAlign framework introduces an inference-aware reward calibration and transformation step before standard RLHF.

Their practical implementation, InfAlign-CTRL (Calibrate-and-Transform RL), follows a three-step recipe:

  1. Calibration: Reward models are notoriously miscalibrated across different prompts. InfAlign-CTRL first maps raw reward scores to a uniform [0, 1] scale (essentially a percentile rank) based on how the base model performs on that specific prompt.
  2. Transformation: It then applies a mathematical transformation ($\Phi$) to these calibrated scores. For example, to optimize for Best-of-N, they use "exponential tilting" ($e^{tu}$). This forces the model to focus on the "right tail" of the distribution—producing those rare, high-quality responses that a Best-of-N search would eventually select.
  3. Optimization: Finally, the method solves a standard RLHF problem (using PPO) but substitutes the original reward with this newly calibrated and transformed reward.

Key Insights

  • The Equivalence Lemma: The authors prove mathematically that for any inference procedure (like Best-of-N), there exists a specific reward transformation that makes standard RLHF produce the optimal policy for that exact procedure.
  • Reward Models are Miscalibrated: A raw reward of "0.7" might represent the 90th percentile for one prompt but only the 50th for another. Calibration fixes this "prompt-dependency," making the training signal much more stable and reliable.
Raw reward scores vary wildly across different prompts, highlighting the need for calibration to stabilize the training signal.
  • Optimizing for the "Floor" (Worst-of-N): While Best-of-N looks for the best response, the authors also explore Worst-of-N (WoN). This is particularly useful for safety: if an attacker generates $N$ samples to find a jailbreak, the defender wants to ensure even the worst (most unsafe) sample remains safe. InfAlign handles this by using a negative exponential transform.
  • Mitigating Reward Hacking: By using calibrated, rank-based rewards, the model is less likely to exploit spurious correlations (like simply generating longer text to inflate scores) because it is anchored to the relative performance of the base model.

Experimental Results

The researchers evaluated InfAlign on three recognized alignment benchmarks: Anthropic Helpfulness, Anthropic Harmlessness, and Reddit TL;DR. They used PaLM-2 S as the base policy and reward model, with a larger PaLM-2 M serving as the judge.

  • Superior Win Rates: InfAlign-CTRL outperformed state-of-the-art baselines (like IPO and BoN-distillation) by 3-8% in inference-time win rates.
  • Better Efficiency: The method achieves a superior Pareto frontier, yielding higher win rates for the same amount of KL divergence (drift) from the original model compared to alternatives.
  • Safety Gains: On the Anthropic Harmlessness task, using the "Worst-of-N" optimization improved safety against jailbreak-style attacks by up to 5%.
  • Calibration as a Strong Baseline: Even without complex transformations, the calibration step alone proved to be a highly effective baseline for standard RLHF, noticeably reducing reward hacking.

Limitations and Future Directions

While powerful, InfAlign has practical constraints. The calibration step requires an offline pass where the base model generates many samples (e.g., $K=100$) for every prompt in the training set. Though a one-time cost, it adds roughly 29% to the total training time.

Furthermore, the framework currently requires knowing the inference-time strategy before training begins. It remains unclear how well a model trained for Best-of-4 would generalize if served with Best-of-32 or a fundamentally different algorithm like Beam Search. Future work may extend this approach to more complex, multi-step inference procedures, such as models utilizing external tools or multi-turn reasoning chains.

Summary updated

BibTeX
@inproceedings{balashankar2025infalign,
  author = {Ananth Balashankar and Ziteng Sun and Jonathan Berant and Jacob Eisenstein and Michael Collins and Adrian Hutter and Jong Lee and Chirag Nagpal and Flavien Prost and Aradhana Sinha and Ananda Theertha Suresh and Ahmad Beirami},
  title = {{InfAlign: Inference-aware language model alignment}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=hInfvt7c4p},
}
Figure