Predict optimal data mixture proportions for multi-domain LLM training using scaling laws that require only 10-20 small experiments. Determine which domains should contribute how much data across model sizes (186M-7B), reducing computational waste in foundation model pretraining.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Predict optimal data mixture proportions for multi-domain LLM training using scaling laws that require only 10-20 small experiments. Determine which domains should contribute how much data across model sizes (186M-7B), reducing computational waste in foundation model pretraining.
Scaling Laws for Optimal Data Mixtures: Efficient Multi-Domain Foundation Model Training
Foundation models trained on diverse domains (code, math, text) must decide how much data from each domain to include. Current practice uses trial-and-error, wasting compute on suboptimal mixtures. This work proposes scaling laws that predict model loss as a function of model size (N), training tokens (D), and domain weights (h), enabling practitioners to determine optimal mixtures efficiently.
The key insight is that only 10-20 small-scale training runs are needed to fit accurate scaling laws that extrapolate to much larger models. Two law formulations are provided: additive (mixture-independent scale parameters, predicting scale-independent optimal mixtures) and joint (mixture-dependent scale parameters, predicting compute-budget-dependent optima). Both formulations have been validated across language models, multimodal models, and vision models.
Core Concept
Multi-domain training loss can be modeled as: E + 1/∑(C_i·h_i^γ_i) + A/N^α + B/D^β, where only the bias term E depends on domain weights h. This reveals a crucial property: for additive scaling laws, optimal domain weights are compute-independent—they don't change with model size or total training budget. Only the absolute performance scales.
For joint scaling laws where scale parameters A and B themselves depend on mixture composition, optimal weights become budget-dependent. The fitting procedure uses Basin-hopping with L-BFGS to navigate the high-dimensional parameter space efficiently.
Architecture Overview
Additive Scaling Law Formulation: Loss depends on domain-weight-dependent bias term; scale parameters (A, B) are mixture-independent
Joint Scaling Law Formulation: Both scale parameters and bias depend on mixture; accounts for scale-mixture interactions
Loss Prediction Pipeline: Fit scaling laws to small experiments, extrapolate to large models/compute budgets
Optimization Framework: Basin-hopping + L-BFGS to solve mixture optimization problem over weight simplex
Multi-Model Validation: Tests on language models (186M-7B), multimodal (image+text), and vision encoders
"""
Predict loss for given model size, tokens, and domain mixture.
Args:
model_size: Model parameter count N
tokens: Total training tokens D
mixture_weights: (num_domains,) domain weight distribution, sums to 1
Returns:
Predicted loss
"""
# Bias term depending on mixture
0.0
0.0
for
in
range
self
self
self
1.0
1e-8
# Scale terms independent of mixture
self
self
self
self
return
def
fit_to_experiments
self, experiments: list
"""
Fit scaling law to experimental data.
Args:
experiments: List of {
'model_size': N,
'tokens': D,
'mixture_weights': (num_domains,),
'loss': measured loss
}
Returns:
Fitted parameters (C, gamma, A, alpha, B, beta)
"""
def
objective
params
# Unpack parameters
self
self
2
self
2
self
2
self
1
2
self
2
2
self
3
# Update self
self
self
self
self
self
self
# Compute MSE
0.0
for
in
self
'model_size'
'tokens'
'mixture_weights'
'loss'
2
return
len
# Initial guess
self
self
self
self
self
self
# Optimize
'method'
'L-BFGS-B'
'bounds'
0.1
10
2
self
0.01
100
0.1
2
0.01
100
0.1
2
20
42
return
def
find_optimal_mixture
self, model_size: int, tokens: int
"""
Find domain mixture that minimizes loss for given compute budget.
For additive formulation, optimal mixture is compute-independent!
Args:
model_size: Target model size (for validation)
tokens: Target training tokens (for validation)
Returns:
Optimal mixture weights (sums to 1)
"""
def
objective_mixture
weights
# Constraint: weights sum to 1
if
not
sum
1.0
return
1e10
# Minimize over mixture (ignoring scale terms since they don't depend on h)