Inference Scaling › Inference-Optimal Model Selection

Michael BrenndoerferOctober 27, 20257 min read
Language AI HandbookAll chapters
Part 23 of 67Scaling Laws
Chapter 167Inference Scaling › Inference-Optimal Model Selection
Reading section 5 of 11 · Inference-Optimal Model Selection · 7 minSection 5 of 11 · 7 min

Book contents

Section 5 of 11 · 7 min read

Inference Scaling › Inference-Optimal Model SelectionOne section · Sections in this chapter5 / 11 ↓

Given expected inference demand, we can determine the optimal model size directly. This requires understanding how loss scales with both model size and training data, and then reformulating the optimization problem to account for total lifecycle costs rather than just training costs.

The Inference-Optimal Scaling Law

Building on the Chinchilla loss function from earlier chapters:

L(N,D)=ANα+BDβ+EL(N, D) = \frac{A}{N^\alpha} + \frac{B}{D^\beta} + E

where:

  • L(N,D)L(N, D): the model's loss as a function of size and training data
  • NN: the number of model parameters
  • DD: the number of training tokens
  • A,BA, B: empirically fitted scaling coefficients
  • α,β\alpha, \beta: empirically fitted exponents (typically around 0.34 and 0.28)
  • EE: the irreducible error floor representing the entropy of natural language

This functional form captures two distinct pathways to reducing loss: adding more parameters (the first term) or training on more data (the second term). The irreducible error floor EE is the basic uncertainty in language. Even a perfect model cannot predict with certainty what word comes next in human text. Understanding this structure is needed for reasoning about the trade-offs between model size and training duration.

We can reformulate the optimization problem for inference-dominant scenarios. Rather than minimizing loss for a fixed training budget (the Chinchilla approach), we want to minimize loss for a fixed total budget that includes both training and expected inference. This reformulation shifts the optimization target from training efficiency to deployment efficiency.

The total compute over the model's lifecycle is:

Ctotal=Ctrain+Cinference=6ND+2N⋅TinferenceC_{total} = C_{train} + C_{inference} = 6ND + 2N \cdot T_{inference}

where:

  • CtotalC_{total}: total compute over the model's entire lifecycle
  • Ctrain=6NDC_{train} = 6ND: training compute (approximately 6 FLOPs per parameter per token)
  • Cinference=2N⋅TinferenceC_{inference} = 2N \cdot T_{inference}: total inference compute (2 FLOPs per parameter per token generated)
  • TinferenceT_{inference}: expected total tokens generated during the model's deployment

This formulation captures the key insight: training cost is paid once, but inference cost accumulates with every token generated. The training term depends on both NN and DD (model size times data), while the inference term depends on NN and TinferenceT_{inference} (model size times usage). This asymmetric structure drives the preference for smaller models in high-inference scenarios.

To minimize loss subject to a total compute budget, we take derivatives and solve. The resulting optimal allocation shifts toward smaller models as expected inference volume increases:

N∗∝Ctotala⋅Tinference−bN^* \propto C_{total}^{a} \cdot T_{inference}^{-b}

where:

  • N∗N^*: the optimal model size (number of parameters) for the given deployment scenario
  • CtotalC_{total}: the total compute budget available across training and inference
  • TinferenceT_{inference}: expected total tokens to be generated during deployment
  • a,ba, b: positive exponents derived from the scaling law parameters α\alpha and β\beta. The exact values depend on the specific scaling law coefficients, but typical values yield a≈0.5a \approx 0.5 and b≈0.3b \approx 0.3

The negative exponent on TinferenceT_{inference} is the key result: it shows mathematically that optimal model size decreases as expected inference volume increases. This relationship emerges directly from the calculus of constrained optimization. When inference tokens grow, the cost of each parameter (which must be activated for every token) grows proportionally, pushing the optimum toward fewer parameters.

The intuition is clear: as inference demand grows, the optimal model size shrinks because each parameter incurs a cost at every inference, while training cost is amortized. A parameter that costs billions of FLOPs to train well might seem expensive, but if that parameter is then used trillions of times at inference, the training cost becomes negligible compared to the cumulative inference burden.

Practical Model Size Selection

For deployment planning, a simplified heuristic helps guide model selection. If you expect to generate TT inference tokens over the model's lifetime, compare the inference compute to training compute:

Inference factor=2N⋅T6ND=T3D\text{Inference factor} = \frac{2N \cdot T}{6ND} = \frac{T}{3D}

where:

  • TT: total inference tokens expected over the model's deployment lifetime
  • DD: number of tokens used for training
  • NN: model parameters (which cancel out in the simplification)

Notice that NN cancels out. The inference factor depends only on the ratio of inference tokens to training tokens. This cancellation is mathematically elegant and practically useful because you can evaluate whether inference will dominate without even knowing the model size. When this factor exceeds 1, inference compute dominates. The larger this factor, the more aggressively you should favor smaller, over-trained models.

The inference factor gives a simple decision rule. Values below 1 indicate training-dominated scenarios where Chinchilla-optimal sizing remains appropriate. Values above 1 signal that inference costs will outweigh training costs, justifying investment in smaller, more heavily trained models. Values above 10 suggest aggressive over-training is warranted. Values above 100 indicate that inference efficiency should be the primary design consideration.

In[7]:
Code
def compute_inference_factor(
    training_tokens: float, inference_tokens: float
) -> float:
    """Calculate ratio of inference to training compute."""
    return inference_tokens / (3 * training_tokens)


def recommend_model_strategy(
    training_tokens: float, inference_tokens: float
) -> str:
    """Recommend training strategy based on expected inference load."""
    factor = compute_inference_factor(training_tokens, inference_tokens)

    if factor < 0.1:
        return "Training-dominated: use Chinchilla-optimal sizing"
    elif factor < 1:
        return "Balanced: moderate over-training beneficial"
    elif factor < 10:
        return "Inference-heavy: significant over-training recommended"
    else:
        return "Inference-dominated: maximize over-training ratio"
Out[8]:
Console
Deployment Scenario Analysis
=================================================================

Research prototype:
  Training tokens: 1e+12
  Inference tokens: 1e+11
  Inference factor: 0.0x
  Recommendation: Training-dominated: use Chinchilla-optimal sizing

Internal tool:
  Training tokens: 1e+12
  Inference tokens: 1e+13
  Inference factor: 3.3x
  Recommendation: Inference-heavy: significant over-training recommended

Consumer product:
  Training tokens: 1e+12
  Inference tokens: 1e+15
  Inference factor: 333.3x
  Recommendation: Inference-dominated: maximize over-training ratio

Major API service:
  Training tokens: 1e+12
  Inference tokens: 1e+17
  Inference factor: 33333.3x
  Recommendation: Inference-dominated: maximize over-training ratio

The output reveals how sharply the optimal strategy shifts based on expected usage. The research prototype shows an inference factor of just 0.03×, meaning training compute still dominates, so Chinchilla-optimal sizing remains appropriate. But as we move to consumer products (333×) and major API services (33,333×), inference compute overwhelms training by orders of magnitude. At these scales, every parameter becomes a recurring cost multiplied across trillions of tokens, making aggressive over-training the only economically rational choice. A research prototype with limited deployment can safely follow Chinchilla scaling, while a consumer-facing API should aggressively over-train smaller models.

Out[9]:
Visualization
Log-scale bar chart comparing inference factors for four deployment scenarios: research prototype at 0.03x, internal tool at 3.3x, consumer product at 333x, and major API service at 33,333x, with a dashed crossover line at factor equals one.
Inference factor across deployment scenarios (log scale). The dashed line at factor=1 marks the transition from training-dominated to inference-dominated regimes. Consumer products and API services fall deep into inference-dominated territory.