Scaling fits and compute allocation
Use empirical scaling models to make constrained allocation decisions while testing extrapolation, fit uncertainty, and deployment costs.
On this page
The question for today
What you’ll understand
- Interpret an empirical model of loss versus parameters and tokens.
- Derive a compute-constrained allocation in a simplified model.
- Identify when inference cost or data quality changes the decision.
Given a fixed compute budget, should a language model use more parameters or see more tokens? Empirical scaling studies turn that question into a measurable allocation problem. Their fitted curves summarize particular experiments under particular training recipes. They are not physical laws guaranteeing future capabilities. A useful engineer reads the axes, fit domain, residuals, and cost model before applying a published exponent to a new architecture, dataset, or hardware generation.
Separate the fit from its interpretation
A common illustrative loss fit combines an irreducible floor with terms that decrease as model size and training data increase. Parameters are learned from measured runs; the formula does not establish that data are independent, equally useful, or indefinitely available. The meaning of loss also depends on tokenizer, validation distribution, and preprocessing. Compare held-out fits on a consistent task, and retain residual plots so systematic misses are visible rather than concealed by a smooth line.
Training compute is often approximated as proportional to parameter count times processed tokens for a chosen dense model family. The proportionality constant hides architecture and accounting conventions. Attention cost, sequence length, sparsity, recomputation, and hardware utilization can break a naive conversion from floating-point operations to wall time. Distinguish algorithmic operation count from measured accelerator-hours and cost. A budget in money may favor a different model than a budget in abstract operations.
Optimize within a declared budget
Substitute the compute constraint into the loss model, leaving one variable. At an interior optimum, increasing model size improves the parameter-limited term while worsening the data-limited term because fewer tokens fit. Balancing derivatives gives a conditional allocation rule. If the fitted exponents coincide and units are normalized consistently, the optimum divides the tradeoff symmetrically only when the fitted coefficients also align. Equal exponents alone do not imply equal raw parameter and token counts.
Use the optimum as a candidate for experiments, not a purchase order. Propagate uncertainty in fitted coefficients and compare several nearby allocations. A shallow loss valley may make a range of choices indistinguishable given run-to-run noise. Validate the extrapolation with intermediate scales before spending the full budget. Data repetition, deduplication, or a changed mixture can alter effective data quality even when the nominal token count increases.
Include the lifetime of the resulting model
A training-optimal model need not minimize lifetime cost. A smaller model trained longer can cost more to create but less to serve across billions of future requests. Count adaptation, evaluation, storage, and inference under the same workload and quality requirements. Conversely, a larger model may reduce the number of calls or generated tokens needed for a task. Compare completed useful tasks, not just a token price detached from output quality.
Capability benchmarks can show thresholds, noise, or metric artifacts even when validation loss changes smoothly. An empirical loss fit does not prove that a deployment will become safe, reliable, or capable at a particular scale. Record the forecast, uncertainty interval, and decision criteria before running the next scale. When evidence disagrees with the prediction, inspect data and optimization changes instead of forcing a new result into the old curve.
Work it through
Allocate a normalized toy compute budget
Use normalized variables with loss excess 4/N + 9/D and constraint ND=144. Find the continuous optimum and compare it with N=D=12.
Substitute D=144/N. The excess loss becomes 4/N + N/16.
Differentiate: −4/N² + 1/16 = 0, giving N²=64 and positive N=8.
Then D=144/8=18, and excess loss is 4/8 + 9/18 = 1.
At N=D=12, excess loss is 4/12 + 9/12 = 13/12 ≈ 1.0833. The unequal coefficients favor the 8-by-18 allocation in this toy fit.
The optimum is N=8, D=18 in normalized units. These numbers illustrate constrained reasoning, not a recommendation for a real model size.
The living notebook
Explore the model
Interactive lab · function
Inspect a local quadratic approximation
Vary a and x in y=ax², its tangent slope 2ax, and its signed area from zero to x. A positive quadratic can illustrate local curvature near a smooth allocation optimum, but this lab does not plot the fitted scaling model or optimize a real training budget.
- y at chosen x
- 0.608
- Tangent slope · 2ax
- 1.35
- Signed area · ax³/3
- 0.182
This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA local approximation is useful only inside a region supported by the underlying measurements.
Pause & reason
Check your understanding
Your turn
Try it yourself
Model A costs 100 normalized units to train and 0.004 per served task. Model B costs 140 to train and 0.002 per task at matched quality. At what task count do total costs match, ignoring all other costs?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Equate training plus per-task cost for the two models.
Compare with the solution
Solve 100 + 0.004Q = 140 + 0.002Q, yielding 0.002Q=40 and Q=20,000 tasks. Beyond that count B is cheaper under these fixed-cost assumptions. Changing task quality, traffic, batching, or hardware can change the crossover.
Keep the idea
Take it with you
- Scaling relationships are empirical fits with domains and residuals.
- Compute-optimal allocation follows from a cost model as well as a loss model.
- Evaluate lifetime task cost and uncertainty before extrapolating.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.