Exact solutions to the nonlinear dynamics of learning in deep linear neural networks

Andrew M. Saxe, James L. McClelland, Surya Ganguli

General learning dynamics of gradient descent

We begin by analyzing learning in a three layer network (input, hidden, and output) with linear activation functions (Fig 1). We let NiN_{i} be the number of neurons in layer ii. The input-output map of the network is y=W32W21xy={W^{32}}{W^{21}}x. We wish to train the network to learn a particular input-output map from a set of PP training examples {xμ,yμ},μ=1,…,P\left\{x^{\mu},y^{\mu}\right\},\mu=1,\ldots,P. Training is accomplished via gradient descent on the squared error ∑μ=1P∥yμ−W32W21xμ∥2\sum_{\mu=1}^{P}\left\|y^{\mu}-{W^{32}}{W^{21}}x^{\mu}\right\|^{2} between the desired feature output, and the network’s feature output. This gradient descent procedure yields the batch learning rule

where λ\lambda is a small learning rate. As long as λ\lambda is sufficiently small, we can take a continuous time limit to obtain the dynamics,

where Σ11≡∑μ=1PxμxμT\Sigma^{11}\equiv\sum_{\mu=1}^{P}x^{\mu}x^{\mu T} is an N1×N1N_{1}\times N_{1} input correlation matrix, Σ31≡∑μ=1PyμxμT{\Sigma^{31}}\equiv\sum_{\mu=1}^{P}y^{\mu}x^{\mu T} is an N3×N1N_{3}\times N_{1} input-output correlation matrix, and τ≡1λ.\tau\equiv\frac{1}{\lambda}. Here tt measures time in units of iterations; as tt varies from 0 to 1, the network has seen PP examples corresponding to one iteration. Despite the linearity of the network’s input-output map, the gradient descent learning dynamics given in Eqn (2) constitutes a complex set of coupled nonlinear differential equations with up to cubic interactions in the weights.

Our fundamental goal is to understand the dynamics of learning in (2) as a function of the input statistics Σ11\Sigma^{11} and input-output statistics Σ31{\Sigma^{31}}. In general, the outcome of learning will reflect an interplay between input correlations, described by Σ11\Sigma^{11}, and the input-output correlations described by Σ31{\Sigma^{31}}. To begin, though, we further simplify the analysis by focusing on the case of orthogonal input representations where Σ11=I\Sigma^{11}=I. This assumption will hold exactly for whitened input data, a widely used preprocessing step.

Because we have assumed orthogonal input representations (Σ11=I\Sigma^{11}=I), the input-output correlation matrix contains all of the information about the dataset used in learning, and it plays a pivotal role in the learning dynamics. We consider its singular value decomposition (SVD)

which will be central in our analysis. Here V11{V^{11}} is an N1×N1N_{1}\times N_{1} orthogonal matrix whose columns contain input-analyzing singular vectors vαv_{\alpha} that reflect independent modes of variation in the input, U33{U^{33}} is an N3×N3N_{3}\times N_{3} orthogonal matrix whose columns contain output-analyzing singular vectors uαu_{\alpha} that reflect independent modes of variation in the output, and S31{S^{31}} is an N3×N1N_{3}\times N_{1} matrix whose only nonzero elements are on the diagonal; these elements are the singular values sα,α=1,…,N1s_{\alpha},\alpha=1,\ldots,N_{1} ordered so that s1≥s2≥⋯≥sN1s_{1}\geq s_{2}\geq\cdots\geq s_{N_{1}}.

Now, performing the change of variables on synaptic weight space, W21=W‾21V11T{W^{21}}={\overline{W}^{21}}{V^{11}}^{T}, W32=U33W‾32{W^{32}}={U^{33}}{\overline{W}^{32}}, the dynamics in (2) simplify to

To gain intuition for these equations, note that while the matrix elements of W21{W^{21}} and W32{W^{32}} connected neurons in one layer to neurons in the next layer, we can think of the matrix element W‾21iα{\overline{W}^{21}}_{i\alpha} as connecting input mode vαv_{\alpha} to hidden neuron ii, and the matrix element W‾32αi{\overline{W}^{32}}_{\alpha i} as connecting hidden neuron ii to output mode uαu_{\alpha}. Let aαa^{\alpha} be the αth\alpha^{\textrm{th}} column of W‾21{\overline{W}^{21}}, and let bαTb^{\alpha T} be the αth\alpha^{\textrm{th}} row of W‾32{\overline{W}^{32}}. Intuitively, aαa^{\alpha} is a column vector of N2N_{2} synaptic weights presynaptic to the hidden layer coming from input mode α\alpha, and bαb^{\alpha} is a column vector of N2N_{2} synaptic weights postsynaptic to the hidden layer going to output mode α\alpha. In terms of these variables, or connectivity modes, the learning dynamics in (4) become

Note that sα=0s_{\alpha}=0 for α>N1\alpha>N_{1}. These dynamics arise from gradient descent on the energy function

and display an interesting combination of cooperative and competitive interactions. Consider the first terms in each equation. In these terms, the connectivity modes from the two layers, aαa^{\alpha} and bαb^{\alpha} associated with the same input-output mode of strength sαs^{\alpha}, cooperate with each other to drive each other to larger magnitudes as well as point in similar directions in the space of hidden units; in this fashion these terms drive the product of connectivity modes aα⋅bαa^{\alpha}\cdot b^{\alpha} to reflect the input-output mode strength sαs^{\alpha}. The second terms describe competition between the connectivity modes in the first (aαa^{\alpha}) and second (bβb^{\beta}) layers associated with different input modes α\alpha and β\beta. This yields a symmetric, pairwise repulsive force between all distinct pairs of first and second layer connectivity modes, driving the network to a decoupled regime in which the different connectivity modes become orthogonal.

2 The final outcome of learning

The fixed point structure of gradient descent learning in linear networks was worked out in . In the language of the connectivity modes, a necessary condition for a fixed point is aα⋅bβ=sαδαβa^{\alpha}\cdot b^{\beta}=s_{\alpha}\delta_{\alpha\beta}, while aαa^{\alpha} and bαb^{\alpha} are zero whenever sα=0s_{\alpha}=0. To satisfy these relations for undercomplete hidden layers (N2<N1,N2<N3N_{2}<N_{1},N_{2}<N_{3}), aαa^{\alpha} and bαb^{\alpha} can be nonzero for at most N2N_{2} values of α\alpha. Since there are rank(Σ31)≡r\textrm{rank}({\Sigma^{31}})\equiv r nonzero values of sαs_{\alpha}, there are (rN2)\begin{pmatrix}r\\ N_{2}\end{pmatrix} families of fixed points. However, all of these fixed points are unstable, except for the one in which only the first N2N_{2} strongest modes, i.e. aαa^{\alpha} and bαb^{\alpha} for α=1,…,N2\alpha=1,\ldots,N_{2} are active. Thus remarkably, the dynamics in (5) has only saddle points and no non-global local minima . In terms of the original synaptic variables W21{W^{21}} and W32{W^{32}}, all globally stable fixed points satisfy

Hence when learning has converged, the network will represent the closest rank N2N_{2} approximation to the true input-output correlation matrix. In this work, we are interested in understanding the dynamical weight trajectories and learning time scales that lead to this final fixed point.

3 The time course of learning

It is difficult though to exactly solve (5) starting from arbitrary initial conditions because of the competitive interactions between different input-output modes. Therefore, to gain intuition for the general dynamics, we restrict our attention to a special class of initial conditions of the form aαa^{\alpha} and bα∝rαb^{\alpha}\propto r^{\alpha} for α=1,…,N2\alpha=1,\ldots,N_{2}, where rα⋅rβ=δαβr^{\alpha}\cdot r^{\beta}=\delta_{\alpha\beta}, with all other connectivity modes aαa^{\alpha} and bαb^{\alpha} set to zero (see for solutions to a partially overlapping but distinct set of initial conditions, further discussed in Supplementary Appendix A).

Here rαr^{\alpha} is a fixed collection of N2N_{2} vectors that form an orthonormal basis for synaptic connections from an input or output mode onto the set of hidden units. Thus for this set of initial conditions, aαa^{\alpha} and bαb^{\alpha} point in the same direction for each alpha and differ only in their scalar magnitudes, and are orthogonal to all other connectivity modes. Such an initialization can be obtained by computing the SVD of Σ31{\Sigma^{31}} and taking W32=U33DaRT,W21=RDbV11T{W^{32}}={U^{33}}D_{a}R^{T},{W^{21}}=RD_{b}{V^{11}}^{T} where Da,DbD_{a},D_{b} are diagonal, and RR is an arbitrary orthogonal matrix; however, as we show

in subsequent experiments, the solutions we find are also excellent approximations to trajectories from small random initial conditions. It is straightforward to verify that starting from these initial conditions, aαa^{\alpha} and bαb^{\alpha} will remain parallel to rαr^{\alpha} for all future time. Furthermore, because the different active modes are orthogonal to each other, they do not compete, or even interact with each other (all dot products in the second terms of (5)-(6) are ).

Thus this class of conditions defines an invariant manifold in weight space where the modes evolve independently of each other.

If we let a=aα⋅rαa=a^{\alpha}\cdot r^{\alpha}, b=bα⋅rαb=b^{\alpha}\cdot r^{\alpha}, and s=sαs=s^{\alpha}, then the dynamics of the scalar projections (a,b)(a,b) obeys,

Thus our ability to decouple the connectivity modes yields a dramatically simplified two dimensional nonlinear system. These equations can by solved by noting that they arise from gradient descent on the error,

This implies that the product abab monotonically approaches the fixed point ss from its initial value. Moreover, E(a,b)E(a,b) satisfies a symmetry under the one parameter family of scaling transformations a→λaa\rightarrow\lambda a, b→bλb\rightarrow\frac{b}{\lambda}. This symmetry implies, through Noether’s theorem, the existence of a conserved quantity, namely a2−b2a^{2}-b^{2}, which is a constant of motion. Thus the dynamics simply follows hyperbolas of constant a2−b2a^{2}-b^{2} in the (a,b)(a,b) plane until it approaches the hyperbolic manifold of fixed points, ab=sab=s. The origin a=0,b=0a=0,b=0 is also a fixed point, but is unstable. Fig. 2 shows a typical phase portrait for these dynamics.

As a measure of the timescale of learning, we are interested in how long it takes for abab to approach ss from any given initial condition. The case of unequal aa and bb is treated in the Supplementary Appendix A due to space constraints. Here we pursue an explicit solution with the assumption that a=ba=b, a reasonable limit when starting with small random initial conditions. We can then track the dynamics of u≡abu\equiv ab, which from (8) obeys

This equation is separable and can be integrated to yield

Here tt is the time it takes for uu to travel from u0u_{0} to ufu_{f}. If we assume a small initial condition u0=ϵu_{0}=\epsilon, and ask when ufu_{f} is within ϵ\epsilon of the fixed point ss, i.e. uf=s−ϵu_{f}=s-\epsilon, then the learning timescale in the limit ϵ→0\epsilon\rightarrow 0 is t=τ/sln⁡(s/ϵ)=O(τ/s)t=\tau/s\ln\left(s/\epsilon\right)=O(\tau/s) (with a weak logarithmic dependence on the cutoff). This yields a key result: the timescale of learning of each input-output mode α\alpha of the correlation matrix Σ31{\Sigma^{31}} is inversely proportional to the correlation strength sαs_{\alpha} of the mode. Thus the stronger an input-output relationship, the quicker it is learned.

We can also find the entire time course of learning by inverting (11) to obtain

This time course describes the temporal evolution of the product of the magnitudes of all weights from an input mode (with correlation strength ss) into the hidden layers, and from the hidden layers to the same output mode. If this product starts at a small value u0<su_{0}<s, then it displays a sigmoidal rise which asymptotes to ss as t→∞t\rightarrow\infty. This sigmoid can exhibit sharp transitions from a state of no learning to full learning. This analytical sigmoid learning curve is shown in Fig. 3 to yield a reasonable approximation to learning curves in linear networks that start from random initial conditions that are not on the orthogonal, decoupled invariant manifold–and that therefore exhibit competitive dynamics between connectivity modes–as well as in nonlinear networks solving the same task. We note that though the nonlinear networks behaved similarly to the linear case for this particular task, this is likely to be problem dependent.

Deeper multilayer dynamics

The network analyzed in Section 1 is the minimal example of a multilayer net, with just a single layer of hidden units. How does gradient descent act in much deeper networks? We make an initial attempt in this direction based on initial conditions that yield particularly simple gradient descent dynamics.

In a linear neural network with NlN_{l} layers and hence Nl−1N_{l}-1 weight matrices indexed by Wl,l=1,⋯ ,Nl−1W^{l},l=1,\cdots,N_{l}-1, the gradient descent dynamics can be written as

where ∏i=abWi=WbW(b−1)⋯W(a−1)Wa\prod_{i=a}^{b}W^{i}=W^{b}W^{(b-1)}\cdots W^{(a-1)}W^{a} with the special case that ∏i=abWi=I\prod_{i=a}^{b}W^{i}=I, the identity, if a>ba>b.

To describe the initial conditions, we suppose that there are NlN_{l} orthogonal matrices RlR_{l} that diagonalize the starting weight matrices, that is, Rl+1TWl(0)Rl=DlR_{l+1}^{T}W_{l}(0)R_{l}=D_{l} for all ll, with the special case that R1=V11R_{1}={V^{11}} and RNl=U33R_{N_{l}}={U^{33}}. This requirement essentially demands that the output singular vectors of layer ll be the input singular vectors of the next layer l+1l+1, so that a change in mode strength at any layer propagates to the output without mixing into other modes. We note that this formulation does not restrict hidden layer size; each hidden layer can be of a different size, and may be undercomplete or overcomplete. Making the change of variables Wl=Rl+1W‾lRlTW_{l}=R_{l+1}\overline{W}_{l}R_{l}^{T} along with the assumption that Σ11=I\Sigma^{11}=I leads to a set of decoupled connectivity modes that evolve independently of each other. In analogy to the simplification occurring in the three layer network from (2) to (8), each connectivity mode in the NlN_{l} layered network can be described by Nl−1N_{l}-1 scalars a1,…,aNl−1a^{1},\dots,a^{N_{l}-1}, whose dynamics obeys gradient descent on the energy function (the analog of (9)),

This dynamics also has a set of conserved quantities ai2−aj2a_{i}^{2}-a_{j}^{2} arising from the energetic symmetry w.r.t. the transformation ai→λaia_{i}\rightarrow\lambda a_{i}, aj→ajλa_{j}\rightarrow\frac{a_{j}}{\lambda}, and hence can be solved exactly. We focus on the invariant submanifold in which ai(t=0)=a0a_{i}(t=0)=a_{0} for all ii, and track the dynamics of u=∏i=1Nl−1aiu=\textstyle\prod_{i=1}^{N_{l}-1}a_{i}, the overall strength of this mode, which obeys (i.e. the generalization of (10)),

This can be integrated for any positive integer NlN_{l}, though the expression is complicated. Once the overall strength increases sufficiently, learning explodes rapidly.

Eqn. (15) lets us study the dynamics of learning as depth limits to infinity. In particular, as Nl→∞N_{l}\rightarrow\infty we have the dynamics

Remarkably this implies that, for a fixed learning rate, the learning time as measured by the number of iterations required tends to zero as NlN_{l} goes to infinity. This result depends on the continuous time formulation, however. Any implementation will operate in discrete time and must choose a finite learning rate that yields stable dynamics. An estimate of the optimal learning rate can be derived from the maximum eigenvalue of the Hessian over the region of interest.

For linear networks with ai=aj=aa_{i}=a_{j}=a, this optimal learning rate αopt\alpha_{opt} decays with depth as O(1Nls2)O\left(\frac{1}{N_{l}s^{2}}\right) for large NlN_{l} (see Supplementary Appendix B). Incorporating this dependence of the learning rate on depth, the learning time as depth approaches infinity still surprisingly remains finite: with the optimal learning rate, the difference between learning times for an Nl=3N_{l}=3 network and an Nl=∞N_{l}=\infty network is t∞−t3∼O(s/ϵ)t_{\infty}-t_{3}\sim O\left(s/\epsilon\right) for small ϵ\epsilon (see Supplementary Appendix B.1). We emphasize that our analysis of learning speed is based on the number of iterations required, not the amount of computation–computing one iteration of a deep network will require more time than doing so in a shallow network.

To verify these predictions, we trained deep linear networks on the MNIST classification task with depths ranging from Nl=3N_{l}=3 to Nl=100N_{l}=100. We used hidden layers of size 1000, and calculated the iteration at which training error fell below a fixed threshold corresponding to nearly complete learning. We optimized the learning rate separately for each depth by training each network with twenty rates logarithmically spaced between 10−410^{-4} and 10−710^{-7} and picking the fastest. See Supplementary Appendix C for full experimental details. Networks were initialized with decoupled initial conditions and starting initial mode strength u0=0.001u_{0}=0.001. Fig. 4 shows the resulting learning times, which saturate, and the empirically optimal learning rates, which scale like O(1/Nl)O(1/N_{l}) as predicted.

Thus learning times in deep linear networks that start with decoupled initial conditions are only a finite amount slower than a shallow network regardless of depth. Moreover, the delay incurred by depth scales inversely with the size of the initial strength of the association. Hence finding a way to initialize the mode strengths to large values is crucial for fast deep learning.

Finding good weight initializations: on greediness and randomness

The previous subsection revealed the existence of a decoupled submanifold in weight space in which connectivity modes evolve independently of each other during learning, and learning times can be independent of depth, even for arbitrarily deep networks, as long as the initial composite, end to end mode strength, denoted by uu above, of every connectivity mode is O(1)O(1). What numerical weight initilization procedures can get us close to this weight manifold, so that we can exploit its rapid learning properties?

A breakthrough in training deep neural networks started with the discovery that greedy layer-wise unsupervised pretraining could substantially speed up and improve the generalization performance of standard gradient descent . Unsupervised pretraining has been shown to speed the optimization of deep networks, and also to act as a special regularizer towards solutions with better generalization performance . At the same time, recent results have obtained excellent performance starting from carefully-scaled random initializations, though interestingly, pretrained initializations still exhibit faster convergence (see Supplementary Appendix D for discussion). Here we examine analytically how unsupervised pretraining achieves an optimization advantage, at least in deep linear networks, by finding the special class of orthogonalized, decoupled initial conditions in the previous section that allow for rapid supervised deep learning, for input-output tasks with a certain precise structure. Subsequently, we analyze the properties of random initilizations.

We consider the following pretraining and finetuning procedure: First, using autoencoders as the unsupervised pretraining module , the network is trained to produce its input as its output (ypreμ=xμy_{\textrm{pre}}^{\mu}=x^{\mu}). Subsequently, the network is finetuned on the ultimate input-output task of interest (e.g., a classification task). In the following we consider the case N2=N1N_{2}=N_{1} for simplicity.

During the pretraining phase, the input-output correlation matrix Σ31pre{\Sigma^{31}}_{\textrm{pre}} is simply the input correlation matrix Σ11\Sigma^{11}. Hence the SVD of Σ31pre{\Sigma^{31}}_{\textrm{pre}} is PCA on the input correlation matrix, since Σ31pre=Σ11=QΛQT{\Sigma^{31}}_{\textrm{pre}}=\Sigma^{11}=Q\Lambda Q^{T}, where QQ are eigenvectors of Σ11\Sigma^{11} and Λ\Lambda is a diagonal matrix of variances. Our analysis of the learning dynamics in Section 1.1 does not directly apply, because here the input correlation matrix is not white. In Supplementary Appendix E we generalize our results to handle this case. During pretraining, the weights approach W32W21=Σ31(Σ31)−1,{W^{32}}{W^{21}}={\Sigma^{31}}({\Sigma^{31}})^{-1}, but since they do not reach the fixed point in finite time, they will end at W32W21=QMQT{W^{32}}{W^{21}}=QMQ^{T} where MM is a diagonal matrix that is approaching the identity matrix during learning. Hence in general, W32=QM1/2C−1{W^{32}}=QM^{1/2}C^{-1} and W21=CM1/2QT{W^{21}}=CM^{1/2}Q^{T} where CC is any invertible matrix. When starting from small random weights, though, each weight matrix will end up with a roughly balanced contribution to the overall map. This corresponds to having C≈R2C\approx R_{2} where R2R_{2} is orthogonal. Hence at the end of the pretraining phase, the input-to-hidden mapping will be W21=R2M1/2QT{W^{21}}=R_{2}M^{1/2}Q^{T} where R2R_{2} is an arbitrary orthogonal matrix.

Now consider the fine-tuning phase. Here the weights are trained on the ultimate task of interest with input-output correlations Σ31=U33S31V11{\Sigma^{31}}={U^{33}}{S^{31}}{V^{11}}. The matrix W21{W^{21}} begins from the pretrained initial condition W21=R2M1/2QT{W^{21}}=R_{2}M^{1/2}Q^{T}. For the fine-tuning task, a decoupled initial condition for W21{W^{21}} is one that can be written as W21=R2D1V11T{W^{21}}=R_{2}D_{1}{V^{11}}^{T} (see Section 2). Clearly, this will be possible only if

Then the initial condition obtained from pretraining will also be a decoupled initial condition for the finetuning phase, with initial mode strengths D1=M1/2D_{1}=M^{1/2} near one. Hence we can state the underlying condition required for successful greedy pretraining in deep linear networks: the right singular vectors of the ultimate input-ouput task of interest V11{V^{11}} must be similar to the principal components of the input data QQ. This is a quantitatively precise instantiation of the intuitive idea that unsupervised pretraining can help in a subsequent supervised learning task if (and only if) the statistical structure of the input is consistent with the structure of input-output map to be learned. Moreover, this quantitative instantiation of this intuitive idea gives a simple empirical criterion that can be evaluated on any new dataset: given the input-output correlation Σ31{\Sigma^{31}} and input correlation Σ11\Sigma^{11}, compute the right singular vectors V11{V^{11}} of Σ31{\Sigma^{31}} and check that V11Σ11V11T{V^{11}}\Sigma^{11}{V^{11}}^{T} is approximately diagonal. If the condition in Eqn. (18) holds, autoencoder pretraining will have properly set up decoupled initial conditions for W21{W^{21}}, with an appreciable initial association strength near 11. This argument also goes through straightforwardly for layer-wise pretraining of deeper networks. Fig. 5 shows that this consistency condition empirically holds on MNIST, and that a pretrained deep linear neural network learns faster than one started from small random initial conditions, even accounting for pretraining time (see Supplementary Appendix F for experimental details). We note that this analysis is unlikely to carry over completely to nonlinear networks. Some nonlinear networks are approximately linear (e.g., tanh nonlinearities) after initialization with small random initializations, and hence our solutions may describe these dynamics well early in learning. However as the network enters its nonlinear regime, our solutions should not be expected to remain accurate.

As an alternative to greedy layerwise pre-training, proposed choosing appropriately scaled initial conditions on weights that would preserve the norm of typical error vectors as they were backpropagated through the deep network. In our context, the appropriate norm-preserving scaling for the initial condition of an NN by NN connectivity matrix WW between any two layers corresponds to choosing each weight i.i.d. from a zero mean Gaussian with standard deviation 1/N1/\sqrt{N}. With this choice, ⟨vTWTWv⟩W=vTv\langle v^{T}W^{T}Wv\rangle_{W}=v^{T}v, where ⟨⋅⟩W\langle\cdot\rangle_{W} denotes an average over distribution of the random matrix WW. Moreover, the distribution of vTWTWvv^{T}W^{T}Wv concentrates about its mean for large NN. Thus with this scaling, in linear networks, both the forward propagation of activity, and backpropagation of gradients is typically norm-preserving. However, with this initialization, the learning time with depth on linear networks trained on MNIST grows with depth (Fig. 6A, left, blue). This growth is in distinct contradiction with the theoretical prediction, made above, of depth independent learning times starting from the decoupled submanifold of weights with composite mode strength O(1)O(1). This suggests that the scaled random initialization scheme, despite its norm-preserving nature, does not find this submanifold in weight space. In contrast, learning times with greedy layerwise pre-training do not grow with depth (Fig. 6A, left, green curve hiding under red curve), consistent with the predictions of our theory (as a technical point: note that learning times under greedy pre-training initialization in Fig. 6A are faster than those obtained in Fig. 4 by explicitly choosing a point on the decoupled submanifold, because there the initial mode strength was chosen to be small (u=0.001u=0.001) whereas greedy pre-training finds a composite mode strength closer to 11).

Is there a simple random initialization scheme that does enjoy the rapid learning properties of greedy-layerwise pre-training? We empirically show (Fig. 6A, left, red curve) that if we choose the initial weights in each layer to be a random orthogonal matrix (satisifying WTW=IW^{T}W=I), instead of a scaled random Gaussian matrix, then this orthogonal random initialization condition yields depth independent learning times just like greedy layerwise pre-training (indeed the red and green curves are indistinguishable). Theoretically, why do random orthogonal initializations yield depth independent learning times, but not scaled random Gaussian initializations, despite their norm preserving nature?

The answer lies in the eigenvalue and singular value spectra of products of Gaussian versus orthgonal random matrices. While a single random orthogonal matrix has eigenvalue spectra lying exactly on the unit circle in the complex plane (Fig. 6A right), the eigenvalue spectra of random Gaussian matrices, whose elements have variance 1/N1/N, form a uniform distribution on a solid disk of radius 1 the complex plane (Fig. 6C left). Moreover the singular values of an orthogonal matrix are all exactly 11, while the squared singular values of a scaled Gaussian random matrix have the well known Marcenko-Pasteur distribution, with a nontrivial spread even as N→∞N\rightarrow\infty, (Fig. 6B left shows the distribution of singular values themselves). Now consider a product of these matrices across all NlN_{l} layers, representing the total end to end propagation of activity across a deep linear network:

Due to the random choice of weights in each layer, WTotW_{\text{Tot}} is itself a random matrix. On average, it preserves the norm of a typical vector vv no matter whether the matrices in each layer are Gaussian or orthogonal. However, the singular value spectra of WTotW_{\text{Tot}} differ markedly in the two cases. Under random orthogonal initilization in each layer, WTotW_{\text{Tot}} is itself an orthogonal matrix and therefore has all singular values equal to 11. However, under random Gaussian initialization in each layer, there is as of yet no complete theoretical characterization of the singular value distribution of WTotW_{\text{Tot}}. We have computed it numerically as a function of different depths in Fig. 6B, and we find that it develops a highly kurtotic nature as the depth increases. Most of the singular values become vanishingly small, while a long tail of very large singular values remain. Thus WTotW_{\text{Tot}} preserves the norm of a typical, randomly chosen vector vv, but in a highly anisotropic manner, by strongly amplifying the projection of vv onto a very small subset of singular vectors and attenuating vv in all other directions. Intuitively WTotW_{\text{Tot}}, as well as the linear operator WTotTW_{\text{Tot}}^{T} that would be closely related to backpropagation of gradients to early layers, act as amplifying projection operators at large depth NlN_{l}. In contrast, all of the eigenvalues of WTotW_{\text{Tot}} in the scaled Gaussian case concentrate closer to the origin as depth increases. This discrepancy between the behavior of the eigenvalues and singular values of WTotW_{\text{Tot}}, a phenomenon that could occur only if the eigenvectors of WTotW_{\text{Tot}} are highly non-orthogonal, reflects the highly non-normal nature of products of random Gaussian matrices (a non-normal matrix is by definition a matrix whose eigenvectors are non-orthogonal).

While the combination of amplification and projection in WTotW_{\text{Tot}} can preserve norm, it is clear that it is not a good way to backpropagate errors; the projection of error vectors onto a high dimensional subspace corresponding to small singular values would be strongly attenuated, yielding vanishingly small gradient signals corresponding to these directions in the early layers. This effect, which is not present for random orthogonal initializations or greedy pretraining, would naturally explain the long learning times starting from scaled random Gaussian initial conditions relative to the other initilizations in Fig. 6A left. For both linear and nonlinear networks, a more likely appropriate condition on weights for generating fast learning times would be that of dynamical isometry. By this we mean that the product of Jacobians associated with error signal backpropagation should act as a near isometry, up to some overall global O(1)O(1) scaling, on a subspace of as high a dimension as possible. This is equivalent to having as many singular values of the product of Jacobians as possible within a small range around an O(1)O(1) constant, and is closely related to the notion of restricted isometry in compressed sensing and random projections. Preserving norms is a necessary but not sufficient condition for achieving dynamical isometry at large depths, as demonstrated in Fig. 6B, and we have shown that for linear networks, orthogonal initializations achieve exact dynamical isometry with all singular values at 11, while greedy pre-training achieves it approximately.

We note that the discrepancy in learning times between the scaled Gaussian initialization and the orthogonal or pre-training initializations is modest for the depths of around 66 used in large scale applications, but is magnified at larger depths (Fig. 6A left). This may explain the modest improvement in learning times with greedy pre-training versus random scaled Gaussian initializations observed in applications (see discussion in Supplementary Appendix D). We predict that this modest improvement will be magnified at higher depths, even in nonlinear networks. Finally, we note that in recurrent networks, which can be thought of as infinitely deep feed-forward networks with tied weights, a very promising approach is a modification to the training objective that partially promotes dynamical isometry for the set of gradients currently being back-propagated .

Achieving approximate dynamical isometry in nonlinear networks

We have shown above that deep random orthogonal linear networks achieve perfect dynamical isometry. Here we show that nonlinear versions of these networks can also achieve good dynamical isometry properties. Consider the nonlinear feedforward dynamics

where xilx^{l}_{i} denotes the activity of neuron ii in layer ll, Wij(l+1,l)W^{(l+1,l)}_{ij} is a random orthogonal connectivity matrix from layer ll to l+1l+1, gg is a scalar gain factor, and ϕ(x)\phi(x) is any nonlinearity that saturates as x→±∞x\rightarrow\pm\infty. We show in Supplementary appendix G that there exists a critical value gcg_{c} of the gain gg such that if g<gcg<g_{c}, activity will decay away to zero as it propagates through the layers, while if g>gcg>g_{c}, the strong linear positive gain will combat the damping due to the saturating nonlinearity, and activity will propagate indefinitely without decay, no matter how deep the network is. When the nonlinearity is odd (ϕ(x)=−ϕ(−x)\phi(x)=-\phi(-x)), so that the mean activity in each layer is approximately , these dynamical properties can be quantitatively captured by the neural population variance in layer ll,

Thus lim⁡l→∞ql→0\lim_{l\rightarrow\infty}q^{l}\rightarrow 0 for g<gcg<g_{c} and lim⁡l→∞ql→q∞(g)>0\lim_{l\rightarrow\infty}q^{l}\rightarrow q^{\infty}(g)>0 for g>gcg>g_{c}. When ϕ(x)=tanh⁡(x)\phi(x)=\tanh(x), we compute gc=1g_{c}=1 and numerically compute q∞(g)q^{\infty}(g) in Fig. 8 in Supplementary appendix G. Thus these nonlinear feedforward networks exhibit a phase-transition at the critical gain; above the critical gain, infinitely deep networks exhibit chaotic percolating activity propagation, so we call the critical gain gcg_{c} the edge of chaos, in analogy with terminology for recurrent networks.

Now we are interested in how errors at the final layer NlN_{l} backpropagate back to earlier layers, and whether or not these gradients explode or decay with depth. To quantify this, for simplicity we consider the end to end Jacobian

which captures how input perturbations propagate to the output. If the singular value distribution of this Jacobian is well-behaved, with few extremely large or small singular values, then the backpropagation of gradients will also be well-behaved, and exhibit little explosion or decay. The Jacobian is evaluated at a particular point xNlx^{N_{l}} in the space of output layer activations, and this point is in turn obtained by iterating (20) starting from an initial input layer activation vector x1x^{1}. Thus the singular value distribution of the Jacobian will depend not only on the gain gg, but also on the initial condition x1x^{1}. By rotational symmetry, we expect this distribution to depend on x1x^{1}, only through its population variance q1q^{1}. Thus for large NN, the singular value distribution of the end-to-end Jacobian in (22) (the analog of WTotW_{\text{Tot}} in (19) in the linear case), depends on only two parameters: gain gg and input population variance q1q^{1}.

We have numerically computed this singular value distribution as a function of these two parameters in Fig. 7, for a single random orthogonal nonlinear network with N=1000N=1000 and Nl=100N_{l}=100. These results are typical; replotting the results for different random networks and different initial conditions (with the same input variance) yield very similar results. We see that below the edge of chaos, when g<1g<1, the linear dampening over many layers yields extremely small singular values. Above the edge of chaos, when g>1g>1, the combination of positive linear amplification, and saturating nonlinear dampening yields an anisotropic distribution of singular values. At the edge of chaos, g=1g=1, an O(1)O(1) fraction of the singular value distribution is concentrated in a range that remains O(1)O(1) despite 100100 layers of propagation, reflecting appoximate dynamical isometry. Moreover, this nice property at g=1g=1 remains valid even as the input variance q1q^{1} is increased far beyond 11, where the tanh⁡\tanh function enters its nonlinear regime. Thus the right column of Fig. 7 at gg near 11 indicates that the useful dynamical isometry properties of random orthogonal linear networks described above survives in nonlinear networks, even when activity patterns enter deeply into the nonlinear regime in the input layers. Interestingly, the singular value spectrum is more robust to perturbations that increase gg from 11 relative to those that decrease gg. Indeed, the anisotropy in the singular value distribution at g=1.1g=1.1 is relatively mild compared to that of random linear networks with scaled Gaussian initial conditions (compare the bottom row of Fig. 7 with the right column of panel B in Fig. 6). Thus overall, these numerical results suggest that being just beyond the edge of orthogonal chaos may be a good regime for learning in deep nonlinear networks.

Discussion

In summary, despite the simplicity of their input-output map, the dynamics of learning in deep linear networks reveals a surprising amount of rich mathematical structure, including nonlinear hyperbolic dynamics, plateaus and sudden performance transitions, a proliferation of saddle points, symmetries and conserved quantities, invariant submanifolds of independently evolving connectivity modes subserving rapid learning, and most importantly, a sensitive but computable dependence of learning time scales on input statistics, initial weight conditions, and network depth. With the right initial conditions, deep linear networks can be only a finite amount slower than shallow networks, and unsupervised pretraining can find these initial conditions for tasks with the right structure. Moreover, we introduce a mathematical condition for faithful backpropagation of error signals, namely dynamical isometry, and show, surprisingly that random scaled Gaussian initializations cannot achieve this condition despite their norm-preserving nature, while greedy pre-training and random orthogonal initialization can, thereby achieving depth independent learning times. Finally, we show that the property of dynamical isometry survives to good approximation even in extremely deep nonlinear random orthogonal networks operating just beyond the edge of chaos. At the cost of expressivity, deep linear networks gain theoretical tractability and may prove fertile for addressing other phenomena in deep learning, such as the impact of carefully-scaled initializations , momentum , dropout regularization , and sparsity constraints . While a full analytical treatment of learning in deep nonlinear networks currently remains open, one cannot reasonably hope to move towards such a theory without first completely understanding the linear case. In this sense, our work fulfills an essential pre-requisite for progress towards a general, quantitative theory of deep learning.

References

Supplementary Material

Appendix A Hyperbolic dynamics of learning

In Section 1.3 of the main text we treat the dynamics of learning in three layer networks where mode strengths in each layer are equal, i.e, a=ba=b, a reasonable limit when starting with small random initial conditions. More generally, though, we are interested in how long it takes for abab to approach ss from any given initial condition. To access this, given the hyperbolic nature of the dynamics, it is useful to make the hyperbolic change of coordinates,

Thus θ\theta parametrizes the dynamically invariant manifolds a2−b2=±c0a^{2}-b^{2}=\pm c_{0}. For any c0c_{0} and θ\theta, this coordinate system covers the region a+b>0a+b>0, which is the basin of attraction of the upper right component of the hyperbola ab=sab=s. A symmetric situation exists for a+b<0a+b<0, which is attracted to the lower left component of ab=sab=s. We use θ\theta as a coordinate to follow the dynamics of the product abab, and using the relations ab=c0sinh⁡θab=c_{0}\sinh\theta and a2+b2=c0cosh⁡θa^{2}+b^{2}=c_{0}\cosh\theta, we obtain

This differential equation is separable in θ\theta and tt and can be integrated to yield

Here tt is the amount of time it takes to travel from θ0\theta_{0} to θf\theta_{f} along the hyperbola a2−b2=±c0a^{2}-b^{2}=\pm c_{0}. The fixed point lies at θ=sinh⁡−1s/c0\theta=\sinh^{-1}s/c_{0}, but the dynamics cannot reach the fixed point in finite time. Therefore we introduce a cutoff ϵ\epsilon to mark the endpoint of learning, so that θf\theta_{f} obeys sinh⁡θf=(1−ϵ)s/c0\sinh\theta_{f}=(1-\epsilon)s/c_{0} (i.e. abab is close to ss by a factor 1−ϵ1-\epsilon). We can then average over the initial conditions c0c_{0} and θ0\theta_{0} to obtain the expected learning time of an input-output relation that has a correlation strength ss. Rather than doing this, it is easier to obtain a rough estimate of the timescale of learning under the assumption that the initial weights are small, so that c0c_{0} and θ0\theta_{0} are close to . In this case t=O(τ/s)t=O(\tau/s) (with a weak logarithmic dependence on the cutoff (i.e. ln⁡(1/ϵ)\ln(1/\epsilon)). This modestly generalizes the result given in the main text: the timescale of learning of each input-output mode α\alpha of the correlation matrix Σ31{\Sigma^{31}} is inversely proportional to the correlation strength sαs_{\alpha} of the mode even when aa and bb differ slightly, i.e., c0c_{0} small. This is not an unreasonable limit for random initial conditions because ∣c0∣=∣a⋅a−b⋅b∣|c_{0}|=|a\cdot a-b\cdot b| where aa and bb are random vectors of N2N_{2} synaptic weights into and out of the hidden units. Thus we expect the lengths of the two random vectors to be approximately equal and therefore c0c_{0} will be small relative to the length of each vector.

These solutions are distinctly different from solutions for learning dynamics in three layer networks found in . In our notation, in , it was shown that if the initial vectors aαa^{\alpha} and bαb^{\alpha} satisfy the matrix identity ∑αaαaαT=∑αbαbαT\sum_{\alpha}a^{\alpha}a^{\alpha^{T}}=\sum_{\alpha}b^{\alpha}b^{\alpha^{T}} then the dynamics of learning becomes equivalent to a matrix Riccatti equation. However, the hyperbolic dynamics derived here arises from a set of initial conditions that do not satisfy the restrictions of and therefore do not arise through a solution to a matrix Ricatti equation. Moreover, in going beyond a statement of the matrix Riccatti solution, our analysis provides intuition about the time-scales over which the learning dynamics unfolds, and crucially, our methods extend beyond the three layer case to the arbitrary NlN_{l} layer case, not studied in .

Appendix B Optimal discrete time learning rates

In Section 2 we state results on the optimal learning rate as a function of depth in a deep linear network, which we derive here. Starting from the decoupled initial conditions given in the main text, the dynamics arise from gradient descent on

We now assume that we start on the symmetric manifold, such that ai=aj=aa_{i}=a_{j}=a for all i,ji,j. Thus we have

One eigenvector is v1=[11⋯1]Tv_{1}=[11\cdots 1]^{T} with eigenvalue λ1=h+(Nl−2)g\lambda_{1}=h+(N_{l}-2)g, or

Now consider the second order update (Newton-Raphson) (here we use 11 to denote a vector of ones)

Note that the basin of attraction does not include small initial conditions, because for small aa the Hessian is not positive definite.

To determine the optimal learning rate for first order gradient descent, we compute the maximum of λ1\lambda_{1} over the range of mode strengths that can be visited during learning, i.e., a∈[0,s1/(Nl−1)]a\in[0,s^{1/(N_{l}-1)}]. This occurs at the optimum, aopt=s1/(Nl−1)a_{opt}=s^{1/(N_{l}-1)}. Hence substituting this into (37) we have

The optimal learning rate α\alpha is proportional to 1/λ1(aopt)1/\lambda_{1}(a_{opt}), and hence scales as

How does the optimal learning rate impact learning speeds? We compare the three layer learning time to the infinite depth limit learning time, with learning rate set inversely proportional to Eqn. (41) with proportionality constant cc.

This yields a three layer learning time t3t_{3} of

and an infinite layer learning time t∞t_{\infty} of

where the final approximation is for u0=ϵ,uf=s−ϵu_{0}=\epsilon,u_{f}=s-\epsilon, and ϵ\epsilon small. Thus very deep networks incur only a finite delay relative to shallow networks.

Appendix C Experimental setup for MNIST depth experiment

We trained deep linear networks on the MNIST dataset with fifteen different depths Nl={3,5,8,10,14,20,28,36,44,54,64,74,84,94,100}N_{l}=\{3,5,8,10,14,20,28,36,44,54,64,74,84,94,100\}. Given a 784-dimensional input example, the network tried to predict a 10-dimensional output vector containing a 1 in the index for the correct class, and zeros elsewhere. The network was trained using batch gradient descent via Eqn. (13) on the 50,000 sample MNIST training dataset. We note that Eqn. (13) makes use of the linearity of the network to speed training and reduce memory requirements. Instead of forward propagating all 50,000 training examples, we precompute Σ31{\Sigma^{31}} and forward propagate only it. This enables experiments on very deep networks that otherwise would be computationally infeasible. Experiments were accelerated on GPU hardware using the GPUmat package. We used overcomplete hidden layers of size 1000. Here the overcompleteness is simply to demonstrate the applicability of the theory to this case; overcompleteness does not improve the representational power of the network. Networks were initialized with decoupled initial conditions and starting initial mode strength u0=0.001u_{0}=0.001, as described in the text. The random orthogonal matrices RlR_{l} were selected by generating random Gaussian matrices and computing a QR decomposition to obtain an orthogonal matrix. Learning times were calculated as the iteration at which training error fell below a fixed threshold of 1.3×1041.3\times 10^{4} corresponding to nearly complete learning. Note that this level of performance is grossly inferior to what can be obtained using nonlinear networks, which reflects the limited capacity of a linear network. We optimized the learning rate λ\lambda separately for each depth by training each network with twenty rates logarithmically spaced between 10−410^{-4} and 10−710^{-7} and picking the one that yielded the minimum learning time according to our threshold criterion. The range 10−410^{-4} and 10−710^{-7} was selected via preliminary experiments to ensure that the optimal learning rate always lay in the interior of the range for all depths.

Appendix D Efficacy of unsupervised pretraining

Recently high performance has been demonstrated in deep networks trained from random initial conditions , suggesting that deep networks may not be as hard to train as previously thought. These results show that pretraining is not necessary to obtain state-of-the-art performance, and to achieve this they make use of a variety of techniques including carefully-scaled random initializations, more sophisticated second order or momentum-based optimization methods, and specialized convolutional architectures. It is therefore important to evaluate whether unsupervised pretraining is still useful, even if it is no longer necessary, for training deep networks. In particular, does pretraining still confer an optimization advantage and generalization advantage when used in conjunction with these new techniques? Here we review results from a variety of papers, which collectively show that unsupervised pretraining still confers an optimization advantage and a generalization advantage.

The optimization advatage of pretraining refers to faster convergence to the local optimum (i.e., faster learning speeds) when starting from pretrained initializations as compared to random initializations. Faster learning speeds starting from pretrained initial conditions have been consistently found with Hessian free optimization . This finding holds for two carefully-chosen random initialization schemes, the sparse connectivity scheme of , and the dense scaled scheme of (as used by ). Hence pretraining still confers a convergence speed advantage with second order methods. Pretrained initial conditions also result in faster convergence than carefully-chosen random initializations when optimizing with stochastic gradient descent . In light of this, it appears that pretrained initial conditions confer an optimization advantage beyond what can be obtained currently with carefully-scaled random initializations, regardless of optimization technique. If run to convergence, second order methods and well-chosen scalings can erase the discrepancy between the final objective value obtained on the training set for pretrained relative to random initializations . The optimization advantage is thus purely one of convergence speed, not of finding a better local minimum. This coincides with the situation in linear networks, where all methods will eventually attain the same global minimum, but the rate of convergence can vary. Our analysis shows why this optimization advantage due to pretraining persists over well-chosen random initializations.

Finally, we note that Sutskever et al. show that careful random initialization paired with carefully-tuned momentum can achieve excellent performance , but these experiments did not try pretrained initial conditions. Krizhevsky et al. used convolutional architectures and did not attempt pretraining . Thus the possible utility of pretraining in combination with momentum, and in combination with convolutional architectures, dropout, and large supervised datasets, remains unclear.

D.2 Generalization advantage

Pretraining can also act as a special regularizer, improving generalization error in certain instances. This generalization advantage appears to persist with new second order methods , and in comparison to gradient descent with careful random initializations . An analysis of this effect in deep linear networks is out of the scope of this work, though promising tools have been developed for the three layer linear case .

Appendix E Learning dynamics with task-aligned input correlations

In the main text we focused on orthogonal input correlations (Σ11=I\Sigma^{11}=I) for simplicity, and to draw out the main intuitions. However our analysis can be extended to input correlations with a very particular structure. Recall that we decompose the input output correlations using the SVD as Σ31=U33S31V11T{\Sigma^{31}}={U^{33}}{S^{31}}{V^{11}}^{T}. We can generalize our solutions to allow input correlations of the form Σ11=V11DV11T\Sigma^{11}={V^{11}}D{V^{11}}^{T}. Intuitively, this condition requires the axes of variation in the input to coincide with the axes of variation in the input-output task, though the variances may differ. If we take D=ID=I then we recover the whitened case Σ11=I\Sigma^{11}=I, and if we take D=ΛD=\Lambda, then we can treat the autoencoding case. The final fixed points of the weights are given by the best rank N2N_{2} approximation to Σ31(Σ11)−1{\Sigma^{31}}(\Sigma^{11})^{-1}. Making the same change of variables as in Eqn. (4) we now obtain

which, again, is decoupled if W‾32{\overline{W}^{32}} and W‾21{\overline{W}^{21}} begin diagonal. Based on this it is straightforward to generalize our results for the learning dynamics.

Appendix F MNIST pretraining experiment

We trained networks of depth 5 on the MNIST classification task with 200 hidden units per layer, starting either from small random initial conditions with each weight drawn independently from a Gaussian distribution with standard deviation 0.01, or from greedy layerwise pretrained initial conditions. For the pretrained network, each layer was trained to reconstruct the output of the next lower layer. In the finetuning stage, the network tried to predict a 10-dimensional output vector containing a 1 in the index for the correct class, and zeros elsewhere. The network was trained using batch gradient descent via Eqn. (13) on the 50,000 sample MNIST training dataset. Since the network is linear, pretraining initializes the network with principal components of the input data, and, to the extent that the consistency condition of Eqn. (18) holds, decouples these modes throughout the deep network, as described in the main text.

Appendix G Analysis of Neural Dynamics in Nonlinear Orthogonal Networks

We can derive a simple, analytical recursion relation for the propagation of neural population variance qlq^{l}, defined in (21), across layers ll under the nonlinear dynamics (20). We have

due to the dynamics in (20) and the orthogonality of W(l+1,l)W^{(l+1,l)}. Now we know that by definition, the layer ll population xilx^{l}_{i} has normalized variance qlq^{l}. If we further assume that the distribution of activity across neurons in layer ll is well approximated by a Gaussian distribution, we can replace the sum over neurons ii with an integral over a zero mean unit variance Gaussian variable zz:

where Dz≡12πe−12z2 dz\mathcal{D}z\equiv\frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}z^{2}}\,dz is the standard Gaussian measure.

This map from input to output variance is numerically computed for g=1g=1 and ϕ(x)=tanh⁡(x)\phi(x)=\tanh(x) in Fig. 8, left (other values of gg yield a simple multiplicative scaling of this map). This recursion relation has a stable fixed point q∞(g)q^{\infty}(g) obtained by solving the nonlinear fixed point equation

Graphically, solving this equation corresponds to scaling the curve in Fig. 8 left by g2g^{2} and looking for intersections with the line of unity. For g<1g<1, the only solution is q∞=0q^{\infty}=0. For g>1g>1, this solution remains, but it is unstable under the recurrence (48). Instead, for g>1g>1, a new stable solution appears for some nonzero value of q∞q^{\infty}. The entire set of stable solutions as a function of gg is shown as the red curve in Fig. 8 right. It constitutes a theoretical prediction of the population variance at the deepest layers of a nonlinear network as the depth goes to infinity. It matches well for example, the empirical population variance obtained from numerical simulations of nonlinear networks of depth 3030 (blue points in Fig. 8 right).

Overall, these results indicate a dynamical phase transition in neural activity propagation through the nonlinear network as gg crosses the critical value gc=1g_{c}=1. When g>1g>1, activity propagates in a chaotic manner, and so g=1g=1 constitutes the edge of chaos.