A Dynamical Model of Neural Scaling Laws
Blake Bordelon, Alexander Atanasov, Cengiz Pehlevan
Introduction
Neural scaling laws play a central role in modern deep learning practice, and have substantial implications for the optimal trade-off between model size and training time (Hoffmann et al., 2022), as well as architecture selection (Alabdulmohsin et al., 2023). Understanding the origin of such scaling laws, as well as their exponents, has the potential to offer insight into better architectures, the design of better datasets (Sorscher et al., 2022), and the failure modes and limitations of deep learning systems. Yet, many questions about neural scaling laws remain open.
In this paper, we introduce and analyze a solvable model which captures many important aspects of neural scaling laws. In particular, we are interested in understanding the following empirically observed phenomena:
In many domains of deep learning, the test loss of a model with trainable parameters trained for iterations has been found to scale as (Kaplan et al., 2020; Hoffmann et al., 2022). These scaling law exponents generally depend on the dataset and architecture. We demonstrate scaling laws on simple vision and language tasks in Figure 1. The compute is proportional to the number of steps of gradient descent times the model size . Setting and optimally gives that test loss scales as a power law in . This is the compute optimal scaling law.
Hoffmann et al. (2022) observed that and are close but slightly different, leading to asymmetric compute-optimal scaling of parameters. For compute budget , they scale model size and training time with . This difference in exponents led to a change in the scaling rule for large language models, generating large performance gains.
Provided feature learning is held constant across model scales (i.e. adopting mean-field or P scaling), wider networks tend to train faster (Yang et al., 2021) (Figure 1). If training proceeds in an online/one-pass setting where datapoints are not repeated, then the wider models will also obtain lower test loss at an equal number of iterations. This observation has been found to hold both in overparameterized and underparameterized regimes (Bordelon & Pehlevan, 2023; Vyas et al., 2023).
Early training can be well described by the learning curves for stochastic gradient descent without reuse of samples (termed the online/ideal limiting dynamics), however over time the effect of reusing data accumulates and leads to worse test performance (Nakkiran et al., 2021b; Mignacco et al., 2020; Ghosh et al., 2022). Similarly the gaps in model performance across various model sizes also grow with training time (Yang et al., 2021; Vyas et al., 2023). Figure 1 (d) shows overfitting and reversal of “wider is better” phenomenon due to data reuse.
Prior works (Dyer & Gur-Ari, 2020; Atanasov et al., 2023; Roberts et al., 2022; Bordelon & Pehlevan, 2023) predict early-time finite-width loss corrections that go as near the infinite width limit in either lazy or feature-learning regimes. Bahri et al. (2021) et al provide experiments demonstrating the convergence. However, finite-width models trained for a long time exhibit non-trivial exponents with respect to model width (Kaplan et al., 2020; Vyas et al., 2023). See Figure 1 for examples of nontrivial scalings at late time on CIFAR-5M and Wikitext.
Near the limit of infinite width, finite models can be thought of as noisy approximations of the infinite-width model with noise that can be eliminated through ensembling (Dyer & Gur-Ari, 2020; Geiger et al., 2020; Atanasov et al., 2023). However recent experiments (Vyas et al., 2023) indicate that ensembling is not enough to match performance of larger models.
These phenomena are not unique to deep networks, but can be observed in linear models, or linearized neural networks operating in the lazy/kernel regime. Though this regime does not capture feature learning, it has benefit of analytical tractability. In this paper, we focus on such linearized models to attempt to gain insight into the dynamics of training.
To attempt to explain these phenomena, we develop a mathematically tractable model of neural scaling laws which allows one to simultaneously vary time, model size, and dataset size. Our contributions are as follows:
We analyze the learning dynamics of a structured and randomly projected linear model trained with gradient descent or momentum. In an asymptotic limit of the model, we obtain a dynamical mean field theory (DMFT) description of the learning curve in terms of correlation functions, which measure the cross-time correlation of training and test errors, and response functions which measure sensitivity of the dynamics to small perturbations.
We solve for the response functions exactly in Fourier domain. This solution reveals faster training for larger models. The low frequency range of these functions allow us to extract the long time limit of the loss.
We show that the model and data corrections to the dynamics accumulate over time. At early time, each of these corrections has a universal scaling, consistent with prior works (Bahri et al., 2021).
For power-law structured features we show that the model exhibits power law scaling of test loss with time, model size and dataset size. While the data and model exponents are the same, the time and model exponents are different in general. We show that this gives rise to an asymmetric compute optimal scaling strategy where training time increases faster than model size.
Our theory explains why ensembling is not compute optimal as it gives less benefit to performance than increase in model size.
We observe in Section 5.1 that feature learning networks can obtain better power law scalings, leading to a better compute optimal frontier. We empirically study this phenomenon in Appendix K.
1 Related Works
The learning curves for linear models with structured (non-isotropic) covariates, including infinite-width kernel regression, have been computed using tools from statistical physics and random matrix theory (Bordelon et al., 2020; Spigler et al., 2020; Canatar et al., 2021; Simon et al., 2021; Bahri et al., 2021; Hastie et al., 2022). Mei & Montanari (2022) analyzed a linear model with random projections of isotropic covariates. There, they study the limiting effects of width and dataset size, and observe model-wise and sample-wise double descent. In (Adlam & Pennington, 2020a) a related model is used to study the finite-width neural tangent kernel (NTK) (Jacot et al., 2018) of a given network. Further, (Adlam & Pennington, 2020b) extends this analysis to understand the different sources of variance in the predictions of random feature models and the effect of ensembling and bagging on the test loss. Other works have extended this to models where an additional untrained projection is applied to the structured covariates (Loureiro et al., 2021, 2022; Zavatone-Veth et al., 2022; Atanasov et al., 2023; Maloney et al., 2022; Zavatone-Veth & Pehlevan, 2023; Ruben & Pehlevan, 2023; Simon et al., 2023). Within this literature, which considered fully trained models, the works of (Bordelon et al., 2020; Spigler et al., 2020) derived power-law decay rates for power-law features which were termed resolution limited by (Bahri et al., 2021) and recovered by (Maloney et al., 2022).
However, we also study the dependence on training time. The limit of our DMFT equations recovers the final losses computed in these prior works. While these prior works find that the scaling exponents for model-size and dataset-size are the same, we find that the test loss scales with a different exponent with training time, leading to a different (model and task dependent) compute optimal scaling strategy.
DMFT methods have been used to analyze the test loss dynamics for general linear and spiked tensor models trained with high-dimensional random data (Mannelli et al., 2019; Mignacco et al., 2020; Mignacco & Urbani, 2022) and deep networks dynamics with random initialization (Bordelon & Pehlevan, 2022b; Bordelon et al., 2023). High dimensional limits of SGD have been analyzed with Volterra integral equations in the offline case (Paquette et al., 2021) or with recursive matrix equations in the online case (Varre et al., 2021; Bordelon & Pehlevan, 2022a). Random matrix approaches have also been used to study test loss dynamics in linear regression with isotropic covariates by (Advani et al., 2020). In this work, we consider averaging over both the disorder in the sampled dataset and the random projection of the features simultaneously.
Other models and hypotheses for scaling laws instead rely on a discrete collection of subtasks or skills which are learned as compute grows (Caballero et al., 2022; Arora & Goyal, 2023; Michaud et al., 2023). Our theory instead focuses on spectral components of a data distribution.
Setup of the Model
We consider a “teacher-student” setting, where data sampled from a generative teacher model is used to train a student random feature model. The teacher and student models mismatch in a particular way that will be described below. This mismatch is the key ingredient that leads to most of the phenomena that we will discuss.
Here play the role of the infinite-width NTK eigenfunctions, which form a complete basis for square-integrable functions . The function describes a component of with which is uncorrelated with . We work in the eigenbasis of features as in (Bordelon et al., 2020), so the covariance given by:
The power law structure in the and entries will lead to power law scalings for the test loss and related quantities.
Our student model is motivated by a scenario where a randomly initialized finite-width network is trained in the linearized or lazy regime (Chizat et al., 2019; Jacot et al., 2018). Such training can be described through learning linear combinations of the finite-width NTK features. These features will span a lower-dimensional subspace of the space of square-integrable functions, and relate to infinite-width NTK features in a complicated way.
Here, we will interpret as the model size with the limit recovering original kernel. Similar models were studied in (Maloney et al., 2022; Atanasov et al., 2023).
We will focus on the setting where the elements of are drawn iid from a distribution of mean zero and variance one. See Appendix B for details on the technical assumptions. The motivations for this choice are (1) tractability and (2) it satisfies the constraint that as the student’s kernel approaches the infinite-width kernel . In more realistic settings, such as when projecting the eigenfunctions of an infinite-width NTK to a finite-width NTK, the form of the matrix is generally not known.
The model is trained on a random dataset of size with gradient flow on MSE loss
We explore extensions (momentum, discrete time, one-pass SGD in Appendix J). We track the test and train loss
In small size systems, these losses depend on the precise realization of the data and matrix . These two quantities can be viewed as the disorder. For large systems, these losses approach a well-defined limit independent of the specific realization of . We will use this fact in the next section when analyzing the model.
DMFT for Scaling Laws
We next describe a theoretical approach for characterizing the learning curves for this model. The full details of this approach is detailed in Appendices A, B.
We derive a mean field theory for large. We analyze both the (1) proportional regime where and , and (2) non-proportional regime where first and . The theories derived in these limits are structurally identical (App. F). While the proportional limit is exact, the finite size theory will also contain variability across realizations of disorder. When relevant, we show these in experiments by plotting standard deviations over draws of data and projection matrices . This variance decays as .
The test loss is then given by . The vector has the following dynamics:
Using DMFT, we characterize this limit by tracking together with the following random vectors:
The key summary statistics (also called order parameters) are the correlation functions:
Here is the response of to a kick in the dynamics of at time . See appendix B.1.1 for details.
The test loss and train loss are related to the time-time diagonal of and respectively
These collective quantities concentrate over random draws of the disorder (Sompolinsky & Zippelius, 1981). We show that these correlation and response functions satisfy a closed set of integro-differential equations which depend on which we provide in the Appendices A.2.
Further, we show in Appendix A.3 that the response functions possess a time-translation invariance property . This enables exact analysis in the Fourier domain . These response functions can then be used to solve for the correlation functions .
To understand the convergence of the learned function along each eigenfunction of the kernel, we introduce the transfer functionThere are dynamical analogues of the mode errors in (Bordelon et al., 2020; Canatar et al., 2021) or learnabilities in (Simon et al., 2021). for mode , . Our key result is that the Fourier transform of can be simply expressed in terms of the Fourier transforms of :
These functions satisfy the self-consistent equations:
From these solved response functions , we can compute local solutions to the correlation functions’ two-variable Fourier transform which are independent equations for each pair of . Information about the early dynamics can be extracted from high frequencies while information about the late-time limit of the system can be extracted from (App. C, D). For example, for the final test loss,
The full temporal trajectory can be obtained with an inverse Fourier transform of . See Appendix A.4.
Results
Our results hold for any and and we provide some simple analytically solvable examples in Appendix H. However, based on empirical observations of NTK spectral decompositions on realistic datasets (Bordelon & Pehlevan, 2021; Spigler et al., 2020; Bordelon & Pehlevan, 2022a; Bahri et al., 2021; Maloney et al., 2022), here, we focus on the case of power law features. In this setting, eigenvalues and target coefficients decay as a power law in the index
We will refer to as the task-power exponent and as the spectral decay exponentThese power-law decay rates are also known as source and capacity conditions in the kernel literature (Caponnetto & Vito, 2005; Cui et al., 2021). See Figure 6 (a)-(b) for an example with a Residual CNN on CIFAR-5M.
For power law features, the test loss will generally be bottlenecked by either training time (steps of gradient descent), the size of the training set , or the size of the model . We can derive bottleneck scalings from our exact expressions for (Appendix I):
A consequence of this is an asymmetry in exponent between the model and data bottlenecks compared to the time bottleneck. We verify this asymmetry in Figure 2.
All three of the bottleneck scalings arise due to rank constraints in the effective dynamics. Heuristically, finite training time or the subsampling of data/features leads to an approximate projection of the target function onto the top eigenspace of the infinite-width kernel. The components of the target function in the null-space of this projection are not learned. This leads to an approximate test loss of the form
For model and data bottlenecks we have that and respectively (App. I). On the other hand, for the time bottleneck also depends on the structure of the features through the exponent . This is due to the fact that the -th eigenfeature is learned at a timescale . Thus at time , we have learned the first modes and the variance in the remaining modes gives . In the limit of our data and model bottleneck scalings agree with the resolution and variance-limited scalings studied in (Bahri et al., 2021) as well as prior works on kernels and random feature models (Bordelon et al., 2020; Maloney et al., 2022).
These results suggest that in our model, one should scale time and model size differently at compute budget ,
We obtain the above scaling by approximating the loss as a sum of the three terms in equation (14) and a constant, see Appendix M. This analysis suggests that for features that have rapid decay in their eigenspectrum, it is preferable to allocate greater resources toward training time rather than model size as the compute budget increases. This is consistent with the findings of (Hoffmann et al., 2022) for language models. In the limit as , the time and parameter count should be scaled linearly together. We verify this scaling rule and its -dependence in Figure 3.
Larger models are not always better in terms of test loss for all time , as we showed in Figure 1 (c), especially if the dataset is limited. In Figure 4, we illustrate that larger can improve convergence to a data-bottlenecked loss for power law features. However, the loss may still be non-monotonic in training time, motivating regularization or early stopping.
The exact gap between train and test losses can exactly be expressed in terms of the DMFT order parameters:
We derive this relation in the Appendix E. At early time this gap goes as (App. D, E). At late time, however, this picks up a nontrivial task-dependent scaling with as we show in Figure 2 (e)-(f) and App. C. In Figure 4 (c) we show this gradual accumulation of finite data on the test-train loss gap. For larger datasets it takes longer training time to begin overfitting (App. E).
Ensembling a set of models means averaging their predictions over the same datasets but with different intitialization seeds. This reduces test loss by reducing the variance of the model output due to initialization. This improvement can be predicted from an extension of our DMFT (App. G). Analogously, bagging over datasets reduces variance due to sampling of data.
One might imagine that ensembling many finite sized models would allow one to approach the performance of an infinite sized model (). If this were possible, the compute optimal strategy could involve a tradeoff between ensemble count and model size. However, recent experiments show that there is a limited benefit from ensembling on large datasets when compared to increasing model size (Vyas et al., 2023). We illustrate this in Figure 5 (a). Our theory can explain these observations as it predicts the effect of ensembling times on the learning dynamics as we show in App. G. The main reason to prefer increasing rather than increasing is that larger has lower bias in the dynamics, whereas ensembling only reduces variance. The bias of the model has the form
which depend on transfer function that we illustrate for power-law features in Figure 5 (b). Since depend on , we see that ensembling/bagging cannot recover the learning curve of the system.
Tests on Realistic Networks
We now move beyond synthetic power-law datasets and consider realistic image datasets and architectures. We take the CIFAR-5M dataset introduced in (Nakkiran et al., 2021a) and consider the task of classfiying animate vs inanimate objects. We plot the spectra of the finite-width NTK at initialization across different widths for a Wide ResNet (Zagoruyko & Komodakis, 2016) in Figure 6 a). Here the width parameter corresponds to the number of channels in the hidden layers. Following (Canatar et al., 2021), we define as the fraction of the task captured by the top kernel eigenmodes:
Then is the portion of the task left unexplained. We plot this for the initial NTKs across widths in Figure 6 b). We extract the spectral decay exponent and the the task power exponent from these two curves. Together, these give the learning scaling laws of the linearized neural network model on this dataset. We plot the compute optimal scaling laws of these linearized models in Figure 6 c). We also plot the predicted scaling law in blue and find excellent agreement.
We also compare these scalings to those of the compute optimal learning curves for feature-learning networks. We train several networks with different widths and initialization seeds for 64 epochs through the dataset. We observe substantially different compute-optimal scaling exponents in the dotted curves of Figure 6 c). This means that although our random feature model does capture the correct linearized scaling trends, which have all of the qualities observed in realistic scaling laws, more is needed to capture the acceleration of scaling induced by feature learning. Further analyses of the after-kernels of feature learning networks are performed in Appendix K. We see that the kernels continue to evolve substantially throughout training. This indicates that a full explanation of the compute optimal scaling exponents will require something resembling a mechanistic theory of kernel evolution (Long, 2021; Fort et al., 2020; Atanasov et al., 2022; Bordelon & Pehlevan, 2022b).
Conclusion
We have presented a model that recovers a wide variety of phenomena observed in more realistic deep learning settings. Our theory includes not just model size and dataset size as parameters but also explicitly treats the temporal dynamics of training. We observe different scaling exponents for performance in terms of model size and number of time steps. Future work to incorporate kernel evolution into this model could further shed insight into the improved scaling laws in the feature-learning regime. Overall, our results provide a theoretical interpretation of compute-optimal scaling as a competition between the training dynamics of the infinite width/infinite data limit and finite model-size bottleneck.
Broader Impact Statement
This paper presents work whose goal is to advance the field of Machine Learning. There are many potential societal consequences of our work, none which we feel must be specifically highlighted here.
Acknowledgements
We are grateful to Yasaman Bahri, Stefano Mannelli, Francesca Mignacco, Jascha Sohl-Dickstein, and Nikhil Vyas for useful conversations. We thank Clarissa Lauditi and Jacob Zavatone-Veth for comments on the manuscript.
B.B. is supported by a Google PhD Fellowship. A.A. is supported by a Fannie and John Hertz Fellowship. C.P. is supported by NSF grant DMS-2134157, NSF CAREER Award IIS-2239780, and a Sloan Research Fellowship. This work has been made possible in part by a gift from the Chan Zuckerberg Initiative Foundation to establish the Kempner Institute for the Study of Natural and Artificial Intelligence.
References
Appendix A Derivation of Dynamical Model of Scaling Laws
We investigate the simplest possible model which can exhibit task-dependent time, model size and finite data bottlenecks. We therefore choose to study a linear model with projected features
The weights are updated with gradient descent on a random training dataset which has (possibly) noise corrupted target values . This leads to the following gradient flow dynamics
We introduce the variable to represent the residual error of the learned weight vector. This residual error has the following dynamics.
The entries of each matrix are treated as random with and . To study the dynamical evolution of the test error , we introduce the sequence of vectors
The train and test losses can be computed from the and fields
In the next section, we derive a statistical description of the dynamics in an appropriate asymptotic limit using dynamical mean field theory methods.
Standard field theoretic arguments such as the cavity or path integral methods can be used to compute the effective statistical description of the dynamics in the limit of large with fixed ratios and (see Appendix B). This computation gives us the following statistical description of the dynamics.
The correlation and response functions obey
These equations are exact in the joint proportional limit for any value of .
A.2 Closing the Equations for the Order Parameters
Though we expressed the dynamics in terms of random fields, we stress in this section that all of the dynamics for the correlation and response functions close in terms of integro-dfferential equations. To shorten the expression, we will provide the expression for , but momementum can easily be added back by making the substitution .
First, our closed integral equations for the response functions are
We note that these equations imply causality in all of the response functions since for . Once these equations are solved for the response functions, we can determine the correlation functions, which satisfy
Solving these closed equations provide the complete statistical characterization of the limit. The test and train losses are given by the time-time diagonal of .
A.3 Time-translation Invariant (TTI) Solution to Response Functions
From the structure of the above equations, the response functions are time-translation invariant (TTI) since they are only functionals of TTI Dirac-Delta function and Heaviside step-function. As a consequence, we write each of our response functions in terms of their Fourier transforms
We will keep track of the regulator and consider at the end of the computation. The resulting DMFT equations for the response functions have the following form in Fourier space
where will be taken after. Combining these equations, we arrive at the simple set of coupled equations
After solving these equations for all , we can invert the dynamics of to obtain its Fourier transform
where we defined the transfer functions . From this equation, we can compute through inverse Fourier-transformation and then compute the correlation function to calculate the test error. An interesting observation is that the response functions alter the pole structure in the transfer function, generating dependent timescales of convergence.
A.4 Fourier Representations for Correlation Functions
While the response functions are TTI, the correlation functions transparently are not (if the time-time diagonal did not evolve, then the loss wouldn’t change!). We therefore define the need to define the double Fourier transform for each correlation function
Assuming that all response functions and transfer functions have been solved for, the correlation functions satisfy the closed set of linear equations.
These equations can be efficiently solved for all pairs of after the response functions have been identified. Then one can take an inverse Fourier transform in both indices.
Appendix B Field Theoretic Derivation of DMFT Equations
In this section, we derive the field theoretic description of our model. We will derive this using both the Martin-Siggia-Rose (MSR) path integral method (Martin et al., 1973) and the dynamical cavity method. For a recent review of these topics in the context of neural networks, see (Helias & Dahmen, 2020).
With the MSR formalism, we evaluate the moment generating functional for the field :
Note that at zero source, we have the important identity that
We insert a Dirac delta functions to enforce the definitions of each of the fields as in equation 8.
We now average over the sources of disorder. We assume that the entries of are i.i.d. with mean zero and variance 1. In the proportional limit, we can replace the entries of as a draw from a Gaussian by appealing to Gaussian equivalence. We furhther justify this in the cavity derivation in the next section. This allows us to evaluate the averages over the matrix .
Similarly, we can calculate the averages over the data, which enters via the design matrices . Again in this proportional limit we can use a Gaussian equivalence on to have it take the form where has entries drawn from a unit normal. Taking the average then gives us
We now insert delta functions for following bracketed terms: and using the following identity (e.g. for at times ):
Here the integrals are taken over the imaginary axis. This yields a moment generating function (here we’ll take ):
The constraint that means that at the saddle point. here is given by:
We have chosen to take to have a different sign and ordering convention than the to simplify our notation later on. We have also used that Equations (38), (39) factorize over their respective indices, so each is a partition function over a single index. The individual are given by:
In the large limit we evaluate this integral via saddle point. The saddle point equations give:
Here denotes an average taken with respect to the statistical ensemble given by the corresponding partition function . Following the discussion below Equation 37, we take , which will enforce and lead to the correct dynamical equations.
To evaluate the remaining, we can integrate out the variables. First let us look at . Using the Hubbard-Stratonovich trick we can write the action in terms linear in . This gives
We now replace by its saddle point value of and by . Integrating over gives a delta function:
For after replacing with their saddle point values we get:
Using the same Hubbard-Stratonovich trick on gives:
Lastly, the equations of motion for in terms of are known:
One can easily add momentum by replacing with without changing anything else about the derivation.
B.2 Cavity Derivation
The cavity derivation relies on Taylor expanding the dynamics upon the addition of a new sample or feature. We will work through each cavity step one at a time by considering the influence of a single new base feature, new sample, and new projected feature. In each step, the goal is to compute the marginal statistics of the added variables. This requires tracking the linear response to all other variables in the system.
The next order corrections have a subleading influence on the dynamics. Now, inserting these perturbed dynamics into the dynamics for the new st set of variables . For , we have
There are now two key steps in simplifying the above expression in the proportional limit:
By the fact that the dynamics are statistically independent of the new feature , we can invoke a central limit theorem for the first term which is mean zero and variance .
Similarly, we can invoke a law of large numbers for the second term, which has mean and variance on the order of . Therefore in the asymptotic limit it can be safely approximated by its mean.
We note in passing that neither of these steps require the variables to be Gaussian. Thus we obtain the following asymptotic statistical description of the random variable
Following an identical argument for we have
Now, computing the dynamics of the new random variable
Now, we finally consider the effect of introducing a single new projected feature so that instead of we now have projected features. This causes a perturbation to which we
Now, we compute the dynamics for the added variable
Now, using the information gained in the previous sections, we can combine all of the dynamics for each field into a closed set of stochastic processes. This recovers the DMFT equations of Appendix A.2.
Appendix C Final Losses (the t→∞→𝑡t\to\infty Limit of DMFT)
In this section we work out exact expressions for the large time limit of DMFT. By comparing with prior computations of the mean-field statics of this problem computed in (Atanasov et al., 2023; Zavatone-Veth & Pehlevan, 2023; Ruben & Pehlevan, 2023; Maloney et al., 2022; Simon et al., 2021), we show that the large time and large limits commute, specifically that . We invoke the final value theorem and use the response functions as before.
We note that for functions which vanish at , that
where we invoked integration by parts and used the assumption that , a condition that is satisfied for the correlation and response functions in our theory. We can therefore use the identity to extract the final values of our order parameters.
We also need to invoke a similar relationship for the final values of the correlation functions
where is the two-variable Fourier transform. The final value of the test loss is .
C.1 General Case (Finite ν,α𝜈𝛼\nu,\alpha)
Before working out the solution to the response functions, we note that the following condition is always satisfied
For , this equation implies that . For , we can have either or but not both. We consider each of these cases below.
In this case, the response function as and as . We thus define
Using the equation which defines , we find that the variable satisfies the following relationship at
After solving this implicit equation, we can find the limiting value of as
Next, we can work out the scaling of the correlation functions in the limit of low frequency. We define the following limiting quantities based on a scaling analysis performed on our correlation functions for small
These limiting quantities satisfy the closed set of linear equations
These equations can be solved for . Simplifying the expressions to a two-variable system, we find
This expression recovers the ridgeless limit of the replica results of (Atanasov et al., 2023; Zavatone-Veth & Pehlevan, 2023) and the random matrix analysis of (Simon et al., 2023).
Following the same procedure, we note that for that and . We thus find the following equation for .
where as before . The analogous scaling argument for small gives us the following set of well-defined limiting quantities
where these limiting correlation values satisfy
This is again a closed linear system of equations for the variables . In the next section, we recover the result for kernel regression where and the learning curve for infinite data with respect to model size .
C.2 Learning Curves for Kernel Regression ν,t→∞→𝜈𝑡\nu,t\to\infty
In the and limit we recover the learning curve for kernel regression with eigenvalues . To match the notation of (Canatar et al., 2021), we define
which generates the following self-consistent equation for
Plugging this into the expression for the loss, we find
Letting , we have
The variable decreases from as . For we have . The quantity comes from overfitting due to variance from the randomly sampled dataset.
Appendix D Early Time Dynamics (High-Frequency Range)
In this section, we explore the early time dynamical effects of this model. Similar to how the late time dynamical effects could be measured by examining the low frequency part of the response and correlation functions, in this section, we analyze the high frequency components . We start by noting the following expansions valid near
We let . These can be plugged into the transfer function for mode
Preforming an inverse Fourier transform, we find the following early time asymptotics
We see from this expression that the early time corrections always scale as or and that these corrections build up over time. A similar expansion can be performed for with which also gives leading corrections which scale as and .
Appendix E Buildup of Overfitting Effects
In this section, we derive a formula for the gap between test loss and train loss . We start from the following formula
Moving the term to the other side, and using the fact that , we find the following relationship between train and test loss
To get a sense of these expressions at early and late timescales, we investigate the Fourier transforms at high and low frequencies respectively.
The relationship between Fourier transforms at high frequencies is
where . Taking a Fourier transform back to real time gives us the following early time differential equation for the test-loss train loss gap
The above equation should hold for early times. We note that exactly recovers the test-train gap.
E.2 Low Frequency Range/Late Time
At late time/low frequency, as we showed in Appendix C, the behavior of the correlation function depends on whether the model is over-parameterized or under-parameterized. In the overparameterized case, the asymptotic train loss is zero while the asymptotic test loss is nonzero. In the underparameterized case, we have a limiting value for both the test and train loss which can be computed from the expressions in Appendix C.
Appendix F Non-Proportional (Dimension-Free) Limit
We can imagine a situation where the original features are already infinite dimensional ( is taken first). This would correspond more naturally to the connection between infinite dimensional RKHS’s induced by neural networks at infinite width (Bordelon et al., 2020; Canatar et al., 2021; Cheng & Montanari, 2022). Further, we will assume a trace class kernel for the base features which diagonalizes over the data distribution as
As before, we are concerned with the test and train losses
The appropriate scaling of our four fields of interest in this setting are
Following the cavity argument given in the previous section, we can approximate the the correlation and response functions as concentrating to arrive at the following field description of the training dynamics
which are exactly the same equations as in the proportional limit except with the substitution and . The correlation and response functions have the form
which will all be under this scaling.
Appendix G Effect of Ensembling and Bagging on Dynamics
We adopt the language of the fine-grained bias-variance decomposition in (Adlam & Pennington, 2020b). There, a given learned function generally depends on both the dataset and initialization seed . We write this as . The role of random initialization is played by the matrix in our setting. For a given function, its variance over datasets and its variance over initializations are respectively given by
G.2 Derivation
In this section, we consider the effect of ensembling over random initial conditions and bagging over random datasets. We let represent the weight discrepancy for model on dataset . Here runs from to and runs from to . The th vector has dynamics:
Ensembling and bagging would correspond to averaging these s over these systems
The key vectors to track for this computation are
We can further show that the and have response functions that decouple across . Intuitively, giving the dynamical system a kick should not alter the trajectory of the separate dynamical system, even if they share disorder . The DMFT description of the proportional limit yields the following integral equations for the fields:
Here, the response functions are to be computed within a single system. In what follows, we will use to denote averages over the disorder, and explicitly write out any averages over the ensemble members and datasets.
The Gaussian variables in the DMFT have the following covariance
The covariances above allow for different ensemble or dataset index but not both. We will use etc to represent the correlation functions within a single system. For instance, while . The correlation function of interest is thus
We can combine the first two equations and the second two equations to identify the structure of the cross-ensemble and cross-dataset (across-system) correlations in terms of the marginal (within-system) correlation statistics
These equations give the necessary cross-ensemble and cross-dataset correlations. Now we can consider the effect of ensembling and bagging on the dynamics. To do so, consider the Fourier transform of the bagged-ensembled error , which has the Fourier transform
Computing the correlation function for this bagged-ensembled field random variable, we find
The first term is the irreducible bias for mode which is the loss for mode when the learned function is averaged over all possible datasets and all possible projections. We see that the second term scales as which will persist even if . Similarly, there is a term that is order which will persist even if . Lastly, there are two terms which depend on both . This is similar to the variance that is explained by the interaction of the dataset and the random projection (Adlam & Pennington, 2020b). The test loss is then a Fourier transform of the above function
If , then we obtain the stated irreducible bias of the main paper
This is the error of the mean output function over all possible datasets and random projections of a certain size.
G.3 Ensembling is Not Always Compute Optimal
For a compute budget , we find that ensembling does not provide as much benefit as increasing the size of the model. From the results in the last section, we note that ensembling reduces the variance. For this section, we consider the limit. We let represent the bias and represent the variance within a single ensemble. The loss at fixed compute then takes the form
For any which satisfies the condition that
we have that ensembling is strictly dominated by increasing .
Appendix H White Bandlimited Model
To gain intuition for the model, we can first analyze the case where , which has a simpler DMFT description since each of the features are statistically identical. We illustrate the dependence of the loss on model size and training time for in Figure 7. We note that the loss can be non-monotonic in at late training times, but that monotonicity is maintained for optimal early stopping, similar to results on optimal regularization in linear models (Advani et al., 2020) and random feature models (Mei & Montanari, 2022; Simon et al., 2023).
In the case of all we have the following definitions
Writing allows us to solve for exactly:
This is a cubic equation that can be solved for as a function of . In the limit of this simplifies to:
H.2 Timescale Corrections in The Small ν𝜈\nu Regime
By expanding the above in the limit of small we get that goes as
From this approximate response function, we find that the transfer function takes the form
where in the last line, we used the residue theorem. We note that in this perturbative approximation that this transfer function is always greater than the transfer function at which is . Thus finite leads to higher bias in this regime. We define bias and variance precisely in Appendix G.1.
H.3 Timescale corrections in fully expressive regime ν>1𝜈1\nu>1
For , we can approximate , we have
where we used the residue theorem after closing the contour in the upper half-plane. In Figure 8, we show that this perturbative approximation does capture a slowdown in the dynamics for large but finite .
Appendix I Power-Law Bottleneck Scalings
In this section we calculate the scaling of the loss with the various limiting resources (time, model size, and data) when using power law features. Since the power-law features give a trace class kernel (i.e. ), we use the non-proportional limit formalism in Appendix F, which gives an expression for with already considered infinite. While the resulting expressions are not a formal proportional thermodynamic limit and finite corrections exist in the form of fluctuations from one random realization of the system to another. These corrections decay rapidly enough at finite for this mean field theory to be accurate and descriptive in realistic systems (Bordelon et al., 2020; Simon et al., 2023; Cheng & Montanari, 2022). We plot this variability of random finite size experiments as highlighted standard deviations in the main text figures.
The time bottleneck is defined as the limiting dynamics in the absence of any model or data finite size effects. To eliminate those effects, we simply study the limit
In this limit, the response functions simplify to so that
Further, in this limit, we have that since all the variance terms (which depend on ) drop out. Thus we have the following loss at time ,
where the final scaling with time can be obtained through either change of variables or steepest descent methods (Bordelon & Pehlevan, 2022a).
I.2 Model Bottleneck
In this section we take . This leaves us with the following equation for .
Now, the large time limit of the transfer functions can be obtained from the final-value theorem
Now, integrating over the eigenvalue density to get the total loss gives
Thus we expect a powerlaw scaling of the form in this regime.
I.3 Data Bottleneck
In this section we take . This leaves us with the following equation for .
Now, the large time limit of the transfer functions can again be obtained from the final-value theorem
Now, integrating over the eigenvalue density to get the total loss gives
The loss will therefore scale as in this data-bottleneck regime.
Appendix J Optimization Extensions
In this section, we point out that DMFT can also completely describe discrete time training as well. In this section we consider discrete time gradient descent with learning rate
The delta function in this context is defined as
ensures that the initial condition is satisfied. These iteration equations can be closed for the response functions and correlation functions and solved over matrices.
Alternatively, we can also solve this problem in an analogous frequency space. Analogous to the Fourier transform method, the equations in discrete time can be closed in terms of the -transform
Applying this transform gives us the following expression for the fields.
Similar to the Fourier case, the final losses can be extracted as the limit of these objects.
J.2 Momentum
As mentioned in appendix B, it is straightforward to extend the DMFT treatment beyond just gradient descent dynamics to include a momentum term with momentum .
We first consider this replacement in continuous time. This requires applying the following replacement:
This slightly modifies the expressions for the response functions. For example, in Fourier space the response functions become:
In discrete time, momentum updates can be expressed as
where is the filtered version of the loss gradient (the field) with momentum coefficient and is the learning rate. The dependence on the field can be eliminated by turning this into a second order difference equation
Again, the final result can be expressed in terms of the -transformed transfer functions which have the form
J.3 One Pass SGD
In this section we derive online SGD with projected features. At each step a random batch of samples are collected (independent of previous samples), giving a matrix of sampled features. The update at step is
The DMFT limit gives the following statistical description of the fields, which decouple over time for the but remain coupled across time for
This system cannot exhibit overfitting effects as we have the statistical equivalence between the covariance of and the test loss:
We note that this is very different than the case where data is reused at every step, which led to a growing gap between train and test loss as we derive in Appendix E.
Appendix K Kernel Analysis of Feature Learning Networks
In Section 5.1, we observed that feature learning networks can achieve better loss and compute-optimal scaling. In such settings, it may be useful to observe the after kernel, namely the NTK at the end of training. This object can often shed insight into the structure of the learned network function (Atanasov et al., 2022; Long, 2021) and its generalization. In some cases, it has been observed that the final kernel stabilizes during the course of training (Fort et al., 2020), potentially allowing one to potentially deduce scaling laws from the spectrum and task-model alignment of this after-kernel, though other papers have observed contrary results (Vyas et al., 2022).
Motivated by this, we study the NTKs of the finite-width networks trained for 64 epochs with the animate-inanimate CIFAR-5m discrimination task. We observe in Figure 9 a) that the spectrum becomes flatter, with a decay exponent of close to down from for the initial kernel.
The fraction of the task power unexplained is also observed to have a lower exponent in Figure 9 b), however there is also the presence of a low rank spike indicative of the kernel aligning to this discrimination tasks.
From these scalings we can obtain the and exponents and get a prediction for the scaling of the test loss. We plot this in grey in Figure 9 c). The observed scaling (in black) is much better than that predicted by the after-kernel. This is an indication the the after kernel continues evolving in this task, improving the scaling exponent of the test loss.
The kernel-target alignment (Cortes et al., 2012), as measured by
is plotted in 9 d). Here is the target labels on a held-out test set, and is the gram matrix of the after-kernel on this test set. We indeed observe a consistent increase in this quantity across time. This gives an indication that understanding the evolution of the after-kernel will be useful
Appendix L Numerical Recipes
The simplest way to solve the DMFT equations is to iterate them from a reasonable initial condition (Mignacco et al., 2020; Bordelon & Pehlevan, 2022b). We solve in discrete time for matrices which have entries , etc. We let where is the learning rate.
Solve for the response functions by updating the closed equations as matrices by iterating the equations.
Once these response functions have converged, we can iterate the equations for the correlation functions
After iterating these equations, one has the discrete time solution to the DMFT order parameters and any other observable can then be calculated.
L.2 Fourier Transform Method
To accurately compute the Fourier transforms in the model/data bottleneck regime ( or ) we have that as so we must resort to analyzing the principal part and the delta-function contribution to the integral. Construct a shifted and non-divergent version of the function .
The Dirac mass is trivial to integrate over giving . Lastly, we must perform an integral of the type
Adding these two terms together, our transfer function has the form
The last integral can be performed numerically, giving a more stable result.
Appendix M Compute Optimal Scaling from Sum of Power-Laws
We suppose that the loss scales as (neglecting irrelevant prefactors)
Our goal is to minimize the above expression subject to the constraint that compute is fixed. Since is fixed we can reduce this to a one-dimensional optimization problem
The optimality condition is
From this last expression one can evaluate the loss at the optimum