                                                                       !                                                                !   !







                                  MixMin: Finding Data Mixtures via Convex Minimization





      Source 1                                         Optimize

                                                       mixtures

                  Train cheap                Target                                              Train on

                                                         with

      Source 2       proxy                             MixMin                                    re-mixed

                    models                                                                         data

      Source 3







Figure 1: Optimizing MixMin to find the mixture weights requires training a few cheap models for each source and a target

dataset. Given the mixture weights we train a more expensive model using the mixture.





the fact the Bayes optimal model for a mixture is the mixture       assays (e.g., distinct but predictive cytotoxicity assays). To

of the Bayes optimal models for each source. However,               summarize, our contributions are:

this reduction does not yet make data mixing amenable to

first-order optimization. To evaluate our convex objective’s          1. Observing data mixing reduces to a single convex min-

gradient we need the Bayes optimal model for each source.                imization as model classes become more expressive

A key challenge is that the proxy models needed to evaluate           2. Proposing MixMin which approximately solves the

this convex objective can be expensive to compute. We                    convex objective by using cheap proxy models and

find that in practice, we can use cheaply computed mod-                  downstream data samples

els and still have good data mixing performance. We call

this approach to optimizing the convex objective MixMin.              3. Empirically showing MixMin improves past baselines

Empirically, we found the performance of MixMin did not                  for finding data mixtures across language modeling

significantly degrade between using proxy models computed                and chemistry tasks

with 100% the cost of a full training run to 1%. In other

                                                                      4. Empirical and analytical evidence showing MixMin is

cases, the MixMin mixture significantly improved over base-

                                                                         robust to the use of weak/cheap proxy models

lines, but the ensemble of proxy models performed much

worse than retraining, suggesting they were far from Bayes

optimal but did not hinder MixMin performance.                      2. Preliminaries

We empirically compared data mixing with MixMin to cur-             We denote a hypothesis space by H, a model by f : X →

rent baselines on both language modeling and chemistry              O ∈ H, a datapoint by (x, y) ∈ X × Y, and our loss

tasks. For language modeling we considered optimizing the           function by L(o, y) : O × Y → R+ . This paper considers

mixture of source domains in SlimPajama (cer, 2023) for             the problem of mixing a set of finite source distributions

PIQA (Bisk et al., 2020), ARC Easy (Clark et al., 2018),            (dp ∈ P where P is finite) to train on to do better on

SciQ (Welbl et al., 2017), or OpenWebMath (Paster et al.,           some downstream “target” distribution (dt). For example,

2023). In all cases we found MixMin improved the base-              mixing Wikipedia and arXiv data to do better on benchmarks

lines for log likelihood, improving or maintaining the gap          evaluating scientific knowledge.

as we increased the scale of the models from pythia-160M

                                                                    Specifically, we are searching for the best weighting λ ∈

to pythia-410M (Biderman et al., 2023). Moreover, for

                                                                    ∆P (where ∆P is the simplex) of our sources to train a

pythia-410M the mixtures we used took 0.15% the com-

                                                                    model on to perform well on our downstream distribution.

pute of the training run to find and improved the negative

                                                                    Formally, using our loss function L as both our measure of

log likelihood by 1 − 5%. For our chemistry experiments

                                                                    downstream performance and training objective:

we considered mixing assay datasets in PubChem (Beaini

et al., 2023; Kim et al., 2016) to improve the performance

of an XGBoost (Chen & Guestrin, 2016) model on several                                               Z

held-out assay datasets. In all cases, we observed MixMin                            DM (λ, H) =                 L(fλ (x), y)dt(x, y)

improved over the natural distribution (the standard data                                                ZX ×Y

mixture after filtering for this domain (Salem et al., 2020;

                                                                                                X

                                                                    where fλ (x) = arg min          λp           L(f (x), y)dp(x, y)

Li et al., 2022; Ye et al., 2018)) as we increased the num-                              f ∈H             X ×Y

ber of surrogates to mix over, improving average precision                                                             (Data Mixing)

scores between 0.03 − 0.15. We note an additional benefit

of optimizing data mixtures for chemistry tasks is that the         In general minλ DM (λ, H) a bi-level optimization that can

found MixMin weights could provide interpretability; we             be hard to optimize: a standard approach is grid/random

highlight patterns MixMin found in PCBA for predicting              searching through mixture weights and solving the inner



                                                                2

