AutoMixAlign: Adaptive Data Mixing for Multi-Task Preference Optimization in LLMs

Nicholas E. Corrado, Julian Katz-Samuels, Adithya M. Devraj, Hyokun Yun, Chao Zhang, Yi Xu, Yi Pan, Bing Yin, Trishul Chilimbi

Abstract

Aligning Large Language Models (LLMs) through preference optimization often involves training on a heterogeneous mixture of datasets covering diverse domains such as coding, safety, and general helpfulness. However, determining the optimal ratio for these datasets—a process known as data mixing—remains a significant challenge, typically relying on expensive brute-force search or suboptimal heuristics. This paper introduces AutoMixAlign (AMA), a framework that automates data mixing by treating it as a dynamic minimax optimization problem. By utilizing task-specific specialists to establish performance baselines, AMA adaptively balances the training process to minimize "excess loss" across all tasks. Experimental results demonstrate that AMA outperforms standard uniform mixing and model merging techniques by up to 9.42%, ensuring robust performance across all targeted domains without the need for exhaustive manual tuning.

Introduction

Preference optimization techniques, such as Direct Preference Optimization (DPO), have become standard for aligning LLMs with human values. A critical yet under-explored aspect of this process is the composition of the training data. When practitioners combine datasets for different tasks—for example, pairing a mathematics dataset with a safety-focused dataset—they face the "black art" of data mixing.

Currently, researchers generally employ two strategies: simple heuristics (like uniform weighting) or brute-force ablations. Heuristics often fail because tasks vary significantly in difficulty and learning rate; a model might overfit an easy task while failing to converge on a harder one. Conversely, brute-force search is computationally prohibitive as the number of datasets increases. AutoMixAlign (AMA) addresses this by providing a principled, automated approach to dynamic data mixing.

Methodology

AutoMixAlign conceptualizes data mixing as a dynamic optimization problem rather than a static pre-training configuration. The framework operates in two distinct phases:

1. The Specialist Phase

Before training the main model, individual "specialist" models are trained on each specific task dataset. These specialists serve as a benchmark, providing the "gold standard" loss achievable for their respective domains. This baseline is crucial because raw loss values are not comparable across different types of data (e.g., the loss magnitude for a coding task differs naturally from that of a conversational task).

2. The Generalist Phase

The goal of this phase is to train a single "generalist" model that matches the performance of all specialists simultaneously. AMA achieves this through a minimax optimization objective. Instead of minimizing the aggregate loss, AMA minimizes the maximum clipped excess loss across all tasks.

Excess loss is defined as the difference between the generalist's current loss and the specialist's baseline loss. By "clipping" this value at zero, the algorithm ensures that once the generalist performs as well as a specialist on a specific task, that task no longer contributes to the optimization gradient. This prevents "over-optimization" and allows the model to shift its focus to tasks where a performance gap still exists.

Algorithmic Variants

AMA is implemented in two primary forms:

  • AMA-R (Reweighting): Maintains uniform data sampling but dynamically adjusts the importance weight of each task within the loss function.
  • AMA-S (Resampling): Dynamically adjusts the probability of sampling data from each task. AMA-S is generally more computationally efficient as it avoids calculating gradients for tasks that have already reached specialist-level performance.

Experimental Setup

The researchers evaluated AMA using the Zephyr-7b-SFT-Full base model across several high-stakes alignment domains:

  • Training Data: UltraFeedback and Chatbot Arena 2024 (Helpfulness), CodeUltraFeedback (Coding), and PKU-SafeRLHF (Safety).
  • Evaluation Benchmarks: IFEval and AlpacaEval 2.0 for general helpfulness, MBPP and HumanEval for coding proficiency, and Toxigen for harmlessness.

Key Insights and Results

Superior Performance and Balancing

In multi-task configurations involving Helpfulness, Coding, and Harmlessness, AMA-R achieved an average score of 54.38%, significantly outperforming standard DPO (50.95%) and uniform sampling (44.96%). Notably, AMA was the only method tested that consistently improved or maintained performance across all benchmarks simultaneously. While standard optimization often led to performance degradation in at least one domain, AMA’s clipping mechanism effectively prevented the "forgetting" of previously learned tasks.

Dynamic Adaptation and Theory

Training logs indicate that AMA-S successfully identifies "hard" tasks early in the training process, shifting sampling weights toward them until the generalist catches up to the specialist baselines. Furthermore, the authors provide a theoretical proof of convergence ($O(1/\sqrt{T})$) for AMA-S using online learning techniques (the EXP3 algorithm), grounding the heuristic success of data mixing in mathematical rigor.

Comparison to Model Merging

AMA also outperformed "Model Averaging" (the practice of merging specialist weights post-hoc). This suggests that joint training with an adaptive mixture is fundamentally more effective than interpolating between models trained in isolation.

Limitations and Future Work

Despite its success, AMA introduces an initial compute overhead due to the requirement of training specialist models. While these specialists can be trained in parallel and often require fewer epochs, it remains an additional step in the pipeline. Additionally, the framework currently relies on human-defined task partitions. Future research may explore using LLMs to automatically cluster raw data into optimal task categories for AMA optimization. Finally, while this study focused on DPO, extending AMA to Supervised Fine-Tuning (SFT) and Reinforcement Learning from Human Feedback (PPO) represents a promising avenue for future development.

Conclusion

AutoMixAlign offers a robust solution to the long-standing problem of data mixing in LLM alignment. By shifting from static heuristics to dynamic, specialist-informed optimization, AMA ensures that multi-task models reach their full potential across diverse domains without the need for exhaustive manual experimentation.

Summary updated

BibTeX
@inproceedings{corrado2025automixalign,
  author = {Nicholas E. Corrado and Julian Katz-Samuels and Adithya M. Devraj and Hyokun Yun and Chao Zhang and Yi Xu and Yi Pan and Bing Yin and Trishul Chilimbi},
  title = {{AutoMixAlign: Adaptive Data Mixing for Multi-Task Preference Optimization in LLMs}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure