TL;DR
This paper introduces AC-ODM, a novel reinforcement learning-based approach for dynamically mixing data during LLM pre-training. By treating the LLM as an environment and using an actor-critic agent to learn optimal data sampling strategies, AC-ODM significantly accelerates convergence and improves downstream performance, outperforming existing methods with minimal computational overhead.
What Problem Does This Paper Address?
Training Large Language Models (LLMs) is computationally expensive, requiring massive datasets and significant energy. The composition and mixture of this pre-training data are crucial for an LLM's ability to generalize to new tasks. While static data mixing strategies (where data proportions are fixed before training) exist, they fail to adapt to the LLM's evolving learning dynamics. Dynamic data mixing methods, like ODM, address this by adjusting data proportions on-the-fly. However, these methods often lack a unified framework for efficiency, flexibility across different training setups (e.g., training from scratch vs. using pre-prepared corpora), and don't fully leverage intra-domain interactions. AC-ODM aims to solve these issues by providing an efficient, flexible, and theoretically grounded dynamic data mixing approach.
Methods
AC-ODM frames data mixing as a reinforcement learning problem. It uses an Actor-Critic architecture:
- Actor: A policy network that learns to adjust domain sampling weights.
- Critic: A network that evaluates the actor's actions.
The LLM being trained acts as the environment. The state observed by the agent includes information like iteration index, per-domain losses, and weight updates. The action is the set of domain sampling weights. The core innovation lies in the reward function, which is designed to maximize "constructive interference" of gradients. This is theoretically shown to be a proxy for maximizing the effective gradient update magnitude, leading to faster convergence.
AC-ODM supports two modes:
- Proxy Mode: A policy is trained on a smaller "proxy" LLM and then transferred to guide data mixing for a larger "target" LLM. This is useful for fixed, pre-prepared corpora.
- Non-Proxy Mode: The actor-critic agent is trained end-to-end with the target LLM from scratch, allowing for dynamic adaptation even when new data domains emerge.
The framework utilizes the Deep Deterministic Policy Gradient (DDPG) algorithm for training the actor-critic networks.
Datasets
- Training: The Pile (825 GB, 22 diverse sources), SlimPajama (7 domains, 672B tokens).
- Evaluation: The Pile, SlimPajama. Downstream tasks include MMLU (zero-shot and five-shot), HumanEval, COPA, SciQ, LogiQA, PIQA, and WinoGrande.
No new benchmarks were introduced; existing ones were used for evaluation.
Key Insights and Ideas
- Reinforcement Learning for Data Mixing: Framing data mixing as an RL problem with an actor-critic agent allows for dynamic adaptation to LLM training dynamics, going beyond static strategies.
- Maximizing Constructive Interference: The novel reward function, designed to maximize the alignment of gradients across domains, is a key theoretical insight. This directly optimizes for faster convergence by ensuring gradients reinforce each other.
- Proxy Mode Efficiency: Training a data mixing policy on a smaller proxy model and transferring it to a larger target LLM is highly effective and efficient, especially for fixed corpora, significantly reducing training time for the target model.
- Flexibility is Key: The dual-mode (Proxy/Non-Proxy) design makes AC-ODM applicable to a wide range of pre-training scenarios, from standard pipelines to end-to-end training from scratch.
- Domain Granularity Matters: The effectiveness of AC-ODM is sensitive to domain partitioning. Coarser partitions can lead to less discriminative rewards, suggesting that meaningful distinctions between domains are beneficial.
Key Results
- Convergence Speed: AC-ODM-410M (proxy mode) reached optimal validation perplexity on The Pile with 66% fewer training steps than competitive baselines. On SlimPajama, it achieved similar speedups (65% fewer steps than ODM).
- Downstream Performance:
- MMLU: AC-ODM-410M achieved a 27.5% relative improvement in accuracy over baselines.
- HumanEval: AC-ODM-410M achieved a 2.23x higher pass@1 score.
- Computational Overhead: AC-ODM incurs a virtually negligible per-step wall-clock increase (0.4%) and only 2% additional memory overhead compared to ODM.
- Proxy Transfer: Policies learned on smaller proxy models (even 160M parameters) significantly outperform joint training with AC-ODM on a 1B target, demonstrating the value of pre-learned policies.
- Domain-Level Generalization: AC-ODM-410M achieved the lowest perplexity in 17 out of 22 domains on The Pile, outperforming static and dynamic baselines.
Limitations and Future Work
- Domain Granularity: The paper notes that AC-ODM's gains are strongest when domain partitions expose meaningful cross-domain gradient structure. Coarser partitions can reduce the reward signal's discriminative power. Future work could explore optimal domain partitioning strategies.
- Proxy-Target Scaling: While experiments suggest proxy transfer is useful at larger scales, a systematic study of proxy-target scaling for even larger models is suggested.
- Reward Estimation: The reward is currently estimated from selected parameters, not intrinsic data quality. Future work could integrate data quality assessment into the reward mechanism.
- Architecture and Corpus Shifts: While AC-ODM shows promise across different architectures (Pythia, LLaMA-style), further investigation into its effectiveness with broader architecture and corpus shifts is warranted.
Summary updated