                                                           Scaling Inference-Efficient Language Models





                 12                                                          12                                                     12

                 10            4096                                          10         4                                           10                             1B

                               5120                                                     8                                                                          3B









                                                                                                                      Latency (s)

                                                               Latency (s)

   Latency (s)



                  8            6144                                           8         12                                           8                             7B

                  6            8192                                           6         16                                           6

                  4                                                           4                                                      4

                  2                                                           2                                                      2

                  0                                                           0                                                      0

                      0    5     10     15      20   25   30                      0   2000 4000 6000 8000 10000                          102                 103

                                      nlayers                                                  dmodel                                     dmodel / nlayers

       (a) Vary layers (nlayers ), fix hidden size                 (b) Vary hidden size (dmodel ), fix layers            (c) Vary ratio (dmodel /nlayers ), fix size N



Figure 3. Model Shape on End-to-End Inference Latency: (Left) We illustrate the correlation between inference latency and the number

of layers, with constant hidden size. Due to the sequential nature of LLM execution, latency increases linearly with the number of layers.

(Center) We plot the relationship between inference latency and hidden size with the number of layers fixed. We see that model width

does not affect latency for smaller models but only for larger models. (Right) We show the relationship between inference latency and

aspect ratio, with the number of model parameters fixed. We see a downward trend in inference latency as we make the model wider and

shallower. All evaluations were performed using the Hugging Face generate function on a single NVIDIA Ampere 40GB A100 GPU with

batch size 1, input length 128, and output length 256.





inference-efficient language models for training using our                                         2.2. Inference-Efficient Scaling Laws

scaling laws in §2.3.

                                                                                                   Despite its popularity, the Chinchilla scaling law fails to

                                                                                                   resolve the following challenges:

2.1. Preliminaries

Scaling laws predict a model’s loss based on the allocated                                              • The FLOPs constraint outlined in Eq. (1) does not re-

compute resource C. Following OpenAI (Kaplan et al.,                                                      flect how model training decisions are made in practice.

2020) and Chinchilla (Hoffmann et al., 2022), the compute                                                 First, both the model size and the training corpus are

resource C is a function dependent on the model size N and                                                determined in advance to accommodate for resource

the number of training tokens D. The goal is to minimize                                                  constraints when deploying these models (Touvron

model loss within the constraints of the available compute                                                et al., 2023a). Therefore, for each model and train-

resources:                                                                                                ing corpus pair, training FLOPs is essentially a fixed

                                                                                                          constant (assuming training epochs are also predeter-

                  arg min L(N, D) s.t. FLOPs(N, D) = C                                   (1)              mined). Furthermore, while the Chinchilla scaling law

                      N,D

                                                                                                          suggests training a 10B parameter model with 200B

                                                                                                          tokens, overtraining frequently occurs in practice. For

Using the formulation above, several scaling laws have been                                               example, the LLaMA-3-8B model uses 15 trillion to-

established (Kaplan et al., 2020; Hoffmann et al., 2022;                                                  kens for training (Touvron et al., 2023a), while the

Muennighoff et al., 2023; Sardana et al., 2023) to accurately                                             Gemma-2-9B model utilizes 8 trillion tokens (Team

model the performance of large language models from train-                                                et al., 2024b). These numbers are 44-93x larger than

ing a series of much smaller ones. The Chinchilla loss                                                    the Chinchilla optimal recommendation.

function L(N, D)3 is widely adopted to predict a model’s

training loss:                                                                                          • Existing scaling laws focus only on how the number

                                                                                                          of parameters affects inference latency. However, as

                          L(N, D) = E + AN −α + BD−β                                     (2)              depicted in Figure 2, smaller models can sometimes

                                                                                                          exhibit higher inference latencies than larger models.

where N is the number of parameters, D is the number of                                                   For instance, MiniCPM-1B (Hu et al., 2024) has a

tokens used for training and A, B, E, α, β are parameters                                                 higher latency compared to Qwen2.5-14B (Yang et al.,

to be learned. Through training multiple models and curve                                                 2024).

fitting, Chinchilla (Hoffmann et al., 2022) identify D ≈

20N as the compute-optimal solution for large language                                             In view of this, we propose rewriting Eq. (1) as below to

model pretraining.                                                                                 meet practical requirements:

    3

      Like Chinchilla (Hoffmann et al., 2022), we use smoothed                                      arg min L(N, D) s.t. N ≤ NC , D ≤ DC , Tinf ≤ TC (3)

training loss to estimate test loss.                                                                    N,D





                                                                                               3

