Simple Algorithm
Deep Learning · Emergence · 30 min

Learning Dynamics of Deep Linear Networks

Exact solutions, stage-like learning and the implicit pull toward low rank.

Remove every nonlinearity from a deep network and the function it computes is just one matrix. Training it, though, is a genuinely nonlinear dynamical system, with plateaus, sudden drops, saddle points and a preference for simple solutions, and it can be solved exactly. Deep linear networks are deep learning's harmonic oscillator: the simplest model in which depth changes how a network learns, not what it can represent.

What you’ll learn

  • Derive the gradient-flow dynamics of a two-layer linear network with whitened inputs, decouple them into singular modes, and solve each mode's logistic equation (Saxe, McClelland & Ganguli, 2014).
  • Explain stage-like learning: why a mode's learning time scales like 1/s1/s, and why plateaus from small initialization lengthen exponentially with depth.
  • State what is proven about the landscape (every local minimum is global; saddles, some without negative curvature) and the end-to-end dynamics under balanced initialization.
  • Derive the singular-value dynamics of deep matrix factorization and explain the implicit bias toward low rank, including the evidence that no norm captures it.

A linear function, a nonconvex loss

A deep linear network computes f(x)=WL⋯W2W1x=Wexf(\mathbf x) = W_L\cdots W_2W_1\mathbf x = W_e\mathbf x, where WeW_e is the end-to-end matrix. It can represent only linear maps, exactly what one matrix can. But the loss is a function of the factors, and products make it nonconvex. The scalar case shows everything: fit y=s xy = s\,x with two weights, L(a,b)=12(s−ab)2L(a, b) = \tfrac12(s - ab)^2. The global minima form the hyperbola ab=sab = s, a continuum, because (a,b)→(ca,b/c)(a, b)\to(ca, b/c) changes nothing; and the origin is a critical point with Hessian (0−s−s0)\begin{pmatrix}0 & -s\\ -s & 0\end{pmatrix}, eigenvalues ±s\pm s: a saddle. With three factors, L=12(s−abc)2L = \tfrac12(s - abc)^2, the Hessian at the origin vanishes altogether.

So the obstacle is not bad minima but time: how long gradient descent lingers near saddles. The rest of the lesson computes it.

The exact solution for two layers

Take y^=W2W1x\hat{\mathbf y} = W_2W_1\mathbf x with loss 12E∥y−W2W1x∥2\tfrac12\E\norm{\mathbf y - W_2W_1\mathbf x}^2 and whitened inputs, E[xx⊤]=I\E[\mathbf x\mathbf x^\top] = I. Everything the data says is in the input–output correlation Σyx=E[yx⊤]\Sigma_{yx} = \E[\mathbf y\mathbf x^\top], with singular value decomposition Σyx=∑αsαuαvα⊤\Sigma_{yx} = \sum_\alpha s_\alpha\mathbf u_\alpha\mathbf v_\alpha^\top. Gradient flow with time constant τ=1/η\tau = 1/\eta reads τW˙1=W2⊤(Σyx−W2W1)\tau\dot W_1 = W_2^\top(\Sigma_{yx} - W_2W_1) and τW˙2=(Σyx−W2W1)W1⊤\tau\dot W_2 = (\Sigma_{yx} - W_2W_1)W_1^\top.

DerivationDecoupling into modes (Saxe, McClelland & Ganguli, 2014)
  1. τa˙=b (s−ab),τb˙=a (s−ab)\tau\dot a = b\,(s - ab),\qquad\tau\dot b = a\,(s - ab)

    Start from weights aligned with the data's singular vectors: W1=∑αaαrαvα⊤W_1 = \sum_\alpha a_\alpha\mathbf r_\alpha\mathbf v_\alpha^\top and W2=∑αbαuαrα⊤W_2 = \sum_\alpha b_\alpha\mathbf u_\alpha\mathbf r_\alpha^\top with orthonormal hidden directions rα\mathbf r_\alpha, so that W2W1=∑αaαbαuαvα⊤W_2W_1 = \sum_\alpha a_\alpha b_\alpha\mathbf u_\alpha\mathbf v_\alpha^\top. Substituting, the flow keeps this form and every mode evolves on its own:

  2. τu˙=a˙b+ab˙=(a2+b2)(s−u)⟹τu˙=2u (s−u)\tau\dot u = \dot ab + a\dot b = (a^2 + b^2)(s - u)\quad\Longrightarrow\quad\tau\dot u = 2u\,(s - u)

    The two layers are tied by a conservation law, ddt(a2−b2)=2τ(ab(s−ab)−ab(s−ab))=0\frac{d}{dt}(a^2 - b^2) = \frac2\tau\big(ab(s - ab) - ab(s - ab)\big) = 0, the scalar case of the matrix law ddt(W2⊤W2−W1W1⊤)=0\frac{d}{dt}(W_2^\top W_2 - W_1W_1^\top) = 0 (Du, Hu & Lee, 2018; see Symmetries & Conservation Laws). From a balanced start a=ba = b, the mode strength u=abu = ab obeys a logistic equation:

  3. u(t)=s e2st/τe2st/τ−1+s/u0,t(u0→uf)=τ2sln⁡uf (s−u0)u0 (s−uf)u(t) = \frac{s\,e^{2st/\tau}}{e^{2st/\tau} - 1 + s/u_0},\qquad t(u_0\to u_f) = \frac{\tau}{2s}\ln\frac{u_f\,(s - u_0)}{u_0\,(s - u_f)}

    Solve it: each mode follows a sigmoid in time, from its initial strength u0u_0 to the singular value ss, and the time to travel from u0u_0 to ufu_f is inversely proportional to ss:

Predict before you look

Two modes start at the same small strength u0=10−3u_0 = 10^{-3}, with singular values s=4s = 4 and s=1s = 1. How many times longer does the weaker mode take to reach half its final value? (Use t=τ2sln⁡s−u0u0t = \frac{\tau}{2s}\ln\frac{s - u_0}{u_0}.)

Show the answer

3.33

t(1)=12ln⁡999≈3.45 τt(1) = \tfrac12\ln999\approx3.45\,\tau and t(4)=18ln⁡3999≈1.04 τt(4) = \tfrac18\ln3999\approx1.04\,\tau: a ratio of about 3.33.3. The leading factor 1/s1/s gives 44; the logarithm, larger for the stronger mode, shaves it down. Strong correlations in the data are learned first.

Compare a single linear layer trained on the same data: τW˙=Σyx−W\tau\dot W = \Sigma_{yx} - W, so every mode relaxes exponentially, u(t)=s+(u0−s)e−t/τu(t) = s + (u_0 - s)e^{-t/\tau}, all at the same rate and with no plateau. The sigmoidal trajectories, the long plateaus followed by rapid transitions, and the ordering of modes by strength are produced by depth, by the product structure of the parameters, not by the data. Saxe, McClelland and Ganguli (2019) used exactly these dynamics as a model of stage-like semantic development, in which broad distinctions (strong modes) are learned before fine ones.

Depth, initialization and the length of plateaus

With DD weight matrices and the same balanced, aligned modes, each factor of a mode has the same strength aa and the mode strength is u=aDu = a^D. Gradient flow on each factor gives τa˙=aD−1(s−u)\tau\dot a = a^{D-1}(s - u), hence:

DerivationEscape time from small initialization
  1. τu˙=D aD−1⋅aD−1(s−u)=D u 2−2/D (s−u)\tau\dot u = D\,a^{D-1}\cdot a^{D-1}(s - u) = D\,u^{\,2 - 2/D}\,(s - u)

    Differentiate u=aDu = a^D:

  2. tescape≈τDs∫u0∞u−2+2/D du=τ u0−(1−2/D)s (D−2)t_{\text{escape}}\approx\frac{\tau}{Ds}\int_{u_0}^{\infty}u^{-2 + 2/D}\,du = \frac{\tau\,u_0^{-(1 - 2/D)}}{s\,(D - 2)}

    For D=2D = 2 this is the logistic equation again. For D≥3D\ge3 the growth rate near u=0u = 0 is u2−2/Du^{2 - 2/D}, superlinear: the origin is a degenerate saddle. While u≪su\ll s, separate variables and integrate from the initial strength u0u_0:

  3. tescape≈τ a0−(D−2)s (D−2)t_{\text{escape}}\approx\frac{\tau\,a_0^{-(D-2)}}{s\,(D - 2)}

    If each layer starts at strength a0<1a_0 < 1, then u0=a0Du_0 = a_0^D and u0−(1−2/D)=a0−(D−2)u_0^{-(1 - 2/D)} = a_0^{-(D - 2)}: the plateau grows exponentially with depth. With a0=12a_0 = \tfrac12, ten layers already wait eight times longer than six (28/82^8/8 against 24/42^4/4). Shamir (2019) proved that for one-dimensional deep linear networks under standard random initializations, the number of gradient-descent iterations needed to converge grows exponentially with depth.

  4. The cure is to start with modes of order one: a0≈1a_0\approx1, as with orthogonal weights at gain 11 or with pretraining. Then the plateau no longer grows with depth, which is Saxe et al.'s result that learning time can stay finite as depth goes to infinity under these initial conditions, but not under scaled random Gaussian ones.

DerivationProof for two factors
  1. W˙e=W˙2W1+W2W˙1=−G W1⊤W1−W2W2⊤G\dot W_e = \dot W_2W_1 + W_2\dot W_1 = -G\,W_1^\top W_1 - W_2W_2^\top G

    With G=∇L(We)G = \nabla\loss(W_e), the factors move by W˙1=−W2⊤G\dot W_1 = -W_2^\top G and W˙2=−GW1⊤\dot W_2 = -GW_1^\top, so by the product rule:

  2. W˙e=−(WeWe⊤)1/2G−G(We⊤We)1/2\dot W_e = -\big(W_eW_e^\top\big)^{1/2}G - G\big(W_e^\top W_e\big)^{1/2}

    Balancedness W2⊤W2=W1W1⊤W_2^\top W_2 = W_1W_1^\top lets each factor's Gram matrix be written through WeW_e: We⊤We=W1⊤(W2⊤W2)W1=(W1⊤W1)2W_e^\top W_e = W_1^\top(W_2^\top W_2)W_1 = (W_1^\top W_1)^2 and likewise WeWe⊤=(W2W2⊤)2W_eW_e^\top = (W_2W_2^\top)^2. Taking positive semidefinite square roots:

The pull toward low rank

Depth also changes which solution gradient descent finds. In matrix completion or matrix sensing, you observe a few linear measurements of an unknown low-rank matrix and fit We=WN⋯W1W_e = W_N\cdots W_1 with full-size factors, so infinitely many WeW_e fit the data exactly. Started from small initialization, gradient descent nevertheless tends to recover the low-rank truth: an implicit bias that no explicit penalty requested. Gunasekar et al. (2017) conjectured that for two factors and vanishing initialization the limit is the minimum-nuclear-norm solution, and proved it when the measurement matrices commute.

DerivationSingular values: the rich get richer (Arora, Cohen, Hu & Luo, 2019)
  1. σ˙r=−N (σr2)1−1/N ⟨∇L(We), urvr⊤⟩\dot\sigma_r = -N\,\big(\sigma_r^2\big)^{1 - 1/N}\,\big\langle\nabla\loss(W_e),\,\mathbf u_r\mathbf v_r^\top\big\rangle

    Write We=∑rσrurvr⊤W_e = \sum_r\sigma_r\mathbf u_r\mathbf v_r^\top. For distinct singular values, σ˙r=ur⊤W˙evr\dot\sigma_r = \mathbf u_r^\top\dot W_e\mathbf v_r. In the end-to-end dynamics, ur⊤(WeWe⊤)(j−1)/N=σr2(j−1)/Nur⊤\mathbf u_r^\top(W_eW_e^\top)^{(j-1)/N} = \sigma_r^{2(j-1)/N}\mathbf u_r^\top and (We⊤We)(N−j)/Nvr=σr2(N−j)/Nvr(W_e^\top W_e)^{(N-j)/N}\mathbf v_r = \sigma_r^{2(N-j)/N}\mathbf v_r, so all NN terms carry the same power:

  2. For N=1N = 1 the factor is 11: every singular value moves at a speed set only by the gradient. For N≥2N\ge2 the speed is multiplied by σr2−2/N\sigma_r^{2 - 2/N}: large singular values grow fast while small ones barely move, and the effect strengthens with depth (exponent 11 for N=2N = 2, 43\tfrac43 for N=3N = 3, approaching 22). From a small start this produces incremental, rank-by-rank learning, which Arora et al. found recovers low-rank matrices more accurately as depth increases, in ways a nuclear-norm explanation does not capture.

Is the bias a norm in disguise? Razin and Cohen (2020) constructed matrix completion problems in which gradient flow on a deep factorization drives every norm and quasi-norm of WeW_e toward infinity while its rank goes down, so no norm-minimization account can describe it; they proposed rank minimization as the better language. With small initialization, gradient descent appears to pass near a sequence of saddles of increasing rank before reaching a sparse, low-rank minimum: Jacot et al. (2021) conjectured this saddle-to-saddle picture for deep linear networks and proved its first transition.

Check your understanding

In a depth-3 matrix factorization, singular value σ1=1\sigma_1 = 1 and σ2=0.1\sigma_2 = 0.1 see gradient components of the same size. How do their growth rates compare?

  1. Equal, since the gradient components are equal
  2. σ2\sigma_2 grows 10 times faster, to catch up
  3. σ1\sigma_1 grows about 0.1−4/3≈210.1^{-4/3}\approx21 times faster
  4. σ1\sigma_1 grows exactly 10 times faster
Show the answer

C. σ1\sigma_1 grows about 0.1−4/3≈210.1^{-4/3}\approx21 times faster

The rate carries (σ2)1−1/N=σ4/3(\sigma^2)^{1 - 1/N} = \sigma^{4/3} for N=3N = 3, and (1/0.1)4/3≈21.5(1/0.1)^{4/3}\approx21.5. Depth turns a small head start into a large lead, the mechanism of the low-rank bias. With N=2N = 2 the ratio would be exactly 1010; with one factor, 11.

What a model with no nonlinearity teaches

Deep linear networks earn their place because their phenomena survive in nonlinear networks, where they cannot be solved exactly: loss curves with plateaus and sudden drops; features learned in order of their strength in the data; a dependence on initialization scale, with small initializations giving staged, low-complexity solutions and large ones giving near-kernel behavior (in Jacot et al.'s analysis, the large-initialization regime is the neural tangent kernel regime); conservation laws that tie layers together; and implicit biases that select among the many zero-loss solutions.

Key takeaways

  • A deep linear network represents only linear maps, but its loss is nonconvex in the factors: every local minimum is global, and the difficulty lies in saddles, some with no negative curvature.
  • With whitened inputs and aligned, balanced initialization, two-layer gradient flow decouples into singular modes obeying τu˙=2u(s−u)\tau\dot u = 2u(s - u): sigmoidal learning, plateaus and strong modes first, with transition time ∝1/s\propto1/s.
  • With DD factors, τu˙=Du2−2/D(s−u)\tau\dot u = Du^{2 - 2/D}(s - u): plateaus from a small start grow like a0−(D−2)a_0^{-(D-2)}, exponentially in depth, while starts of order one (orthogonal, pretrained) keep learning time finite.
  • Under balanced initialization the end-to-end matrix follows a depth-dependent preconditioned flow, and its singular values obey σ˙r=−N(σr2)1−1/N⟨∇L,urvr⊤⟩\dot\sigma_r = -N(\sigma_r^2)^{1-1/N}\langle\nabla\loss,\mathbf u_r\mathbf v_r^\top\rangle: the rich get richer, which biases deep factorizations toward low rank in a way no norm captures.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

A two-layer linear network is trained from a small, balanced, aligned initialization on whitened data. In what order does it learn the singular modes of Σyx\Sigma_{yx}?

  1. All at once, at the same rate
  2. Largest singular value first: each mode follows a sigmoid whose transition time scales like 1/s1/s
  3. Smallest singular value first, because small modes need smaller weights
  4. In random order, set by the initialization
Show the answer

B. Largest singular value first: each mode follows a sigmoid whose transition time scales like 1/s1/s

Each mode obeys τu˙=2u(s−u)\tau\dot u = 2u(s - u), with transition time τ2sln⁡s−u0u0\frac{\tau}{2s}\ln\frac{s - u_0}{u_0}. Strong input–output correlations are picked up first, weak ones after long plateaus.

Question 2

What is proven about the critical points of a deep linear network with squared loss (Kawaguchi, 2016)?

  1. The loss is convex, so there are no saddles
  2. There are poor local minima, but they are rare
  3. Every local minimum is global, every other critical point is a saddle, and with more than one hidden layer some saddles have no direction of negative curvature
  4. Every critical point is a global minimum
Show the answer

C. Every local minimum is global, every other critical point is a saddle, and with more than one hidden layer some saddles have no direction of negative curvature

No spurious minima, but degenerate saddles, such as the origin of 12(s−abc)2\tfrac12(s - abc)^2 where the Hessian vanishes, make escape slow and invisible to second-order tests.

Question 3

A deep linear network is initialized with every factor of a mode at strength a0=0.5a_0 = 0.5. How does the plateau before that mode is learned scale with the number of factors D≥3D\ge3?

  1. It shrinks, since more layers mean more parameters moving at once
  2. It is independent of depth
  3. It grows linearly in DD
  4. It grows roughly like a0−(D−2)=2D−2a_0^{-(D-2)} = 2^{D-2}, exponentially in depth
Show the answer

D. It grows roughly like a0−(D−2)=2D−2a_0^{-(D-2)} = 2^{D-2}, exponentially in depth

The mode obeys τu˙=Du2−2/D(s−u)\tau\dot u = Du^{2 - 2/D}(s - u) with u0=a0Du_0 = a_0^D, which gives an escape time of about τa0−(D−2)/(s(D−2))\tau a_0^{-(D-2)}/(s(D - 2)). Starting the factors near strength 11 (orthogonal weights, pretraining) removes the exponential.

Question 4

What did Razin and Cohen (2020) show about the implicit regularization of deep matrix factorization?

  1. It always finds the minimum nuclear norm solution
  2. There are matrix completion problems where gradient flow drives every norm toward infinity while the rank decreases, so no norm explains the bias
  3. It has no bias: the solution depends only on the initialization's random seed
  4. It minimizes the Frobenius norm, like gradient descent on a linear model
Show the answer

B. There are matrix completion problems where gradient flow drives every norm toward infinity while the rank decreases, so no norm explains the bias

Their constructions rule out any norm (or quasi-norm) minimization account, and they proposed rank minimization as the better description, consistent with the rich-get-richer singular-value dynamics.

Further reading

  • A. M. Saxe, J. L. McClelland & S. Ganguli, "Exact solutions to the nonlinear dynamics of learning in deep linear neural networks," ICLR (2014).
  • K. Kawaguchi, "Deep learning without poor local minima," NeurIPS (2016).
  • S. Arora, N. Cohen & E. Hazan, "On the optimization of deep networks: Implicit acceleration by overparameterization," ICML (2018).
  • S. Arora, N. Cohen, W. Hu & Y. Luo, "Implicit regularization in deep matrix factorization," NeurIPS (2019).
  • N. Razin & N. Cohen, "Implicit regularization in deep learning may not be explainable by norms," NeurIPS (2020).