mixle.models.train_search module¶
DoE for training LLMs – multi-fidelity Bayesian optimization of the training recipe, budget as the fidelity.
Training a language model is the expensive-objective, cheap-proxy setting multi-fidelity BO is built for: a short
run (few steps / a data subset) is a noisy, cheap estimate of the full run’s loss. tune_training() wraps
mixle.doe.multi_fidelity_minimize so the search spends cheap low-budget runs to locate good recipes and
reserves full-budget runs to refine – reaching a good recipe for a fraction of the compute of grid search.
The objective is your training callback train(recipe, budget) -> held-out loss (budget in (0, 1] is the
fraction of full training), so it scales from a tiny local model to a real pretraining loop unchanged –
lm_train_fn() gives a ready callback that trains a mixle LM.
extrapolate_learning_curve() predicts a full-budget loss from a partial run’s curve, for early stopping.
- class TrainingSpace(d_model_choices=(64, 128, 256, 512), n_layer_range=(2, 12), log10_lr_range=(-4.0, -2.0), batch_choices=(16, 32, 64, 128))[source]
Bases:
objectThe tunable axes of an LM training recipe and how a unit-cube point decodes into concrete knobs.
- Parameters:
- class TrainingSearchResult(recipe, loss, history=None)[source]
Bases:
objectThe outcome of a multi-fidelity training search: the best recipe, its full-budget loss, and the history.
- loss: float
- history: Any = None
- tune_training(train, space=None, *, fidelities=(0.25, 1.0), costs=None, max_cost=20.0, n_init=None, seed=0)[source]
Multi-fidelity BO of the training recipe;
train(recipe, budget)returns held-out loss (lower is better).fidelitiesare the training-budget fractions the search may run at (cheap first). Returns the recipe with the best full-budget loss and the full BO history. Scale the objective by swappingtrainfor a real launcher – the search machinery is identical.
- lm_train_fn(token_ids, val_ids, *, vocab, block=64, max_epochs=3, device='cpu')[source]
A ready training callback
(recipe, budget) -> held-out nats/tokenthat trains a real mixleLM.budget in (0, 1]scales the number of epochs (the cheap-fidelity axis is training length); a real pretraining loop would scale steps or the token subset the same way.
- extrapolate_learning_curve(steps, losses, *, at)[source]
Predict the loss at budget/step
atfrom a partial run’s(steps, losses)via a power-law fit.Fits
loss(t) = a + b * t^(-c)(the standard learning-curve form) and evaluates it atat– so a cheap partial run can estimate the full-budget loss for early stopping. Falls back to the last observed loss if the fit fails.