Sebastian Goldt

Madhu S Advani

Andrew M Saxe

Florent Krzakala

Lenka Zdeborová

Generalisation dynamics of online learning in over-parameterised neural networks

Deep neural networks achieve stellar generalisation on a variety of problems, despite often being large enough to easily fit all their training data. Here we study the generalisation dynamics of two-layer neural networks in a teacher-student setup, where one network, the student, is trained using stochastic gradient descent (SGD) on data generated by another network, called the teacher. We show how for this problem, the dynamics of SGD are captured by a set of differential equations. In particular, we demonstrate analytically that the generalisation error of the student increases linearly with the network size, with other relevant parameters held constant. Our results indicate that achieving good generalisation in neural networks depends on the interplay of at least the algorithm, its learning rate, the model architecture, and the data set.

Introduction

One hallmark of the deep neural networks behind state-of-the-art results in image classification [START_REF] Lecun | Deep learning[END_REF] or the games of Atari and Go [START_REF] Mnih | Humanlevel control through deep reinforcement learning[END_REF][START_REF] Silver | Mastering the game of Go with deep neural networks and tree search[END_REF] is their size: their free parameters outnumber the samples in their training set by up to two orders of magnitude [START_REF] Simonyan | Very Deep Convolutional Networks for Large-Scale Image Recognition[END_REF]. Statistical learning theory would suggest that such heavily over-parameterised networks should generalise poorly without further regularisation [START_REF] Bartlett | Rademacher and Gaussian complexities: Risk bounds and structural results[END_REF][START_REF] Mohri | Foundations of Machine Learning[END_REF][START_REF] Neyshabur | Norm-Based Capacity Control in Neural Networks[END_REF][START_REF] Golowich | Size-Independent Sample Complexity of Neural Networks[END_REF][START_REF] Dziugaite | Computing Nonvacuous Generalization Bounds for Deep (Stochastic) Neural Networks with Many More Parameters than Training Data[END_REF][START_REF] Arora | Stronger generalization bounds for deep nets via a compression approach[END_REF][START_REF] Allen-Zhu | Learning and Generalization in Overparameterized Neural Networks, Going Beyond Two Layers[END_REF], yet empirical studies consistently find that increasing the size of networks to the point where they can fit their training data and beyond does not impede their ability to generalise well [START_REF] Neyshabur | In search of the real inductive bias: On the role of implicit regularization in deep learning[END_REF][START_REF] Zhang | Understanding deep learning requires rethinking generalization[END_REF][START_REF] Arpit | A Closer Look at Memorization in Deep Networks[END_REF]. This paradox is arguably one of the biggest challenges in the theory of deep learning.

In practice, it is notoriously difficult to determine the point at which a statistical model becomes over-parameterised for a given data set. Instead, here we study the dynamics of learning neural networks in the teacher-student setup. The student is a two-layer neural network with weights w that computes a scalar function φ(w, x) of its inputs x. It is trained with samples (x, y), where y = φ(B, x) + ζ is the noisy output of another two-layer network with weights B, called the teacher, and ζ is a Gaussian random variable with mean 0 and variance σ 2 . Crucially, the student can have a number of hidden units K that is different from M , the number of hidden units of the teacher. Choosing L ≡ K -M > 0 then gives us neural networks that are over-parameterised with respect to the generative model of their training data in a controlled way. The key quantity in our model is the generalisation error

g ≡ 1 2 [φ(w, x) -φ(B, x)] 2 , (1)
where the average • is taken over the input distribution. Our main questions are twofold: how does g evolve over time, and how does it depend on L? Main contributions. We derive a set of ordinary differential equations (ODEs) that track the typical generalisation error of an over-parameterised student trained using SGD. This description becomes exact for large input dimension and data sets that are large enough to allow that we visit every sample only once before training converges. Using this framework, we analytically calculate the generalisation error after convergence * g . We find that with other relevant parameters held constant, the generalisation error increases at least linearly with L. For small learning rates η in particular, we have * g ∼ ησ2 L.

(2)

Our model thus offers an interesting perspective on the implicit regularisation of SGD, which we will discuss in detail. The derivation of a set of ODEs for over-parameterised neural networks and their perturbative solution in the limit of small noise are an extension of earlier work by [START_REF] Biehl | Learning by on-line gradient descent[END_REF] and [START_REF] Saad | Exact Solution for On-Line Learning in Multilayer Neural Networks[END_REF][START_REF] Saad | On-line learning in soft committee machines[END_REF].

The concepts and tools from statistical physics that we use in our analysis have a long and successful history of analysing average-case generalisation in learning and inference [START_REF] Gardner | Three unfinished works on the optimal storage capacity of networks[END_REF][START_REF] Seung | Statistical mechanics of learning from examples[END_REF][START_REF] Watkin | The statistical mechanics of learning a rule[END_REF][START_REF] Engel | Statistical Mechanics of Learning[END_REF][START_REF] Zdeborová | Statistical physics of inference: thresholds and algorithms[END_REF], and they have recently seen a surge of interest [START_REF] Advani | Statistical mechanics of optimal convex inference in high dimensions[END_REF][START_REF] Chaudhari | Entropy-SGD: Biasing Gradient Descent Into Wide Valleys[END_REF][START_REF] Advani | High-dimensional dynamics of generalization error in neural networks[END_REF][START_REF] Aubin | The committee machine: Computational to statistical gaps in learning a two-layers neural network[END_REF][START_REF] Baity-Jesi | Comparing Dynamics: Deep Neural Networks versus Glassy Systems[END_REF].

We begin our paper in Sec. 2 with a description of the teacher-student setup, the learning algorithm and the derivation of a set of ordinary differential equations that capture the dynamics of SGD in our model. Using this framework, we derive Eq. (2) in Sec. 3 and discuss networks with sigmoidal, linear and ReLU activation functions in detail. We discuss our results and in particular the importance of the size of the training set in Sec. 4 before concluding in Sec. 5.

Setup

The teacher generates test and training data

We study the learning of a supervised regression problem with inputs x ∈ R N and outputs y(x) ∈ R with a generative model as follows. We take the components of the inputs x n (n = 1, . . . , N ) to be i.i.d. Gaussian random variables 1 with zero mean and unit variance. The output y(x) is given by a neural network with a single hidden layer containing M hidden units and all-to-all connections, see Fig. 1. Its weights B ∈ R M ×N from the inputs to the hidden units are drawn at random from some distribution p(B) and kept fixed 2 . Given an input x, the network's output is given by

φ(B, x) = M m=1 g B m x √ N (3)
where B m is the mth row of B, B m x is the dot product between two vectors and g : R → R is the activation function of the network. We focus on the case where both student and teacher have the same activation function. In particular, we study linear networks with g(x) = x, sigmoidal networks with g(x) = erf x/ √ 2 , and rectified linear units where g(x) = max(0, x). The training set consists of P tuples (x µ , y µ B (x µ )), µ = 1, . . . , P ; where

y µ B (x µ ) ≡ φ(B, x µ ) + ζ µ , (4)
is a noisy observation of the network's output and the random variable ζ µ is normally distributed with mean 0 and variance σ 2 .

In the statistical physics literature on learning, a data-generating neural network is called the teacher and neural networks of the type (3) are called Soft Committee Machines [START_REF] Schwarze | Learning a rule in a multilayer neural network[END_REF]. They combine the apparent simplicity of their architecture, which allows for a detailed analytical . . .

x g K . . . g 2 g 1 g k = g(w k x) φ φ = k g k Figure 1:
Neural network with a single hidden layer. A network with K hidden units and weights w implements a scalar function of its inputs x, y = K k g(w k x), where g : R → R is the non-linear activation function of the network. description, with the power of a universal approximator: given a hidden layer of sufficient size, they can approximate any continuous function of their inputs to any desired accuracy [START_REF] Cybenko | Approximation by superpositions of a sigmoidal function[END_REF][START_REF] Hornik | Multilayer feedforward networks are universal approximators[END_REF]. They have thus been at the center of a lot of recent research on the generalisation of neural networks [START_REF] Mei | A mean field view of the landscape of two-layer neural networks[END_REF][START_REF] Rotskoff | Parameters as interacting particles: long time convergence and asymptotic error scaling of neural networks[END_REF][START_REF] Aubin | The committee machine: Computational to statistical gaps in learning a two-layers neural network[END_REF][START_REF] Chizat | On the global convergence of gradient descent for over-parameterized models using optimal transport[END_REF][START_REF] Li | Learning Overparameterized Neural Networks via Stochastic Gradient Descent on Structured Data[END_REF].

The student aims to mimic the teacher's function

Once a teacher network has been chosen at random, we train another neural network, called the student, on data generated by the teacher according to [START_REF] Simonyan | Very Deep Convolutional Networks for Large-Scale Image Recognition[END_REF]. The student has a single fullyconnected hidden layer with K hidden units, and we explicitly allow for K = M . The student's weights from the input to the hidden layer are denoted w ∈ R K×N and its output is given by φ(w, x). We keep the weights from the hidden units to the output fixed at unity and only train the first layer weights w. We consider both networks in the thermodynamic limit, where we let N → ∞ while keeping M, K of order 1.

The key quantity in our study is the generalisation error of the student network with respect to the teacher network, which we defined in Eq. (1) as the mean squared error between the outputs of the student and the noiseless output of the teacher, averaged over the distribution of inputs. Note that including the output noise of the teacher would only introduce a constant offset proportional to the variance of the output noise.

The student is trained using online learning

Since we are training the student for a regression task, we choose a quadratic loss function. Given a training data set with P samples, the training error reads

E(w) = 1 2 P µ=1 φ(w, x µ ) -y µ B 2 . ( 5
)
We perform stochastic gradient descent on the training error to optimise the weights of the student, using only a single sample (x µ , y µ B ) to evaluate the gradient of E(w) at every step. To make the problem analytically tractable, we consider the limit where the training data set is large enough to allow that each sample (x µ , y µ B ) is visited only once during the entire training until the generalisation error converges to its final value 3 . We can hence index the steps of the algorithm by µ and write the weight updates as

w µ+1 k = w µ k - κ N w µ k - η √ N ∇ w k E(w)| (x µ ,y µ B ) (6)
3 In Sec. 4, we investigate the case of small P via simulations.

K = 2 K = 4 K = 6 K = 8
Figure 2: The analytical description of the generalisation dynamics of sigmoidal networks (solid) matches simulations (crosses). We show learning curves g (α) obtained by integration of the ODEs (12) (solid). From left to the right, we vary the variance of the teacher's output noise σ, the learning rate η, and the number of hidden units in the student K. For each combination of parameters shown in the plots, we ran a single simulation of a network with N = 784 and plot the generalisation observed (crosses). κ = 0 in all cases.

where κ is the weight decay rate, the learning rate is η, and we have chosen their scaling with N such that all terms remain of order 1 in the thermodynamic limit N → ∞. Evaluating the derivative yields

w µ+1 k = w µ k - κ N w µ k - η √ N x µ r µ k (7)
where

r µ k ≡ g (λ µ k ) φ(w, x µ ) -y µ B (8)
and we have defined λ µ k ≡ w k x µ / √ N . Stochastic gradient descent with mini-batch size 1 in the limit of very large training sets is also known as online or one-shot learning. Kinzel [START_REF] Kinzel | Improving a Network Generalization Ability by Selecting Examples[END_REF] first realised that its dynamics could be described in terms of order parameters, initiating a number of works on the perceptron [START_REF] Mace | Statistical mechanical analysis of the dynamics of learning in perceptrons[END_REF][START_REF] Engel | Statistical Mechanics of Learning[END_REF]. Online learning in committee machines was first studied by Biehl and Schwarze [START_REF] Biehl | Learning by on-line gradient descent[END_REF] in the case M = 1, K = 2 and by Saad and Solla [START_REF] Saad | On-line learning in soft committee machines[END_REF][START_REF] Saad | Learning with Noise and Regularizers Multilayer Neural Networks[END_REF], who gave a detailed analytic description of the case K = M with g(x) = erf x/ √ 2 . Beyond its application to neural networks, its performance has been analysed for problems ranging from PCA [START_REF] Oja | On stochastic approximation of the eigenvectors and eigenvalues of the expectation of a random matrix[END_REF][START_REF] Wang | Scaling Limit: Exact and Tractable Analysis of Online Learning Algorithms with Applications to Regularized Regression and PCA[END_REF] to the training of generative adversarial networks [START_REF] Wang | A Solvable High-Dimensional Model of GAN[END_REF].

The dynamics of online learning can be described in closed form

Our aim is to track the evolution of the generalisation error g [START_REF] Lecun | Deep learning[END_REF], which can be written more explicitly as

g = 1 2 K k=1 g λ µ k - M m=1 g(ν µ m ) 2 , (9)
where ν µ m ≡ B m x µ / √ N . Since the inputs x only appear as products with the weight vectors of the student and the teacher, we can replace the average • over x with an average over λ µ k and ν µ m . To determine the distribution of the latter, the assumption that every sample (x µ , y µ B ) is only used once during training becomes crucial, because it guarantees that the inputs and the weights of the networks are uncorrelated. By the central limit theorem, ν µ m , λ µ k are hence normally distributed with mean zero since x n = 0. Their covariance is also easily found: writing w ka for a component of the kth weight vector, we have

λ k λ l = N a,b w ka w lb x a x b N = w k w l N ≡ Q kl ( 10
)
since x a x b = δ ab . Likewise, we define

ν n ν m = B n B m N ≡ T nm , λ k ν m = w k B m N ≡ R km . (11)
The variables R in , Q ik , and T nm are called order parameters in statistical physics and measure the overlap between student and teacher weight vectors w i and B n and their self-overlaps, respectively. Crucially, from Eq. ( 9) we see that they are sufficient to determine the generalisation error g . We can obtain a closed set of differential equations for the time evolution of the order parameters Q and R by squaring the weight update [START_REF] Neyshabur | Norm-Based Capacity Control in Neural Networks[END_REF] and taking its inner product with B n , respectively 4 . Then, an average over the inputs x needs to be taken. The resulting equations of motion for R and Q can be written as

dR in dα = -κR in + η r i ν n (12a) dQ ik dα = -2κQ ik + η r i λ k + η r k λ i + η 2 r i r k + η 2 σ 2 g (λ i )g (λ k ) (12b)
where α = µ/N becomes a continuous time-like variable in the limit N → ∞. The averages over inputs • can again be reduced to an average over the normally distributed local fields λ µ k and ν µ m as above. If the averages can be evaluated analytically, the equations of motion (12) together with the generalisation error (9) form a closed set of equations which can be integrated numerically and provides an exact description of the generalisation dynamics of the network in the limit of large N and large training sets. Indeed, the integrals have an analytical solution for the choice g(x) = erf(x/ √ 2) [START_REF] Biehl | Learning by on-line gradient descent[END_REF] and for linear networks. Eqns. [START_REF] Neyshabur | In search of the real inductive bias: On the role of implicit regularization in deep learning[END_REF] hold for any M and K, enabling us to study the learning of complex non-linear target functions φ(B, x), rather than data that is linearly separable or follows a Gaussian distribution [START_REF] Brutzkus | SGD learns overparameterized networks that provably generalize on linearly separable data[END_REF][START_REF] Soltanolkotabi | Theoretical insights into the optimization landscape of over-parameterized shallow neural networks[END_REF]. A detailed derivation and the explicit form of the equations of motion are given in Appendix A.

We plot g (α) obtained by numerically integrating 5 Eqns. [START_REF] Neyshabur | In search of the real inductive bias: On the role of implicit regularization in deep learning[END_REF] and the generalisation error observed during a single run of online learning [START_REF] Neyshabur | Norm-Based Capacity Control in Neural Networks[END_REF] with N = 784 in Fig. 2. The plots demonstrate a good quantitative agreement between simulations and theory and display some generic features of online learning in soft committee machines.

One notable feature of all the plots in Fig. 2 is the existence of plateaus during training, where the generalisation error is almost stationary. During this time, the student "believes" that data are linearly separable and all its hidden units have roughly the same overlap with all the hidden units of the teacher. Only after a longer time, the student picks up the additional structure of the teacher and "specialises": each of its hidden units ideally becomes strongly correlated with one and only one hidden unit of the teacher before the generalisation error decreases exponentially to its final value. This effect is well-known in the literature for both batch and online learning [START_REF] Schwarze | Learning a rule in a multilayer neural network[END_REF][START_REF] Biehl | Learning by on-line gradient descent[END_REF][START_REF] Saad | Exact Solution for On-Line Learning in Multilayer Neural Networks[END_REF] and will be revisited in Sec. 3.

It is perhaps surprising that the generalisation dynamics seem unaffected by the difference in output noise (Fig. 2 a) until they leave the plateau. This is due to the fact that the noise appears in the equations of motion only in terms that are quadratic in the learning rate. Their effect takes longer to build up and become significant. The specialisation observed above is also due to terms that are quadratic in the learning rate. This goes to show that even in the limit of small learning rates, one cannot simplify the dynamics of the neural network by linearising Eqns. [START_REF] Neyshabur | In search of the real inductive bias: On the role of implicit regularization in deep learning[END_REF] in η without losing some key properties of the dynamics. We plot theoretical predictions for * g /σ 2 for sigmoidal networks (Eq. ( 13), solid line) and linear networks (Eq. ( 15), dashed) together with the result from a single simulation of a network with N = 784. Parameters: η = 0.05, σ = 0.01.

Asymptotic generalisation of over-parameterised students after online learning

In the absence of output noise (σ = 0) and without weight decay (κ = 0), online learning of a student with K ≥ M hidden units will yield a network that generalises perfectly with respect to the teacher. More precisely, at some point during training, the generalisation error will start an exponential decay towards zero (see Appendix B.1). On the level of the order parameters Q and R, a student that generalises perfectly with respect to the teacher corresponds to a stable fixed point of the equations of motion ( 12) with g = 0. This fixed point disappears for σ > 0 and the order parameters converge to a different fixed point. The values of the order parameters at that fixed point can be obtained perturbatively in the limit of small noise, i.e. small σ. To this end, we first make an ansatz for the matrices Q and R that involves eight order parameters for any M, K. We choose this number of order parameters for two reasons: it is the smallest number of variables for which we were able to self-consistently close the equations of motion [START_REF] Neyshabur | In search of the real inductive bias: On the role of implicit regularization in deep learning[END_REF], and they agree with numerical evidence obtained from integrating the full equations of motion [START_REF] Neyshabur | In search of the real inductive bias: On the role of implicit regularization in deep learning[END_REF].

We then derive equations of motion for this reduced set of order parameters, and expand them to first order in σ around the fixed point with perfect generalisation. Throughout this section, we set κ = 0 and choose uncorrelated and isotropic weight vectors for the teacher, i.e. T nm = δ nm , which is equivalent to drawing the weights at random from a standard normal distribution.

Sigmoidal networks

We have performed this calculation for teacher and student networks with g(x) = erf(x/ √ 2). We discuss the details of this tedious calculation in Appendix 3, and here we only state the asymptotic value of the generalisation error * g to first order in the variance of the noise σ 2 for teacher and student with sigmoidal activation:

* g = σ 2 η 2π f (M, L, η) + O(σ 3 ) ( 13
)
where f (M, L, η) is a lengthy rational function of its variables. The full expression spans more than two pages, so here we plot it in Fig. 3 together with a single run of a simulation of a neural network with N = 784, which is in excellent agreement.

Discussion

One notable feature of Fig. 3 is that with all else being equal, the generalisation error increases monotonically with L. In other words, our result [START_REF] Zhang | Understanding deep learning requires rethinking generalization[END_REF] implies that SGD alone fails to regularise the student networks of increasing size in our setup, instead yielding students whose generalisation error increases at least linearly with L.

One might be tempted to mitigate this effect by simultaneously decreasing the learning rate η for larger students. However, this raises two problems: first of all, a lower learning rate means the model would take longer to train. More importantly though, the resulting longer training time implies that more data is required until the final generalisation error is achieved. This is in agreement with statistical learning theory, where given more and more data, models with more parameters (higher L) and a higher complexity class, e.g. a higher VC dimension or Rademacher complexity [START_REF] Mohri | Foundations of Machine Learning[END_REF], generalise just as well as smaller ones. In practice however, more data might not be readily available. Furthermore, we show in the Appendix B.2.1 that even when we choose η = 1/K, the generalisation error still increases with L before plateauing at a constant value.

We can gain some intuition for the result (13) by considering the final representations learnt by a sigmoidal network. On the left half of Fig. 4, we plot the overlap matrices Q and R for a teacher with M = 2 and various K. For K = 2, we see that each of the hidden units of the student has learnt the weights of one teacher hidden unit, yielding diagonal matrices Q and R (modulo the permutation symmetry of the hidden units). As we add a third hidden unit to the student, K = 3, the specialisation discussed in the previous section becomes apparent: two of the hidden units of the student each align almost perfectly with a different hidden unit of the teacher, such that R 01 = R 20 ≈ 1, while the weights of the third unit go to zero (Q 11 ≈ 0). As we add even more hidden units, (K = 5), the weight vectors of some units become exactly anticorrelated, hence effectively setting their weights to zero as far as the output of that network is concerned (since we set the weights of the second layer to unity). This behaviour is essentially a consequence of the sigmoidal form of the activation function, which makes it hard to express the sum of M hidden units with K = M hidden units, instead forcing 1-to-1 specialisation of the student's hidden units.

In the over-parameterised case, L = K -M units of the student are hence effectively specialising to hidden units of the teacher with zero weights. Although their weights are unbiased estimators of the weights B = 0, their variance is finite due to the noise in the teacher's output.

Thus they always hurt generalisation.

This intuition can be confirmed analytically by going to the limit of small learning rates, which is the most relevant in practice. Expanding * g to first order in the learning rate reveals a particularly revealing form, * g =

σ 2 η 2π L + M √ 3 + O(η 2 ), (14)
with second-order corrections that are quadratic in L. The linear term in η is the sum of two contributions: the asymptotic generalisation errors of M independent networks with one hidden units that are learning from a teacher with single hidden unit hand T = 1. The L = K -M superfluous units contribute each the error of a continuous perceptrons that is learning from a teacher with zero weights (T = 0). Again, we relegate the detailed calculation to the Appendix C.

Linear networks

One might suspect that part of the scaling * g ∼ L in sigmoidal networks is due to the specialisation of the hidden units or the fact that teacher and student network can implement functions of different range if K = M . It thus makes sense to calculate * g for linear neural networks, where g(x) = x [START_REF] Krogh | Generalization in a linear perceptron in the presence of noise[END_REF]. These networks have no specialisation transition [START_REF] Aubin | The committee machine: Computational to statistical gaps in learning a two-layers neural network[END_REF] and their output range is set by the magnitude of their weights, rather than their number of hidden units. Furthermore, linear networks are receiving increasing attention as models for neural networks [START_REF] Saxe | Exact solutions to the nonlinear dynamics of learning in deep linear neural networks[END_REF][START_REF] Advani | High-dimensional dynamics of generalization error in neural networks[END_REF][START_REF] Lampinen | An analytic theory of generalization dynamics and transfer learning in deep linear networks[END_REF].

Following the same steps as for the sigmoidal networks, a perturbative calculation in the limit of small noise yields

* g = ησ 2 (L + M ) 4 -2η(L + M ) + O(σ 3 ). (15)
In the limit of small learning rates, the above expression further simplifies to

* g = 1 4 ησ 2 (L + M ) + O η 2 . ( 16
)
Hence we see that in the limit of small learning rates, the asymptotic generalisation error of linear networks has the same scaling with σ, η and L as for sigmoidal networks. This result is again in good agreement with the results of simulations, demonstrated in Fig. 3.

Discussion

The linear scaling of * g with L, keeping all other things equal, might be surprising given that all linear networks implement a linear transformation with an effective matrix W = k w k , irrespective of their number of hidden units. However, this is exactly the problem: adding hidden units to a linear network does not augment the class of functions it can implement, but it adds free parameters which will indiscriminately pick up fluctuations due to the output noise in the teacher. The optimal generalisation error is indeed realised with K = 1 irrespective of M , since a linear network with K = 1 has the lowest number of free parameters while having the same expressive power as a teacher with arbitrary M . Our formula [START_REF] Biehl | Learning by on-line gradient descent[END_REF] however only applies to the case K > M .

Linear networks thus show that the scaling of * g with L is not only a consequence of either specialisation or the mismatched range of the networks' output functions, as one might have suspected by looking only at sigmoidal networks.

Interestingly, if we rescale the learning rate by choosing η = 1/K, we find that the generalisation error [START_REF] Biehl | Learning by on-line gradient descent[END_REF] becomes equal to σ 2 /2, independent of L. Again, this rescaling of the learning rate comes at the cost of increased training time and hence, in this model, increased training data. A quantitative exploration of the trade-off between learning rate and network size for a fixed data set is an interesting problem, however, it goes beyond the domain of online learning and is hence left for future work. L. Simulations confirm that the asymptotic generalisation error * g of a ReLU student learning from a ReLU teacher scales with the learning rate η, the variance of the teacher's output noise σ 2 and the number of additional hidden units as g ∼ ησ 2 L, which is the same scaling as the one found analytically for sigmoidal networks in Eq. ( 14). Straight lines are linear fits to the data, with slope 1 in (a) and (b). Parameters: M = 2, K = 6 (a, b) and M = 4, 16; K = M + L (c); in all figures, N = 784, κ = 0.

Numerical results suggest the same scalings for ReLU networks, too

The analytical calculation of g described above for networks with ReLU activation function poses some additional technical challenges, so here we resort to simulations to illustrate the behaviour of * g in this case and leave the analytical description for future work. The results are shown in Fig. 5: we found numerically that the asymptotic generalisation error of a ReLU student learning from a ReLU teacher has the same scaling as the one we found analytically for networks with sigmoidal and with linear activation functions: * g ∼ ησ 2 L.

Discussion

Looking at the final overlap matrices Q and R for ReLU networks in the right half of Fig. 4, we see a mechanism behind Eq. ( 2) for ReLU networks that is reminiscent of the linear case: instead of the one-to-one specialisation of sigmoidal networks, all the hidden units of the student have a finite overlap with all the hidden units of the teacher. This is a consequence of the fact that it is much simpler to re-express the sum of M ReLU units with K = M ReLU units. However, this also means that there are a lot of redundant degrees of freedom, which nevertheless all pick up fluctuations from the output noise and degrade the generalisation error.

For ReLU networks, one might imagine that several ReLU units can specialise to one and only one teacher unit and thus act as an effective denoiser for that teacher unit. However, we have checked numerically that this configuration is not a stable fixed point of the SGD dynamics.

Discussion

The main result of the preceding section was a set of ODEs that described the generalisation dynamics of over-parameterised two-layer neural networks. This framework allowed us to derive the scaling of the generalisation error of the student with the network size, the learning rate and the noise level in the teacher's outputs. This scaling is robust with respect to the choice of the activation function as it holds true for linear, sigmoidal and ReLU networks. In this section, we discuss several possible changes to our setup and discuss their impact on the scaling of * g .

Weight decay

A natural strategy to avoid overfitting is to explicitly regularise the weights, for example by using weight decay. In our setup, this is introduced by choosing a finite κ > 0 in Eq. ( 7). In our simulations with κ > 0, we did not find a scenario where weight decay did not increase the final generalisation error compared to the case κ = 0. In particular, we did not find a scenario where weight decay improved the performance of a student with L > 0. The corresponding plots can be found in Appendix D.

SGD with mini-batches

We also made sure that the phenomenology we observed persists if we move to stochastic gradient descent with mini-batches, where the gradient estimate in Eq. ( 7) is averaged over several samples (x, y B ), as is standard in practice. We observed that increasing the mini-batch size lowers the asymptotic generalisation error up to a certain mini-batch size of order ∼ 100 samples, after which it stays roughly constant. Crucially, having mini-batches does not change the scaling of * g with L (see Appendix E for details).

Structured input data

One idealised assumption in our setup is that we take our inputs x as i.i.d. draws from a standard normal distribution (see Sec. 2). We therefore repeated our experiments using MNIST images as inputs x, while leaving all other aspects of our setup the same. In particular, we still trained the student on a regression task with y generated using a random teacher. This setup allowed us to trace any change in the generalisation behaviour of the student to the higher-order correlations of the input distribution. Switching to MNIST inputs reproduced the same g -L curve as having Gaussian inputs to within the experimental error; the interested reader is referred to Appendix F for a detailed description of these experiments.

The scaling of * g with L depends also on the size of the training set

In practice, a single sample of the training data set will be visited several times during training. After a first pass through the training set, the online assumption that an incoming sample (x, y B ) is uncorrelated to the weights of the network thus breaks down. A complete analytical treatment in this setting remains an open problem, so to study this practically relevant setup, we turn to simulations. We keep the setup described in Sec. 2, but simply reduce the number of samples in the training data set P . Our focus is again on the final generalisation error after convergence * g for linear, sigmoidal and ReLU networks, which we plot from left to right as a function of L in Fig. 6.

Linear networks show a similar behaviour to the setup with a very large training set discussed in Sec. 3.2: the bigger the network, the worse the performance for both P = 4 and P = 50. Again, the optimal network has K = 1 hidden units, irrespective of the size of the teacher. However, for non-linear networks, the picture is more varied: For large training sets, where the number of samples easily outnumber the free parameters in the network (P = 50, red curve; this corresponds roughly to learning a data set of the size of MNIST), the behaviour is qualitatively described by our theory from Sec. 3: the best generalisation is obtained by a network that matches the teacher size, K = M . However, as we reduce the size of the training set, this is no longer true. For P = 4, for example, the best generalisation is obtained with networks that have K > M . Thus the size of the training set with respect to the network has an important influence on the scaling of * g with L. Note that the early-stopping generalisation error, which we define as the minimal generalisation error over the duration of training, shows qualitatively the same behaviour as * g (see Appendix G for additional information.)

Concluding perspectives

We have studied the dynamics of online learning in two-layer neural networks within the teacherstudent framework, where we train a student network using SGD on data generated by another network, the teacher. One advantage of this setup is that it allows us to investigate the behaviour of networks that are over-parameterised with respect to the generative model of their data in a controlled fashion. We derived a set of eight ODEs that describe the generalisation dynamics of over-parameterised students of any size. Within this framework, we analytically computed the final generalisation error of the student in the limit of online learning with small noise. One immediate consequence of this result is that SGD alone is not enough to regularise the overparameterised student, instead yielding networks whose generalisation error scales linearly with the network size. Furthermore, we demonstrated that adding explicit regularisation by introducing weight decay did not improve the performance of the networks and that the same phenomenology arises when using mini-batches or after substituting the Gaussian inputs used in the theoretical analysis with a more realistic data set. Nevertheless, we were able to find a scenario in our setup where the generalisation decreases with the student's size, namely when training using a finite data set that contains roughly as many samples as there are free parameters in the network.

In the setting we analyse, our results clearly indicate that the regularisation of neural networks goes beyond the properties of SGD alone. Instead, a full understanding of the generalisation properties of deep networks requires taking into account the interplay of at least the algorithm, its learning rate, the model architecture, and the data set, setting up a formidable research programme for the future.

APPENDICES

A. Derivation of the ODE description of the generalisation dynamics of online learning

We will now show how to derive ODEs that describe the dynamics of online learning in twolayer neural networks, following the seminal work by Biehl and Schwarze [START_REF] Biehl | Learning by on-line gradient descent[END_REF] and Saad and Solla [START_REF] Saad | Exact Solution for On-Line Learning in Multilayer Neural Networks[END_REF][START_REF] Saad | On-line learning in soft committee machines[END_REF]. We focus on the teacher-student setup introduced in the main paper, where a student network with weights w ∈ R K×N and output

φ(w, x) = K k=1 g w k x √ N (17)
is trained on samples (x µ , y µ ) generated by another two-layer network with weights B ∈ R M ×N , the teacher, according to

y µ B (x µ ) ≡ φ(B, x µ ) + ζ µ . (18)
Here, ζ µ is normally distributed with mean 0 and variance σ 2 . We will make two technical assumptions, namely having a large network (N → ∞) and a data set that is large enough to allow that we visit every sample only once before training converges.

A.1. Expressing the generalisation error in terms of order parameters

To make this section self-consistent, we briefly recapitulate how the assumptions stated above allow to rewrite the generalisation error in terms of a number of order parameters. We have

g ≡ 1 2 [φ(w, x) -φ(B, x)] 2 (19) = 1 2 K k=1 g λ µ k - M m=1 g(ν µ m ) 2 , ( 20
)
where we have introduced the local fields

λ µ k ≡ w k x µ √ N , (21)
ν µ m ≡ B m x µ √ N . ( 22
)
Here and throughout this paper, we will use the indices i, j, k, . . . to refer to hidden units of the student, and indices n, m, . . . to denote hidden units of the teacher. Since the input x µ only appears in g only via products with the weights of the teacher and the student, we can replace the high-dimensional average • over the input distribution p(x) by an average over the K + M local fields λ µ k and ν µ m . The assumption that the training set is large enough to allow that we visit every sample in the training set only once guarantees that the inputs and the weights of the networks are uncorrelated. Taking the limit N → ∞ ensures that the local fields are jointly normally distributed with mean zero ( x n = 0). Their covariance is also easily found: writing w ka for the ath component of the kth weight vector, we have

λ k λ l = N a,b w ka w lb x a x b N = w k w l N ≡ Q kl , (23)
since x a x b = δ ab . Likewise, we define

ν n ν m = B n B m N ≡ T nm , λ k ν m = w k B m N ≡ R km . ( 24
)
The variables R in , Q ik , and T nm are called order parameters in statistical physics and measure the overlap between student and teacher weight vectors w i and B n and their self-overlaps, respectively. Crucially, from Eq. ( 20) we see that they are sufficient to determine the generalisation error g . We can thus write the generalisation error as

g = 1 2 i,k I 2 (i, k) + 1 2 n,m I 2 (n, m) - i,n I 2 (i, n), (25)
where we have defined

I 2 (i, k) ≡ g(λ i )g(λ k ) = 1 π arcsin Q ik √ 1 + Q ii √ 1 + Q kk . ( 26
)
The average in Eq. ( 26) is taken over a normal distribution for the local fields λ i and λ k with mean (0, 0) and covariance matrix

C 2 = Q ii Q ik Q ik Q kk . ( 27
)
Since we are using the indices i, j, . . . for student units and n, m, . . . for teacher hidden units, we have

I 2 (i, n) = g(λ i )g(ν m ) , (28)
where the covariance matrix of the joint of distribution λ i and ν m is given by

C 2 = Q ii R in T in T nn . ( 29
)
and likewise for I 2 (n, m). We will use this convention to denote integrals throughout this section.

For the generalisation error, this means that it can be expressed in terms of the order parameters alone as

g = 1 π i,k arcsin Q ik √ 1 + Q ii √ 1 + Q kk + 1 π n,m arcsin T nm √ 1 + T nn √ 1 + T mm - 2 π i,n arcsin R in √ 1 + Q ii √ 1 + T nn . (30)

A.2. ODEs for the evolution of the order parameters

Expressing the generalisation error in terms of the order parameters as we have in Eq. ( 30) is of course only useful if we can track the evolution of the order parameters over time. We can derive ODEs that allow us to do precisely that by first writing again the SGD update of the weights:

w µ+1 k = w µ k - κ N w µ k - η √ N x µ r µ k , ( 31
)
where µ is a running index counting the weight updates or, equivalently, the samples used so far, and

r µ k ≡ g (λ µ k ) φ(w, x µ ) -y µ B . ( 32
)
From this equation, we can obtain differential equations for the time evolution of the order parameters Q by squaring the weight update [START_REF] Mei | A mean field view of the landscape of two-layer neural networks[END_REF] and for R taking the inner product of [START_REF] Mei | A mean field view of the landscape of two-layer neural networks[END_REF] with B n , respectively, which yields the Eqns. ( 12) of the main text and which we state again for completeness:

dR in dα = -κR in + η r i ν n (33a) dQ ik dα = -2κQ ik + η r i λ k + η r k λ i + η 2 r i r k + η 2 σ 2 g (λ i )g (λ k ) ( 33b
)
where α = µ/N becomes a continuous time-like variable in the limit N → ∞. These equations are valid for any choice of activation functions g 1 and g 2 . To make progress however, i.e. to obtain a closed set of differential equations for Q and R, we need to evaluate the averages • over the local fields. In particular, we have to compute three types of averages:

I 3 = g (a)bg (c) , ( 34
)
where a is one the local fields of the student, while b and c can be local fields of either the student or the teacher;

I 4 = g (a)g (b)g(c)g(d) , (35)
where a and b are local fields of the student, while c and d can be local fields of both; and finally

J 2 = g (a)g (b) , (36)
where a and b are local fields of the teacher. In each of these integrals, the average is taken with respect to a multivariate normal distribution for the local fields with zero mean and a covariance matrix whose entries are chosen in the same way as discussed for I 2 .

We can re-write Eqns. ( 33) with these definitions in a more explicit form as [START_REF] Saad | Exact Solution for On-Line Learning in Multilayer Neural Networks[END_REF][START_REF] Saad | On-line learning in soft committee machines[END_REF] dR

in dα = -κR in + η   m I 3 (i, n, m) - j I 3 (i, n, j)   , (37)
dQ ik dα = -2κQ ik + η 2 σ 2 J 2 (i, k) + η   m I 3 (i, k, m) - j I 3 (i, k, j)   + η   m I 3 (k, i, m) - j I 3 (k, i, j)   + η 2   n,m I 4 (i, k, n, m) -2 j,n I 4 (i, k, j, n) + j,l I 4 (i, k, j, l)   . (38)
The explicit form of the integrals I 2 (•), I 3 (•), I 4 (•) and J 2 (•) is given in Sec. H for the case g(x) = erf x/ √ 2 . Solving these equations numerically for Q and R and substituting their values in to the expression for the generalisation error [START_REF] Advani | High-dimensional dynamics of generalization error in neural networks[END_REF] gives the full generalisation dynamics of the student. We show the resulting learning curves together with the result of a single simulation in Fig. 2 of the main text. We have bundled our simulation software and our ODE integrator as a user-friendly Python package 6 . In Sec. B, we discuss how to extract information from them in an analytical way.

B. Calculation of g in the limit of small noise

Our aim is to understand the asymptotic value of the generalisation error * g ≡ lim α→∞ g (α).

(

) 39
We focus on students that have more hidden units than the teacher, K ≥ M . These students are thus over-parameterised with respect to the generative model of the data and we define

L ≡ K -M (40)
as the number of additional hidden units in the student network. In this section, we focus on the sigmoidal activation function g

(x) = erf x/ √ 2 , (41)
unless stated otherwise. Eqns. [START_REF] Saad | Learning with Noise and Regularizers Multilayer Neural Networks[END_REF] are a useful tool to analyse the generalisation dynamics and they allowed Saad and Solla to gain plenty of analytical insight into the special case K = M [START_REF] Saad | Exact Solution for On-Line Learning in Multilayer Neural Networks[END_REF][START_REF] Saad | On-line learning in soft committee machines[END_REF]. However, they are also a bit unwieldy. In particular, the number of ODEs that we need to solve grows with K and M as K 2 + KM . To gain some analytical insight, we make use of the symmetries in the problem, e.g. the permutation symmetry of the hidden units of the student, and re-parametrised the matrices Q ik and R in in terms of eight order parameters that obey a set of self-consistent ODEs for any K > M . We choose the following parameterisation with eight order parameters:

Q ij =                Q i = j ≤ M, C i = j; i, j ≤ M, D i > M, j ≤ M or i ≤ M, j > M, E i = j > M, F i = j; i, j > M, (42)
R in =      R i = n, S i = n; i ≤ M, U i > M, (43)
which in matrix form for the case M = 3 and K = 5 read:

R =       R S S S R S S S R U U U U U U       and Q =       Q C C D D C Q C D D C C Q D D D D D E F D D D F E       (44)
We choose this number of order parameters and this particular setup for the overlap matrices Q and R for two reasons: it is the smallest number of variables for which we were able to selfconsistently close the equations of motion [START_REF] Saad | Learning with Noise and Regularizers Multilayer Neural Networks[END_REF], and they agree with numerical evidence obtained from integrating the full equations of motion [START_REF] Saad | Learning with Noise and Regularizers Multilayer Neural Networks[END_REF]. By substituting this ansatz into the equations of motion (37), we find a set of eight ODEs for the order parameters. These equations are rather unwieldy and some of them do not even fit on one page, which is why we do not print them here in full; instead, we provide a Mathematica notebook where they can be found and interacted with7 . These equations allow for a detailed analysis of the effect of over-parameterisation on the asymptotic performance of the student, as we will discuss now.

B.1. Heavily over-parameterised students can learn perfectly from a noiseless teacher using online learning

For a teacher with T nm = δ nm and in the absence of noise in the teacher's outputs (σ = 0), there exists a fixed point of the ODEs with R = Q = 1, C = D = E = F = 0, and perfect generalisation g = 0. Online learning will find this fixed point, as is demonstrated in Fig. 7, where we plot the generalisation dynamics of a student with K hidden units learning from a teacher with M = 4 hidden units for both Erf and ReLU activation functions. More precisely, after a plateau whose length depends on the size of the network for the sigmoidal network, the generalisation error eventually begins an exponential decay to the optimal solution with zero generalisation error. The learning rates are chosen such that learning converges, but aren't optimised otherwise.

B.2. Perturbative solution of the ODEs

We have calculated the asymptotic value of the generalisation error * g for a teacher with T nm = δ nm to first order in the variance of the noise σ 2 . To do so, we performed a perturbative expansion around the fixed point

R 0 = Q 0 = 1, (45)
S 0 = U 0 = C 0 = D 0 = E 0 = F 0 = 0, (46)
with the ansatz

X = X 0 + σ 2 X 1 (47)
for all the order parameters. Writing the ODEs to first order σ 2 and solving for their steady state where X (α) = 0 yielded a fixed point with an asymptotic generalisation error

* g = σ 2 η 2π f (M, L, η) + O(σ 3 ). ( 48
)
f (M, L, η) is an unwieldy rational function of its variables. Due to its length, we do not print it here in full; instead, we give the full function in a Mathematica notebook 8 . Here, we plot the results in various forms in Fig. 8. We note in particular the following points:

B.2.1. Discussion * g increases with L, η
The two plots on the left show that the generalisation error increases monotonically with both L and η while keeping the other fixed, resp., for teachers with M = 2 (red) and M = 16 (blue)

Divergence at large η Our perturbative result diverges for large L, or equivalently, for a large learning rate that depends on the number of hidden units L ∼ K. For the special case K = M , the learning rate η div at which our perturbative result diverges is precisely the maximum learning rate η max for which the exponential convergence to the optimal solution is still guaranteed for σ = 0 [START_REF] Saad | On-line learning in soft committee machines[END_REF]

η max = √ 3π M + 3/ √ 5 -1 (49)
as we show in the right-most plot of Fig. 8. The final generalisation error of over-parameterised Erf networks scales linearly with the learning rate, the variance of the teacher's output noise, and L. We plot * g /σ 2 in the limit of small noise, Eq. ( 48), for M = 2 (red) and M = 16 (blue). It is clear that generalisation error increases with the number of superfluous units L at fixed learning rate (left) and the learning rate η (middle). Right: For K = M , the learning rate η div at which our perturbative result diverges is precisely the maximum learning rate η max at which the exponential convergence to the optimal solution is guaranteed for σ = 0, Eq. ( 49)

Expansion for small η In the limit of small learning rates, which is the most relevant in practice and which from the plots in Fig. 8 dominates the behaviour of * g outside of the divergence, the generalisation error is linear in the learning rate. Expanding * g to first order in the learning rate reveals a particularly revealing form, * g =

σ 2 η 2π L + M √ 3 + O(η 2 ) (50)
with second-order corrections that are quadratic in L. This is actually the sum of the asymptotic generalisation errors of M continuous perceptrons that are learning from a teacher with T = 1 and L continuous perceptrons with T = 0 as we calculate in Sec. C. This neat result is a consequence of the specialisation that is typical of SCMs with sigmoidal activation functions as we discussed in the main text.

Rescaling the learning rate by K The expression for the generalisation error in the limit of small learning rates might tempt one to rescale the learning rate η by K in order to mitigate the detrimental effect of the over-parameterisation. As we note in the main text, this a leads to a longer training duration which in our model implies that more data is required until the final generalisation error is achieved, both of which might not be feasible in practice. Moreover, we show in Fig. 9 that the asymptotic generalisation error (48) of a student trained using SGD with learning rate η = 1/K still increases with L before plateauing at a constant value that is independent of M .

C. Asymptotic generalisation error of a noisy continuous perceptron

What is the asymptotic generalisation for a continuous perceptron, i.e. a network with K = 1, in a teacher-student scenario when the teacher has some additive Gaussian output noise? In this section, we repeat a calculation by Biehl and Schwarze [START_REF] Biehl | Learning by on-line gradient descent[END_REF] where the teacher's outputs are given by

y B = g Bx √ N + ζ ( 51
)
where ζ is again a Gaussian random variable with mean 0 and variance σ 2 . We keep denoting the weights of the student by w and the weights of the teacher by B. To analyse the generalisation Figure 9: Asymptotic generalisation error for sigmoidal networks with learning rate η = 1/K. We plot the asymptotic generalisation error * g (48) over σ 2 of a student with a varying number of hidden units trained on data generated by teachers with M = 2, 4, 16 using SGD with learning rate 1/K. The generalisation error still increases with K, before plateauing at a constant value that is independent of M . κ = 0. dynamics, we introduce the order parameters

R ≡ wB N , Q ≡ ww N and T ≡ BB N . (52)
and we explicitly do not fix T for the moment. For g(x) = erf x/ √ 2 , they obey the following equations of motion:

dR dt = 2η π (Q(t) + 1) T Q(t) -R(t) 2 + T (T + 1)Q(t) -R(t) 2 + T + 1 - R(t) 2Q(t) + 1 (53) dQ dt = 4η π(Q(t) + 1) R(t) 2(Q(t) + 1) -R(t) 2 - Q(t) 2Q(t) + 1 + 4η 2 π 2 2Q(t) + 1 -2 arcsin R(t) (6Q(t) + 2)(2Q(t) -R(t) 2 + 1) + arcsin 2 Q(t) -R(t) 2 + 1 2 (2Q(t) -R(t) 2 + 1) + arcsin Q(t) 3Q(t) + 1 + 2η 2 σ 2 π 2Q(t) + 1 . ( 54
)
The equations of motion have a fixed point at Q = R = T which has perfect generalisation for σ = 0. We hence make a perturbative ansatz in σ 2

Q(t) =T + σ 2 q(t) (55) R(t) =T + σ 2 r(t) (56)
and find for the asymptotic generalisation error

* g = ησ 2 (4T + 1) 2 √ 2T + 1 -η √ 8T 2 + 6T + 1 + 4πT + π + O σ 3 . (57)
To first order in the learning rate, this reads

* g = ησ 2 2π √ 2T + 1 , (58)
which should be compared to the corresponding result for the full SCMs, Eq. (50).

* g L = 2 L = 1 L = 0 L = 1 L = 2 L = 4 L = 8 L = 16
* g L = 2 L = 1 L = 0 L = 1 L = 2 L = 4 L = 8 L = 16

D. Regularisation by weight decay does not help

A natural strategy to avoid the pitfalls of overfitting is to regularise the weights, for example by using explicit weight decay by choosing κ > 0. We have not found a setup where adding weight decay improved the asymptotic generalisation error of a student compared to a student that was trained without weight decay in our setup. As a consequence, weight decay completely fails to mitigate the increase of * g with L. We show the results of an illustrative experiment in Fig. 10.

E. SGD with mini-batches

One key characteristic of online learning is that we evaluate the gradient of the loss function using a single sample from the training step per step. In practice, it is more common to actually use a number of samples b > 1 to estimate the gradient at every step. To be more precise, the weight update equation for SGD with mini-batches would read:

w µ+1 k = w µ k - κ N w µ k - η b √ N b =1 x µ, g (λ µ, k ) φ(w, x µ, ) -y µ, B . (59)
where x µ, is the th input from the mini-batch used in the mth step of SGD, λ µ, k is the local field of the kth student unit for the th sample in the mini-batch, etc. Note that when we use every sample only once during training, using mini-batches of size b increases the amount of data required by a factor b when keeping the number of steps constant.

We show the asymptotic generalisation error of student networks of varying size trained using SGD with mini-batches and a teacher with M = 4 in Fig. 11. Two trends are visible: first, using increasing the size of the mini-batches decreases the asymptotic generalisation error * g up to a certain mini-batch size, after which the gains in generalisation error become minimal; and second, the shape of the * g -L curve is the same for all mini-batch sizes, with the minimal generalisation error attained by a network with K = M .

F. Using MNIST images for training and testing

In the derivation of the ODE description of online learning for the main text, we noted that only the first two moments of the input distribution matter for the learning dynamics and for the final generalisation error. The reason for this is that the inputs only appear in the equations of motion for the order parameters as a product with the weights of either the teacher or the student. Now since they are -by assumption -uncorrelated with those weights, this product is the sum of large number of random variables and hence distributed by the central limit theorem.

We have checked how our results change when this assumption breaks down in one example where we train a network on a finite data set with non-trivial higher order moments, namely the images of the MNIST data set. We studied the very same setup that we discuss throughout this work, namely the supervised learning of a regression task in the teacher-student scenario. We only replace the the inputs, which would have been i.i.d. draws from the standard normal distribution, with the images of the MNIST data set. In particular, this means that we do not care about the labels of the images. Figure 12 shows a plot of the resulting final generalisation against L for both the MNIST data set and a data set of the same size, comprised of i.i.d. draws from the standard normal distribution, which are in good agreement.

G. Early-stopping generalisation error for finite training sets

A common way to prevent over-fitting of a neural network when training with a finite training set in practice is early stopping, where the training is stopped before the training error has converged to its final value yet. The idea behind early-stopping is thus to stop training before over-fitting sets in. For the purpose of our analysis of the generalisation of two-layer networks trained on a fixed finite data set in Sec. 4 of the main text, we define the early-stopping generalisation error ˆ g as the minimum of g during the whole training process. In Fig. 13, we reproduce Fig. 6 from the main text at the bottom and plot ˆ g obtained from the very same experiments at the top. While the ReLU networks showed very little to no over-training, the sigmoidal networks showed more significant over-training. However, the qualitative dependence of the generalisation errors on L was observed to be the same in this experiment. In particular, the early-stopping generalisation error also shows two different regimes, one where increasing the network hurts generalisation (P K), and one where it improves generalisation or at least doesn't seem to affect it much (small P ∼ K).

H. Explicit form of the integrals appearing in the equations of motion of sigmoidal networks

To be as self-contained as possible, here we collect the explicit forms of the integrals I 2 , I 3 , I 4 and J 2 that appear in the equations of motion for the order parameters and the generalisation error for networks with g(x) = erf x/ √ 2 , see Eq. [START_REF] Saad | Learning with Noise and Regularizers Multilayer Neural Networks[END_REF]. They were first given by [START_REF] Biehl | Learning by on-line gradient descent[END_REF][START_REF] Saad | Exact Solution for On-Line Learning in Multilayer Neural Networks[END_REF]. Each average • is taken w.r.t. a multivariate normal distribution with mean 0 and covariance matrix C ∈ R n , whose components we denote with small letters. The integration variables u, v are always components of λ, while w and z can be components of either λ or ν.

Figure 3 :

 3 Figure 3: Theoretical predictions for * g match simulations.We plot theoretical predictions for * g /σ 2 for sigmoidal networks (Eq. (13), solid line) and linear networks (Eq. (15), dashed) together with the result from a single simulation of a network with N = 784. Parameters: η = 0.05, σ = 0.01.

Figure 4 :

 4 Figure 4: Sigmoidal networks learn different representations from a noisy teacher than ReLU networks. For sigmoidal networks (left), we see clear signs of specialisation as described in Sec. 3.1: for K = 3, one unit is simply shut down: w 1 = 0. As we increase K, some units become exactly anti-correlated to each other (e.g. units 1, 4 for K = 5), hence effectively setting their weights to zero (we keep the weights of the second layer fixed at unity). ReLU networks instead find representations where several nodes are used. Parameters: N = 784, η = 0.3, σ = 0.1, κ = 0.

Figure 5 :

 5 Figure 5: The final generalisation error of over-parametrised ReLU networks scales as * g ∼ ησ 2L. Simulations confirm that the asymptotic generalisation error * g of a ReLU student learning from a ReLU teacher scales with the learning rate η, the variance of the teacher's output noise σ 2 and the number of additional hidden units as g ∼ ησ 2 L, which is the same scaling as the one found analytically for sigmoidal networks in Eq. (14). Straight lines are linear fits to the data, with slope 1 in (a) and (b). Parameters: M = 2, K = 6 (a, b) and M = 4, 16; K = M + L (c); in all figures, N = 784, κ = 0.

Figure 6 :

 6 Figure 6: The scaling of * g with L depends on the size of the training set. We plot * g after SGD with a finite training set with P N samples for linear, sigmoidal and ReLU networks from left to right. The result for online learning for linear and sigmoidal networks, Eqns. (13) and (15), are plotted in violet. In the linear case, the online learning result exactly matches the simulation for P = 50. Error bars indicate one standard deviation over 10 simulations, each with a different training set; many of them are too small to be clearly visible. Parameters: N = 784, M = 4, η = 0.1, σ = 0.01.

3 K

 3 = 16, = 0.002 K = 32, = 0.001 K = 64, = 0.0005 K = 128, = 0.0001

Figure 7 :

 7 Figure 7: Over-parametrised networks with sigmoidal or ReLU activations learn perfectly from a noiseless teacher. The generalisation dynamics for students with sigmoidal (left) and ReLU activation function (right) for various K learning from a teacher with M = 4 is shown. In all cases, the generalisation error eventually decays exponentially towards zero. (N = 784)

Figure 8 :

 8 Figure 8: The final generalisation error of over-parameterised Erf networks scaleslinearly with the learning rate, the variance of the teacher's output noise, and L. We plot * g /σ 2 in the limit of small noise, Eq. (48), for M = 2 (red) and M = 16 (blue). It is clear that generalisation error increases with the number of superfluous units L at fixed learning rate (left) and the learning rate η (middle). Right: For K = M , the learning rate η div at which our perturbative result diverges is precisely the maximum learning rate η max at which the exponential convergence to the optimal solution is guaranteed for σ = 0, Eq. (49)

Figure 10 :

 10 Figure 10: Weight decay. We plot the final generalisation error * g of a student with a varying number of hidden units trained on data generated by a teacher with M = 4 using SGD with weight decay. The generalisation error clearly increases with the weight decay constant κ. Parameters: N = 784, η = 0.1, sigma = 0.01.

Figure 11 :Figure 12 :

 1112 Figure 11: SGD with mini-batches shows the same qualitative behaviour as online learning We show the asymptotic generalisation error * g for students with sigmoidal (left) and ReLU activation function (right) for various K learning from a teacher with M = 4. Between the curves, we change the size of the mini-batch used at each step of SGD from 1 (online learning) to 20 000. Parameters: N = 500, η = 0.2, σ = 0.1, κ = 0.

Figure 13 :

 13 Figure 13: The scaling of * g with L shows a similar dependence on the size of the training set for early-stopping (top) and final (bottom) generalisation error. We plot the asymptotic and the early-stopping generalisation error after SGD with a finite training set containing P N samples (linear, sigmoidal and ReLU networks from left to right). The result for online learning for linear and sigmoidal networks, Eqns. 13 and 15 of the main text, are plotted in violet. Error bars indicate one standard deviation over 10 simulations, each with a different training set; many of them are too small to be clearly visible. Parameters: N = 784, M = 4, η = 0.1, σ = 0.01.

J 2 ≡ 12 - 3 c 23 ( 1 + 4 = ( 1 + c 11 )( 1 + c 22 ) -c 2 12

 212323141111222 g (u)g (v) = 2 π 1 + c 11 + c 22 + c 11 c 22 -c 2 c 11 ) -c 12 c 13 1 + c 11(62)I 4 ≡ g (u)g (v)g(w)g(zΛ 4 c34 -c 23 c 24 (1 + c 11 ) -c 13 c 14 (1 + c 22 ) + c 12 c 13 c 24 + c 12 c 14 c 23 (65) Λ 1 = Λ 4 (1 + c 33 ) -c 2 23 (1 + c 11 ) -c 2 13 (1 + c 22 ) + 2c 12 c 13 c 23 (66) Λ 2 = Λ 4 (1 + c 44 ) -c 2 24 (1 + c 11 ) -c 2 14 (1 + c 22 ) + 2c 12 c 14 c 24 (67)

N.B. our results for large N are valid for any input distributions that has the same mean and variance, for example equiprobable binary inputs xn = ±1.

It is also possible to extend our approach to time-dependent weights B.

Since we keep the teacher fixed, T remains constant; however, our approach can be easily extended to a time-dependent teacher.

We have packaged our simulations and our ODE integrator into a user-friendly Python library. To download, visit https://github.com/sgoldt/pyscm

To download, visit https://github.com/sgoldt/pyscm

To download, visit https://github.com/sgoldt/pyscm

To download, visit https://github.com/sgoldt/pyscm

Acknowledgements

SG and LZ acknowledge funding from the ERC under the European Union's Horizon 2020 Research and Innovation Programme Grant Agreement 714608-SMiLe. MA thanks the Swartz Program in Theoretical Neuroscience at Harvard University for support. AS acknowledges funding by the European Research Council, grant 725937 NEUROABSTRACTION. FK acknowledges support from "Chaire de recherche sur les modèles et sciences des données", Fondation CFM pour la Recherche-ENS, and from the French National Research Agency (ANR) grant PAIL.