Kaplan Scaling Laws › Loss vs. Compute
Language AI HandbookAll chapters Kaplan Scaling Laws › Loss vs. ComputeOne section · Sections in this chapter5 / 15 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
The third scaling law relates loss directly to the compute budget. This is perhaps the most practically important relationship because compute (measured in GPU-hours, dollars, or energy consumption) is the fundamental constraint that organizations face when training models. Unlike parameters, which can be chosen freely, or data, which can often be collected or synthesized, compute represents a hard resource limit.
Understanding how loss scales with compute means recognizing that compute is a derived resource, not a fundamental one. You don't directly spend compute; instead, you spend it indirectly by choosing a model size (which determines compute per forward-backward pass) and a number of training steps (which determines how many passes you perform). The compute budget constrains the product of these choices, creating a tradeoff. You can train a large model for few steps or a small model for many steps, but you cannot train a large model for many steps within a fixed compute budget.
When training is optimally allocated between model size and training steps, the loss follows:
where:
- : the cross-entropy loss on held-out text
- : the total compute budget measured in PetaFLOP-days (one PetaFLOP-day equals floating-point operations performed continuously for one day)
- : a fitted constant representing the characteristic compute scale (approximately PetaFLOP-days)
- : the compute scaling exponent (approximately 0.050)
The characteristic compute scale PetaFLOP-days represents an enormous amount of computation, roughly 310 million PetaFLOP-days. To put this in perspective, training GPT-3 required approximately 3,640 PetaFLOP-days, which is about five orders of magnitude smaller than . This large characteristic scale ensures that practical training runs operate in the regime where the ratio is much greater than 1, producing meaningful loss values that decrease predictably with more compute.
The compute exponent is smaller than both and because compute is a derived resource. It gets split between making the model larger (more parameters) and training longer (more data passes). The compound effect means each 10x increase in compute yields less loss reduction than a 10x increase in parameters or data alone.
The fitted parameters are:
To understand why the compute scaling works, consider that total compute is approximately . The factor of 6 accounts for roughly two operations per parameter in the forward pass and four in the backward pass (computing gradients for both activations and weights). This relationship comes from the arithmetic of matrix multiplications: each parameter participates in operations during both forward and backward passes, with the backward pass requiring roughly twice the computation of the forward pass to compute gradients. The factor of 6 is an approximation that works reasonably well across typical transformer architectures and training configurations, though the exact multiplier can vary with specific implementation details. This means compute constrains the product of model size and data, forcing a tradeoff between the two.
The compute exponent is smaller than both and . This makes sense: compute is spent on both larger models and more training steps, so its effect is spread across multiple factors. When you increase compute, you gain both from having more parameters (benefiting from the exponent) and from seeing more data (benefiting from the exponent), but neither benefit is realized fully because the compute is divided between them. The key insight is that this relationship only holds when you allocate compute optimally, which brings us to Kaplan's most consequential finding.
# Kaplan scaling law parameters for loss vs C
alpha_C = 0.050
C_c = 3.1e8
# Generate compute budgets from 10 to 10M PetaFLOP-days
C_values = np.logspace(1, 7, 100) # 10^1 to 10^7 PF-days
# Calculate predicted loss
L_C = (C_c / C_values) ** alpha_C