Iliad

Training Dynamics

Cluster BB.4 · Training Dynamics

Exact learning dynamics of deep linear networks -- loss-landscape geometry, balanced gradient flow and the NTK, the rich (saddle-to-saddle) and lazy regimes, their mixed unification, and the implicit bias of SGD noise.

By Guillaume Corlouer (Stormglass)

The Dumbest Neural Network Worth StudyingWatch on YouTube ↗
Uncovering The Hidden Biases of Deep LearningWatch on YouTube ↗
What you’ll learn

Motivation

  • Know about some big open questions in learning dynamics
  • Understand the concept of implicit regularization
  • Know about the different approaches to studying learning dynamics
  • Understand the AI safety motivations for learning dynamics
  • Know about emergent misalignment as a safety-relevant phenomenon that illustrates the importance of understanding generalization for AI safety

Geometry and dynamics of deep neural networks

  • Know key results about the loss landscape of deep linear networks (DLNs): critical points are saddles or global minima
  • Explain the edge of stability phenomenon
  • Understand that gradient flow can be written as NTK-weighted gradient in function space
  • DLNs are degenerate and have conserved quantities through gradient flow

Regimes of learning in deep linear networks

  • Understand the role of initialization, width and depth for the lazy and rich (saddle to saddle) regimes in DLNs
  • Know about implicit regularization from non-linearity (neural race reduction)

Use LLMs to help you out when you spend longer than the suggested time (but make sure that you understand). Make sure you keep at least 30 minutes to do problem 3.

References: (Saxe et al. 2014), (Achour et al. 2024), (Tu et al. 2024).

1. Setup and notation

We study deep linear networks (DLNs) with weight matrices . The network computes:

where is the end-to-end (or "student") matrix. We train on a dataset with the squared loss:

In the population limit with whitened inputs , this becomes, up to an additive constant1:

where is the "teacher" matrix (the OLS solution) with SVD , and .

2. Loss landscape geometry

This problem explores the critical point structure of deep linear networks, following (Achour et al. 2024).

Exercise 2.1 (Diagonal decomposition). Consider the diagonal case: , and the teacher is diagonal, , with . Restrict attention to diagonal weight matrices . Show that the loss decomposes into independent scalar problems:

Solution

When all are diagonal, the product is also diagonal with entries . The teacher is diagonal with entries . Then:

Since the different modes share no parameters, the loss decomposes into independent scalar problems.

Exercise 2.2 (Scalar critical points). For a single scalar mode with target , find all first-order critical points of at depth . Show that the critical points are:

  • The global minimum manifold:
  • The origin:

Classify the origin as a saddle point by computing the Hessian of at and showing it has both positive and negative eigenvalues.

Hint: Write the gradient equations.

Solution

For , the gradient equations are:

Case 1: , i.e. . This is the global minimum manifold (a hyperbola ) with .

Case 2: If , then the first equation requires and the second requires . (For instance, if and , the first equation gives , which contradicts and .) So the only other critical point is .

The Hessian at . We need the second derivatives of :

At :

The eigenvalues are . Since , has one positive and one negative eigenvalue. The origin is a strict saddle point.

Exercise 2.3 (Critical-point structure). Achour et al. (Achour et al. 2024) show that every first-order critical point satisfies: there exists a subset such that

where is the orthogonal projector onto the span of the left singular vectors of . For the diagonal case , write the value of the loss at the critical point corresponding to with .

Solution

At the critical point with , the student retains only the first modes: . The loss is:

This is strictly positive whenever (since all ), so these are not global minima. By the Hessian analysis (extending Exercise 2.2), the direction corresponding to "switching on" a missing mode is a descent direction, making these critical points saddle points. All critical points with have and : these are the global minima. Therefore there are no spurious local minima — every local minimum is global.

Exercise 2.4 (Symmetry of the global minima). The group acts on the weights by:

Verify that the student map is invariant under this action: .

Solution

Under the group action:

All and factors cancel telescopically. This means every parameter point in the orbit maps to the same student .

For the dimension of the set of global minima, this invariance means the following. The global minima form the fiber , which contains the entire orbit for any global minimizer . The orbit has dimension (the dimension of ), so the set of global minima is a continuous manifold of very high dimension — far from being isolated points.

3. Gradient flow and conserved quantities

We now study gradient flow: , the continuous-time limit of gradient descent with infinitesimal learning rate.

Exercise 3.1 (Gradient-flow equations). For a two-layer DLN (), the loss is given by . Assume that each weight matrix is diagonal. Derive the gradient flow equations for each layer. In particular, show that:

Note: these equations also hold for general (non-diagonal) and .

Solution

We have .

General matrix derivation. Expand:

Differentiating with respect to , using and :

So .

Similarly, , giving .

Diagonal shortcut. For diagonal matrices , , : the loss decouples as . Then and , which is the diagonal version of the matrix equations above.

Exercise 3.2 (Balancedness is conserved). Define the balancedness matrix:

Show that is conserved under the gradient flow, i.e. . In other words, gradient flow is constrained to the balanced manifold

Hint: Compute , substitute the gradient flow equations and verify that the terms cancel pairwise.

Solution

Let denote the residual. Compute:

Substitute the gradient flow equations. Using and :

Therefore:

The terms cancel pairwise. is conserved.

From now on, assume balanced initialization: , which by Exercise 3.2 means for all time. We want to derive the gradient flow in function space (the ODE for the student ). This requires several steps.

Exercise 3.3 (Function-space velocity). Compute using the gradient flow equations from Exercise 3.1. Show that:

Solution

Apply the product rule:

Writing :

Exercise 3.4 ( in terms of ). We now need to express and in terms of . Show that:

Solution

Balancedness gives , so

Both and are positive semidefinite. A positive semidefinite matrix has a unique positive semidefinite square root, so it follows that

Exercise 3.5 ( in terms of ). Similarly, show that .

Solution

Analogous to Exercise 3.4.

Exercise 3.6 (The balanced function-space ODE). Substitute the results of Exercise 3.4 and 3.5 into Exercise 3.3 to obtain:

Solution

Substituting into Exercise 3.3:

Exercise 3.7 (The NTK operator). Define the NTK operator for as:

Show that the gradient flow from Exercise 3.6 can be written as .

It turns out that this result generalizes to depth on the balanced manifold:

This is the NTK equation in the case of DLNs. The NTK equation is a gradient flow in function space with NTK being a preconditioning operator for the gradient.

Solution

With , the equation from Exercise 3.6 reads:

The general depth- result follows from the same approach applied to the -fold balanced conditions for all .

4. Rich regime: saddle-to-saddle

This is the core problem. We derive the exact solution of the rich regime dynamics directly from the self-consistent equation of Section 3, emphasizing the NTK perspective.

Alignment assumption. Start from the balanced gradient flow equation derived in Exercise 3.6:

We work in the rich regime (small initialization) with balanced weights. Assume that the student is aligned to the teacher: the singular vectors of coincide with those of at all times. Concretely, write:

where are the left/right singular vectors of , and are the evolving singular values of .

Exercise 4.1 (Aligned NTK). Under this alignment assumption, show that the NTK operator is aligned to the task, i.e.  preserves the SVD basis. In particular, show that:

and that the residual is .

Hint: Recall that for , we have , and therefore .

Solution

Under the alignment assumption, . Then:

Since , the positive matrix square root is:

Similarly:

The residual is immediate:

The NTK operator acts on any matrix as:

So stays in the SVD basis of — the NTK is aligned to the task.

Exercise 4.2 (Decoupled scalar ODEs). Substitute into the self-consistent equation. Show that the matrix equation decouples into independent scalar ODEs:

Hint: Compute the product in the SVD basis. It is diagonal with entries . The second term contributes identically, giving the factor of 2.

Solution

Substitute into :

First term:

Second term:

Summing:

Since and the singular vectors are constant by assumption, we read off:

The NTK perspective makes the structure transparent: the factor is the NTK eigenvalue for mode , which amplifies learning in directions that are already strong, while is the residual.

Exercise 4.3 (Timescale of learning). The ODE is a logistic equation whose solution is:

where . Compute the time it takes for mode to travel from initial strength to a final strength . Show that:

Deduce that modes with larger singular values are learned faster. This is a separation of timescales: the network learns features in decreasing order of their singular value strength.

Solution

From the logistic solution , we invert to find as a function of . The derivation is equivalent to integrating by separation of variables:

Using partial fractions :

Therefore:

For a fixed ratio and fixed , the learning time scales as : modes with larger singular values are learned faster. The network learns features in decreasing order of their strength — a strong separation of timescales.

Contrast with the lazy regime (anticipating Section 5): in the lazy regime the NTK is frozen at , so . All modes converge at the same exponential rate , independent of . The rich regime has state-dependent NTK (), creating a positive feedback loop — modes that are already large learn even faster — which amplifies the differences between into a hierarchy of timescales .

Exercise 4.4 (Incremental learning). Consider a teacher with nonzero singular values and a small uniform initialization for all . Qualitatively, discuss:

  • What is the approximate distribution of singular values of at early times?
  • How do the singular values of evolve throughout training?
  • What happens in the limit ?

What does this analysis tell us about the sequence of critical points visited by the gradient flow?

Solution

With uniform initialization for all , the sigmoid solution shows that mode remains near until time , then transitions rapidly to .

Early times (): Only mode 1 has grown significantly, so the spectrum is one singular value near , with all the others still near . The student is approximately , effectively rank 1.

Intermediate times: As increases, switches on, then , etc. The singular values switch on one at a time, in decreasing order of , each staying near and then rising to over a narrow window. The student is approximately where increases stepwise, so the effective rank increases incrementally.

Long times (): All modes converge, , and .

This is an implicit bias toward low-rank (simple) solutions: at any finite time, the network represents the best rank- approximation to the teacher. The gradient flow effectively performs a greedy SVD.

Connection to the saddle structure (Exercise 2.3): The saddle points with are exactly the best rank- approximations to , with loss . The gradient flow trajectory passes near these saddles as it incrementally recruits modes. The plateaus in the loss curve correspond to time spent near saddle points (only modes active), and the sharp transitions correspond to escaping along the unstable direction that activates the next mode.

5. Lazy regime

We now show that large initialization freezes the NTK and eliminates the timescale separation found in Section 4. For clarity, we work with the diagonal scalar model from Exercise 2.1, so each mode is independent. This avoids matrix algebra and isolates the essential mechanism.

Setup. Consider a single mode: a depth-2 diagonal DLN with scalar weights learning a target . From Section 3 and 4, the balanced gradient flow for is:

The factor is the (scalar) NTK — it is state-dependent: the effective learning rate depends on the current value of .

Exercise 5.1 (Linearizing the NTK). Now initialize at a large value . Assume that in the early phase of training, while has not changed much from , the ODE becomes approximately:

Solution

Starting from the same ODE , with , the weight needs to decrease from to . As long as has not changed much from , we can write with , so:

The ODE becomes:

This is a linear ODE — the NTK factor has been frozen at its initial value . Note that only the NTK prefactor is linearized; the residual is kept exact since it drives learning.

Exercise 5.2 (Frozen-NTK solution). Solve the linearized ODE from Exercise 5.1. Show that:

What is the learning timescale?

Solution

The linearized ODE is first-order linear. Set , then , with solution . Therefore:

This is exponential convergence to (contrast with the sigmoid of Section 4). The learning timescale is:

It depends on the initialization scale but not on the target . This is the defining feature of the lazy regime: the learning speed is set by the NTK at initialization, not by the structure of the task.

Self-consistency: During the learning phase (), the displacement is (since ). The relative change in the NTK is , so the NTK does change significantly in absolute terms. However, the key point is that the dynamics remain well approximated by the linear ODE because the convergence rate is dominated by , which is large and approximately constant throughout training. In the rich regime, by contrast, the NTK changes from to — a change of order relative to the initial value — making the linearization completely invalid.

Exercise 5.3 (No timescale separation). Now restore the mode index . In the lazy regime, each mode satisfies with the same rate for all . Compare the lazy learning time with the rich-regime timescale from Exercise 4.3: .

Solution

Restoring the mode index, each mode satisfies with solution:

All modes converge at the same exponential rate , regardless of . The time for mode to go from to within of is:

which is independent of . All modes reach their targets simultaneously.

Contrast with the rich regime:

Rich regimeLazy regime
NTKState-dependent: Frozen:
Learning time for mode
Timescale separationStrong: None
Intermediate solutionsLow-rank (incremental)Full-rank from the start
Implicit rank biasYes (low-rank → high-rank)No

In the lazy regime, all components of are learned simultaneously: signal and noise alike. The network converges directly to the full OLS solution without passing through low-rank intermediates. There is no mechanism to separate signal from noise based on singular value structure. With early stopping, the rich regime recovers a low-rank signal while ignoring noise; the lazy regime cannot.

6. Mixed dynamics: unifying lazy and rich

In practice, networks are neither purely lazy nor purely rich. Tu, Aranguri & Jacot (2024) provide a unified description. We develop the key ideas using the diagonal scalar model.

Exercise 6.1 (The interpolating ODE). In Section 4 and 5, we studied the same ODE in two limits: small (rich) and large (lazy). A more general model for a depth-2 DLN with balanced initialization at scale and width replaces the scalar NTK by:

where is a threshold parameter that depends on the initialization scale and width.

Verify that this ODE reproduces the two known regimes:

  • Rich limit (): recover .
  • Lazy limit ( with bounded): recover .
Solution

The interpolating ODE is .

Rich limit (): The square root reduces to , giving:

For this is , exactly the logistic ODE from Exercise 4.2.

Lazy limit (, bounded): The square root is dominated by : , giving:

This is a linear ODE with rate , independent of — the frozen-NTK regime of Section 5 (with playing the role of ).

Exercise 6.2 (Two-phase dynamics). At initialization, all modes start at (since ). Observe that:

  • When , the effective learning rate is , the same for all modes (lazy behavior).
  • When , the effective learning rate is , which is mode-dependent (rich behavior).

Describe the resulting two-phase dynamics in words: what happens first, and what happens later?

Solution

At initialization, (since ). So initially all modes satisfy .

Early phase (lazy): for all . Every mode evolves at the same linear rate :

(assuming ). The dynamics are approximately linear and the NTK is approximately constant. During this phase, the network aligns with the task: each grows toward at the same rate. There is no timescale separation.

Late phase (rich): Once some grow past , the square root transitions to , and those modes enter the rich regime with the sigmoidal, self-accelerating dynamics . The state-dependent NTK creates timescale separation, and the modes that have crossed the threshold converge rapidly to their targets.

In summary: the network starts in a lazy phase where all modes grow uniformly (alignment), then transitions to a rich phase where modes accelerate individually (incremental learning).

Exercise 6.3 (Mode-by-mode transition). Not all modes cross the threshold at the same time: which modes cross it first? Explain why this means that a single network can simultaneously have some modes in the rich regime and others still in the lazy regime.

Solution

In the lazy phase, each mode grows as . At any given time, : modes with larger are larger. Since the lazy-to-rich transition occurs when , the time for mode to cross the threshold satisfies:

For , this crossing time exists and is smaller for larger . For , the mode never reaches the threshold and remains permanently lazy.

This means that different modes can be in different regimes simultaneously: large- modes have crossed into the rich regime and are converging rapidly, while small- modes are still in the lazy phase (or may never leave it). The network interpolates between the two regimes mode by mode.

Connection to grokking: This lazy-to-rich transition provides a mechanism for grokking. During the lazy phase, the network fits the training data via kernel regression with the initial (misaligned) NTK — it memorizes. The test loss plateaus because the frozen kernel cannot capture the task structure. Later, as modes cross the threshold into the rich regime, feature learning kicks in: the NTK rotates to align with the task, and the test loss drops — generalization is achieved. The grokking delay is controlled by the time it takes the relevant modes to cross . Increasing the initialization scale or the width increases , which extends the lazy phase and widens the grokking gap. This is the same mechanism identified by Kumar et al., Grokking as the Transition from Lazy to Rich Training Dynamics (arXiv:2310.06110).

7. Stochastic implicit bias (bonus)

SGD introduces noise from mini-batching. A continuous model is the Langevin SDE:

where is the covariance of the stochastic gradient noise and is the learning rate.

Exercise 7.1 (Boltzmann equilibrium). The probability density of the parameters evolves according to the Fokker–Planck equation:

where is the probability current. Assume: (i) stationarity , (ii) thermal equilibrium , and (iii) isotropic noise . Show that the equilibrium distribution is the Boltzmann distribution:

Hint: Setting with gives . This is a first-order ODE for in terms of . Try the ansatz and solve for .

Solution

Setting (thermal equilibrium) with isotropic noise :

Rearranging:

The left-hand side is , so:

Integrating both sides:

This is the Boltzmann distribution with inverse temperature .

Exercise 7.2 (Temperature and flatness). The ratio plays the role of an inverse temperature . Interpret what happens to the equilibrium distribution when:

  • is very small (low temperature)
  • is very large (high temperature)

Which regime favors flatter minima, and why might this be beneficial for generalization?

Solution

The effective temperature is .

Small (low temperature, ): The distribution concentrates sharply on the global minima of . SGD converges to the lowest-loss minimizer without exploring.

Large (high temperature, ): The distribution becomes nearly uniform over parameter space. SGD explores broadly and does not settle into any particular minimum.

Flat vs. sharp minima: At moderate temperature, the Boltzmann distribution assigns more probability mass to broad basins (flat minima) than to narrow ones. This is because a flat minimum occupies a larger volume of parameter space at any given loss level — the width of the basin acts as an entropic contribution. Flat minima tend to generalize better because small perturbations to the parameters (or slight distribution shift in the data) do not dramatically change the loss. Thus the implicit bias of SGD noise toward flat minima is beneficial for generalization.

Exercise 7.3 (Anisotropic noise). In practice, SGD noise is not isotropic: depends on both the loss landscape and the data. Without solving anything, explain qualitatively why anisotropic noise can introduce an implicit bias that goes beyond what the loss function alone would select. Specifically, why might SGD preferentially escape sharp directions of the loss while remaining stable along flat directions?

Solution

When is anisotropic, the noise strength varies by direction. The Fokker-Planck current becomes:

The second term introduces an Itô drift that depends on the spatial variation of the noise covariance. In directions where has large eigenvalues (high noise), the effective diffusion is strong and the system escapes easily from sharp regions of the loss landscape. In directions where has small eigenvalues (low noise), the system is more stable and tends to remain there.

This creates a direction-dependent regularizer: SGD preferentially pushes parameters out of sharp directions (high gradient variance → large noise eigenvalue → fast escape) while preserving parameters along flat directions (low gradient variance → small noise eigenvalue → stability). This goes beyond what the Boltzmann distribution on alone would predict. In general, detailed balance may not hold for anisotropic, state-dependent noise, leading to persistent probability currents and non-equilibrium steady states that further modify the implicit bias.

Learn more

The readings are roughly ordered in a way that makes sense for learning. Discuss the readings in groups of 2 or 3, to be formed in this Google doc. Spend 30 minutes reading, 30 minutes discussing and 30 minutes to write down your thoughts in the Google doc.

Key readings

Loss landscape geometry

Implicit biases of gradient flow

Learning rate (discrete GD)

Stochasticity

Emergence: empirical examples

Theoretical approaches to emergence

References

Achour, Malgouyres, and Gerchinovitz (2024). The loss landscape of deep linear neural networks: a second-order analysis. Journal of Machine Learning Research (JMLR).

Saxe, McClelland, and Ganguli (2014). Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. International Conference on Learning Representations (ICLR).

Footnotes

  1. The constant is , which is the residual of the OLS. It vanishes on realizable data.