When training a large neural network, the final performance is influenced by numerous factors—switching to a different optimizer, changing the model architecture, or swapping the training set can all lead to vastly different results. In engineering practice, we jokingly refer to the empirical process of tuning these factors as 'alchemy.' But how do we elevate mere experience into general laws, describing the relationships among them more accurately and quantitatively? If we can figure this out, our alchemy will rest on much firmer ground.
'Scaling laws' attempt to answer this question in a relatively quantitative manner. Since OpenAI's foundational work in 2020 (Kaplan Law), scaling laws have become one of the most reliable empirical laws in deep learning. They can be used to predict model performance, guide hyperparameter selection, determine the effectiveness of modifications, and more. To this end, many works have also sought to provide deeper interpretations of scaling laws that get closer to their underlying nature.
In this post, I will also share some of my own understanding of scaling laws.
In the later sections, we will repeatedly encounter problems of the form 'finding the minimum of a combination of power laws under a given constraint,' so in this preparatory section, let us first establish two basic results.
First is the inequality used most frequently. Let , then
The condition for equality is
It is a generalization of the simple inequality , which can be proved by taking derivatives or via the weighted AM-GM inequality. Below we demonstrate the latter. The weighted AM-GM inequality is , so we have
The condition for equality to hold is , namely . For convenience, we refer to this inequality result as the 'opposite-power inequality.' Its defining feature is that it contains two power functions whose exponents have opposite signs. Even more interestingly, both the minimizer and the minimum value itself are still power laws, which is one of the cornerstones of our subsequent derivations.
The opposite-power inequality minimizes the sum of two power terms after fixing their product (), but in other scenarios (such as finding the optimal ratio of parameter counts), we need to fix their 'sum' to find the minimum. Specifically, let , and we want to solve
Unfortunately, this problem has no elementary analytical solution, but solving it numerically poses no issue. It is not difficult to see that the minimum must exist; substituting and differentiating gives , and setting it to zero yields
The left-hand side is, on , clearly monotonically increasing with respect to , and as , the left-hand side approaches ; when , the left-hand side approaches 0. By the intermediate value theorem, it has a unique solution on , which can be directly found using bisection.
The training process of a model can be formalized as
Given data , architecture , and optimizer , minimize the loss function .
Here, denotes some ideal distribution, which can also be imagined as an immensely huge test set, while any training set that we can construct is a subset, or a sampled result, of it; denotes the loss value that the model can achieve on the ideal distribution under these conditions.
This decomposition might seem to complicate the problem, but in fact it decomposes the distance from the current training state to the ideal target into three progressive steps. Under the conventional "more is better" assumption, each bracketed term is non-negative. Therefore, it is equivalent to writing the total gap as the sum of three separately interpretable distances, decoupling the effects of individual variables on the loss function as much as possible, allowing us to more reasonably hypothesize the dependencies between them.
Now let us explain the meaning of each term in the formula one by one.
The first layer of decomposition is
where represents, for a given architecture and optimizer , the loss value of the model on the training set .
Note that by definition, represents the loss of the model under the ideal distribution , which is our ultimate goal. However, is untouchable during training, and we can only deal with the training set , so we can only obtain the training loss , and then try to use to describe the gap between them.
This term is also commonly referred to as the "generalization error," whose key driving factor is data—such as data quantity, quality, diversity, and so on. In addition, architecture and optimizer may also alter the generalization error; which variables specifically need to be considered depends on our analytical objectives.
The second layer of decomposition is
where represents the ideal loss that could be achieved on the training set when optimization is pushed to the limit—for example, with a perfect super-optimizer, or by pushing both training steps and hyperparameter tuning iterations to infinity.
Therefore, represents the ceiling of the optimizer, while represents the distance between practical optimizers and this ceiling. It measures whether the optimizer is good enough—such as whether the learning rate is appropriate, whether the number of training steps is sufficient, whether the batch size is large enough to stabilize gradients, and so forth.
The third level of decomposition is
where represents the most ideal loss achievable on the training set when both optimization and architecture are pushed to the limit—an arbitrarily good optimizer and an arbitrarily powerful model.
Therefore, is the theoretical limit determined by the current dataset itself, while represents the performance gap between a practical model and its theoretical limit. It measures whether the architecture is good enough—whether the parameter count is sufficient, whether the depth and width are sufficient, whether there is room for improvement in residual connections, and so on.
In this section, we first explore the optimization gap . Given an optimizer (such as Adam or Muon), we are mainly concerned with the learning rate , batch size , and number of training steps —the impact of these three core parameters. Of course, in theory other parameters like momentum and other details could also be taken into account, but here we mainly consider these three parameters.
First, a reasonable assumption is that "the more training, the better the performance." Here, training more carries the twofold meaning of "more steps" and "a larger learning rate." Alternatively, we can intuitively think that is the actual "distance" traveled by the model. The longer the distance traveled, the better the performance. Thus, we can guess that one contribution is .
On the other hand, training performance is also affected by noise; a reasonable assumption is that higher noise leads to worse performance. Noise comes from two sources: first, the batch size , where a smaller batch size means higher noise; second, the learning rate, which represents the degree of non-smoothness in the training process, where a larger rate also means higher noise. Therefore, we guess there is another term .
Adding these two parts together yields
We can also understand the above formula by dividing the training process into two stages: in the early stage of training, noise is secondary, and the term quickly brings down the loss function first; subsequently, noise gradually comes into play, and the model begins to oscillate around the target point, akin to a spiral descending trajectory.
This form is consistent with that used in 2503.12645 and 2603.15958. It is worth pointing out that these two works are not experimental fits, but are derived directly from theoretical convergence analyses of optimizers like SignSGD and Muon, concluding that . In the subsequent derivations, we can substitute these values for a simple sanity check.
Eq. contains 6 parameters. If we fit it directly, we would need to sample a vast number of points, which would be extremely costly. At the same time, it is very prone to overfitting. In response, we can use the optimal parameter assumption to further simplify the form.
First, using the opposite-power inequality, we can obtain the optimal learning rate that minimizes the right-hand side:
The corresponding minimum value is
This tells us two results: 1. There exists some such that the optimal learning rate is inversely proportional to ; 2. Assuming that we can always find the optimal learning rate for each configuration, the asymptotic scaling of the optimization error can be simplified to the form of , reducing the parameters to 4. This is precisely what 2607.01487 proposed as a decoupled form, while 2605.09154 derived from a noisy quadratic model and also reached the conclusion of modeling separately.
Now, starting from the optimal learning rate assumption, let the optimization error be
Let , which represents the number of samples seen during training. Note that we do not restrict to a single epoch, so we do not rule out the possibility that some samples may be learned multiple times. If we fix , then the right-hand side becomes , and again using the opposite-power inequality, we obtain the minimum value
Equality holds at
This likewise yields two conclusions: given the total number of training samples , the optimal batch size is proportional to , where ; while under the optimal batch size, the scaling law simplifies to , which is precisely the classic scaling law form.
Now we can summarize: the general scaling law for an optimizer is , which, assuming that we always run at the optimal learning rate, can be simplified to , and if we further fix the number of training samples and assume that the optimal batch size can always be found, it simplifies to .
As for the optimal parameters, the optimal batch size is proportional to raised to some power no greater than 1, which matches Step Law; the optimal learning rate is inversely proportional to raised to some power no greater than 1, and converted according to , the optimal learning rate is also inversely proportional to raised to some power no greater than 1, which agrees with Microsoft Law, but is contrary to Step Law.
If we substitute the theoretical values mentioned earlier, , then we have , which in turn yields , which is relatively close to the given by Step Law; in addition, we have , which converted according to yields , which is not far from Microsoft Law's either. Finally, we have , which is also very close to the given by Chinchilla Law.
Next, we turn to the model gap , which purely discusses the contribution of architecture to the loss function. Classic variables include the parameter count , width , depth , etc. At the same time, introducing architectural variables in turn affects the patterns of the optimization gap; we will sort through all of this as much as possible.
Under the premise of fixing the overall architecture, the main variable of the model is the parameter count . Assuming that a larger parameter count leads to better results, it is reasonable to consider that
This is the most naive assumption of scaling laws regarding parameter count, consistent with Kaplan Law, Chinchilla Law, etc., where the result given by Kaplan Law is , while the fitted result given by Chinchilla Law is . It is currently widely believed that Chinchilla Law is more accurate as the training scale increases.
A point of contention here is whether the parameter count should include embeddings in its accounting. The mainstream practice is to exclude them, but this may cause a relatively large discrepancy at small scales, which might be one of the reasons for the difference between the results of Kaplan Law and Chinchilla Law (in the era of Kaplan's experiments, training scales were generally not large). The paper 2406.12907 provides a detailed analysis of this. For how to account for the contribution of embeddings more accurately, one can refer to the subsequent "Memory Layers" section.
In addition to compressing the entire architecture into a single parameter count , we can be a bit more fine-grained. For example, we can separate width and depth , investigating whether it is better for a model to be "tall and thin" or "short and fat":
Since the model parameter count is roughly , we can solve for the optimal width, height, and the corresponding :
The paper 2606.25008 starts from theory (2505.10465, 2602.05970) to propose ; substituting these yields
The final is still very close to Chinchilla Law.
At the same time, changes in parameter count also affect the optimization process. In Eq. , the three coefficients were treated as constants under the assumption of a given architecture . Now that we have introduced the parameter count , are naturally also functions of .
We can likewise understand this in two parts: on the one hand, the larger the parameter count, the stronger the model's capability and the faster the loss function decreases, so for , we replace it with ; on the other hand, the larger the parameter count, the more complex the model and the greater the noise introduced, so for , we replace them respectively with and , and thus
A natural question arises here: why do we only consider how vary with , but not how the exponents vary? We leave this question for discussion in the "Power Laws" section. Repeating the calculations from the "Optimization" section now, we can obtain
If we accept Kaplan Law, Chinchilla Law, and Step Law and similar results, then and are independent of . By setting the exponent of in these two terms to 0, we can solve for
Substituting these into the various equations, we find that only one new parameter, , is introduced:
Interestingly, has exactly the same form as in Microsoft Law, being negatively correlated with both and . This is by no means trivial, because we only assumed that and are independent of , with no assumptions made about . Finally, substituting the theoretical values , we get
As for , Microsoft Law gives , whereas Step Law gives . Considering that these two laws have completely opposite dependencies on , it is only natural that they show a noticeable discrepancy in this exponent. The theory broadly leans somewhat more toward Microsoft Law. From observations of some convex optimization results, is related to the standard deviation of the gradients over all parameters, so we conjecture that the exponent lies in . Combining this with Microsoft Law, we can ballpark .
Combining and , we have
For dense models, the computation per step of the model is basically proportional to the parameter count ; is the number of samples seen during training, which is also proportional to the training compute, so the total compute cost consumed during training is , where the proportionality factor for standard architectures is roughly , including for the forward pass and for the backward pass.
In practical training, compute is usually limited. We want to achieve maximum intelligence under a fixed compute budget , so we need to find, under the constraint , the optimal and . Substituting into the equation above (absorbing constant factors into the coefficient) yields
This again has the form of the opposite-power inequality. Applying the formula directly yields
If we substitute the earlier theoretical values and , then
This is very close to the core conclusion of Chinchilla Law: the optimal model scale and the optimal data volume should scale roughly in equal proportion (the paper's fitted result is ). Finally, substituting the expressions for and into the previous section's and yields
Here, is actually, compared to DeepSeek Law's , not much different, but DeepSeek Law gives , whereas here, even substituting only yields , which is still quite a bit off. Looking at it this way, the results from various groups are fairly consistent on the optimal batch size, but differ substantially on the optimal learning rate, which may be closely related to specific optimization setups, learning rate schedules, and the like.
Earlier we said that 'computation is roughly proportional to parameter count ', which holds for dense models. Assuming the core operation of the model is a linear layer, an input is multiplied by a parameter matrix, the compute is , and the parameter count is ; both are proportional to , so parameter count is compute. In recent years, however, people have also devoted efforts to architectures that decouple parameter count and compute, such as MoE.
MoE is naturally the undisputed mainstream architecture at present, with almost every open-source large model being an MoE. An important new parameter it introduces is sparsity , which can be defined as the ratio of total parameters to active parameters, or the ratio of total experts to active experts. Theoretically, the theoretical compute of an MoE roughly depends only on the active parameter count; that is, increasing sparsity theoretically does not increase compute, yet the loss can be reduced, so increasing sparsity is always worthwhile.
A simple approach to incorporating sparsity into the scaling law is:
where are the active parameter count and total parameter count, respectively, , and a similar form also appears in 2501.12370. If viewed from Eq. , this is equivalent to likewise assuming that only affects the coefficient via a power law, without affecting the exponent . From the equation above, we can also derive the concept of 'effective parameter count':
That is, an MoE model with active parameter count and total parameter count is equivalent to a dense model with parameter count , for which a popular empirical formula in the community is (reference). This concept can be traced back to 2202.01169's proposed Effective Parameter Count; later, Ling Law further extended it into 'efficiency leverage' and explored its variation patterns.
However, compute is only proportional to the active parameter count , which means we could keep unchanged while letting , in other words, reducing compute to nearly zero while keeping performance unchanged, but this seems rather unrealistic. Therefore, a reasonable guess is that should have an additional penalty term for to guarantee a certain number of active parameters:
Works modeling sparsity also include 2309.08520, 2501.12370, 2502.05172 among others, and the scaling law forms they posit are each distinct. In addition to sparsity, expert granularity (first modeled by 2402.07871) and shared experts also have some impact on performance; 2509.23678 blends all these factors into a very massive form for experimental fitting.
Of course, 'arbitrarily increasing sparsity is always worthwhile' is only theoretical. In practice, issues such as routing overhead and inference efficiency must also be considered; increasing sparsity is not entirely free and requires the co-design of algorithms and infra.
Beyond MoE, avenues for decoupling parameter count and compute budget also include sparse memory layers. Classic examples include PKM, UltraMem, and the like, while newly emerging ones such as Over-Encoding, Engram, and others can all be grouped into this category.
In fact, works of this kind can also be viewed as the other extreme of MoE: their "experts" are simplified into trainable vectors without any computation, and then a trainable router (pointer) or n-gram hash is used to select which "experts" to activate. From this perspective, their scaling laws should resemble MoE. For example, once a dense model is paired with several memory layers, the scaling law should likewise exhibit the form of Eq. .
If both types of sparse designs—MoE and memory—are used simultaneously, what should the scaling law look like? Let us first define several notations: , representing "active parameter count (counting only parameters that generate computation, i.e., the dense part plus active experts)", "total parameter count after removing memory", "total parameter count after removing inactive experts", and "total parameter count", respectively. They satisfy the identity
If we conjecture that the roles of MoE and memory are complementary, their scaling law may be additive, i.e.,
This also leads to a new optimization problem: if we must fix the active parameter count (the compute bottleneck) and the total parameter count (the memory bottleneck), how should we allocate parameters between MoE and memory? According to the identity , at this point is simply a constant, and we want to minimize the above expression under this constraint. Let ; substituting this into the equation above turns the problem into the sum-constrained minimization problem introduced in the section "Optimal Allocation Ratio", which can be solved numerically.
In other words, it is not optimal to allocate all parameters to MoE or to memory; rather, an optimal ratio exists, which aligns with the findings of Engram.
Like the optimization section, this section starts with empirical power-law assumptions and then mainly uses the opposite-power inequality for the optimization calculations.
The simplest variable for quantifying a model is the total parameter count ; in finer detail, one can separately consider width and depth . Changes in the model also cause changes in optimization error, so we have also briefly discussed the joint effects of various optimizer parameters and parameter count. Under the assumption of a dense model, parameter count itself represents compute, while the optimizer's training steps and batch size are also positively correlated with compute. Thus, we can further explore how to determine the optimal parameter count and corresponding optimizer parameters given a fixed total budget .
If refined even further, model architecture involves even more variables. For instance, MoE architectures distinguish between "active parameters" and "total parameters", and memory designs like Engram are similar; when they appear together, the problem of optimal parameter allocation arises again, not to mention residual-connection improvements such as MHC, AttnRes, and others that we have not yet mentioned. In short, the variables that can be considered on the model side are extraordinarily numerous, so we could only touch upon them briefly here.
Finally, we turn to the data gap . By definition, this term requires us to focus on the performance on the ideal distribution ; however, we also stated that the ideal distribution is theoretically unreachable. That being so, how can it be measured?
In fact, there is no good solution: we can only choose a dataset that was not used in training and that we consider sufficiently representative as a test set, using the test loss computed on it as an approximation of . Therefore, much like benchmarks, constructing test sets is especially important; it reflects how accurately we understand and describe the ideal target.
The core data hyperparameter is the size of the training set , and we consider that the larger the training set, the better the generalization performance (i.e., 'broadly experienced'), so it contributes a term .
If the data at each step is sampled uniformly at random from the training set, then is the average number of times each sample is trained on, which is the number of training epochs. We consider that the more severe the multi-epoch training, the worse the generalization performance, so it contributes a term , and thus a basic form is
Most scaling law works, under the single-epoch assumption, treat and as the same quantity; in this post, we distinguish between them precisely to account for the impact of multi-epoch training.
The recent paper 《Prescriptive Scaling Laws for Data Constrained Training》 also introduced a similar power law, but replaced with , while simultaneously taking into account the effect of the model parameter count. Roughly speaking, it considers that the larger the model parameter count, the more prone it is to overfitting, and thus the less it should undergo multi-epoch training; therefore, it makes and positively correlated; we can also make such modifications as needed.
On the other hand, 《Scaling Data-Constrained Language Models》 and other papers introduce the concept of 'value decay' to convert the amount of data after multi-epoch training into an 'effective data size', thereby modifying the scaling law. However, I feel that this term is needed only when one does not distinguish between and ; since we have already distinguished between and , we only need to directly penalize the overfitting risk brought about by multi-epoch training.
Combining the optimization error and the data error (fixing , , and assuming training is always conducted under optimal hyperparameters), the result is:
This clearly shows that the more we train, the smaller the optimization error, but the more often the data is repeated, the larger the generalization error. Applying the opposite-power inequality again, we can obtain the optimal value of :
This provides a scaling law regarding multi-epoch training. The conclusion is: with less data, one should instead train for more epochs; with more data, the optimal number of epochs is smaller. This conclusion is exactly opposite to that of 2511.13421. One possible improvement scheme is to generalize to , in which case we have
In this way, it is possible for the optimal number of epochs to either increase or decrease as data increases.
However, even if we replace it with , there are still some unreasonable aspects here; for example, when , it also tends to infinity, but empirically, even if we keep training indefinitely, the test loss should not become infinitely large. However, if we only fit over a narrow range (assuming that the number of multi-epochs cannot be too large), the power-law assumption may still yield practically usable results.
In addition to the core parameter of data size , many works have made detailed distinctions regarding data composition, such as domain ratios (2403.16952, 2507.09404, 2603.19149, 2605.12715, 2606.08167), quality levels (2510.03313), and modality ratios (2607.22043), etc. These works are diverse and multifaceted, making it difficult to extract a unified form, so I will not elaborate on them one by one.
Compared to optimization and architecture, scaling laws on the data side indeed give a sense of being "messy" and "vague." The reason is easy to understand: optimizer variables () and architectural variables () are relatively well-defined numbers, whereas in data, aside from dataset size , which can be quantified fairly accurately, dimensions such as specialized domains, quality, and modality have no very clear boundaries and cannot be characterized accurately by a single scalar.
Furthermore, from , we can see that are all its conditions, which means that changes in optimizer variables and architectural variables will in principle also affect scaling laws on the data side. The interaction of various variables makes it very difficult for us to study the dependency patterns of data clearly in a "clean" setting.
What is worse, if we think about it carefully, we find that the proposition of "Data Scaling Law" itself is baffling: in order to fairly evaluate performance, we first need to prepare a sufficiently representative test set, and then "pretend" we know nothing about the test set while trying to study "scaling laws" on the training data so that performance on the test set is as good as possible. No matter how you look at it, this whole process is quite bizarre.
In this section, we briefly introduced scaling laws for the data gap, mainly introducing the dataset size as a parameter. We considered the benefits of increasing data size and the overfitting risk from multi-epoch training, then combined these with optimization error to derive the optimal number of epochs. Overall, however, scaling laws on the data side still leave many puzzling questions that need deeper thought.
So far, we have assumed that all these scaling relationships are sums or products of power laws, then used the opposite-power inequality to derive optimal choices. Looking back, two questions deserve thought: 1. Why assume a power-law form? 2. When we introduce other conditions, why consider changes only in the coefficients, rather than the exponents?
Why power laws? Many researchers have attempted to propose more "fundamental" explanations, but I feel that many of these attempts merely replace one assumption with another without substantive change, such as "Deriving Model Scaling Laws Based on the Quantization Hypothesis".
I believe the most straightforward explanation is: once we determine that the dependence on a variable is monotonically decreasing and we only care about asymptotic behavior, there are actually not many functions to choose from—typically just two classes: power functions and exponential functions. Exponential functions decay too quickly—in the language of distributions, they are "short-tailed"—which means that with just a small investment of some resource, returns quickly hit a ceiling, contradicting our intuitive perception of the real world; power functions, on the other hand, are "long-tailed" and decay more slowly, better capturing the phenomenon of "continuous investment yields continuous improvement."
To put it more philosophically, if this world were dominated by exponential functions, it would be far too boring: everything would quickly hit a ceiling, and all kinds of investment would soon lose their meaning. It is precisely because power laws dominate that the story of scaling up becomes so vivid.
Another perspective is that power laws are equivalent to "scale invariance": , so the function looks the same at any scale. The original meaning of "scaling" is precisely a relationship across scales, and power laws seem to be the only elementary functions that can play this role. In practical terms, a power law is a straight line on log-log axes, making it easier to fit and visualize. The opposite-power inequality, whose minimizer and minimum value are themselves power laws, is another important reason why power laws can serve as empirical laws.
Of course, power laws are not the only answer; in the "Data Part", for example, there is a paper that uses an exponential function to describe the value decay of multi-epoch training. We can only say that a power law is the basic rule that can be tried first in most cases; if we encounter a problem that is particularly difficult to fit, we can then consider making adjustments. Or put another way, if the interval we want to extrapolate is not large, the monotonicity of the function may matter more, and the difference between different functional forms might not be that significant.
The second question first appeared in the "Architecture section", where we assumed that changes in conditions affect at most the coefficients of power laws—for example, architectural changes only affect the coefficient of the power law for optimization error, and changes in MoE sparsity only affect the power law for architectural error, while keeping the exponents unchanged. What was the motivation behind this? What deeper principle lies within?
First, mathematical pragmatism: if the exponents also vary with conditions, the power-law form itself breaks down. The result is no longer a power law, the opposite-power inequality no longer applies, and the framework loses its simplest practical form. Allowing only the coefficients to vary is the smallest extension that preserves the form, making it a reasonable hypothesis to try first.
Second, an analogy from physics: in statistical physics, the critical exponents of phase transitions are universal; different materials within the same universality class share the same set of exponents, while material details only modify the non-universal prefactors. Similarly, the exponents in scaling laws can be understood as the "difficulty" of the problem itself—determined by the data distribution and the task; the coefficients, on the other hand, represent the "engineering capability" of the solution—varying with improvements in optimizers and architectures. This essentially means doing better on the exact same problem, so what should change is the coefficient in front of the power law, not the exponent.
Looking at it in reverse, if a finite engineering improvement could genuinely change the exponent, then in an asymptotic sense, the relative advantage it brings would amplify without bound as the scale grows—finite investment yielding unbounded relative gains, which would amount to an exponential leap out of thin air, and is typically unrealistic. Unless this improvement changes the problem itself, but that would no longer be an "engineering improvement on the same problem"; it would be switching to a different problem entirely.
Of course, this is mostly my conjecture based on simplicity and self-consistency; consider it an open question, and discussions are welcome.
After reading this blog post, some readers might feel as though "it seems like everything has been said, yet nothing has been said at all"—we haven't proven any theorems; we merely wrote down a tripartite decomposition, empirically wrote down a set of power-law hypotheses, and then performed some basic analyses using optimization methods.
In this way, we have attempted to find commonalities among various scaling law results and clarify their interaction mechanisms. Fortunately, this article has indeed arrived at some heuristic results, but limited by my own ability, most of the content can only be introduced at a superficial level; in particular, for the "Data Part", my understanding is still at a very rudimentary stage.
Going through the whole derivation process, I personally feel it carries a flavor reminiscent of "dimensional analysis" in physics: it is not as rigorous as a first-principles derivation, but rather guesses the power-law form of each term based on intuition and monotonicity, further derives the patterns of the optimal solution, and finally compares against classic results for simplification or revision.
I hope the perspective in this article can provide a bit of help for readers in understanding and applying scaling laws.