MetaAlign: Align Large Language Models with Diverse Preferences during Inference Time

Mozhi Zhang, Pengyu Wang, Chenkun Tan, Mianqiu Huang, Dong Zhang, Yaqian Zhou, Xipeng Qiu

Abstract

Current alignment techniques like Reinforcement Learning from Human Feedback (RLHF) embed a static set of values directly into Large Language Model (LLM) weights, creating "one-size-fits-all" models that are difficult to adapt. MetaAlign addresses this by introducing a framework for "dynamic alignment," enabling LLMs to adjust their behavior and preferences at inference time. By utilizing a novel three-tier "Meta-Prompt" and a specialized dataset of 38.9k samples, MetaAlign allows models to switch between safety-first and helpfulness-first modes or adopt specific cultural personas on the fly.

Introduction

The gold standard for making LLMs behave—techniques like RLHF or Direct Preference Optimization (DPO)—typically embeds a static set of values (Helpful, Honest, Harmless) directly into the model's parameters. While effective, this creates a rigid model that is difficult to adapt to specific user needs. A creative writer might want a model that prioritizes imagination, while a medical assistant must prioritize safety above all else. MetaAlign seeks to move from static alignment to inference-time alignment, where the model learns how to align with any preference specified in the prompt.

Methodology

The authors propose a two-pronged approach: a new prompting architecture and a specialized training regime.

Three-tier Meta-Prompt

Instead of the standard "System Prompt + User Query," MetaAlign uses a "Meta-Prompt" consisting of:

  • System Info: Behavioral guidelines from the model provider (e.g., "Prioritize safety").
  • User Info: The user’s background, viewpoints, or specific needs (e.g., "I am a researcher who needs unrestricted data").
  • User Query: The actual task.

Training Strategy

To handle cases where System Info and User Info conflict, the authors developed a Priority Matrix to define the model's "ground truth" behavior during training. The researchers performed Supervised Fine-Tuning (SFT) and DPO on a Llama-2 base using their new dataset, teaching the model the relationship between the Meta-Prompt and the desired output style.

The MetaAlign framework pipeline, detailing the steps from sampling candidate responses to inference-time alignment.

The MetaAlign Dataset

The authors introduced the MetaAlign Dataset, a high-quality collection of 38.9k samples covering over 12k different preferences. It is divided into four sub-datasets:

  • Priority Dataset (14.4k): Focused on the trade-off between safety and helpfulness.
  • Helpful-based Dataset (10k): General instruction-following data.
  • Consensus Dataset (2.5k): Responses that synthesize multiple viewpoints.
  • Diverse-Opinion Dataset (12k): Responses tailored to specific user personas (e.g., occupation, hobbies) for debate-style questions.

Key Insights: Intent-Aware Representations

A significant finding of the MetaAlign research is the emergence of Intent-Aware Representations. Using t-SNE visualizations, the authors found that MetaAlign models cluster data based on the intent specified in the Meta-Prompt. In contrast, vanilla models' internal representations remain intermingled, suggesting they do not truly internalize the behavioral instructions provided in a prompt.

t-SNE visualization showing how MetaAlign-Llama2-7B clusters internal representations based on the intent specified in the Meta-Prompt.

Furthermore, MetaAlign helps mitigate the "alignment tax." By learning to be "dynamically helpful" or "dynamically safe," the model maintains its general capabilities. When told to prioritize helpfulness, MetaAlign-Llama2-7B achieved a win rate of 82% on AlpacaEval, significantly higher than models with static safety alignment (70%).

Results

  • Dynamic Safety Switching: On safety benchmarks, MetaAlign models successfully switched from a "refusal" mode to an "informative" mode based solely on the Meta-Prompt.
  • Personalization: In the Diverse-Opinion test, MetaAlign achieved a personalization score of 4.98/5.0, compared to 4.11 for standard aligned models, indicating a superior ability to adopt a user's specific background.
  • Model Scaling: The benefits of MetaAlign were even more pronounced in the 13B parameter model compared to the 7B version, suggesting that larger models are better at internalizing complex Meta-Prompt instructions.

Conclusion and Future Work

MetaAlign demonstrates that LLMs can be taught to shape-shift their values at inference time, providing a path toward more customizable and transparent AI. Future work will focus on increasing dataset diversity, automating data construction, and exploring more complex ethical conflict resolution.

Summary updated

BibTeX
@inproceedings{zhang2025metaalign,
  author = {Mozhi Zhang and Pengyu Wang and Chenkun Tan and Mianqiu Huang and Dong Zhang and Yaqian Zhou and Xipeng Qiu},
  title = {{MetaAlign: Align Large Language Models with Diverse Preferences during Inference Time}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.findings-naacl.324},
}
Figure