Skip to main content

solvers.ScalingModel

solvers.ScalingModel()

Analyzes the ‘Scaling Physics’ of model training (Chinchilla Laws).

This model determines the optimal model size (P) and dataset size (D) given a compute budget (C), following the compute-optimal training regime where D ≈ 20P.

Literature Source: 1. Hoffmann et al. (2022), “Training Compute-Optimal Large Language Models.” 2. Kaplan et al. (2020), “Scaling Laws for Neural Language Models.” 3. McCandlish et al. (2018), “An Empirical Model of Large-Batch Training.”

Methods

Name Description
solve Allocate a training compute budget between parameters and tokens.

solve

solvers.ScalingModel.solve(compute_budget, target_model_size=None)

Allocate a training compute budget between parameters and tokens.

Parameters

Name Type Description Default
compute_budget Quantity Finite positive training work in FLOPs, or a finite positive duration interpreted as reference-H100 compute time at the declared sustained efficiency. Any compatible FLOP prefix is accepted and normalized before calculation. required
target_model_size Quantity Finite positive fixed parameter count. If omitted, use the registered compute-optimal tokens-per-parameter ratio. None

Returns

Name Type Description
ScalingResult Modeled parameter and token counts, compute budget, and dimensionless tokens per parameter. The result does not include a quality estimate or a memory-feasibility decision.

Notes

Equation: C = k P D, where k is the registered compute coefficient. With D = r P, P = sqrt(C / (k r)); when P is fixed, D = C / (k P). A time input becomes C = duration * reference_peak * reference_MFU.

Assumptions: parameter-dominated dense training work and a constant registered optimal token ratio. The time conversion uses a declared reference accelerator rather than an arbitrary fleet supplied by a user.

Excludes: inference cost, data-quality variation, architecture-dependent loss prediction, attention work, and hardware memory capacity.

References

Hoffmann et al. (2022), “Training Compute-Optimal Large Language Models.” https://arxiv.org/abs/2203.15556 (bibliography key: hoffmann2022chinchilla). The fixed-ratio allocation is the package’s simplified accounting form.

Examples

>>> result = ScalingModel().solve(Q_(1200000, "flop"))
>>> result.optimal_parameters.to("count").magnitude > 0
True
>>> result.optimal_tokens.to("count").magnitude > 0
True
Back to top