Adaptive Data Optimization: Dynamic Sample Selection with Scaling Laws

## Abstract

Abstract The composition of pretraining data is a key determinant of foundation models’ performance, but there is no standard guideline for allocating a limited computational budget across different data sources. Most current approaches either rely on extensive experiments with smaller models or dynamic data adjustments that also require proxy models, both of which significantly increase the workflow complexity and computational overhead. In this paper, we introduce Adaptive Data Optimization (ADO), an algorithm that optimizes data distributions in an online fashion, concurrent with model training. Unlike existing techniques, ADO does not require external knowledge, proxy models, or modifications to the model update. Instead, ADO uses per-domain scaling laws to estimate the learning potential of each domain during training and adjusts the data mixture accordingly, making it more scalable and easier to integrate. Experiments demonstrate that ADO can achieve comparable or better performance than prior methods while maintaining computational efficiency across different computation scales, offering a practical solution for dynamically adjusting data distribution without sacrificing flexibility or increasing costs. Beyond its practical benefits, ADO also provides a new perspective on data collection strategies via scaling laws.

## 1 Introduction

Foundation models, large neural networks pre-trained on vast amounts of data, are the backbone for a wide range of today’s machine learning workload (Bommasani et al., ). It is well established that the composition of the pretraining data plays a crucial role in these models’ final performance (Gadre et al., ); however, there are currently no standard guidelines for selecting good pretraining data. Most existing datasets are filtered and curated snapshots of the web data (Gao et al., ; Penedo et al., ), often categorized into distinct heterogeneous domains (e.g., CommonCrawl and Github). Even after filtering, a challenge remains: deciding how to allocate computational resources across these different domains. Given the ever increasing cost of pretraining large foundation models (Sharir et al., ), optimizing the data composition is a potential avenue for improving performance without increasing computational cost.

There are two popular approaches to adjusting the data distribution. A straightforward approach to this problem is to experiment with smaller models, test different data policies, and then apply the best-performing policy to the larger model (Ye et al., ; Ge et al., ). However, this strategy has several drawbacks. First, as the number of domains increases, the cost of training on all possible policies can grow linearly or even exponentially (if the level of discretization remains the same), making even small-scale experiments costly. Second, the optimal data policy for a smaller model does not necessarily generalize to larger models (Ye et al., ; Albalak et al., ).
Another approach involves dynamically adjusting the data policy during training based on various statistics (Xie et al., ; Chen et al., ; Qin et al., ; Fan et al., ). However, these methods often require training a smaller proxy model to guide the data policy, whose cost is still non-negligible.

A significant limitation of almost all existing methods (with the exception of Albalak et al. ()) is their requirement for additional computational steps beyond standard training. This extra complexity entails substantial modifications to the training pipeline, making it challenging to integrate these methods when other components are varied (e.g., the architecture, tokenizer, or optimizer). The consequence of this usage barrier is that these methods have not been tested widely, making them less popular for those training a new model. To enable broader adoption of data mixture optimization, we argue that it must be implemented in an online fashion, concurrent with model training, without disrupting the standard training process, which means that the data mixture must adapt itself based on the feedback from the model. This is closely related to curriculum learning (Bengio et al., ), a training strategy where models are progressively exposed to domains in a curated order.

At a fundamental level, this work develops and empirically investigates questions about the existence of good pretraining curricula and the feasibility of cheaply identifying them. We first demonstrate in controlled experiments that good curricula can generally be found with more computation and that it is hard to accurately predict larger models’ performance with only a few small models. This leads to our main contribution, Adaptive Data Optimization (ADO): an algorithm for adaptively adjusting the data mixture online during training (Figure 1). In experiments on language models up to 1.3B parameters trained on the Pile (Gao et al., ), we find that ADO improves performance across a variety of common benchmarks and improves validation loss on SlimPajama (Soboleva et al., ) and FineWeb (Penedo et al., ), both of which are considered to be higher-quality datasets. Most importantly, ADO achieves these without requiring significant additional computation (less than $0.4\%$ wallclock time for 1.3B), proxy models, or extensive modification to the training pipelines.

Figure: Figure 1: ADO is a cheap online technique for adjusting the data distribution while training large models. In contrast to prior methods, ADO tailors its data distribution to the model as it is being trained, and does not require training smaller proxy models in advance.
Refer to caption: x1.png

## 2 Motivations

Figure: Figure 2: Extrapolating larger models’ loss using scaling laws up to a threshold model size, where the threshold is indicated by color. Extrapolations become more accurate with more models.
Refer to caption: x2.png

##### The drawbacks of small proxy models.

At first glance, transferring data selection strategies from smaller to larger models seems plausible, with positive results in specific cases, such as in Mindermann et al. () and Xia et al. (). However, as shown in Figure 2, using a small number of models to predict the behavior of larger models can exhibit high variance on the Pythia model family (Biderman et al., ), indicating that they cannot reliably forecast larger models’ performance. At a per-domain level (Figure 7), the variation becomes even more pronounced. While this does not fully rule out the possibility of transfer, it raises doubts about whether small models can reliably select data mixtures for larger models. Another issue is that the efficacy of distributions generated by proxy models is highly sensitive to factors like the tokenizer and other hyperparameters (Albalak et al., ). Our findings also confirm this brittleness (Section 4). This means that the optimized distributions from one experiment might not transfer, and they need to be retrained for a new model. This is undesirable because proxy models add non-trivial overhead — Ge et al. () estimated that a single round of DoReMi proxy training requires 760 GPU hours on 8 Nvidia A100 GPUs, and several proxy training rounds are needed before training the full model.

##### The existence of good curricula.

Curriculum learning (Bengio et al., ) is a conceptually appealing idea that has been regularly studied over the years, but these methods have not been widely adopted in deep learning outside of a few relatively niche areas (Graves et al., ; Florensa et al., ; Jesson et al., ; Tang et al., ).
To the best of our knowledge, there is no consensus on why curriculum learning has not had wide success in deep learning.
Some hypothesize that deep learning is different from human learning or that overparameterization makes curriculum less effective (Wu et al., ; Mannelli et al., ).
On the other hand, some experimental evidence suggests that deep neural networks implicitly learn functions of increasing complexity from easy to hard (Kalimeris et al., ; Baldock et al., ), loosely resembling some aspects of human learning (Lawrence, ; Baker & Osgood, ; Skinner, ).
For overparameterization, it is not clear if modern foundation model pretraining is in the overparameterized regime since dataset size generally scales with the number of model parameters (Hoffmann et al., ).

To motivate our later work, we propose an alternative hypothesis: *good curricula exist but they are computationally difficult to find*. Let’s start with an instructive experiment of finding good curricula with more computation. Suppose we have a fixed dataset of size $N$ and want to train SGD at a minibatch size of 1 for 1 epoch (i.e., each data point is used once, which is common for language model pretraining). We are interested in finding a data ordering that is better than a random shuffle when training a model *initialized at random*. Brute force search is intractable even for a small dataset. Unlike most existing curricula that rely on some prior notions of difficulty, we will find a good curriculum with *only* training data by optimizing over the space of permutations with meta learning. Due to space constraints, we defer the details of this meta learning procedure to Appendix B.

We apply this procedure to a logistic regression problem as well as a multi-layer perceptron where the goal is to imitate a teacher. We randomly sample the initialization $\theta_{0}$, ground truth $\theta^{\star}$ and the data ${\mathcal{Z}}=\left\{\left({\bm{x}}_{i},\,f({\bm{x}}_{i};\theta^{\star})\right
)\right\}_{i=1}^{N}$. For a fixed set of data points, we run the meta optimization for some steps ($200$ for logistic regression and $1000$ for MLP) and evaluate the performance of learned ordering on a new initialization. We repeat this experiment $50$ times and report the results in Figure 3. As can be seen from the results, the performance of meta-optimized data ordering is significantly better than that of random order even though during evaluation the models are initialized at random. In a concurrent work, Gu et al. () conducted a similar experiment but their meta objective uses additional validation data and optimizes a distribution over all training data points rather than SGD.

Figure: Figure 3: The average learning curves of SGD and the meta-optimized curricula for a logistic regression (Left) and an MLP (Middle). The meta-optimized curricula consistently outperform SGD. Further, the meta loss for curricula is still decreasing after 1000 steps (Right). The first two figures are averaged over 50 runs and the shaded region corresponds to 1 standard deviation.
Refer to caption: x3.png

This shows that given a dataset, it is possible to find an ordering that greatly outperforms random ordering without committing to any prior notion of difficulty.
This procedure does *not* leverage additional data, but it requires significantly more computational resources than random ordering, so it is neither practical nor scalable. Moreover, given our limited understanding of the landscape of curriculum optimization, it is highly unlikely that we are identifying the globally optimal curriculum. As shown in Figure 3 (right), even this meta-optimization has not fully converged after 1000 steps. Nonetheless, it demonstrates definitively
the existence of a good curriculum, which raises the question of how we can find a better curriculum in a computationally efficient manner(^1^11Since a static mixture is nothing but a fixed stationary curriculum throughout the training, this computational difficulty applies to finding a static mixture too.).

## 3 Adaptive data optimization

We demonstrated above a general, albeit costly, strategy for finding good curricula but it is too expensive to be practically useful.
We believe that an ideal online data selection strategy for pretraining foundation models should incur a minimal computational cost.

Furthermore, computational efficiency alone is not sufficient. Perhaps an equally important consideration is that such methods should avoid explicit dependence on any particular specification of downstream tasks. The fundamental premise of a foundation model is to serve as the basis for *all* reasonable downstream tasks;
explicitly relying on a fixed set of downstream tasks to pick pre-training data distribution risks unintentionally overfitting to the downstream tasks (Goodhart, ).
Indeed, the evaluation of current language models has become increasingly difficult as performance on existing benchmarks becomes saturated. While evaluating downstream tasks is undoubtedly important because they are representative of the models’ main use cases, we believe that it is valuable to define an objective for online data selection that is agnostic to the downstream tasks.

Previous works like DoReMi (Xie et al., ), and DoGE (Fan et al., ) share this task-agnostic philosophy of data selection. However, these methods require training proxy models which makes them inconvenient and expensive to use. Lifting the requirement for a proxy model would make data selection methods more accessible and practical.

The goal of this work is to advocate for data selection methods that satisfy the following desiderata(^2^22These criteria are not mutually exclusive with proxy models or other offline data selection methods and can be used in tandem if needed (e.g., training a model that specializes in coding).):

Based on these criteria, we introduce our method of online data selection, *Adaptive Data Optimization* (ADO).
In the following sections, we present the algorithmic components of ADO. First, we discuss how we fit a scaling law for each domain, allowing the data mixture to account for variations in the natural diversity across different domains. Next, we describe how the data mixture is dynamically adjusted based on these scaling laws *during model training*. Each domain is characterized by two key quantities: 1. the domain’s learning potential, indicating the potential improvement from further optimization in that domain (Section 3.1), and 2. a credit assignment score that quantifies the domain’s contribution to the reduction of training loss (Section 3.2). To address potential noise from simultaneously updating the data mixture and the model, we employ several time-averaging techniques to smooth these quantities (Section 3.3).

### 3.1 Construction neural scaling laws for each domain

To achieve our desiderata, it is crucial to be able to predict the evolution of our model’s training online with cheap computational routines that do *not* scale with the size of the model. To accomplish this, we use neural scaling laws (Kaplan et al., ) to extrapolate the loss as a function of the amount of training data observed so far, which we denote $n$. It is important to highlight that this scaling law is for predicting the future training loss within a single training run. In contrast, typical neural scaling laws (Hoffmann et al., ) use the results of completed training runs to extrapolate the loss of future training runs, typically with larger models or datasets.

For simplicity and interpretability, we use a standard power law:
$\widehat{{\mathcal{L}}}(n;\alpha,\beta,\varepsilon)=\varepsilon+\beta n^{-\alpha}$,
where $\alpha,\beta,\varepsilon$ are the parameters to be fitted, and $\widehat{{\mathcal{L}}}$ is a surrogate loss used to model the behavior of the true loss. The parameter $\varepsilon$ can be seen as the irreducible loss or the “entropy” of the data. Data with high diversity (e.g., CommonCrawl) would naturally have a higher irreducible loss and data that are more predictable (e.g., code and math) would tend to have a lower irreducible loss. The parameter $\alpha$ measures how quickly the loss decreases with more training data.
Although such scaling laws may be inaccurate at extrapolating training loss far into the future (e.g., due to the learning rate schedule), we can cheaply refit the parameters on the fly (Appendix A.1). Since the parameters from each fit are only used for a short period before being updated and the learning curves usually do not change abruptly, our scaling law need only be locally accurate.

Instead of fitting a single scaling law for the overall loss (Kaplan et al., ; Hoffmann et al., ), we will fit a separate scaling law for the loss on each domain, each of which will guide ADO to adjust the weights of each domain.

###### Definition 1 .

A domain scaling law is a training sample scaling law, $\widehat{{\mathcal{L}}}_{k}(n)=\widehat{{\mathcal{L}}}(n;\alpha_{k},\beta_{k},
\varepsilon_{k})=\varepsilon_{k}+\beta_{k}n^{-\alpha_{k}}$, that predicts the $k^{\text{th}}$ domain’s training loss after training on $n$ samples. $\varepsilon_{k},\beta_{k},\alpha_{k}$ are functions of the architecture, training algorithms, and the overall data distribution.

The domain scaling law serves as a tractable middle ground between modeling the overall loss and modeling how every domain interacts with each other. Modeling the full dependencies faithfully may be challenging while training online because we cannot modify the data distribution drastically.
As the first step towards this goal, our method will only model how each domain interacts with itself and leave more complex modeling to future works.
Nonetheless, this scaling law reveals important information about each domain. For example, $\varepsilon_{k}$ corresponds to the estimated irreducible loss of a domain, which could be useful for various applications (Xia et al., ). More importantly, we can interpret the derivative of the loss with respect to the number of samples as the following:

$$ $\displaystyle\frac{d\widehat{{\mathcal{L}}}_{k}(n)}{dn}=\frac{-\alpha_{k}\beta _{k}n^{-\alpha_{k}}}{n}=-\frac{1}{n}\underset{\text{Learning speed}}{ \definecolor{tcbcolframe}{rgb}{1,1,1}\definecolor{tcbcolback}{rgb}{ 0.84765625,0.9375,0.84765625}\definecolor{tcbcol@origin}{rgb}{0,0,0} \definecolor{.}{rgb}{0,0,0}\definecolor{.}{rgb}{0,0,0}\leavevmode\hbox to29.41 pt{\vbox to25.6pt{\pgfpicture\makeatletter\hbox{\hskip 0.0pt\lower 0.0pt\hbox to 0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgfstrokecolor}{ rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ } \pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt} \pgfsys@invoke{ }\nullfont\hbox to0.0pt{{}{}{}{}\pgfsys@beginscope \pgfsys@invoke{ }{}{}{}{}{}{}{}{}\definecolor[named]{pgffillcolor}{rgb}{1,1,1} \pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\pgfsys@fill@opacity{1.0} \pgfsys@invoke{ }{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{} {}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}\pgfsys@moveto{0.0pt}{4.26788pt} \pgfsys@lineto{0.0pt}{21.32988pt}\pgfsys@curveto{0.0pt}{23.687pt}{1.91077pt}{2 5.59776pt}{4.26788pt}{25.59776pt}\pgfsys@lineto{25.13763pt}{25.59776pt} \pgfsys@curveto{27.49475pt}{25.59776pt}{29.40552pt}{23.687pt}{29.40552pt}{21.3 2988pt}\pgfsys@lineto{29.40552pt}{4.26788pt}\pgfsys@curveto{29.40552pt}{1.9107 7pt}{27.49475pt}{0.0pt}{25.13763pt}{0.0pt}\pgfsys@lineto{4.26788pt}{0.0pt} \pgfsys@curveto{1.91077pt}{0.0pt}{0.0pt}{1.91077pt}{0.0pt}{4.26788pt} \pgfsys@closepath\pgfsys@fill\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\pgfsys@beginscope\pgfsys@invoke{ }{}{}{}{}{}{}{}{} \definecolor[named]{pgffillcolor}{rgb}{0.84765625,0.9375,0.84765625} \pgfsys@color@rgb@fill{0.84765625}{0.9375}{0.84765625}\pgfsys@invoke{ } \pgfsys@fill@opacity{1.0}\pgfsys@invoke{ }{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{ }{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}\pgfsys@moveto{1.4 2262pt}{4.26788pt}\pgfsys@lineto{1.42262pt}{21.32988pt}\pgfsys@curveto{1.42262 pt}{22.90129pt}{2.69647pt}{24.17514pt}{4.26788pt}{24.17514pt}\pgfsys@lineto{25 .13763pt}{24.17514pt}\pgfsys@curveto{26.70905pt}{24.17514pt}{27.9829pt}{22.901 29pt}{27.9829pt}{21.32988pt}\pgfsys@lineto{27.9829pt}{4.26788pt} \pgfsys@curveto{27.9829pt}{2.69647pt}{26.70905pt}{1.42262pt}{25.13763pt}{1.422 62pt}\pgfsys@lineto{4.26788pt}{1.42262pt}\pgfsys@curveto{2.69647pt}{1.42262pt} {1.42262pt}{2.69647pt}{1.42262pt}{4.26788pt}\pgfsys@closepath\pgfsys@fill \pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope \pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@fill@opacity{1.0}\pgfsys@invoke{ }{ {{}}{{}}{{}}{{}}{{}}{{}}{{}}\pgfsys@beginscope\pgfsys@invoke{ } \pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{9.95842pt}{11.61833pt}\pgfsys@invoke{ }\hbox{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0} \pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\hbox{\set@color{$ \displaystyle\alpha_{k}$}}}}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{}{}\hss} \pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}} \lxSVG@closescope\endpgfpicture}}}\underset{\text{Reducible loss}}{ \definecolor{tcbcolframe}{rgb}{1,1,1}\definecolor{tcbcolback}{rgb}{ 1,0.94140625,0.8828125}\definecolor{tcbcol@origin}{rgb}{0,0,0}\definecolor{.}{ rgb}{0,0,0}\definecolor{.}{rgb}{0,0,0}\leavevmode\hbox to65.65pt{\vbox to27.07 pt{\pgfpicture\makeatletter\hbox{\hskip 0.0pt\lower 0.0pt\hbox to0.0pt{ \pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgfstrokecolor}{rgb}{ 0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill {0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ } \nullfont\hbox to0.0pt{{}{}{}{}\pgfsys@beginscope\pgfsys@invoke{ }{}{}{}{}{}{} {}{}\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1} \pgfsys@invoke{ }\pgfsys@fill@opacity{1.0}\pgfsys@invoke{ }{{}{}{{}}}{{}{}{{}} }{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{} \pgfsys@moveto{0.0pt}{4.26788pt}\pgfsys@lineto{0.0pt}{22.80368pt} \pgfsys@curveto{0.0pt}{25.1608pt}{1.91077pt}{27.07156pt}{4.26788pt}{27.07156pt }\pgfsys@lineto{61.38664pt}{27.07156pt}\pgfsys@curveto{63.74376pt}{27.07156pt} {65.65453pt}{25.1608pt}{65.65453pt}{22.80368pt}\pgfsys@lineto{65.65453pt}{4.26 788pt}\pgfsys@curveto{65.65453pt}{1.91077pt}{63.74376pt}{0.0pt}{61.38664pt}{0. 0pt}\pgfsys@lineto{4.26788pt}{0.0pt}\pgfsys@curveto{1.91077pt}{0.0pt}{0.0pt}{1 .91077pt}{0.0pt}{4.26788pt}\pgfsys@closepath\pgfsys@fill\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\pgfsys@beginscope \pgfsys@invoke{ }{}{}{}{}{}{}{}{}\definecolor[named]{pgffillcolor}{rgb}{ 1,0.94140625,0.8828125}\pgfsys@color@rgb@fill{1}{0.94140625}{0.8828125} \pgfsys@invoke{ }\pgfsys@fill@opacity{1.0}\pgfsys@invoke{ }{{}{}{{}}}{{}{}{{}} }{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{}{{}{}{{}}}{{}{}{{}}}{}{} \pgfsys@moveto{1.42262pt}{4.26788pt}\pgfsys@lineto{1.42262pt}{22.80368pt} \pgfsys@curveto{1.42262pt}{24.37509pt}{2.69647pt}{25.64894pt}{4.26788pt}{25.64 894pt}\pgfsys@lineto{61.38664pt}{25.64894pt}\pgfsys@curveto{62.95805pt}{25.648 94pt}{64.2319pt}{24.37509pt}{64.2319pt}{22.80368pt}\pgfsys@lineto{64.2319pt}{4 .26788pt}\pgfsys@curveto{64.2319pt}{2.69647pt}{62.95805pt}{1.42262pt}{61.38664 pt}{1.42262pt}\pgfsys@lineto{4.26788pt}{1.42262pt}\pgfsys@curveto{2.69647pt}{1 .42262pt}{1.42262pt}{2.69647pt}{1.42262pt}{4.26788pt}\pgfsys@closepath \pgfsys@fill\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope } \pgfsys@endscope\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@fill@opacity{1.0} \pgfsys@invoke{ }{{{}}{{}}{{}}{{}}{{}}{{}}{{}}\pgfsys@beginscope\pgfsys@invoke { }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{9.95842pt}{11.03578pt} \pgfsys@invoke{ }\hbox{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{ rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\hbox{ \set@color{$\displaystyle(\widehat{{\mathcal{L}}}_{k}(n)-\varepsilon_{k})$}}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}\pgfsys@invoke{ \lxSVG@closescope }\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope \endpgfpicture}}}.$ (1) $$

The quantity $\widehat{{\mathcal{L}}}_{k}(n)-\varepsilon_{k}$ informs us about how far away a particular domain is from the estimated minimum loss, which coincides with the notion of population-level *reducible loss* (Mindermann et al., ),
and $\alpha_{k}$ indicates how fast the loss of a particular domain is changing with new data. This derivative informs us about how much loss decrease we can expect per data point locally.
At a high level, the cross entropy loss has an information theoretic interpretation, so this quantity can be understood as a form of *information density*, or, the amount of information gain per unit of computation. Intuitively, prioritizing data with high information density is a likely better use of computation and could lead to richer representation as it implies more information is “stored in” the model weights. We leave the formalization of this statement to future works.
It may be useful to contrast this quantity with Albalak et al. (, ODM) which only prioritizes domains with a high loss ${\mathcal{L}}_{k}(n)$ without considering the irreducible loss. This objective could lead to the underrepresentation of domains with inherently lower entropy such as code or math(^3^33Albalak et al. () showed that ODM achieves higher loss on Github than other methods. In our 124M experiments, ODM achieves 1.54 validation loss on Github while ADO achieves 1.40 validation loss.).

###### Definition 1 .

### 3.2 The contribution of the data from each domain

In contrast to prior works that train multiple models to find optimal data policies offline (Ye et al., ; Ge et al., ), our online approach adaptively prioritizes selecting data so that the model learns quickly, as predicted by scaling laws that we fit on the fly. It consists of a data policy $\pi(t)\in\Delta^{K}$ that specifies a sampling distribution over the $K$ domains. An intuitive approach would be to prioritize sampling domains where the model will learn quickly: e.g., we could sample from domain $k$ in proportion to $-\frac{d\widehat{{\mathcal{L}}}_{k}}{dn}$ (Equation 1).

However, independent domain scaling laws do not account for how samples from one domain help learning on a different domain. Consider a thought experiment where the loss ${\mathcal{L}}_{k}$ is decreasing rapidly, but we have sampled very little data from domain $k$. Intuitively, data from domain $k$ should not get much credit for this loss decrease, which can instead be attributed to transfer learning from other domains. This calls for some form of credit assignment based on whether a domain has actually been sampled recently.

###### Definition 2 .

A credit assignment score, $\lambda_{k}(t)$, is a real positive-valued function that indicates how much data from the $k^{\text{th}}$ domain contributed to recent changes in the loss ${\mathcal{L}}_{k}$.

Ideally, we would like to understand how each domain affects every other domain. Unfortunately, this interaction might be highly complex and not local (i.e., the best solution locally at a given time step may not be optimal in the long run). As mentioned earlier, we focus on modeling the domain’s contribution to itself for now.
A reasonable assumption is that the contribution a domain makes to its own learning progress is positively correlated with what proportion of the recent data came from this domain. In other words, we assume that if a domain was useful for itself in recent history, it will likely continue to be useful.
Based on this assumption, we keep a history of the exponential moving average of the *recent* data policy (with a coefficient of $\gamma_{1}<1$) and apply a power transformation with a smoothing parameter $s<1$ to smooth the distribution since the assignment can be inaccurate:

$$ $\displaystyle h_{k}(t)=\gamma_{1}\pi_{k}(t)+(1-\gamma_{1})h_{k}(t-1),\quad \lambda_{k}(t)\propto h_{k}(t)^{s}.$ (2) $$

We find that $\gamma_{1}=0.1$ and $s=0.5$ work well consistently for all scales we tested. We emphasize that this design choice is a simple heuristic that can be easily computed and other choices are possible.

Figure: Algorithm 1 Adaptive Data Optimization (ADO)

###### Definition 2 .

### 3.3 Constructing the data policy update

To define our data policy, we combine the two principles we have seen thus far: prioritize sampling from a domain $k$ if the model is decreasing its loss ${\mathcal{L}}_{k}$ quickly, but only if that decrease can be attributed to data from domain $k$.
Additionally, it is common to have a natural prior distribution $\mu\in\Delta^{K}$ over the domains (e.g., number of tokens in each domain), which we may also incorporate:

###### Definition 3 .

Given the learning speed forecast by a scaling law, $\frac{\partial}{\partial n}\widehat{{\mathcal{L}}}_{k}(n)$, credit assignment score $\lambda_{k}(t)$, and a prior domain weight $\mu_{k}$, the preference distribution is

$$ $\displaystyle\rho_{k}(t)\propto-\mu_{k}\,\frac{\partial}{\partial n}\widehat{{ \mathcal{L}}}_{k}(n)\,\lambda_{k}(t)=\frac{1}{n}\,\mu_{k}\,\lambda_{k}(t)\, \alpha_{k}\,(\widehat{{\mathcal{L}}}_{k}(n)-\varepsilon_{k}).$ (3) $$

Note that the preference distribution is *not* a perfect indication of the best possible distribution to learn from because we have no access to the true gradient of the data policy.
As shown in the definition of the credit assignment score, we have to resort to various approximations.

###### Definition 3 .

##### Temporal average.

This local estimate of a data policy may not be optimal globally. Both DoReMi (Xie et al., ) and DoGE (Fan et al., ) take the proxy model’s data training distributions over all time steps to obtain the stationary final distribution which both reported to be better than using a dynamically changing distributions.
Since our goal is to select a data policy online, we do not have the option for post-hoc processing. Instead, we use an online analogy of this process:

$$ $\displaystyle\bar{\pi}_{k}(t)$ $\displaystyle=\tfrac{1}{t+1}\rho_{k}(t)+\left(1-\tfrac{1}{t+1}\right)\bar{\pi} _{k}(t-1),$ (4) $\displaystyle\pi_{k}(t)$ $\displaystyle=\gamma_{2}\,\rho_{k}(t)+(1-\gamma_{2})\bar{\pi}_{k}(t-1).$ (5) $$

$\bar{\pi}_{k}(t)$ is a temporal moving average of the preference policy at every step and $\pi_{k}(t)$ is a linear combination of the moving average and the chosen policy according to which the data are sampled from, which combines both the current preference distribution and the time-averaged distribution. We find that $\gamma_{2}=0.1$ works well consistently. This update is similar to Defazio et al. (). Using the coefficient of $\frac{1}{t}$ ensures that all the preference distributions from all time steps contribute equally to the final average, similar to the effect of post-hoc averaging.
Doing so ensures that all history is being accounted for equally. Finally, to ensure that no domain would be completely unsampled, we enforce the smallest domain probability to be no smaller than $\delta_{\text{min}}=0.01$ by clipping the probability (Appendix C). Algorithm 1 shows the pseudocode for the entire algorithm.

## 4 Experiments

##### Evaluation.

We conduct all our experiments on the Pile dataset (Gao et al., ) with decoder-only transformer language models (Vaswani et al., ) of varying sizes. We consider two types of metrics: 1. validation loss on the Pile, an unweighted version of the pile validation set where each domain receives equal probability, SlimPajama (Soboleva et al., ), and a 1 billion token subset of FineWeb (Penedo et al., ), 2. zero-shot downstream performance on 6 common-sense reasoning domains from the language model evaluation harness (Gao et al., ): HellaSwag (Zellers et al., ), WinoGrande (Sakaguchi et al., ), PIQA (Bisk et al., ), ARC-E (Clark et al., ), SciQ (Welbl et al., ), LogiQA2 (Liu et al., ) and LAMBADA (Paperno et al., ).

**Table 1: Zero-shot performance of different methods across different downstream evaluations. Highlighted cells indicate top-performing methods (deeper color indicates better performance).**
|  | HellaSwag | WinoGrande | PIQA | ARC-E | SciQ | LogiQA2 | LAMBADA | Average |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 124M-Pile | 0.279 | 0.515 | 0.615 | 0.435 | 0.747 | 0.228 | 0.357 | 0.454 |
| 124M-DoReMi | 0.279 | 0.520 | 0.609 | 0.429 | 0.741 | 0.237 | 0.368 | 0.455 |
| 124M-ODM | 0.285 | 0.514 | 0.603 | 0.453 | 0.764 | 0.230 | 0.374 | 0.461 |
| 124M-Balanced | 0.280 | 0.511 | 0.610 | 0.447 | 0.762 | 0.227 | 0.362 | 0.457 |
| 124M-Natural | 0.290 | 0.503 | 0.624 | 0.435 | 0.755 | 0.234 | 0.401 | 0.463 |
| 124M-ADO | 0.290 | 0.520 | 0.635 | 0.456 | 0.771 | 0.244 | 0.371 | 0.470 |
| 1.3B-DoReMi | 0.416 | 0.582 | 0.707 | 0.609 | 0.870 | 0.228 | 0.615 | 0.575 |
| 1.3B-Balanced | 0.382 | 0.546 | 0.689 | 0.580 | 0.862 | 0.225 | 0.613 | 0.557 |
| 1.3B-Natural | 0.424 | 0.584 | 0.718 | 0.627 | 0.886 | 0.232 | 0.624 | 0.585 |
| 1.3B-ADO | 0.442 | 0.590 | 0.730 | 0.625 | 0.875 | 0.228 | 0.638 | 0.590 |

##### Methods.

We conduct experiments at 2 computation scales: 124 million parameters (124M) and 1.3 billion parameters (1.3B). For 124M models, we use a batch size of 256 with a context length of 1024 trained for $60{,}000$ steps (approximately 15 billion tokens), and for 1.3B, we use a batch size of 2048 with a context length of 1024 trained for 60000 steps (approximately 125 billion tokens). Both scales use the natural distribution for $\mu$ and the *same* hyperparameters for ADO. Training details can be found in Appendix A.

##### Comparisons.

For comparison, we use the original Pile weights (Gao et al., , Pile) and DoReMi weights (Xie et al., , DoReMi)(^4^44Since DoReMi is sensitive to the choice of tokenizer, we used the DoReMi weights from Albalak et al. () who use the same tokenizer as we do.) as the baselines. We also consider ODM (Albalak et al., ), another online method. In addition, we introduce a simple baseline that is surprisingly missing from the literature: weighing each domain by the number of tokens in it. This mixture naturally takes into account the tokenizer being used and training on this policy essentially corresponds to training on the natural distribution of the dataset (i.e., corresponds to empirical risk minimization where train, validation, and test sets all follow the same distribution *defined by the tokenizer*). We estimate the tokens per domain by randomly sampling 1000 documents from each domain to estimate each domain’s average tokens per document, and then multiply it by the total number of documents (Appendix A). We will refer to this policy as Natural.
We also use a second baseline, Balanced, which considers the unweighted mixture of all the domains.

##### Observations.

The results for downstream performance are shown in Table 1. We will highlight some key observations here. Observation 1: at 124M scale, ADO achieves the highest average accuracy; it also outperforms all the baselines on 6 out of 7 downstream tasks and is competitive on LAMBADA.
At 1.3B scale, ADO also achieves the highest average accuracy and outperforms the baselines on 4 out of 7 downstream tasks.
Observation 2: interestingly, Natural turns out to be a very competitive baseline. It achieves the second-best average downstream performance at both scales and performs well on individual domains, too. To the best of our knowledge, very few works on data selection have benchmarked against using the empirical distribution of tokens given by the dataset and tokenizer. As such, we recommend future works on data selection to compare against this simple baseline. Balanced also turns out to be a quite competitive baseline at 124M scale likely because smaller domains are not extensively repeated given the low total number of tokens processed at this scale. This observation is in line with the findings of Goyal et al. () which suggest that good data policies are different for different compute scales.

Conventionally, validation loss is considered a good indicator of the models’ performance if they are trained on the same data, but it is less clear whether it remains a good indicator when the data policy is dynamically changing throughout the training. Empirically (Figure 4), we found that it is difficult to outperform Natural on the Pile validation loss (at least within the same training setup and without spending much more computation), even though we do outperform this mixture on the downstream tasks as shown above. Observation 3: for validation loss, ADO slightly underperforms Natural on the Pile validation set, but on the validation set of SlimPajama and a subset of FineWeb, ADO outperforms Natural. Since SlimPajama and FineWeb are heavily filtered to be “higher quality” data compared to the Pile, we speculate that ADO may be able to implicitly select data aligned with some notion of high quality throughout the training process (e.g., by prioritizing learnability). Nonetheless, since it can be challenging to quantify or precisely define “high quality” data, we will leave this investigation to future work.

Figure: Figure 4: Perplexity of 1.3B models on different domains, trained using either DoReMi, Natural, or ADO. On the left side of the red line, we have the validation perplexity on the Pile validation set, the unweighted Pile validation set, the SlimPajama validation set, and a random subset of FineWeb. On the right side of the red line, we show the validation perplexity of each domain of the Pile.
Refer to caption: x6.png

### 4.1 Analysis

##### Mixture over the training.

A natural question about data selection methods is what does the distribution look like.
We now show that the curricula learned by ADO differ for models of different scales in Figure 5. We observe that CommonCrawl (Pile-CC) receives the most probability mass in both 124M and 1.3B. This observation is consistent with some previous works that put most of the probability mass on CommonCrawl (Xie et al., ). OpenWebText2 also receives a higher proportion compared to the empirical mixture. Github receives a higher probability in 124M initially but eventually decays whereas in 1.3B it first decreases rapidly and gradually *increases* towards the end of the training.
This is consistent with the intuition that code data naturally have much lower entropy so it is “easier” to learn in some sense. ADO does not account for the fact that code could be desirable for general capabilities such as reasoning (Ma et al., ) since it is agnostic to the downstream tasks. This issue can be partially resolved by assigning a higher prior to code but further research on data selection targeting reasoning is likely needed.

Figure: Figure 5: The sampling distribution produced by our data policy during training on The Pile. For ease of visualization, we only highlight the top 6 largest domains. ADO produces qualitatively different strategies at different model scales and adaptively changes its weightings over time.
Refer to caption: x7.png

##### Accuracy of the scaling law throughout the training.

Unlike most applications of scaling laws, we refit the scaling laws on the fly as the models train and the data mixtures are dynamically changing. This introduces new challenges because the forecasts from scaling laws fit early on can be inaccurate for steps far in the future. In Figure 6, we show the predictions of the scaling laws for 3 domains at various points during training (all domains are shown in the Appendix, Figure 8). It can be seen that while the predictions of our scaling laws eventually deviate from the true learning curves, they are accurate locally for much of the training and thus can act as a learning signal for the data policy. More specifically, we can see that the scaling laws consistently *overestimate* the final loss for all domains, likely due to the presence of learning rate schedules. Empirically, when the learning rate decays towards the end of the training, the training loss tends to decrease more rapidly, until a certain point when the learning rate is too small (Hägele et al., ).
We believe that incorporating recent techniques for incorporating the effect of learning rate schedules into the scaling laws (Tissue et al., ) could further improve ADO.

Figure: Figure 6: The forecasts from our scaling laws (fit online throughout training) versus the actual training loss on different domains in the Pile. The forecasts shown were fit at $10{,}000$, $30{,}000$, and $50{,}000$ steps (time of fit is shown in dashed lines). We observe that the scaling laws: (1) become more accurate over the course of training, and (2) can be surprisingly accurate at forecasting the final loss even very early into training on some domains, such as Pile-CC. Forecasts from all domains are shown in the Appendix, Figure 8.
Refer to caption: x8.png

## 5 Related works

##### Data curation and selection.

For current large language models, compute often poses a greater constraint than data availability, making data selection crucial (Albalak et al., ). A widely used approach is *data filtering* (Soboleva et al., ; Penedo et al., ; ), where undesirable data points are removed based on heuristics like perplexity, repetition (Lee et al., ), or semantic similarity (Abbas et al., ). This filtering process is foundational for constructing most large-scale datasets today. After filtering, data is often categorized into subsets or domains (e.g., code, books), and deciding how much data to use from each domain becomes an important step.

Two primary strategies for data selection are prevalent: one focuses on deciding whether individual data points should be included based on various criteria (Mindermann et al., ; Engstrom et al., ), and the other uses all available data but samples from different domains with varying probabilities (Xie et al., ; Fan et al., ; Albalak et al., ). While data selection aims to enhance training efficiency, these methods may introduce considerable computational overhead (Xie et al., ; Chen et al., ; Fan et al., ). Moreover, Kaddour et al. () show that under the same computational budget, these methods often fail to surpass standard training, and Wang et al. () proves that the data selection’s efficacy depends on the user’s utility function.

Another line of work focuses on selecting pre-training data that aligns more closely with downstream tasks (Kang et al., ). Data selection has also been explored for computer vision. For example, Evans et al. () use a small reference model to select data for CLIP, while others propose pruning batches based on diversity criteria (Qin et al., ; Hong et al., ) to improve training efficiency.

##### Neural scaling laws.

Studies have found that various quantities of interest for large pretrained models (e.g., validation loss) can be reliably predicted with simple statistics such as the model size, dataset size, or the amount of computation (Kaplan et al., ; Hoffmann et al., ). These findings have been central to the design of training protocols for large language models where trial and error are expensive. More recent works have studied the relationship between data repetition and the performance of the models (Hernandez et al., ; Muennighoff et al., ; Goyal et al., ). Data curation, in particular pruning, has also been shown to have significant effects to achieve better scaling laws (Sorscher et al., ). Studying the loss curve via scaling law (Hutter, ) is relatively less well-explored because the loss curves do not follow a power law exactly due to the learning rate schedule; however, we found that a power law is still a decent model for learning curves with cosine decay for language models. Recently, Tissue et al. () showed that learning rate schedules can be incorporated into scaling laws to make even more accurate predictions, though we do not explore this direction in this work.

## 6 Conclusion

Dynamic data selection has the potential to
improve the pretraining efficiency of foundation models, but most existing approaches incur additional computation costs. We introduce ADO, a cheap online data selection method that dynamically adjusts data distribution over different domains based on domain scaling laws. The scaling laws forecast the model’s loss on different data domains and automatically adjust the training data distribution based on each domain’s learning potential. ADO does not require a proxy model so it naturally takes into account the architecture, the optimizer, and other hyperparameters of the training. In our experiments, with a single set of hyperparameters, ADO performs comparably to or better than existing methods on scales from 124M to 1.3B, with much less additional computation. Our implementation only added 20 minutes of additional wall-clock time to a 3.5-day training run ($\sim 0.4\%$), and can be optimized further. The relative cost would decrease more at larger scales since ADO’s cost does not scale with the model size. Overall, we believe ADO represents an important step towards accessible and automated online data selection.

##### Limitations and future directions.

Given further computational resources, it would be interesting to scale ADO up to larger models and datasets and study its behaviors more thoroughly.
On the technical side, we believe there are several promising directions: 1. how to create better and more fine-grained domains, 2. how to design more realistic scaling laws that can model inter-domain interactions and learning rate schedules, and 3. whether insights of ADO can be applied to other training settings such as continued pretraining or finetuning.

#### Acknowledgments

We are grateful to Jack Rae, Stephen McAleer, Zhangir Azerbayev, Minqi Jiang, Roberta Raileanu, Michael Xie, Andrew Jesson, Alex Robey, Sam Sokota, Swaminathan Gurumurthy, Jeremy Cohen, and Marc Finzi for helpful discussions during the early phase of this project.
We would also like to thank Mengzhou Xia and Tianyu Gao for discussion on model evaluation. The assets used in Figure 1 are courtesy of pojok d, Muhammad Ali, faisalovers from [flaticon.com](flaticon.com).
YJ is supported by the Google PhD Fellowship. AZ would like to acknowledge support from Chelsea Finn and the National Science Foundation (GRFP). SM acknowledges funding from NSF, ONR, Simons Foundation, and DARPA. We also thank the Google TPU Research Cloud for generously providing computing for the experiments in this paper.

#### Reproducibility

The code for this work is available at [https://github.com/yidingjiang/ado](https://github.com/yidingjiang/ado).

## Appendix A Training details

Architecture.
All experiments use the same architecture, which follows the Llama 2 family (Touvron et al., ): a Transformer-based language model with key components including SwiGLU MLP layers (Shazeer, ), RMS normalization (Zhang & Sennrich, ), and rotary embeddings (Su et al., ). We use the GPT-NeoX-20B tokenizer (Black et al., ), and tie the weights in the embedding and final layers. Our experiments contain models trained at two scales: 124M parameters and 1.3B parameters.

Training. All models were trained for $60{,}000$ steps at batch size $2048$ (1B) or $256$ (124M), using AdamW (Loshchilov, ). We use decoupled weight decay with $\lambda=10^{-4}$, set $\beta_{2}=0.05$, and otherwise use default hyperparameters as specified by Optax (DeepMind et al., ). For ADO, we fit scaling laws for each domain every $1{,}000$ training steps starting at step $5{,}000$ (we run an empirical sampling strategy for the first $5{,}000$ steps).

Compute and time expenditure.
We ran our experiments on TPUs using the open-source midGPT library (Zhou et al., ), which is based on JAX (Bradbury et al., ) and Equinox (Kidger & Garcia, ). All experiments were run on Google Cloud TPUs. On a TPU v3-128, a 1B model can be trained for $60{,}000$ steps in $\sim 3.5$ days. Fitting scaling laws for all domains takes less than $20$ seconds–over the course of a training run, this amounts to under $19$ minutes in additional time spent fitting scaling laws. This number can likely be further improved by using a smaller or smarter / non-uniform grid (we found the results to be not sensitive to the size of the grid search) or smarter optimization custom-made for power law. Although not present in our particular implementation, the fitting of the scaling laws could, in principle, take place asynchronously in parallel with model training since it does *not* require any information from the model other than the loss, which can be staggered as the scaling laws remain accurate for some duration into the future.

### A.1 Fitting scaling laws

We fit an individual loss curve scaling law to each domain where the input is the total number of samples processed so far, and the prediction is the training loss of that particular domain. Namely, suppose the dataset is broken down into $K$ distinct heterogeneous domains, we would learn $\widehat{{\mathcal{L}}}_{k}(n)=\varepsilon_{k}+\beta_{k}n^{-\alpha_{k}}$. To estimate these parameters of the scaling law, we use the standard procedure for fitting a power law (Hoffmann et al., ) which minimizes the Huber loss with $\delta=0.001$ between the predicted log loss and observed log loss with L-BFGS:

$$ $\displaystyle\min_{\varepsilon_{k},\beta_{k},\alpha_{k}}\sum_{n}\text{Huber}_{ \delta}\left(\log\widehat{{\mathcal{L}}}_{k}(n)-\log{\mathcal{L}}_{k}(n)\right).$ (6) $$

Since learning curves have a large number of points, we subset the learning curve at regular intervals to obtain the data for fitting. Similar to prior works, we use grid search with different initialization, although we found that usually a smaller grid search suffices since the individual scaling laws do not need to be very accurate. The losses of the first $500$ steps are not included as the weights have not stabilized yet and we subsample the trajectory at $10$-step intervals to speed up the training. This does not significantly impact the algorithm since scaling laws do not change drastically. We also apply a threshold to the parameters’ values to mitigate potential instability due to online fitting.

$\beta$ and $\varepsilon$ are both parameterized in their log forms. We use a grid search over the following parameters initialization:

- •
$\alpha_{0}\in\{0.1,0.2,0.3,0.4,0.5,0.6,0.7\}$
- •
$\log\beta_{0}\in\{-2,-1,0,1,2,3,4,5\}$
- •
$\log\varepsilon_{0}\in\{-2,-1.5,-1,-0.5,1,1.5\}$

Further, we enforce $0<\alpha<0.8$, $\log\beta<6.5$ and $\log\varepsilon>0.5$. These bounds are purely preventative in cases of numerical instability and are almost never saturated.

### A.2 Estimated empirical mixture

In Figure 5, we show various data mixtures used in this paper. For the natural distribution, we sampled 1000 documents from each domain, tokenized them with our chosen tokenizer, and then computed the average number of tokens per document. Using the estimated average, we can estimate the total number of tokens within a domain by multiplying it by the number of documents.

Note that the DoReMi differs from the number of  Xie et al. () due to the use of different tokenizers. The numbers we use here are from Albalak et al. () which uses GPT-NeoX-20B tokenizer (Black et al., ) like us. Also, note that the estimated empirical distribution differs from the default Pile weights. Notably, Github and Wikipedia are weighted significantly higher.

**Table 2: Different mixtures used in this paper.**
| Dataset | Natural | DeReMi | Pile |
| --- | --- | --- | --- |
| FreeLaw | 0.0449 | 0.0380 | 0.0612 |
| Enron Emails | 0.0010 | 0.0040 | 0.0014 |
| Github | 0.1227 | 0.0325 | 0.0759 |
| OpenSubtitles | 0.0158 | 0.0032 | 0.0155 |
| PubMed Central | 0.1215 | 0.0608 | 0.1440 |
| OpenWebText2 | 0.1096 | 0.1905 | 0.1001 |
| StackExchange | 0.0491 | 0.0746 | 0.0513 |
| Pile-CC | 0.1825 | 0.1379 | 0.1811 |
| ArXiv | 0.0886 | 0.0535 | 0.0896 |
| USPTO Backgrounds | 0.0262 | 0.0327 | 0.0365 |
| Books3 | 0.1046 | 0.0757 | 0.1207 |
| Wikipedia (en) | 0.0402 | 0.1068 | 0.0153 |
| PubMed Abstracts | 0.0221 | 0.0970 | 0.0307 |
| NIH ExPorter | 0.0019 | 0.0084 | 0.0030 |
| BookCorpus2 | 0.0063 | 0.0037 | 0.0075 |
| EuroParl | 0.0081 | 0.0120 | 0.0073 |
| HackerNews | 0.0047 | 0.0084 | 0.0062 |
| DM Mathematics | 0.0191 | 0.0019 | 0.0124 |
| YoutubeSubtitles | 0.0040 | 0.0117 | 0.0060 |
| PhilPapers | 0.0027 | 0.0093 | 0.0038 |
| Ubuntu IRC | 0.0049 | 0.0083 | 0.0088 |
| Gutenberg (PG-19) | 0.0195 | 0.0292 | 0.0217 |

## Appendix B Meta-learning permutations

Suppose we have a dataset ${\mathcal{Z}}=\{{\bm{z}}_{1},{\bm{z}}_{2},\dots,{\bm{z}}_{N}\}$ drawn from the distribution $P_{\bm{z}}$ and we wish to train a model in the *one-epoch* setting, that is, the model gets to see each example only once(^5^55This is common for the training regime of the modern language model.). In this setting, the space of curricula is ${\mathcal{S}}_{N}$, all permutations of $[N]$. Note that the size of this search space $|{\mathcal{S}}_{N}|=N!$ is extremely large for even a small $N$, and would be even larger if we allowed data repetition. Given a curriculum $\sigma:[N]\rightarrow[N]$ and the stochastic gradient descent update rule $U(\theta,{\bm{z}})=\theta-\eta\nabla_{\theta}\ell({\bm{z}};\theta)$, we initialize the model parameters $\theta_{0}$ and iteratively update them: $\theta_{t+1}=U(\theta_{t},{\bm{z}}_{\sigma(t)})$. We can denote the entire training process from $\theta_{0}$ to $\theta_{N}$ by $\theta_{N}=\mathtt{SGD}(\theta_{0},\sigma,N)$.

In standard SGD, the curriculum is a randomly sampled permutation, $\sigma_{\text{random}}\sim\text{Unif}\left({\mathcal{S}}_{N}\right)$. Given the size of the search space, we can instead formulate the problem of finding curricula as an optimization problem over ${\mathcal{S}}_{N}$. An optimization problem needs an objective, but what should the objective be for finding a good curriculum? The ultimate goal of this problem is to find a curriculum such that the final parameter $\theta_{N}$ achieves a low population loss, i.e., $\sigma^{\star}=\operatorname*{arg\,min}_{\sigma}\mathbb{E}_{{\bm{z}}\sim P_{
\bm{z}}}\left[\ell({\bm{z}};\mathtt{SGD}(\theta_{0},\sigma,N))\right]$. However, we cannot in general assume access to the data distribution so we need a surrogate objective. In this experiment, we use the following surrogate meta objective that depends only on the training data:

$$ $\displaystyle\sigma^{\star}=\operatorname*{arg\,min}_{\sigma}\frac{1}{N}\sum_{ t=0}^{N-1}\sum_{i=1}^{N}\ell({\bm{z}}_{i};U(\theta_{t},z_{\sigma(t)}))= \operatorname*{arg\,min}_{\sigma}{\mathcal{L}}(\sigma).$ (7) $$

This objective encourages the curriculum to minimize the total training loss after each update (i.e., training as fast as possible). Since we are in the one-epoch setting, the parameters are updated with the gradient of each example only once so there is less, if any, risk of overfitting.

One obstacle to directly learning a good curriculum here is that gradient-based optimizers are not suitable for searching over permutations. We follow Mena et al. () and parameterize the curriculum with a matrix $Z\in\mathbb{R}^{N\times N}$. We then use the Sinkhorn operator $S(\cdot)$ to project $Z$ to a doubly stochastic matrix $X=S(Z)$ (Sinkhorn, ; Adams & Zemel, ), which we can think of as a “soft” approximation to a permutation. Since $X$ is doubly stochastic but not necessarily an actual permutation, we use a generalization of our meta-objective:

$$ $\tilde{{\mathcal{L}}}(X)=\frac{1}{N}\sum_{t=0}^{N-1}\sum_{i=1}^{N}\ell\left({ \bm{z}}_{i};\theta_{t}-\eta\frac{1}{N}\sum_{j=1}^{N}X_{tj}\nabla_{\theta}\ell( {\bm{z}}_{j};\theta_{t})\right).$ (8) $$

This loss generalizes our actual objective in the sense that, in the special case where $X$ is not only doubly stochastic but also a permutation, then it reduces to the loss in Eq. 7.

After optimizing $Z$ against the modified objective, we can project $Z$ to a true permutation which serves as our final learned curriculum:

$$ $\displaystyle Z_{t+1}=Z_{t}-\eta\nabla_{Z}\tilde{{\mathcal{L}}}(S(Z_{t})), \quad\sigma=\operatorname*{arg\,max}_{P\in\mathcal{P}_{N}}\langle Z_{\infty},P\rangle.$ (9) $$

This procedure can be further generalized to selecting a minibatch. To do so, we relax the constraints on $X$ from a doubly stochastic matrix to a matrix differentiable top-K relaxation at each row (Xie & Ermon, ). We apply this to the MLP experiments in Figure 3 with minibatch size $10$.

## Appendix C Clipping function

Below is the pseudocode we use for clipping the probability. It evenly distributes the excess probability amongst the other categories.

Figure: Algorithm 2 Clip Minimum Probability

## Appendix D Additional empirical results

Figure: Figure 7: Exrapolating the loss of larger models on each domain of the Pile with the loss of models with fewer than 1B parameters.
Refer to caption: x9.png

Figure: Figure 8: ADO loss forecasts produced by our scaling laws on each domain in The Pile while training a 1B model. Scaling laws are fit regularly throughout training, with the forecasts shown being from fits at $10{,}000$, $30{,}000$, and $50{,}000$ steps (dashed line shows when each scaling law was fit).
Refer to caption: x10.png

## Peer Reviews

confidence: 3
contribution: 2
initial_rating: 6
presentation: 3
questions: 1. Figures 6, 7, and 8 show the training loss for ADO only. I'd like to see how quickly ADO's training loss decreases compared to the baselines. I assume that ADO converges faster, but it would be interesting to observe how it performs relative to the baselines.

2. Can ADO be effectively applied to vision data and tasks? It would be of great importance if ADO could be used in training vision models that require multiple domains, such as large vision-language models (LVLMs) and diffusion models for image generation.
soundness: 3
strengths: 1. The motivations presented in Section 2 highlight significant concerns, and the proposed method properly addresses these issues.
2. ADO outperforms the baselines overall, offering online data selection without the requirement of external knowledge or proxy models.
3. The authors present several interesting observations that align with our intuition and the literature (e.g. line 428, 409, 431).
summary: The authors propose ADO, an online data selection method that adjusts data distribution dynamically across various domains by leveraging domain scaling laws. Without requiring a proxy model or external knowledge, ADO forecasts the model's loss on different data domains and automatically modifies the training data distribution according to each domain's learning potential. The experiments indicate that ADO surpasses baseline methods overall, with only a minimal increase in clock time.
weaknesses: 1. Although the 1.3B model is not small, ADO is especially practical and relevant for LLMs with at least 8B parameters—the size typical of many popular "small" LLMs such as Llama 3.1 8B. The paper's relevance and importance might have been enhanced if the authors had conducted experiments with language models of at least 8B parameters
2. The performance improvement achieved by ADO does not seem significant enough, especially on the 1.3B model. More problematically, Table 1 shows diminishing returns as the model scale increases from 124M to 1.3B parameters. For example, 1.3B-ADO only outperforms 4 out of 7 downstream tasks, whereas 124M-ADO outperforms 6 out of 7 tasks. Additionally, the gap between the average score of ADO and the second-best baseline is less pronounced in the 1.3B model. This suggests that ADO may not scale well as the number of parameters increases.
3. Although the authors propose interesting future research directions (e.g. Section 6), incorporating some of these suggestions—such as learning rate scheduling—into the current paper would make it more complete and thorough.

---

confidence: 3
contribution: 2
initial_rating: 5
presentation: 2
questions: - The smoothing parameter $s$ for computing the credit assignment scores seems a bit confusing. By using $s<1$, I suppose $\lambda_k$ indeed changes drastically when $h_k$ is close to 0? Should using $s<1$ encourages $\lambda_k$ to be larger than $h_k$ especially when $h_k$ is originally close to 0? Some further discussion on the effect of this hyper-parameter may be necessary. 
- Also, can we consider other types of functions to compute $\lambda_k$ from $h_k$? Some empirical comparison on different types of functions may help others better understand how the credit assignment score affects model training, and why the authors reject simply using $\lambda_k=h_k$ here. 
- Experiments are limited to medium scale models (124M and 1.3B), and the performance gain seems to decrease with increasing model size. Such a tendency can naturally make one wonder if the performance gain can be smaller or even diminish on larger models (e.g., 2.3B or 7/8B)? Some more empirical results may be necessary to better support the proposed method. 
- While the proposed method includes many hyper-parameters (e.g., the smoothing parameter $s$ mentioned above), the authors did not provide sufficient analysis on how these hyper-parameters can affect the final performance. These results should be necessary to demonstrate that ADO can be robust to different values of these hyper-parameters. 
- Despite showing the final sampling probabilities in Figure 5, the authors may also consider further showing how $\lambda_k(t)$ and $\frac{\partial}{\partial n} \hat{L}_k(n)$ changes with training iteration $t$. These results may help others better understand how these two terms affect the sampling probabilities of different domains and how they can affect model training.
soundness: 2
strengths: The proposed method is introduced clearly and easy to understand
summary: This paper proposes a novel method ADO to adaptively sample data from different domains based on their contribution to model training, which is estimated from scaling law in an online manner. Empirical results on different data sets demonstrate the effectiveness of the proposed method.
weaknesses: - Several parts of ADO lack sufficient motivation
- Empirical results seem not supportive enough to fully evaluate the proposed method

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: 1.	In ADO's data selection process, some datasets might receive minimal training due to low selection probabilities, potentially leading to under-representation. Have any additional measures been implemented to balance data distribution and ensure adequate representation across datasets?
2.	How sensitive is ADO to changes in its hyperparameters, such as the smoothing coefficient (γ1) and update intervals? Would different tasks or datasets require significant parameter tuning?
3.	Given the current limitation in modeling solely intra-domain interactions, have the authors considered potential methodologies to incorporate inter-domain interactions within the ADO framework? What approaches might be feasible for capturing these cross-domain dynamics to enhance the model’s adaptability and performance in tasks where inter-domain relationships play a significant role?
4.	ADO is designed to be task-agnostic, but certain applications may benefit from targeted data selection. Could ADO be extended to incorporate task-specific objectives without compromising its efficiency?
soundness: 2
strengths: 1.	ADO utilizes online scaling laws to dynamically adapt data selection during training, replacing the need for pre-trained proxy models or multi-staged processes. It requires no prior domain knowledge or external models, making it highly practical and versatile.
2.	The paper presents empirical evaluations demonstrating ADO's effectiveness across multiple benchmarks and datasets. ADO outperforms or matches existing baselines on several downstream tasks while incurring a small computational overhead (e.g., less than 0.4% additional wall-clock time).
3.	ADO offers a practical, scalable solution for data selection in large model training, with the potential to significantly reduce computational waste. The method aligns with the growing emphasis on efficient resource utilization in AI research, especially as models scale in size and cost.
summary: The paper introduces ADO, a novel online algorithm for optimizing data distributions during the training of large-scale foundation models. ADO addresses the challenge of efficiently managing data mixtures in pretraining by continuously adapting the data distribution based on scaling laws, without requiring proxy models or significant computational overhead. The primary contribution lies in the use of per-domain scaling laws to estimate learning potential and dynamically adjust the data mixture during model training. Experimental results demonstrate that ADO can achieve comparable or better performance than prior methods, while maintaining computational efficiency across various model scales.
weaknesses: 1.	Figure 4 reveals that fewer than half of the datasets achieve minimal perplexity under the ADO algorithm, indicating potential limitations in the algorithm’s generalization capability across diverse scenarios. The paper would benefit from a more detailed analysis of ADO's applicability.
2.	The algorithm employs heuristic choices for key parameters, such as the exponential moving average in credit assignment and smoothing coefficients, which may impact the robustness and consistency of ADO across different datasets and tasks due to the lack of a more systematic basis for parameter selection.
3.	Symbols such as $\gamma_2$ appears in key formulas but might be clarified further with more detailed context, especially for readers unfamiliar with its role in the algorithm.
4.	Although ADO highlights low computational overhead as a strength, the paper lacks a systematic computational complexity analysis and comparative experiments. The absence of quantitative and visual evidence of its efficiency limits the clarity of its computational advantages.

---

confidence: 4
contribution: 2
initial_rating: 5
presentation: 4
questions: - About Figure 2, I think the point on the variance is clear. But what’s more important is the agreement of the relative order of data strategies: if a data strategy is better than another on a smaller model, is it also better on a larger model? Did the authors study that? Also, what are the blue dots? I guess they are the actual validation loss of different model sizes, but would be nice to make it clear in the caption.
- The authors also write “they find $\gamma_1 = 0.1$, $s = 0.5$, $\gamma_2 = 0.1$” works well. How exactly is the process of finding those values?
- The authors write in line 480: “they are accurate locally for much of training and thus can act as a learning signal for the data policy”. On what basis do the claims are made?
soundness: 3
strengths: - Novelty. It’s a novel idea to improve over online data optimization (ODM, Albalak et al. (2023)) on 3 aspects. 1) Using scaling law to predict training loss on each domain and the derivative of the loss w.r.t. to the number of data points has intuitive interpretation as the loss reduction per data point. 2) The weighting also considers the number of data points used for a domain. 3) A combined weighting with the above two and temporal average.
- Readability. The paper not only shows their method works but also spends a reasonable amount of space discussing perspectives, hence better readability. For example on the curriculum learning (Section 2) and on the requirements (Section 3, online and agnostic to downstream tasks) of data optimization for pretrained models.
- Besides their proposed method, the authors also discover a strong baseline called “natural” policy, that depends on the number of tokens in each domain.
summary: This work proposes an online adaptive data optimization (ADO) method for finding a policy (weighting) for different domains when pre-training a language model. The core idea is to use scaling law to model training loss. The derivative of the loss w.r.t. to the number of data points can be understood as loss reduction per data point locally, i.e. outline the potential for a domain. The final scoring also considers the contribution of the domain itself from the last update and makes it stable with a moving average. Their experiments show the ADO brings improved downstream performances on 7 common-sense reasoning tasks.
weaknesses: - Many heuristics are used such as fitting of scaling law (Section 3.1 eq1), credit assignment (Section 3.2, eq2 ), preference distribution (Section 3.3, eq3) and temporal average (eq4 and eq5). The authors try to motivate those choices from related works and intuitions, but only eq1 is adequately explained and validated. 
- Following the above, are all the heuristics (eq 1- 5) necessary? How important are they? This is a missing part in the paper. An ablation on them can validate if the invented heuristics are actually all useful.

Meta-review: This paper proposes an algorithm to optimise data distributions accros domains during model training in order to leverage domain-based scaling laws. The claims are supported and validated experimentally. The topic is timely and all reviewers agreed that the results are worth sharing with the community. One remaining question remained unanswered, namely that we do not know for sure whether the proposed method would still work with bigger models than the ones considered in the paper. While this is a valid point, it does not invalidate the results reported in this work. The authors also provided an adequate discussion of this limitation.

Decision: Accept (Poster)