Scaling ResNets in the Large-depth Regime
Pierre Marion, Adeline Fermanian, Gérard Biau, Jean-Philippe Vert
Introduction
The most common architectures have 50-150 layers, but ResNets can be trained with depths up to the order of thousand layers (He et al., 2016b). Yet, the training procedure needs to be carefully crafted to avoid vanishing or exploding gradients, particularly as the depth increases. As pointed out by, e.g., Shao et al. (2020), these instabilities are related to a shift in the magnitude of the variance of a signal as it passes through the network. In the original approach of He et al. (2016a), the issue was mitigated by adding a normalization step, called batch normalization (Ioffe and Szegedy, 2015), which rescales the output of each layer via centering and unit variance normalization. However, this normalization stage introduces practical and theoretical difficulties, among which computational overhead and strong dependence on the batch size (see Brock et al., 2021, and the references therein). A widespread alternative to stabilize training in deep models, explored for example by Yang and Schoenholz (2017), Arpit et al. (2019), Zhang et al. (2019b), and De and Smith (2020), is to incorporate a scaling factor in front of the residual term in (1), yielding the model
There is strong evidence that this scaling factor should depend on , without however any consensus to date on the exact form of this dependence, nor on the mathematical grounding of the approach. Thus, despite progresses on the empirical side, the mathematical forces in action behind the stability of deep ResNets are still poorly understood, although they are key to unlock training at arbitrary depth.
Our goal in the present paper is to take a step forward towards a better theoretical understanding of deep ResNets by providing a thorough probabilistic analysis of the sequence at initialization when is large, and by leveraging a continuous-time interpretation of model (2) via the so-called neural ordinary differential equation (neural ODE, Chen et al., 2018) paradigm. In a nutshell, our results highlight the intimate connection that exists at initialization between stability of the learning process, the regularity of the weights, and the scaling factor . We offer in particular a proper mathematical grounding on why and how to choose the parameter as a function of the depth and the distribution of the weights.
2 Our contributions
The optimal parameters of ResNets are learnt by minimizing some empirical risk function via a gradient descent algorithm. As highlighted for example by Yang and Schoenholz (2017), Hanin and Rolnick (2018), and Arpit et al. (2019), a good parameter initialization of this learning phase plays a major role in the quality of the learnt model, in particular to avoid vanishing gradients and deadlock at initialization, or exploding gradients and quick divergence of the model parameters at the beginning of training. Moreover, a good initialization allows the use of larger learning rates, which have been shown to correlate with better generalization (Jastrzkebski et al., 2017). It is thus of great interest to study and understand the role played by scaling of deep ResNets at initialization. This is the context in which we place ourselves in the sequel.
The continuous approach.
As noticed by several authors (Chen et al., 2018; Thorpe and van Gennip, 2018; E et al., 2019), model (2) with a scaling factor (and not ) is formally similar to the discretization of a differential equation. Thus, when tends to infinity, the weights and hidden states change continuously with the layer according to the equation
Going further, our third contribution is to exhibit in Section 4 a continuous range of regimes that are controlled by the choice of (beyond the cases and ) and the distribution of at initialization, derived from a continuous-time process with a regularity different from a Brownian motion. More precisely, we show experimentally that there is a strong interplay (with the same three cases—explosion, identity mapping, non-trivial behavior) between the choice of and the regularity of as a function of the layer index . In addition, empirical evidence suggests that this interplay impacts both the behavior and performance of the networks during training, beyond initialization.
3 Related work
The choice of scaling for ResNets has been discussed in many papers, without however reaching a clear consensus on the form this scaling factor should take. For instance, Hanin and Rolnick (2018) state that stability requires , while Zhang et al. (2019b) show that is enough to ensure stability. On the other hand, Cohen et al. (2021) claim that the scaling factor observed in practice in trained ResNets is of the form with . Other authors have proposed more complex choices for (e.g., Zhang et al., 2019a; Shao et al., 2020). Taking another point of view, De and Smith (2020) observe that batch normalization is empirically equivalent to taking a normalization factor. Bachlechner et al. (2021) suggest to learn a scaling parameter that is allowed to vary from one layer to another, whereas, in (4), is kept constant across layers. These authors observe a great acceleration for training compared to traditional ResNets with no scaling. They also suggest a similar architecture for Transformers and then notice that at the end of training.
Closest to our analysis at initialization are the papers of Arpit et al. (2019) and Zhang et al. (2019b). Arpit et al. (2019) develop a theoretical analysis based on mean field approximation that suggests that a scaling factor prevents vanishing/exploding gradients at initialization, and provide experimental evidence that this approach is competitive with batch normalization. However, the authors do not provide rigorous mathematical statements for the three different cases , , and , nor do they highlight the connection with the continuous-time interpretation. Interestingly, the idea of exploiting the martingale structure to analyze the magnitude of the hidden states is present in Zhang et al. (2019b), who study the convergence of gradient descent for over-parameterized ResNets with different values of . Nevertheless, they consider a specific model with Gaussian weights, and only provide asymptotic results when both width and depth tend to infinity.
The connection between the choice of scaling and the continuous-time point of view has previously been noticed by Zhang et al. (2019c), then studied in detail by Cohen et al. (2021). The latter show that, under assumptions on the form of the weights, it is possible to derive limiting (stochastic or ordinary) differential equations for the hidden states. However, they do not discuss the transition between these two regimes, nor do they link differential equations regimes with the stability of the network.
Scaling at initialization
Our goal in this section is to study the effect of the scaling factor on the stability of ResNets at initialization, assuming that the weights are i.i.d. random variables. We start by making more precise the model and the learning problem introduced in (1).
An important feature of model (4) is that the layer function takes the form of a matrix-vector multiplication, which will prove crucial to make use of concentration results on random matrices. We stress that this setting is standard in practice and that it encompasses many different types of ResNets. It includes for example simple ResNets where with the activation function, and the original ResNets from He et al. (2016a), which have
Probabilistic setting at initialization.
It is stressed that the distribution of the parameters are assumed to be independent of the depth, so that all the dependence on is captured in the scaling factor . This model enables us to consider multiple architectures at once, via the function . By contrast, some authors formulate the problem of scaling as a choice of the variance at initialization (e.g., Yang and Schoenholz, 2017; Wang et al., 2022), which makes the analysis architecture-dependent. However, for a given architecture, these two approaches are essentially equivalent since .
The quantity carries key information on the behavior of the network at initialization. On the one hand, if , the network is essentially equal to the identity function. On the other hand, if , the output of the network explodes. An intermediate situation is when . In addition, another source of information is provided by the gradients of the hidden states with respect to the empirical risk . If , the gradients do not change as they flow through the network, which means that the exact same information is backpropagated throughout the network. Conversely, if , the gradients explode during backpropagation. By exploiting the martingale structure of , as well as state-of-the-art concentration inequalities for random matrices with sub-Gaussian entries, we provide in this section probabilistic bounds on the magnitude of these various quantities.
Assumptions.
The following assumptions will be needed throughout the section: for any ,
For some , the entries of are symmetric i.i.d. sub-Gaussian random variables, independent of and , with unit variance.
Assumption is mild and satisfied by all initializations used in practice. For example, the classical Glorot initialization (Glorot and Bengio, 2010)—which is the default implementation in the Keras package (Chollet et al., 2015)—takes the entries of as uniform variables. This means that is initialized with random variables, which satisfy . Other examples include the Gaussian initialization of He et al. (2015) and, for example, initialization with Rademacher variables.
The first part of Assumption ensures that is not too far away from being an isometry in expectation. The second part is more technical and, roughly, allows to upper bound the deviations of the norm of . Our next Proposition 1 shows that most classical ResNet architectures verify Assumption . For the sake of readability, these models, together with their parameters, are summarized in Table 1 below.
Let res-1, res-2, and res-3 be the models defined in Table 1. Then
Assumption is satisfied for res-1.
Assumption is satisfied for res-2 and res-3, as soon as the entries of are symmetric i.i.d. sub-Gaussian random variables, independent of and , with unit variance.
In the models res-1 and res-2, can be, for instance, taken as the parametric ReLU function, i.e., , where (resp. ) denotes the positive (resp. negative) part and the slope is a parameter of the model. Observe also that res-2 differs from res-3 since the classical ReLU function is defined by and thus does not satisfy the condition . Note that there is no bias term in these three models, as this term is commonly initialized to zero, and we are interested in the behavior at initialization.
2 Probabilistic bounds on the norm of the hidden states
The next two propositions describe how the quantity changes as a function of . Proposition 2 provides a high-probability bound of interest when . In this case, we see that, with high probability, the network acts as the identity function, directly mapping to . On the other hand, Proposition 3 provides information in the two cases and . When , the lower bound indicates an explosion with high probability of the norm of the last hidden state. On the other hand, when , the bounds and show that randomly varies around with fluctuation sizes bounded from below and above.
Consider a ResNet (4) such that Assumptions and are satisfied. If , then, for any , with probability at least ,
Consider a ResNet (4) such that Assumptions and are satisfied.
Assume that and . Then, for any , with probability at least ,
Assume that . Then, for any , with probability at least ,
Note that the assumptions of Proposition 3 on and are mild, since in the learning tasks where deep ResNets are involved, one typically has with , and . Note also that condition (5) is not severe since, when and are large, it encompasses all reasonable values of . Propositions 2 and 3 are interesting in the sense that they provide finite-depth high-probability bounds on the behavior of the hidden states, depending on the magnitude of . The results become clearer by letting , with , as shown in the following corollary.
Consider a ResNet (4) such that Assumptions and are satisfied, and let , with .
If and , then
If , , , then, for any , with probability at least ,
Corollary 4 highlights three different asymptotic behaviors for , depending on the values of . For , statement tells that converges towards in probability, as tends to infinity, which means that the neural network is essentially equivalent to an identity mapping. On the other hand, for , the norm of explodes with high probability. Finally, for the critical value , we see that fluctuates around , with a fluctuation size independent of . Observe that the lower bound in is not trivial as soon as , i.e., . The message of Corollary 4 is that the only scaling leading to a non-degenerate distribution at initialization is for .
The three statements of Corollary 4 are illustrated in Figure 1. In this experiment, we consider model res-3, a random Gaussian observation in dimension , and parameters initialized with a uniform distribution . We refer to Appendix E for a detailed setup of all the experiments of the paper. Figure 2(a) shows the empirical distribution of when for a large number of realizations. This figure illustrates in particular that our bounds are reasonably sharp, since the bounds indicate that the first quartile of the distribution is larger than (whereas the first quartile of the empirical histogram is equal to ) and the third quartile is less than (whereas the third quartile of the empirical histogram is equal to ). Determining the exact distribution of is an interesting avenue for future research that is beyond the scope of the present article. There is however a strong indication that the ratio follows a log-normal distribution, as confirmed by a normality test on (the log of) the empirical distribution.
In a nutshell, the proofs of Propositions 2 and 3 rest upon controlling of the norm of the hidden states, which obeys the recurrence
The equalities (2.2) and (8) allow deriving without further work bounds in expectation on , as already observed by Arpit et al. (2019). However, the results we are after are stronger since they involve high-probability bounds. A finer control of the deviations of and is then needed. This involves concentration inequalities on random matrices with sub-Gaussian entries.
3 Probabilistic bounds on the gradients
Analyzing the behavior of the sequence is challenging since, according to the backpropagation (or reverse-mode differentiation) formula, one has
Although the equation looks qualitatively similar to (6), it has the unpleasant feature that depends on , hence on , while depends on . This forbids applying directly the same proof techniques as for the hidden states. Therefore, to extract useful information from this recurrence equation, one needs to characterize the dependence of the distribution of with respect to . To do so, it is sometimes assumed that these two quantities are independent (see, e.g., Yang and Schoenholz, 2017). However, assuming independence remains a strong requirement, which is not verified for many network architectures (for example model res-1). We tackle the problem from a different point of view and propose an alternative approach based on forward-mode differentiation, valid under a much weaker assumption. The cost we pay is that we obtain results in expectation and not in high probability.
Identity (9), which is similar to (4), expresses as a function of , and therefore respects the flow of information. Next, assuming that is random with a Gaussian distribution, it is possible to express one of our quantities of interest, , as a function of the last vector . Indeed,
In summary, the recurrence (9) allows us to derive bounds on the norm of , which can then transfer to via (10). For this, it is necessary to make the following assumption on the ratio :
It is a mild assumption, which is verified for instance if with squared error (for regression) or cross-entropy (for binary classification). In these cases, , where is the Frobenius norm and is the weight matrix of the last layer. We finally need the following assumption, which is the equivalent of Assumption for the gradients.
Assumption is satisfied by all the standard architectures listed in Table 1, as shown by the next proposition.
Let res-1, res-2, and res-3 be the models defined in Table 1. Assume that is satisfied and is almost everywhere differentiable, with . Then
Assumption is satisfied for res-1.
Assumption is satisfied for res-2 and res-3, when the entries of are symmetric i.i.d. random variables, independent of and , with unit variance.
The next two propositions are the counterparts of Proposition 2 and Proposition 3 for the gradient dynamics.
Consider a ResNet (4) such that Assumptions - are satisfied. If , then, for any , with probability at least ,
Consider a ResNet (4) such that Assumptions - are satisfied. Then
A simple corollary of the propositions above is as follows.
Consider a ResNet (4) such that Assumptions - are satisfied, and take , with . Then
Corollary 8 is illustrated in Figure 3. The experimental protocol is the same as in Figure 1, but we now track and , the gradients of the loss with respect to the first and the last hidden states. In accordance with our results, when , the gradient remains the same from one layer to another (left plot). On the other hand, the middle plot clearly shows that when the gradient explodes. Once again, the case (right plot) is the only one for which the distribution of gradients at initialization is non-trivial. Figure 2(b) illustrates that the empirical distribution of gradients in this case also seems to be log-normal.
In summary, this and the previous subsection both point towards the same conclusion: there are three different cases, depending on the value of —explosion when , non-degenerate limit when , and identity when . In the explosion case, it is well known that the network cannot be trained (Yang and Schoenholz, 2017). The theory thus points out that the value plays a pivotal role. Remarkably, this value has a specific interpretation in the continuous-time point of view of ResNets, in terms of SDE. This is the topic that we address in the next section.
Scaling in the continuous-time setting
Starting with the discrete ResNet (4), it is tempting to let go to infinity and consider the network as the discretization of a differential equation where the layer index is replaced by the time index . This interpretation of deep neural networks has been popularized by Chen et al. (2018) and is often referred to as the neural ODE paradigm. Notice that this setting is different from the so-called mean-field analysis, where the width of the network is assumed to be infinite beforehand. In our setting, the width is assumed to be finite and fixed.
One of the main messages of Section 2 is that the standard initialization with i.i.d. parameters leads to a non-degenerate model for large values of only if (Propositions 2 and 3), or, equivalently, if when (Corollary 4). Remarkably, in the continuous-time limit, this regime corresponds to the discretization of an SDE. Indeed, consider for simplicity the (discrete) ResNet model res-1
where the entries of are assumed to be i.i.d. . Recall the following definition:
A one-dimensional Brownian motion is a continuous-time stochastic process with , almost surely continuous, with independent increments, and such that for any , .
and the increments for different values of are independent. As a consequence, the recurrence (11) is equivalent in distribution to the recurrence
(Note that this is true because has the same distribution as .) We recognize the Euler-Maruyama discretization (Kloeden and Platen, 1992) on the mesh of the SDE
where the output of the network is now a function of the final value of , that is, . The link between the discrete ResNet (11) and the SDE (12) is formalized in the next proposition.
Consider the res-1 model, where the entries of are i.i.d. Gaussian random variables. Assume that the activation function is Lipschitz continuous. Then the SDE (12) has a unique solution and, for any ,
Notice that the requirement that is Lipschitz continuous is satisfied by most classical activation functions, including ReLU. This proposition is interesting for several reasons. First, the scaling , which is exactly the one that yields a non-trivial dynamics at initialization, corresponds in the continuous world to a remarkably ‘simple’ model of diffusion. This shows that very deep neural networks properly initialized with i.i.d. weights are equivalent to solutions of SDE. This analogy opens interesting perspectives for training deep networks using automatic differentiation for solutions of neural SDE (Li et al., 2020).
Second, we stress that the emergence of an SDE instead of an ODE carries an important message. Several authors (including, e.g., Thorpe and van Gennip, 2018) have shown that, under appropriate assumptions, a deep ResNet converges in the large depth limit to an ODE and not an SDE. The reason why we obtain an SDE here is intrinsically connected with the choice of i.i.d. initialization for the weights, which makes a Brownian motion appear at the limit, as highlighted above. In other words, the i.i.d. initialization, the choice (the relevant critical value exhibited in Section 2), and the emergence of an SDE are intimately linked together. On the other hand, the case matches with an ODE if the initialization is not i.i.d., as we will see in Subsection 3.2.
Finally, we point out that Proposition 10 states the convergence of a ResNet towards an SDE for the basic architecture res-1 and for Gaussian initialization. The extension to more general settings is an interesting direction of research, although clearly beyond the scope of the present paper (see, e.g., Peluchetti and Favaro, 2020, and Cohen et al., 2021, for results in this direction).
2 Scaling in the neural ODE setting
The basic message of our Proposition 10 is that an i.i.d. initialization, together with , leads to an SDE rather than an ODE. A natural question is then whether a different choice of weight distributions (at initialization) and scaling can lead to a classical neural ODE.
where and . Of course, it is still possible to consider (resp. ) as random variables, by letting (resp. ) be a continuous-time stochastic process. In this model, we shall need the following assumption:
For any , one has and , where the stochastic processes and are almost surely Lipschitz continuous and bounded.
More precisely, almost surely, there exist , such that, for any ,
We shall also need the following requirement on , which is satisfied by all our models as soon as is Lipschitz continuous:
Under Assumptions and , the recurrence (13) almost surely converges towards the neural ODE given by
Consider model (13) such that Assumptions and are satisfied. Then the ODE (14) has a unique solution , and, almost surely, there exists some such that, for any ,
It should be stressed that the transition from the discrete recurrence (13) to the continuous-time differential equation (14) relies on the assumptions that the weight sequences and are the discretizations of smooth limiting processes and on the one hand, and that the scaling is chosen as on the other hand. From a practical perspective, Proposition 11 shows that it is possible to initialize ResNets in the ODE regime, by choosing a smooth stochastic process, discretizing it at each layer, and taking a scaling. This is in sharp contrast with the results of Sections 2 and 3.1, which show that the usual i.i.d. procedure leads to a neural SDE.
Stability and scaling.
Assuming that the weights of the network are discretizations of a smooth function (Assumption ), it is possible to obtain stability results, depending on the value of , similarly to what has been done in Section 2. We show below that is a critical value, by examining the hidden states, in the same way as is a critical value in the i.i.d. setting. Similar results can be shown for the gradients. We begin by a proposition handling the cases and .
Consider a ResNet (4) such that Assumptions and are satisfied. Let , with .
If , then, almost surely, there exists some such that
The explosion case () is more delicate to deal with. We prove it for a linear model, and leave for future work the extension to more general cases.
Consider the res-1 model, taking as the identity function. Assume that Assumption is satisfied and that has a positive eigenvalue. Let , with . Then, almost surely,
The assumption of the existence of a positive eigenvalue for is mild. For instance, if the entries of are i.i.d. random variables with finite moments of all order, Götze and Jalowy (2021) show that such an eigenvalue exists with probability at least for large enough.
In this setting, we observe experimentally a behavior of the output and of the gradients when grows large similar to the one explored in Section 2. This is illustrated in Figures 4 and 5, which mirror Figures 1 and 3 in Section 2. The figures clearly show that there exist three cases for the output and for the gradients: an identity case (left plots), an explosion case (middle), and a non-trivial case separating explosion and identity (right). However, the remarkable point is that the separation occurs for , and not , as predicted by Propositions 12 and 13.
Experiments
We experimentally investigate in this section two questions. The first one is to know whether there exists a range of scaling factors and weight initializations, beyond the i.i.d. and the smooth regimes. The second question is whether our analysis, which pertains to the initialization phase, provides insights into the training phase, beyond initialization.
In order to describe the transition between the i.i.d. and smooth cases, a possible route is to consider that the weights are increments of a -Hölder stochastic process. This model is interesting insofar as the Brownian motion (SDE regime) is -Hölder () and a Lipschitz continuous stochastic process (ODE regime) is -Hölder.
In line with the above, in a series of experiments, we initialize the weights as increments of a fractional Brownian motion . Recall that is a continuous-time Gaussian process, starting at zero, with zero expectation for all , and covariance function
where is called the Hurst index. This index describes the raggedness of the process, with a higher value leading to a smoother process. When , the process is a standard Brownian motion (Definition 9), whose increments are independent by construction. When , the increments of the process are positively correlated, while if the increments are negatively correlated. Importantly, a fractional Brownian motion with Hurst index is -Hölder continuous for any . In the limit when , the trajectories converge to linear functions (whose increments satisfy ). As an illustration, Figure 6 depicts three realizations of a fractional Brownian motion with (left), (middle), and (right).
In order to assess the effect of the scaling factor and the Hurst index , we initialize a neural network res-3 with , , various values of , and with weights taken as increments of fractional Brownian motions with various Hurst indices . Figure 7 depicts the empirical magnitude of the output and the gradients at initialization as a function of the Hurst index and the scaling factor . First note that we recover the two regimes (i.i.d. and smooth) discussed so far. For , the i.i.d. regime kicks in, with explosion (, orange zone), non-trivial behavior (, black zone), and identity (, blue zone). Likewise, we see at a similar pattern in the smooth regime, with, as predicted by Proposition 12, a critical value . Beyond these two specific cases, we observe for an index varying in a whole range of intermediate situations, where the transition between identity and explosion seems to happen for a critical . Interestingly, for , the transition seems to saturate at the value .
The take-home message is that the choice of the scaling of a ResNet seems to be closely linked to the regularity of the weights as a function of the layer. More precisely, for all regimes, the critical scaling factor between explosion and identity seems to have a natural interpretation as the (Hölder) regularity of the underlying continuous-time stochastic process. We believe that the mathematical understanding of this connection, beyond the fractional Brownian motion case, is a promising research direction for the future. Finally, these experiments suggest that it is sensible to initialize a ResNet for any value of the scaling , while avoiding the identity and explosion situations, by simulating a fractional Brownian motion of Hurst index and initializing the weights as the increments of this process.
2 Beyond initialization
At initialization, before the gradient descent, the distribution of the weights and is chosen by the practitioner. By contrast, during and after training, control is lost on these distributions, making the picture more complex. In particular, the existence and characterization of a continuous-time stochastic process whose discretization matches the trained ResNet is an interesting but difficult problem. Attacking this question requires a fine understanding of the interaction between training dynamics and the regularity of the sequence of the weights during the gradient descent. However, there is experimental evidence that the trained weights exhibit strong structure as a function of the layer index (Cohen et al., 2021; Bayer et al., 2022), and that their regularity strongly depends on the choice of initialization. Figure 8 depicts this mechanism by plotting a given coordinate of as a function of the layer index ranging from to the depth , after training.
To investigate the link between regularity of the weights at initialization, scaling, and performance after training, we train ResNets on the datasets MNIST (Deng, 2012) and CIFAR-10 (Krizhevsky, 2009). As in Subsection 4.1, we initialize the ResNets with various scaling factors and weights that are increments of fractional Brownian motions with different regularities. Then, for each combination of weight initialization and scaling factor, the ResNet is trained using the Adam optimizer (Kingma and Ba, 2015) for epochs. The results in terms of accuracy are presented in Figure 9 (light orange = good performance, blue = bad performance). We observe a pattern similar to the one of Figure 7, however shifted downwards. This means that, for a given regularity, the network is unable to learn if it is initialized with a scaling too far below the critical value, which of course is connected with the gradient explosion issue discussed previously. On the other hand, and perhaps more surprisingly, the performance seems to be more or less stable in the identity region, with perhaps a small degradation in the case of CIFAR-10. This somewhat contrasts with the results from Yang and Schoenholz (2017), who exhibit a decrease in performance for i.i.d. initialization and a large scaling factor . Note however that, in our experiments, we adapted the learning rate of the gradient descent on a grid by cross-validation. This was done to prevent a slowdown in training when the scaling factor is too large, since, in the gradient descent, the gradients updates are also scaled by the factor —which gets smaller as increases. The interplay between the learning rate and the scaling factor is one of the keys to better assess how the performance of the trained network is connected with the scaling.
The authors thank S. Schoenholz for fruitful discussion. P. Marion has been supported by a grant from Région Île-de-France and by a Google PhD Fellowship award.
Appendix A Proofs
Throughout the proofs, the -th coordinate of a vector is denoted by . Similarly, the -th row of a matrix is denoted by , and its -th entry by .
A.2 Proof of Proposition 2
But, for , we have Therefore,
and the result follows from Markov’s inequality.
Consider a ResNet (4) such that Assumptions and are satisfied. Then
Taking the squared norm of the forward update rule (4) and dividing by yields
We deduce by Assumptions and that
Now, observe that . Thus, we have
By conditioning on all random variables except for (and for ), it is easy to see that the only non-zero terms are when . This yields
A.3 Proof of Proposition 3
Dividing (15) by and taking the logarithm leads to
and . The proof of Proposition 3 strongly relies on the following lemma, which provides technical information on the moments of and . For the sake of clarity, its proof is postponed to Appendix B.
Assume that Assumptions and are satisfied. Then
The last inequality is true for . Therefore, by inequality (17), we obtain, for ,
We conclude that, for any , with probability at least ,
This shows statement of the proposition.
Next, to prove statement , observe that ,
Using the inequality for , we obtain
where the last inequality is valid for and . Hence, for ,
Using the -inequality respectively for and , we see that
By -, it is easy to verify that, for and ,
This shows that, for ,
To conclude the proof, it remains to upper bound the second term of inequality (18). According to inequality (22) in the proof of Lemma 15 (with ), one has
Putting everything together, we are led to
Take . Then, if 2L\exp\big{(}-\frac{d}{64\alpha_{L}^{2}s^{2}}\big{)}\leqslant\frac{\delta}{11}, with probability at least ,
Notice that this inequality is valid under the assumption .
A.4 Proof of Corollary 4
Statement is a consequence of Proposition 2, whereas is a consequence of Proposition 3 . The latter is valid under the conditions and , which is automatically satisfied for all large enough. Furthermore, an inspection of the proof of Proposition 3 reveals that the divergence in high probability of can be proved under the relaxed assumption . Indeed, the main constraint on comes from the lower bound (19), where one needs to make sure that , which is the case for .
To prove , we use a union bound on both statements of Proposition 3.
A.5 Proof of Proposition 5
The first claim follows from the observation that
from , and from the assumption on .
Denote by the matrix in the middle of the right-hand side. Then
Since the are symmetric random variables, we conclude that
A.6 Proof of Proposition 6
Letting , as in Assumption , and taking expectation in (10), we obtain
The rest of the proof is similar to the proof of Proposition 2. From (9), we have
By independence of from and ,
Using arguments similar to (20), we may write
Now, upon noting that ,
for . Note that the second equality is obtained by conditioning on every random variable except for (and for ). Finally, by using Markov’s inequality, we conclude that, for any ,
A.7 Proof of Proposition 7
A.8 Proof of Corollary 8
The first statement is an immediate consequence of Proposition 6. The second one is a consequence of Proposition 7 and the fact that, for ,
Finally, follows from Proposition 7.
A.9 Proof of Proposition 10
The proposition is a consequence of Kloeden and Platen (1992, Theorems 4.5.3 and 10.2.2) for the SDE
Letting and , we need to check the following assumptions:
Assumptions , , and readily follow from the definitions. Assumption is true since is Lipschitz continuous, and follows from
A.10 Proof of Proposition 11
In addition, it is continuous in its second one. Thus, according to the Picard-Lindelöf theorem (Theorem 22 in Appendix D), this is enough to show that the neural ODE (14) has a unique solution on $HM>0$.
In order to prove the approximation bound of Proposition 11, we start by proving that both and are Lipschitz continuous in . Under and , this is clear for since is bounded. Moreover, for any , we have
Now, let and denote the Lipschitz constants of (in both arguments) and respectively, and, for any , let . Then we have, for ,
A.11 Proof of Proposition 12
Starting from (4) and using Assumption , one easily obtains the existence of and (whose values depend on the realization of and ) such that
Hence, using ,
since we showed that each term in the sum is bounded by some constant , independent of and . Hence we have that
yielding the results depending on the value of .
A.12 Proof of Proposition 13
Take a unit-norm eigenvector of with associated eigenvalue . Then
Since is Lipschitz and , there exists such that . Hence
Let , and suppose that for all . Then
Then, for ,
Thus, since , we have that , which contradicts our assumption that for all . We deduce that, for all large enough,
Appendix B Technical results
Proof The first part is a consequence of the assumption on . To prove the equality, let . Then
The result follows by summing over all .
B.2 Proof of Lemma 15
and are simple consequences of Assumptions and .
To prove , let . Then
It is easy to verify that, under Assumption , each term of the sum above has zero expectation. This shows .
To establish , we start by noting that
To prove , let . Then, for any ,
by Jensen’s inequality. Finally, using Assumption , we deduce that
In particular, for all (see, e.g., Pauwels, 2020),
Finally, and are consequences of Lemma 21 in Appendix C.
Appendix C Concentration of sub-Gaussian random matrices
In this appendix, we are interested in the concentration of linear and quadratic forms of sub-Gaussian matrices (Lemma 20 and Lemma 21). These two propositions are byproducts of the main result of Kontorovich (2014), which generalizes McDiarmid’s inequality to sub-Gaussian variables. We start by a technical result regarding the sub-Gaussian diameter introduced by Kontorovich (2014), whose definition is recalled below.
Let be a real-valued random variable, an independent copy of , and a Rademacher random variable, independent of and . Then the sub-Gaussian diameter of is defined as the smallest such that is sub-Gaussian.
Let be a sub-Gaussian symmetric random variable. Then the sub-Gaussian diameter of is less than .
where the last equality is a consequence of the symmetry of .
We are now ready to prove the two main results of this appendix.
By the triangle inequality, is a Lipschitz continuous function, with Lipschitz constant equal to . Observe also that is a sub-Gaussian. Thus, according to Lemma 19, the sub-Gaussian diameter of is less than . By Kontorovich (2014, Theorem 1), for any , one has
Each function is a Lipschitz continuous function, with Lipschitz constant equal to . Observe now that the random variable is sub-Gaussian. Thus, according to Lemma 19, the sub-Gaussian diameter of is less than . Therefore, according to Kontorovich (2014, Theorem 1), for any ,
From identity (21) in the proof of technical Lemma 17, given in Appendix B, we obtain that, for ,
which is an improvement by a factor over the previous upper bound. To conclude, it remains to conclude and with the . To do so, observe that
Hence, by independence of the ,
Appendix D A version of the Picard-Lindelöf theorem
Appendix E Detailed experimental setting
Our code is available at https://github.com/PierreMarion23/scaling-resnets.
To obtain Figures 1 to 3, we initialize ResNets from res-3 with the hyper-parameters of Table 2.
Each experiment is repeated times, with independent data and weight sampling.
For Figures 4 and 5, we take the same hyper-parameters except for , which now takes values in , and for the weight distribution. The weights are now initialized as discretizations of a Gaussian process. More precisely, each entry of and is an independent Gaussian process with zero mean and an RBF kernel of variance .
To obtain Figure 7, we take the hyper-parameters of Table 3.
More precisely, for each , we let be the increments of a fractional Brownian motion (fBm), where the various fBm involved are independent. The procedure is the same for .
In Figure 9, we use res-1, with the hyper-parameters of Table 4.
We train on MNISThttp://yann.lecun.com/exdb/mnist and CIFAR-10https://www.cs.toronto.edu/~kriz/cifar.html using the Adam optimizer (Kingma and Ba, 2015) for epochs. The learning rate is divided by after epochs. The best performance on the learning rate grid is reported in the figure.
Figure 8 is obtained by plotting a random coordinate of , after training on MNIST.