How the Hessian-Spectrum of Neural Networks Depends on Data


Abstract

The Hessian matrix is an important quantity of interest when it comes to studying the loss landscape and optimization dynamics in deep learning, as well as designing measures of generalization, second-order learning algorithms, etc. Prior works have focused on empirical results or pursued a theoretical treatment under overly simplified settings. In this work, we derive the eigenvalues of the Hessian of linear networks with arbitrary widths and depths, and datasets with an arbitrary number of samples, features, and labels. Importantly, for classification tasks with MSE loss, we identify that the sharpness of the solution is directly related to the maximum proportion of samples belonging to any class. We empirically validate our predictions and systematically analyze the effects of shedding the impractical assumptions one at a time, as well as incorporating nonlinearities. We observe that our predictions are considerably robust in most cases, allowing us to extend our conclusions to more practical learning setups.

1 Introduction↩︎

Neural networks induce highly nonconvex loss landscapes that are complicated to study. Despite this complexity, the Hessian matrix of the loss, encoding only its second-order information, has played a central role in designing efficient optimization algorithms [1], [2], deriving measures of generalization [3], [4] – which, in turn, inspired the design of well-generalizing optimizers [5], [6] – as well as practical algorithms for pruning [7], [8], quantization [9], continual learning [10], [11], etc.

Our motivation resembles that of [12], [13], in that we aim to precisely characterize the full spectrum of the Hessian. However, while these works prioritize minimal assumptions at the cost of model complexity, we leverage standard assumptions in deep learning theory in exchange for networks with arbitrary widths and depths, and datasets with arbitrary number of samples, features and labels. Our methodology falls closest to [14], which studies the spectrum of the Hessian and training dynamics at the edge-of-stability (EoS) [15] for matrix factorization problems. In contrast, we consider the problem of supervised learning, with the overarching goal of understanding the influence of data-geometry on the sharpness of the learnt solution.

2 Setup↩︎

Consider the inputs \(\mathbf{x}_1, \ldots, \mathbf{x}_n \in \mathbb{R}^{1\times d_0}\) collected in \(\mathbf{X}\in \mathbb{R}^{n\times d_0}\), and outputs \(\mathbf{y}_1, \ldots, \mathbf{y}_n \in \mathbb{R}^{1\times d_L}\) collected in \(\mathbf{Y}\in \mathbb{R}^{n\times d_L}\). Our model is an \(L\)-layer linear neural network, defined as

(; _1,_2,…,_L) &= _1^_2^…_L^

with \(\mathbf{W}_{\ell} \in \mathbb{R}^{d_{\ell} \times d_{\ell-1}}\) is the learnable weight matrix in the \(\ell^{\textsuperscript{th}}\) layer, \(\forall \ell \in \left[L\right] \mathrel{\vcenter{:}}= \{1, 2, \ldots, L\}\).1 In what follows, we denote the model parameters by \(\mathbf{W}_{1:L} \mathrel{\vcenter{:}}= \left(\mathbf{W}_1, \mathbf{W}_2, \ldots, \mathbf{W}_L\right)\). The loss function is the Mean-Squared Error (MSE):

(_1:L; ,) ̍(; _1:L) - ̍_F^2

where \(\left\|\cdot\right\|_F\) denotes the Frobenius norm of the argument.

2.1 Approximating the Hessian-spectrum↩︎

We use the generalized Gauss-Newton (GGN) approximation of the Hessian, which gets more and more precise as loss reduces with training:

(_1:L; ,) ()^() = ^^pp

with the total number of parameters given by \(p = \sum_{\ell=1}^L d_{\ell} d_{\ell-1}\), and the Jacobian w.r.t.predictions given by \(\mathbf{J}\mathrel{\vcenter{:}}= \partial \mathbf{f}\left(\mathbf{X}\right) / \partial \mathbf{W}_{1:L} = \begin{bmatrix} \mathbf{J}_1 & \mathbf{J}_2 & \ldots & \mathbf{J}_{L} \end{bmatrix} \in \mathbb{R}^{d_Ln\times p}\), where

_ &= (__ ^d_d_L)^ (__ ^d_0d_)

where \(\otimes\) is the Kronecker outer-product. The GGN matrix shares its non-zero eigenvalues with the Neural Tangent Kernel (NTK) matrix [17], which is simpler to study:

^ &= _^L (_^_) ( _ _^^) ^d_Lnd_Ln

Going forward, we will make use of the Singular Value Decomposition (SVD) of the feature matrix, \(\mathbf{X}= \mathbf{U}_{\mathbf{X}}\mathbf{\Sigma}\mathbf{V}_{\mathbf{X}}^\intercal\), where \(\mathbf{U}_{\mathbf{X}}\in\mathbb{R}^{n\times r}\) is a semi-orthogonal matrix, \(\mathbf{\Sigma}\in\mathbb{R}^{r\times r}\) is a diagonal matrix with \(\mathbf{\Sigma}_{11} \geq \mathbf{\Sigma}_{22} \geq \ldots \geq \mathbf{\Sigma}_{rr} > 0\), and \(\mathbf{V}_{\mathbf{X}}\in\mathbb{R}^{r\times r}\) is an orthogonal matrix; \(r\) is the rank of \(\mathbf{X}\).

Assumption 1. We have an overdetermined system, i.e.\(n\geq d_0\), the feature matrix is full-rank, i.e.\(r = d_0\), and the features are isotropic, i.e.\(\mathbf{\Sigma}= \mathbf{\Sigma}_{11}\mathbf{I}_{d_0}\).

This is a rather strong assumption, and not realistic in practice, but it helps draw insights from the bounds we derive on the eigenvalues of the NTK.

2.2 Shallow Networks↩︎

Theorem 1. The non-zero eigenvalues of shallow linear networks (\(L=2\)) are characterized by the pairwise-sums of squared singular values of the two layers:

_ij(^) & (_i^2(_1) + _j^2(_2))

where \(i\in\left[\min\left\{d_0,d_1\right\}\right]\) and \(j\in\left[\min\left\{d_1,d_2\right\}\right]\), and \(\sigma_i\left(\mathbf{W}\right)\) denotes the \(i\textsuperscript{th}\) largest singular value of \(\mathbf{W}\). Furthermore, the bound is attained under 1.

a

b

c

Figure 1: Percentage error in approximating top-10 eigenvalues of the Hessian (using 1) for a 2-layer MLP on (a) MNIST, (b) FashionMNIST, and (c) CIFAR10..

We visualize the case of isotropic features in 1, where we note that the approximation becomes increasingly precise as training progresses. 1 implies that, of the \(d_0d_1+d_1d_2\) eigenvalues of the Hessian, at most \(\min\left\{d_0,d_1\right\} \times \min\left\{d_1,d_2\right\}\) may be non-zero; we comment on this at the end of 3.

a

b

c

Figure 2: Top eigenvalue of the Hessian, along with the predictions in 1 and [13], for a 2-layer MLP on (a) MNIST, (b) FashionMNIST, and (c) CIFAR10..

Consider the case where \(\mathbf{\Sigma}= \sqrt{n} \mathbf{I}_{d_0}\). The spectral norm (largest eigenvalue for symmetric matrices) of the NTK is given by \(\lambda_{\max}\left(\frac{1}{n}\mathbf{J}\mathbf{J}^\intercal\right) = \left\|\mathbf{W}_1\right\|_2^2 + \left\|\mathbf{W}_2\right\|_2^2\). This contradicts the conclusion drawn in [13], suggesting that the maximum eigenvalue is given by \(\max\left\{\left\|\mathbf{W}_1\right\|_2^2, \left\|\mathbf{W}_2\right\|_2^2\right\}\); we believe that the discrepancy is caused by the block-diagonal structure of the Hessian assumed in their analysis. This distinction is visualized in 2, where the sum of squared spectral-norms gets increasingly good at approximating the sharpness of the Hessian, as training progresses.

a

b

Figure 3: Sum of eigenvalues of the Hessian, computed numerically (Hutchinson’s method [18]), and squared parameter-norm of (a) a 2-layer MLP and (b) a 4-layer MLP trained on CIFAR10..

As for the sum of eigenvalues, \(\text{Tr}\left(\frac{1}{n}\mathbf{J}\mathbf{J}^\intercal\right) = d_2 \left\|\mathbf{W}_1\right\|_F^2 + d_0 \left\|\mathbf{W}_2\right\|_F^2\). This relation provides insight into the progressive flattening and subsequent sharpening observed in early- and intermediate-training [19], [20], respectively, before training reaches EoS [15], [21], [22] – sharpness decreases since the parameter norm decreases in early-training, as the model output evolves to align with the labels, and both start increasing after a point [23]. In 3, we demonstrate this relation for a shallow network as well as for a deep network, showing a high amount of agreement in the dynamics of \(\text{Tr}\left(\frac{1}{n}\mathbf{J}\mathbf{J}^\intercal\right)\) and the squared parameter-norm.

3 Strongly Balanced Deep Networks↩︎

In this section, we derive analogous results to 1 but for networks of arbitrary depth, while relying on an additional assumption on the balance between layers.

Assumption 2. Assume that consecutive layers are strongly balanced, i.e.\(\mathbf{W}_{\ell} \mathbf{W}_{\ell}^\intercal= \mathbf{W}_{\ell+1}^\intercal\mathbf{W}_{\ell+1}\), \(\forall \ell \in \left[L-1\right]\).

In essence, this implies that the left singular vectors of a layer are aligned with the right singular vectors of the next layer. Moreover, all layers share their non-zero singular values; we denote them by \(\sigma_i\left(\mathbf{W}\right)\). While arbitrary points in the parameter space need not correspond to balanced layers, initially balanced layers remain balanced under gradient flow training, provided their is no nonlinearity between them [24], [25]. Even if initially unbalanced, [23] showed that the layers become increasingly balanced under weight-decay training, while [14] showed that gradient descent training at EoS [15] balances the singular values of the weight matrices.Therefore, the results hereon can be seen as characterizing the local geometry of the minimizers.

Theorem 2. Under 2, the non-zero eigenvalues of the NTK are given by

_ij(^) &

&, _i() _j()
L ^2(L-1)() &, () _i() = _j()

with equality under 1.

a

b

c

Figure 4: Top-10 eigenvalues of the Hessian and the predicted values (in black, using 2) for a 4-layer MLP on (a) MNIST, (b) FashionMNIST, and (c) CIFAR10..

Hence, of the \(p \mathrel{\vcenter{:}}= \sum_{\ell=1}^L d_{\ell}d_{\ell-1}\) eigenvalues of the Hessian, at most \(\left(\min\left\{d_0,d_1,\ldots,d_L\right\}\right)^2\) are non-zero. This corresponds to the empirical observations suggesting that the bulk of eigenvalues of the Hessian are near-zero [26][28]. We visualize the case of isotropic features in 4, where we note that the approximation becomes increasingly precise as training progresses.

Corollary 1. Under 2, the spectral norm of the NTK can be bounded as

̍̍_2^2 ̍̍_2^2(L-1) _(^) ̍̍_2^2 ̍̍_2^2(L-1)

a

b

c

Figure 5: Sharpness of the NTK of the ordinary-least squares (OLS) solution, using (a) original datasets and (b) whitened features, along with corresponding lower and upper bounds (1). In (c), we redefine the feature matrix by sampling singular values from a Gaussian distribution with different scales..

We distinguish two cases: 1. when the features are highly anisotropic (typical case for real-world datasets), and 2. when the features are isotropic (more idealistic). We observe that in the former case, the lower bound is tight, while in the latter case the upper bound is tight; see 5. This suggests that the true sharpness floats between the two bounds as the degree of isotropy in the features changes.

4 Dependence on Data↩︎

Theorem 3. Say the network implements the ordinary least-squares (OLS) solution, i.e.\(\mathbf{W}_{1}^\intercal\mathbf{W}_{2}^\intercal\ldots \mathbf{W}_{L}^\intercal= \mathbf{X}^{\dagger}\mathbf{Y}\), where \(\cdot^{\dagger}\) denotes the Moore-Penrose inverse. Under 1 2,

_i() = _11^-1/L _i^1/L(_^)

In particular, the spectral norm is given by

_(^) = L ()^1/L ()^1-1/L L ()^1/L ()^1-1/L

This bound is attained when \(\mathcal{L}\left(\mathbf{W}_{1:L};\mathbf{X},\mathbf{Y}\right) = 0\).

We visualize this correspondence in the left panel in 6, where we note that the theory predicts the non-zero eigenvalues exactly. Dependence on dataset size. Assuming the entries of \(\mathbf{X}\) and \(\mathbf{Y}\) are constant in the datasets size, i.e.\(\mathbf{X}_{ij}, \mathbf{Y}_{ij} = \mathbf{\Theta}_n\left(1\right)\), their spectral-norms scale as \(\mathbf{\Theta}\left(\sqrt{n}\right)\), and hence, the sharpness of balanced solutions is independent of dataset size (see 8), in disagreement with [15], which suggests that sharpness increases with \(n\). Their observation may be better understood through the geometry of the loss landscape and the behavior of optimization algorithms, which are beyond the scope of this work.

Dependence on depth. Sharpness increases with depth when \(\left\|\mathbf{X}\right\|_2 \leq \left\|\mathbf{Y}\right\|_2\), or \(L \geq 2\ln \frac{\left\|\mathbf{X}\right\|_2}{\left\|\mathbf{Y}\right\|_2}\) – we visualize this in the middle panel in 6.

a

b

c

Figure 6: Computing eigenvalues of the Hessian of strongly balanced solutions using the labels, \(\mathbf{Y}\). (a) Computed numerically and theoretically (2 3) with random data. (b) On the effect of depth for different values of \(\left\|\mathbf{X}\right\|_2^2/n\), with fixed \(\alpha_{\max} = 0.2\). (c) Spectral norm of trained models and theoretical predictions (3)..

Dependence on features. For a centered feature matrix \(\mathbf{X}\), i.e.the empirical mean of each feature-dimension is zero, \(\{\sigma_{i}^{2}\left(\mathbf{X}\right)/n\}_{i=1}^{d_0}\) represents the amount of variance explained by the principle components. Under 1, this is given by \(\mathbf{\Sigma}_{11}^2\). Hence, larger the magnitude of the features, the more spread out they are, and larger is the sharpness of the solution.

Dependence on labels. For one-hot encoded labels, \(\{\sigma_{i}^{2}\left(\mathbf{Y}\right)/n\}_{i=1}^{d_L}\) is the empirical distribution of labels, i.e.proportion of labels from each class in the training set; in what follows, we will use \(\alpha_i \mathrel{\vcenter{:}}= \sigma_{i}^{2}\left(\mathbf{Y}\right)/n\) to denote these proportions. This implies that the model learns sharper solutions when there is one class with disproportionately large number of labels; we illustrate this in the right panel in 6. Such datasets are, intuitively, simpler to learn, e.g.as an extreme case, a dataset with all inputs belonging to one class should be easier to learn than a dataset with uniform label distribution. This intuition is in disagreement with [15], which suggests that the model achieves lower peak-sharpness on simpler datasets.

a

b

c

Figure 7: Ablating model assumptions: (a) raw inputs (shedding 1), (b) Kaiming uniform initialization (shedding 2), and (c) unbalanced initialization and Tanh (nonlinear) activation..

Ablations. We repeat the experiment in 6, shedding each of 1 2 one-at-a-time. In the left panel in 7, we present the results shedding the assumption on whitened inputs. In this case, our theory breaks down immediately – the sharpness of the learnt solution turns out to have inconsistent variations with maximum label proportion in the dataset, suggesting that peak-sharpness is strongly influenced by the input-geometry. In the middle panel, we present the results shedding the assumption on balanced weights, and use the standard Kaiming uniform initialization [29] implemented in the PyTorch framework. Here, we note the theoretical predictions made in previous section stay intact, as the final sharpness increasing with label imbalance. Finally, we inspect if incorporating nonlinearity breaks our theory. In the right panel, we present results for a Tanh-MLP, noting that while the results are slightly different from the theoretical predictions, they are qualitatively similar, allowing us to extend our conclusions on the effects of label distribution to such nonlinear networks.

5 Omitted Proofs↩︎

1. For \(L=2\), following [eqn:column-gramian],

&_1^_1 = _2 _2^_i(_1^_1) = _i^2(_2)
&_1_1^^= ^_i(_1_1^^) = _i^2() _11^2
&_2^_2 = _d_2 _i(_2^_2) = 1
&_2_2^^= _1^_1 ^_i(_2_2^^) _11^2 _i^2(_1)

where both upper bounds are tight under 1. Therefore,

_ij(^) & (_i^2(_1) + _j^2(_2))

Furthermore, under 1, the two summands share their (unnormalized) eigenvectors:

_ij(^) &= _i (_j)

where \(\mathbf{u}_{i}\) is the \(i\textsuperscript{th}\) left singular vector of \(\mathbf{W}_2\), and \(\mathbf{v}_{j}\) is the \(j\textsuperscript{th}\) right singular vector of \(\mathbf{W}_1\). Therefore, all non-zero eigenvalues of the NTK are given by pairwise-sums of squared singular values of the two layers:

_ij(^) &= (_i^2(_1) + _j^2(_2))

where \(i\in\left[\min\left\{d_0,d_1\right\}\right]\) and \(j\in\left[\min\left\{d_1,d_2\right\}\right]\). ◻

2. Under 2, we have \(\mathbf{S}_{\ell}^\intercal\mathbf{S}_{\ell} = \left(\mathbf{W}_{L} \mathbf{W}_{L}^\intercal\right)^{L-\ell}\) and \(\mathbf{P}_{\ell} \mathbf{P}_{\ell}^\intercal= \left(\mathbf{W}_{1}^\intercal\mathbf{W}_{1}\right)^{\ell-1}\). Therefore, following [eqn:column-gramian],

^ &= _^L (_L _L^)^L- ((_1^_1)^ ^)

Using triangle inequality and 1, the eigenvalues of the NTK are upper bounded as

_ij( ^) & _^L _i^2(L-)() _j((_1^_1)^ ^)
& _^L _j^2(L-)() _i^2()()
&=

&, _i() _j()
L ^2(L-1)() &, () _i() = _j()

If \(\mathbf{\Sigma}= \mathbf{\Sigma}_{11}\mathbf{I}_{d_0}\), then we further have that the (unnormalized) eigenvectors of each summand are given by the Kronecker products \(\mathbf{q}_{ij} = \mathbf{u}_{i} \otimes \left(\mathbf{X}\mathbf{v}_{j}\right)\), where \(\mathbf{u}_{i}\) is the \(i\textsuperscript{th}\) left singular vector of \(\mathbf{W}_L\), and \(\mathbf{v}_{j}\) is the \(j\textsuperscript{th}\) right singular vector of \(\mathbf{W}_1\). Hence, the eigenvalues add up over the summands, and the upper bound derived above becomes tight. ◻

3. The OLS solution to the problem is given by \(\mathbf{W}_1^\intercal\mathbf{W}_{2}^\intercal\ldots\mathbf{W}_L^\intercal= \mathbf{X}^{\dagger}\mathbf{Y}\). Under 2, the shared singular values simplify as \(\sigma_i^L\left(\mathbf{W}\right) = \sigma_i\left(\mathbf{X}^{\dagger}\mathbf{Y}\right)\). Using 1, we have

_i^L() &= _11^-1_i(_^) _i() = _11^-1/L _i^1/L(_^)

In particular, if \(\mathbf{X}\mathbf{W}_1^\intercal\mathbf{W}_{2}^\intercal\ldots\mathbf{W}_L^\intercal= \mathbf{Y}\), then

(_1^_1)^L ^= ^&_11^2 _i^2L() = _i^2()
&_i() = _11^-1/L _i^1/L()

All that is left is to substitute the shared singular values in 2. ◻

6 Other Results↩︎

6.1 Summary of Eigenvalues↩︎

Several works have used Hessian-based measures like the maximum eigenvalue (spectral norm for symmetric matrices) or the sum of eigenvalues (trace) to measure generalization. Intuitively, at a local minimum, the spectral norm measures the worst-case change in loss caused by a small perturbation in any direction, while the trace measures the expected change in loss caused by a random isotropic perturbation with small variance.

Lemma 1. The spectral norm and trace of the NTK are given by

&_ (^) _^L ̍_̍_2^2 ̍_̍_2^2
&(^) _^L ̍_̍_F^2 ̍_̍_F^2

where the bound for trace is attained under 1.

Proof. Following [eqn:column-gramian],

^ &= _^L (_^_) (_ _^^)

Using triangle inequality,

_ (^) & _^L _ ((_^_) (_ _^^))
&= _^L ̍_̍_2^2 _ (_ _^^)
&= _^L ̍_̍_2^2 ̍_̍_2^2

As for the sum of eigenvalues,

(^) &= _^L ((_^_) (_ _^^))
&= _^L ̍_̍_F^2 (_ _^^)
& _^L ̍_̍_F^2 ̍_̍_F^2

 ◻

6.2 Other Figures↩︎

a

b

c

Figure 8: Effect of dataset size on spectral norm of trained networks: (a) \(n=4\)k, (b) \(7\)k and (c) \(10\)k. Theoretical predictions correspond to 2 3. Some high \(\alpha_{\max}\) are not presented for \(n=7\)k and \(10\)k since they requires more samples with label \(0\) than available – \(5\)k in the datasets considered..

7 Experimental Details↩︎

Data Whitening. Given the SVD of a feature matrix \(\mathbb{R}^{n\times d_0} \ni \mathbf{X}' = \mathbf{U}_{\mathbf{X}}\mathbf{\Sigma}\mathbf{V}_{\mathbf{X}}^\intercal\), we redefine the features to be proportional to the polar factor, i.e.\(\mathbf{X}= \sqrt{n}\sigma_{\mathbf{x}}\mathbf{U}_{\mathbf{X}}\mathbf{V}_{\mathbf{X}}^\intercal\). Sampling Balanced Weights. Assume we are given a sequence of \(k=\min\left\{d_0,d_1,\ldots,d_L\right\}\) singular values; we arrange them to create a diagonal matrix, \(\mathbf{S}\in \mathbb{R}^{k\times k}\). To construct a sequence of balanced weight matrices, we start by sampling the right singular vectors of \(\mathbf{W}_1\) by orthogonalizing a random \(d_0\times k\) matrix with \(\mathcal{N}\left(0,1\right)\) entries; denote it by \(\mathbf{V}_1 \in \mathbb{R}^{d_0\times k}\). Then, for each \(\ell \in \left[L\right]\), do

  1. Sample the left singular vectors of \(\mathbf{W}_{\ell}\) by orthogonalizing a random \(d_{\ell}\times k\) matrix with \(\mathcal{N}\left(0,1\right)\) entries; denote it by \(\mathbf{U}_{\ell} \in \mathbb{R}^{d_1\times k}\).

  2. Define the weight matrix as \(\mathbf{W}_{\ell} \mathrel{\vcenter{:}}= \mathbf{U}_{\ell}\mathbf{S}\mathbf{V}_{\ell}^\intercal\in \mathbb{R}^{d_{\ell}\times d_{\ell-1}}\).

  3. Set the right singular vectors of the next layer as the left singular vectors of the previous layers, \(\mathbf{V}_{\ell+1} \mathrel{\vcenter{:}}= \mathbf{U}_{\ell}\).

Subsampling. With real-world datasets MNIST [30], FashionMNIST [31] and CIFAR10 [32], we use subsets of \(n=5,000\) samples. If the maximum label proportion \(\alpha_{\max}\) is set, we take \(\lfloor(1-\alpha_{\max})n\rfloor\) samples from each of the classes \(1\!-\!9\), where \(\lfloor\cdot\rfloor\) denotes the floor function, and the rest of the samples from class \(0\).

Training. All models are trained using full-batch gradient descent for \(10,000\) epochs, with an initial learning rate \(\eta_{\max}\) which is successively halved anytime \(<0.1\%\) improvement in loss is observed over \(100\) epochs.

1: Top-10 eigenvalues of the Hessian, computed numerically using LOBPCG and analytically using 1. Datasets are orthogonalized with \(\sigma_{\mathbf{x}}=1\), and our model is a 2-layer Linear-MLP with width 256, trained with \(\eta_{\max}=1e-3\).

2: Top eigenvalue of the Hessian, along with the predictions in 1 and [13]. Datasets are orthogonalized with \(\sigma_{\mathbf{x}}=1\), and our model is a 2-layer Linear-MLP with width 256, trained with \(\eta_{\max}=1e-3\).

3: Sum of eigenvalues of the Hessian is computed numerically using Hutchinson’s method [18]. Datasets are orthogonalized with \(\sigma_{\mathbf{x}}=1\), and our models are a 2-layer Linear-MLP with width 256 and a 4-layer Linear-MLP with width 64, trained with \(\eta_{\max}=5e-4\).

4: Top-10 eigenvalues of the Hessian, computed numerically using LOBPCG and analytically using 2. Datasets are orthogonalized with \(\sigma_{\mathbf{x}}=1\), and our model is a 4-layer Linear-MLP with width 64, trained with \(\eta_{\max}=1e-2\).

5: The OLS solution is computed as \(\mathbf{W}^\intercal\mathrel{\vcenter{:}}= \mathbf{W}_1^\intercal\mathbf{W}_2^\intercal\ldots\mathbf{W}_L^\intercal= \mathbf{X}^{\dagger}\mathbf{Y}\), and a network with balanced layers is constructed to simulate this solution by setting \(\mathbf{V}_1\) and \(\mathbf{U}_L\) as the right and left singular vectors of \(\mathbf{W}\). Our model is a 2-layer Linear-MLP with width 128.

6:

  • Left: We sample \(\mathbf{X}' \in \mathbb{R}^{20\times 100}\) with standard normal entries, and then orthogonalize it with \(\sigma_{\mathbf{x}} = 3\). We sample \(d=20\) singular values from \(\mathcal{U}\left[0,1\right]\), and use it sample a sequence of \(L=5\) balanced weight matrices, with \(\mathbf{W}_{\ell} \in \mathbb{R}^{d\times d}\). Finally, set \(\mathbf{Y}= \mathbf{W}_5\mathbf{W}_4\ldots\mathbf{W}_1\mathbf{X}\) so that the GGN approximation is exact.

  • Right: Spectral norm of the Hessian is computed numerically using LOPPCG [33], [34] and analytically using 2 3. Datasets are orthogonalized with \(\sigma_{\mathbf{x}}=1\), and our model is a 4-layer Linear-MLP with width 64, initialized with balanced weights, and trained with \(\eta_{\max}=1e-2\).

7: Spectral norm of the Hessian is computed numerically using LOBPCG and analytically using 2 3.

  • Left: Datasets are not orthogonalized, and our model is a 4-layer Linear-MLP with width 64, initialized with balanced weights.

  • Middle: Datasets are orthogonalized with \(\sigma_{\mathbf{x}}=1\), and our model is a 4-layer Linear-MLP with width 64, initialized with Kaiming uniform initialization [29] (standard in PyTorch).

  • Right: Datasets are orthogonalized with \(\sigma_{\mathbf{x}}=1\), and our model is a 4-layer Tanh-MLP with width 64, initialized with balanced weights.

All models are trained with \(\eta_{\max}=1e-2\).

8: Spectral norm of the Hessian, computed numerically using LOPPCG and analytically using 2 3. Datasets are orthogonalized with \(\sigma_{\mathbf{x}}=1\), and our model is a 4-layer Linear-MLP with width 64, trained with \(\eta_{\max}=1e-2\).

References↩︎

[1]
James Martens. Deep learning via hessian-free optimization. In Proceedings of the 27th International Conference on Machine Learning, ICML, page 735–742, Madison, WI, USA, 2010. Omnipress.
[2]
Vineet Gupta, Tomer Koren, and Yoram Singer. Shampoo: Preconditioned stochastic tensor optimization. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 1842–1850. PMLR, 10–15 Jul 2018.
[3]
Pratik Chaudhari, Anna Choromanska, Stefano Soatto, Yann LeCun, Carlo Baldassi, Christian Borgs, Jennifer Chayes, Levent Sagun, and Riccardo Zecchina. Entropy-SGD: Biasing gradient descent into wide valleys. In International Conference on Learning Representations, 2017.
[4]
Stanisław Jastrzȩbski, Zachary Kenton, Devansh Arpit, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos Storkey. Three factors influencing minima in sgd, 2018.
[5]
Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. In International Conference on Learning Representations, 2021.
[6]
Jungmin Kwon, Jeongseop Kim, Hyunseo Park, and In Kwon Choi. Asam: Adaptive sharpness-aware minimization for scale-invariant learning of deep neural networks. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pages 5905–5914. PMLR, 18–24 Jul 2021.
[7]
Yann LeCun, John Denker, and Sara Solla. Optimal brain damage. In Advances in Neural Information Processing Systems, volume 2. Morgan-Kaufmann, 1989.
[8]
B. Hassibi, D.G. Stork, and G.J. Wolff. Optimal brain surgeon and general network pruning. In IEEE International Conference on Neural Networks, pages 293–299 vol.1, 1993.
[9]
Elias Frantar and Dan Alistarh. Optimal brain compression: A framework for accurate post-training quantization and pruning. In Advances in Neural Information Processing Systems, volume 35, pages 4475–4488. Curran Associates, Inc., 2022.
[10]
Seyed Iman Mirzadeh, Mehrdad Farajtabar, Razvan Pascanu, and Hassan Ghasemzadeh. Understanding the role of training regimes in continual learning. In Advances in Neural Information Processing Systems, volume 33, pages 7308–7320. Curran Associates, Inc., 2020.
[11]
Seyed Iman Mirzadeh, Mehrdad Farajtabar, Dilan Gorur, Razvan Pascanu, and Hassan Ghasemzadeh. Linear mode connectivity in multitask and continual learning. In International Conference on Learning Representations, 2021.
[12]
Sidak Pal Singh and Thomas Hofmann. Closed form of the hessian spectrum for some neural networks. In High-dimensional Learning Dynamics 2024: The Emergence of Structure and Reasoning, 2024.
[13]
Sidak Pal Singh, Weronika Ormaniec, and Thomas Hofmann. Cracking the hessian: Closed-form hessian spectra for fundamental neural networks, 2026.
[14]
Avrajit Ghosh, Soo Min Kwon, Rongrong Wang, Saiprasad Ravishankar, and Qing Qu. Learning dynamics of deep matrix factorization beyond the edge of stability. In International Conference on Learning Representations, volume 2025, pages 17753–17800, 2025.
[15]
Jeremy Cohen, Simran Kaur, Yuanzhi Li, J Zico Kolter, and Ameet Talwalkar. Gradient descent on neural networks typically occurs at the edge of stability. In International Conference on Learning Representations, 2021.
[16]
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019.
[17]
Arthur Jacot, Franck Gabriel, and Clement Hongler. Neural tangent kernel: Convergence and generalization in neural networks. In Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018.
[18]
M.F. Hutchinson. A stochastic estimator of the trace of the influence matrix for laplacian smoothing splines. Communication in Statistics- Simulation and Computation, 18: 1059–1076, 01 1989.
[19]
Dayal Singh Kalra and Maissam Barkeshli. Phase diagram of early training dynamics in deep neural networks: effect of the learning rate, depth, and width. In Advances in Neural Information Processing Systems, volume 36, pages 51621–51662. Curran Associates, Inc., 2023.
[20]
Dayal Singh Kalra, Tianyu He, and Maissam Barkeshli. Universal sharpness dynamics in neural network training: Fixed point analysis, edge of stability, and route to chaos. In International Conference on Learning Representations, volume 2025, pages 55966–56000, 2025.
[21]
Jeremy M. Cohen, Behrooz Ghorbani, Shankar Krishnan, Naman Agarwal, Sourabh Medapati, Michal Badura, Daniel Suo, David Cardoze, Zachary Nado, George E. Dahl, and Justin Gilmer. Adaptive gradient methods at the edge of stability, 2024.
[22]
Rustem Islamov, Michael Crawshaw, Jeremy Cohen, and Robert Gower. Non-euclidean gradient descent operates at the edge of stability. In Proceedings of the 43rd International Conference on Machine Learning, ICML, 2026.
[23]
Jasraj Singh, Enea Monzio Compagnoni, and Antonio Orvieto. Unified perspectives on balancedness and parameter-norm evolution in neural nets. In Workshop on Scientific Methods for Understanding Deep Learning, 2026.
[24]
Simon S Du, Wei Hu, and Jason D Lee. Algorithmic regularization in learning deep homogeneous models: Layers are automatically balanced. In Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018.
[25]
Sanjeev Arora, Nadav Cohen, and Elad Hazan. On the optimization of deep networks: Implicit acceleration by overparameterization. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 244–253. PMLR, 10–15 Jul 2018.
[26]
Levent Sagun, Léon Bottou, and Yann LeCun. Singularity of the hessian in deep learning. CoRR, abs/1611.07476, 2016.
[27]
Levent Sagun, Utku Evci, V. Ugur Guney, Yann Dauphin, and Leon Bottou. Empirical analysis of the hessian of over-parametrized neural networks, 2018.
[28]
Vardan Papyan. The full spectrum of deepnet hessians at scale: Dynamics with sgd training and sample size, 2019.
[29]
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In 2015 IEEE International Conference on Computer Vision (ICCV), pages 1026–1034, 2015.
[30]
Yann LeCun, Corinna Cortes, and CJ Burges. Mnist handwritten digit database. ATT Labs [Online], 2, 2010.
[31]
Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
[32]
Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
[33]
Andrew V. Knyazev. Toward the optimal preconditioned eigensolver: Locally optimal block preconditioned conjugate gradient method. SIAM Journal on Scientific Computing, 23 (2): 517–541, 2001.
[34]
Andreas Stathopoulos and Kesheng Wu. A block orthogonalization procedure with constant synchronization requirements. SIAM Journal on Scientific Computing, 23 (6): 2165–2182, 2002.

  1. The parameterization follows the implementation of a linear layer in the PyTorch framework [16].↩︎