                                                                     Rethinking Parameter Counting in Deep Models:
                                                                           Effective Dimensionality Revisited


                                                                     Wesley J. Maddox∗       Gregory Benton∗       Andrew Gordon Wilson
                                                                                            New York University


                                                                     Abstract                               3.5                                                           94
arXiv:2003.02139v2 [cs.LG] 25 May 2020




                                                                                                                                                           Test Loss
                                                                                                            3.0                                            Train Loss     92
                                                Neural networks appear to have mysterious gener-            2.5                                            Neff(Hessian) 90




                                                                                                                                                                          Neff(Hessian)
                                                alization properties when using parameter count-
                                                                                                            2.0                                                           88




                                                                                                         Loss
                                                ing as a proxy for complexity. Indeed, neural
                                                                                                            1.5                                                           86
                                                networks often have many more parameters than
                                                                                                            1.0                                                           84
                                                there are data points, yet still provide good gener-
                                                alization performance. Moreover, when we mea-               0.5                                                           82
                                                sure generalization as a function of parameters,            0.0                                                           80
                                                                                                                      10      20      30       40     50       60       70
                                                we see double descent behaviour, where the test er-                                        Width
                                                ror decreases, increases, and then again decreases.
                                                We show that many of these properties become              Figure 1. A resolution of double descent. We replicate the dou-
                                                understandable when viewed through the lens of            ble descent behaviour of deep neural networks using a ResNet18
                                                effective dimensionality, which measures the di-          (He et al., 2016) on CIFAR-100, where train loss decreases to
                                                mensionality of the parameter space determined            zero with sufficiently wide model while test loss decreases, then
                                                by the data. We relate effective dimensionality to        increases, and then decreases again. Unlike model width, the ef-
                                                posterior contraction in Bayesian deep learning,          fective dimensionality computed from the eigenspectrum of the
                                                                                                          Hessian of the loss on training data alone follows the test loss in
                                                model selection, width-depth tradeoffs, double
                                                                                                          the overparameterized regime, acting as a much better proxy for
                                                descent, and functional diversity in loss surfaces,
                                                                                                          generalization than naive parameter counting.
                                                leading to a richer understanding of the interplay
                                                between parameters and functions in deep models.
                                                We also show that effective dimensionality com-
                                                                                                          works (CNNs) for image recognition tasks is almost entirely
                                                pares favourably to alternative norm- and flatness-
                                                                                                          about the inductive biases of convolutional filters, depth,
                                                based generalization measures.
                                                                                                          and sparsity, for extracting local similarities and hierarchical
                                                                                                          representations, rather than flexibility (LeCun et al., 1989;
                                                                                                          Szegedy et al., 2015). Convolutional neural networks have
                                         1. Introduction                                                  far fewer parameters than fully connected networks, yet
                                         Parameter counting is often used as a proxy for model com-       can provide much better generalization. Moreover, width
                                         plexity to reason about generalization (e.g., Zhang et al.,      can provide flexibility, but it is depth that has made neural
                                         2017; Shazeer et al., 2017; Belkin et al., 2019a), but it can    networks distinctive in their generalization abilities.
                                         be a poor description of both model flexibility and inductive    In this paper, we argue that we should move beyond sim-
                                         biases. One can easily construct degenerate cases, such as       ple parameter counting, and show how the generalization
                                         predictions being generated by a sum of parameters, where        properties of neural networks become interpretable through
                                         the number of parameters is divorced from the statistical        the lens of effective dimensionality (MacKay, 1992a). Effec-
                                         properties of the model. When reasoning about generaliza-        tive dimensionality was originally proposed to measure how
                                         tion, overparametrization is besides the point: what matters     many directions in parameter space had been determined in
                                         is how the parameters combine with the functional form of        a Bayesian neural network, by computing the eigenspectrum
                                         the model.                                                       of the Hessian on the training loss (Eq. (3), Section 2). We
                                         Indeed, the practical success of convolutional neural net-       provide explicit connections between effective dimension-
                                                                                                          ality, posterior contraction, model selection, loss surfaces,
                                           *
                                               Equal contribution.                                        and generalization behaviour in modern deep learning.
                                                                                                          Consider Figure 1, where we see that once a model has
                                                              Effective Dimensionality Revisited

        8      Effective Dimensionality             100   8               Test Loss                      2.2   8           Train Loss
                                                                                                                                                       3.5
                                                    95                                                   2.0
        6                                                 6                                                    6                                       3.0
                                                    90                                                                                                 2.5
                                                                                                         1.8
Depth




                                                    85                                                                                                 2.0
        4                                                 4                                                    4
                                                    80                                                   1.6                                           1.5
        2                                           75    2                                              1.4   2                                       1.0
                                                    70                                                                                                 0.5
        0 12                                              0 12                                           1.2   0 12
               16    20     24    28      32   36                   16   20     24      28     32   36                16   20     24    28   32   36
                          Width                                               Width                                             Width

Figure 2. Left: Effective dimensionality as a function of model width and depth for a CNN on CIFAR-100. Center: Test loss as a function
of model width and depth. Right: Train loss as a function of model width and depth. Yellow level curves represent equal parameter
counts (1e5, 2e5, 4e5, 1.6e6). The green curve separates models with near-zero training loss. Effective dimensionality serves as a good
proxy for generalization for models with low train loss. We see wide but shallow models overfit, providing low train loss, but high test
loss and high effective dimensionality. For models with the same train loss, lower effective dimensionality can be viewed as a better
compression of the data at the same fidelity. Thus depth provides a mechanism for compression, which leads to better generalization.


 achieved low training loss, the effective dimensionality,                                   the eigenvectors of the Hessian, which lead to function-
 computed from training data alone, closely tracks the myste-                                space homogeneity for both training and testing inputs.
 rious double descent behaviour for neural networks. Indeed,                                 The presence of a high dimensional parameter space
 models with increasing width actually have lower effec-                                     in which functional predictions are unchanged sug-
 tive dimensionality, and better generalization. Such models                                 gests that subspace and ensembling methods could be
 can be viewed as providing a better compression of the data,                                improved through the avoidance of expensive com-
 despite having more parameters. Alternatively, consider Fig-                                putations within degenerate parameter regimes. This
 ure 2, where we see that width and depth determine effective                                finding also leads to an interpretation of effective di-
 dimensionality in different ways, though both are related                                   mensionality as model compression, since the undeter-
 to numbers of parameters. Remarkably, for models with                                       mined directions do not contain additional functional
 low training loss (above the green partition), the effective                                information.
 dimensionality closely tracks generalization performance
 for each combination. We also see that wide but shallow                                • In Section 6, we show that effective dimensionality
 models overfit, while depth helps provide lower effective                                provides a compelling mechanism for model selection,
 dimensionality, leading to a better compression of the data.                             resolving generalization behaviour in deep learning
                                                                                          that appears mysterious from the perspective of sim-
 Specifically, our contributions are as follows:                                          ple parameter counting, such as double-descent and
                                                                                          width-depth tradeoffs. Given two models with the same
        • In Section 4.2, we demonstrate that the effective di-                           training error, the one with lower effective dimension-
          mensionality of a Bayesian neural network is inversely                          ality, but not necessarily fewer parameters, should be
          proportional to the variance of the posterior distribu-                         preferred.
          tion. As the effective dimensionality increases, so does
                                                                                        • In Section 7, we compare effective dimensionality to
          the dimensionality of parameter space in which the
                                                                                          the path-norm and PAC-Bayesian flatness generaliza-
          posterior variance has contracted.
                                                                                          tion measures, showing a greater ability to both track
        • In Section 4.3, we prove analytically for linear and gen-                       and explain generalization performance when compar-
          eralized linear models with isotropic priors, k param-                          ing between large modern neural networks.
          eters, and n < k data observations, there exist k − n
          orthogonal directions corresponding to eigenvectors                         We make code available at https://github.com/
          of the Hessian of the loss with smallest eigenvalues,                       g-benton/hessian-eff-dim.
          where perturbations in parameters lead to almost no
          difference in the predictions of the corresponding func-                    2. Posterior Contraction, Effective
          tions on training data. That is, f (x; θ) ≈ f (x; θ),
                                                             e for
                                                                                         Dimensionality, and the Hessian
          training inputs x and perturbed parameters θ. e
                                                                                      We consider a model, typically a neural network, f (x; θ),
        • In Section 5, we demonstrate experimentally that there                      with inputs x and parameters θ ∈ Rk . We define the Hessian
          exist degenerate directions in parameter space for over-                    as the k × k matrix of second derivatives of the loss, Hθ =
          parameterized deep neural networks, determined from                         −∇∇θ L(θ, D). Often the loss used to train a model by
                                              Effective Dimensionality Revisited

optimization is taken to be the negative log posterior L =       Typically as neural networks are trained we observe a gap
− log p(θ|D).                                                    in the eigenspectrum of the Hessian of the loss (Sagun et al.,
                                                                 2017); a small number of eigenvalues become large while
To begin, we describe posterior contraction, effective dimen-
                                                                 the rest take on values near 0. In this definition of effective
sionality, and connections to the Hessian.
                                                                 dimensionality, eigenvalues much larger than z contribute a
                                                                 value of approximately 1 to the summation, and eigenvalues
2.1. Posterior Contraction                                       much smaller than z contribute a value of approximately 0.
Definition 2.1. We define posterior contraction of a set of
parameters, θ, as the difference in the trace of prior and       2.4. The Hessian and the Posterior Distribution
posterior covariance.
                                                                 We provide a simple example involving posterior contrac-
   ∆post (θ) = tr(Covp(θ) (θ)) − tr(Covp(θ|D) (θ)),      (1)     tion, effective dimensionality, and their connections to the
                                                                 Hessian. Figure 3 shows the prior and posterior distribu-
where p(θ) is the prior distribution and p(θ|D) is the poste-    tion for a Bayesian linear regression model with a single
rior distribution given data, D.                                 parameter, with predictions generated by parameters drawn
                                                                 from these distributions. As expected from Sections 2.1 and
With increases in data the posterior distribution of param-      2.3, we see that the variance of the posterior distribution is
eters becomes increasingly concentrated around a single          significantly reduced from that of the prior — what we refer
value (e.g., van der Vaart, 1998, Chapter 10). Therefore         to here as posterior contraction.
Eq. (1) serves to measure the increase in certainty about the    We can see from Figure 3 that the arrival of data increases
parameters under the posterior as compared to the prior.         the curvature of the loss (negative log posterior) at the opti-
                                                                 mum. This increase in curvature of the loss that accompa-
2.2. Parameter Space and Function Space                          nies certainty about the parameters leads to an increase in
When combined with the functional form of a model, a dis-        the eigenvalues of the Hessian of the loss in the multivariate
tribution over parameters p(θ) induces a distribution over       case. Thus, growth in eigenvalues of the Hessian of the loss
functions p(f (x; θ)). The parameters are of little direct       corresponds to increased certainty about parameters, leading
interest — what matters for generalization is the distribu-      to the use of the effective dimensionality of the Hessian of
tion over functions. Figure 3 provides both parameter- and       the loss as a proxy for the number of parameters that have
function-space viewpoints. As parameter distributions con-       been determined.1
centrate around specific values, we expect to generate less      We often desire models that are both consistent with data,
diverse functions.                                               but as simple as possible in function space, embodying
We show in Appendix C that the posterior contraction for         Occam’s razor and avoiding overfitting. The effective di-
Bayesian linear regression, y ∼ N (f = Φ> β, σ 2 I), with        mensionality explains the number of parameters that have
isotropic Gaussian prior, β ∼ N (0, α2 IN ), is given by         been determined by the data, which corresponds to the num-
                                                                 ber of parameters the model is using to make predictions.
                               N                                 Therefore in comparing models of the same parameteriza-
                               X       λi
              ∆post (θ) = α2                 ,           (2)     tion that achieve low loss on the training data, we expect
                                   λ i + α−2
                               i=1                               models with lower effective dimensionality to generalize
                                                                 better — which is empirically verified in Figures 1 and 2.
where λi are the eigenvalues of Φ> Φ. This quantity is dis-
tinct from the posterior contraction in function space (also     We can further connect the Hessian and the posterior dis-
shown in Appendix C). We refer to the summation in Eq.           tribution by considering a Laplace approximation as in
(2) as the effective dimensionality of Φ> Φ.                     MacKay (1992a;b). Here we assume that the distribution of
                                                                 parameters θ is multivariate normal around the maximum
2.3. Effective Dimensionality                                    a posteriori (MAP) estimate, θMAP = argmaxθ p(θ|D), and
                                                                 the Hessian of the negative log posterior, Hθ + A,2 serves as
Definition 2.2. The effective dimensionality of a symmetric      the precision matrix. The approximating distribution is then
matrix A ∈ Rk×k is defined as                                    N (θMAP , (Hθ + A)−1 ). The intuition built using Figure 3
                                                                 carries through to this approximation: as the eigenvalues of
                                 k
                                 X    λi                         the Hessian increase, the eigenvalues of the covariance ma-
                Nef f (A, z) =            ,              (3)     trix in our approximation to the posterior distribution shrink,
                                    λ
                                 i=1 i
                                       +z
                                                                    1
                                                                        Empirically described in Appendix A.
in which λi are the eigenvalues of A and z > 0 is a regular-        2
                                                                        A = −∇∇θ log p(θ) is the Hessian of the log prior.
ization constant (MacKay, 1992a).
                                                                                  Effective Dimensionality Revisited

                                                                  4                                    Friedman et al. (2001, Chapter 7) use the effective dimen-
              0.6
                                                                                                       sionality (calling it the effective degrees of freedom) to com-
Probability


                                                                  2
              0.4                                                 0                                    pute the expected generalization gap for regularized linear




                                                              Y
              0.2                                                 2
                                                                                                       models. Dobriban & Wager (2018) specifically tied the bias
                                                                  4
              0.0
                    7.5   5.0   2.5   0.0   2.5   5.0   7.5           1.0   0.5      0.0   0.5   1.0
                                                                                                       variance decomposition of predictive risk in ridge regression
                                 Parameter                                           X                 (e.g. the finite sample predictive risk under Gaussian priors)
                                      Prior             Posterior             Data                     to the effective dimensionality of the feature matrix, Φ> Φ.
                                                                                                       Hastie et al. (2019), Muthukumar et al. (2019), Bartlett et al.
Figure 3. Left: A comparison of prior and posterior distributions                                      (2019), Mei & Montanari (2019), and Belkin et al. (2019b)
in a Bayesian linear regression setting, demonstrating the decrease                                    studied risk and generalization in over-parameterized linear
in variance referred to as posterior contraction. Right: Functions                                     models, including under model misspecification. Bartlett
sampled from the prior and posterior distributions, along with the
                                                                                                       et al. (2019) also introduced the concept of effective rank
training data.
                                                                                                       of the feature matrix, which has a similar interpretation to
                                                                                                       effective dimensionality.
further indicating contraction around the MAP estimate.                                                Sagun et al. (2017) found that the eigenvalues of the Hes-
We demonstrate this property algebraically in Appendix B,                                              sian increase through training, while Papyan (2018) and
where we also connect the effective dimensionality to the                                              Ghorbani et al. (2019) studied the eigenvalues of the Hes-
bias-variance tradeoff (Dobriban & Wager, 2018) and to the                                             sian for a range of modern neural networks. Suzuki (2018)
Hilbert space norm (Rasmussen & Williams, 2008).                                                       produced generalization bounds on neural networks via the
                                                                                                       effective dimensionality of the covariance of the functions at
2.5. Practical Computations And Parameterizations                                                      each hidden layer. Fukumizu et al. (2019) embedded narrow
For deep and wide neural networks the Hessian of the loss is                                           neural networks into wider neural networks and studied the
large, and thus computing the eigenvalues and eigenvectors                                             flatness of the resulting minima in terms of their Hessian
is nontrivial. We employ an efficient implementation of the                                            via a PAC-Bayesian approach. Achille & Soatto (2018) ar-
Lanczos method for determining eigenvalues provided in                                                 gue that flat minima have low information content (many
GPyTorch, allowing for the rapid computation of approxi-                                               small magnitude eigenvalues of the Hessian) by connecting
mate eigenvalue, eigenvector pairs (Gardner et al., 2018). In                                          PAC-Bayesian approaches to information theoretic argu-
practice, we estimate effective dimensionality by selectively                                          ments, before demonstrating that low information functions
computing the leading eigenvalues, since many of the eigen-                                            learn invariant representations of the data. Dziugaite & Roy
values are typically close to zero and do not significantly                                            (2017) optimize a PAC-Bayesian bound to both encourage
contribute to the estimate.                                                                            flatness and to compute non-vacuous generalization bounds,
                                                                                                       while Jiang et al. (2019) recently found that PAC-Bayesian
In general, the Hessian of the loss (and its effective dimen-                                          measures of flatness, in the sense of insensitivity to random
sion) is not invariant to re-parameterizations (e.g. ReLU                                              perturbations, perform well relative to other generalization
rescaling and batch normalization) (MacKay, 2003, Chapter                                              bounds. Zhou et al. (2018) used PAC-Bayesian compression
27). For this reason we assume a fixed parameterization, as                                            arguments to construct non-vacuous generalization bounds
is typically the case in practice, and compare only between                                            at the ImageNet scale.
models of the same parameterization.
                                                                                                       Moreover, MacKay (2003) and Smith & Le (2017) provide
                                                                                                       an Occam factor perspective linking flatness and general-
3. Related Work                                                                                        ization. Related minimum description length perspectives
Cleveland (1979) introduced effective dimensionality into                                              can be found in MacKay (2003) and Hinton & Van Camp
the splines literature as a measure of goodness of fit, while                                          (1993). Other works also link flatness and generalization
Hastie & Tibshirani (1990, Chapter 3) used it to assess gen-                                           (e.g., Hochreiter & Schmidhuber, 1997; Keskar et al., 2017;
eralized additive models. Gull (1989) first applied effective                                          Chaudhari et al., 2019; Izmailov et al., 2018), with Izmailov
dimensionality in a Bayesian setting for an image recon-                                               et al. (2018) and Chaudhari et al. (2019) developing opti-
struction task, while MacKay (1992a;b) used it to compute                                              mization procedures to select for flat regions of the loss.
posterior contraction in Bayesian neural networks. Moody                                               To the best of our knowledge, Opper et al. (1989), Opper
(1992) argued for the usage of the effective dimensionality                                            et al. (1990), Bös et al. (1993), and LeCun et al. (1991)
as a proxy for generalization error, while Moody (1991) sug-                                           introduced the idea that generalization error for neural net-
gested that effective dimensionality could be used for neural                                          works can decrease, increase, and then again decrease with
network architecture selection. Zhang (2005) and Capon-                                                increases in parameters (e.g. the double descent curve) while
netto & Vito (2007) studied the generalization abilities of                                            Belkin et al. (2019a) re-introduced the idea into the mod-
kernel methods in terms of the effective dimensionality.
                                                 Effective Dimensionality Revisited

ern machine learning community by demonstrating its ex-                                 80
                                                                                                    Bayesian Linear Regression                  Bayesian Neural Network
                                                                                                                                     4.0 200                                   2000
istence on a wide variety of machine learning problems.                                 70                                           3.5 175




                                                                    Neff (Parameter Cov.)
                                                                                                                                                                               1750
                                                                                        60                                           3.0 150                                   1500
Nakkiran et al. (2019) found generalization gains as neural




                                                                                                                                                                                    Neff (Hessian)
                                                                                        50                                           2.5 125                                   1250
networks become highly overparameterized, showing the                                   40                                           2.0 100                                   1000
double descent phenomenon that occurs as the width param-                               30                                           1.5 75                                    750
                                                                                                                                     1.0 50                                    500
eter of both residual and convolutional neural networks is                              20
                                                                                        10                                           0.5 25                                    250
increased.                                                                                                                           0.0                                        0
                                                                                            0                                             0
                                                                                                0     50   100   150   200   250   300      0    1000   2000   3000   4000   5000
                                                                                                       Number of Data Points                     Number of Data Points
                                                                                                                Parameter Covariance                Hessian
4. Posterior Contraction and Function-Space
   Homogeneity in Bayesian Models
                                                                        Figure 4. Left: Bayesian linear regression. Right: Bayesian neu-
In this section, we demonstrate that effective dimensionality           ral network. Both: The effective dimensionality of the posterior
of both the posterior parameter covariance and the Hessian              covariance over parameters and the function-space posterior co-
of the loss provides insights into how a model adapts to                variance. Red indicates the under-parameterized setting, yellow
data during training. We derive an analytic relationship                the critical regime with p ≈ n, and green the over-parameterized
                                                                        regime. In both models we see the expected increase in effec-
between effective dimensionality and posterior contraction
                                                                        tive dimensionality in parameter space and decrease in effective
for models where inference is exact, and demonstrate this
                                                                        dimensionality of the Hessian.
relationship experimentally for deep neural networks.

4.1. Posterior Contraction of Bayesian Linear Models
                                                                         at which point the effective dimensionality of the posterior
Theorem 4.1 (Posterior Contraction in Bayesian Linear                    covariance of the parameters slowly approaches 0, while the
Models). Let Φ = Φ(x) ∈ Rn×k be a feature map of n data                  effective dimensionality of the Hessian of the loss increases
observations, x, with n < k and assign isotropic prior β ∼               towards an asymptotic limit. As the parameters become
N (0k , α2 Ik ) for parameters β ∈ Rk . Assuming a model of              more determined (e.g. the effective dimensionality of the
the form y ∼ N (Φβ, σ 2 In ) the posterior distribution of β             posterior covariance decreases), the curvature of the loss
has a k − n directional subspace in which the variance is                increases (the effective of the Hessian increases). In the
identical to the prior variance.                                         Bayesian linear model setting, the Hessian of the loss is
                                                                         the inverse covariance matrix and the trade-off between the
We prove Theorem 4.1 in Appendix D.1, in addition to an
                                                                         effective dimensionality of the Hessian and the parameter
equivalent result for generalized linear models. Theorem
                                                                         covariance can be determined algebraically (see Appendix
4.1 demonstrates why parameter counting often makes little
                                                                         B.1).
sense: for a fixed data set of size n, only min(n, k) parame-
ters can be determined, leaving many dimensions in which
                                                                         4.2. Posterior Contraction of Bayesian Neural
the posterior is unchanged from the prior when k  n.
                                                                              Networks
Empirical Demonstration for Theorem 4.1. We con-                        While much effort has been spent grappling with the chal-
struct Φ(x) with each row as an instance of a                           lenges of marginalizing a high dimensional parameter space
200 dimensional feature vector consisting of sinu-                      for Bayesian neural networks, the practical existence of sub-
soidal terms for each of 500 observations: Φ(x) =                       spaces where the posterior variance has not collapsed from
[cos(πx), sin(πx), cos(2πx), sin(2πx), . . . ]. We assign the           the prior suggests that both computational and approxima-
coefficient vector β a prior β ∼ N (0, I), and draw ground              tion gains can be made from ignoring directions in which
truth parameters β ∗ from this distribution. The
                                               model takes             the posterior variance is unchanged from the prior. This
the form β ∼ N (0, I) and y ∼ N Φβ, σ 2 I .                             observation helps explain the success of subspace based
                                                                        techniques that examine the loss in a lower dimensional
We randomly add data points one at a time, tracking the
                                                                        space such as Izmailov et al. (2019). Alternatively, by work-
                                           compute the
posterior covariance matrix at each step. We
                                                                        ing directly in function space, as in Sun et al. (2019), the
effective dimensionality, Nef f Σβ|D,σ , α , where Σβ|D,σ
                                                                        redundancy of many parameters could be avoided.
is the posterior covariance of β.3
                                                                         For Bayesian linear models, the effective dimensionality
In Figure 4 we see that the effective dimensionality of the
                                                                         of the parameter covariance is the inverse of the Hessian,
posterior covariance decreases linearly with an increase in
                                                                         and as the effective dimensionality of the parameter covari-
available data until the model becomes overparameterized,
                                                                         ance decreases the effective dimensionality of the Hessian
    3
      Here we use α = 5, however the results remain qualitatively        increases. We hypothesize that a similar statement holds for
the same as this parameter changes.                                      Bayesian neural networks — as the number of data points
                                             Effective Dimensionality Revisited
                                                                                                                               6
grows, the effective dimensionality of the posterior covari-        5.0
                                                                                                                               4
ance should decrease while the effective dimensionality of          2.5                                                        2
the Hessian should increase.




                                                                Y




                                                                                                                          Y
                                                                    0.0                                                        0

                                                                    2.5                                                        2
To test this hypothesis, we generate a nonlinear function of        5.0
                                                                                                                               4
the form, y = w1 x+w2 x2 +w3 x3 +(0.5+x2 )2 +sin(4x2 )+                   0.0   0.1       0.2
                                                                                                X
                                                                                                    0.3   0.4      0.5             0.0     0.1     0.2
                                                                                                                                                         X
                                                                                                                                                             0.3    0.4      0.5

, with wi ∼ N (0, I) and  ∼ N (0, 0.052 ), and de-mean                              MAP Estimate/Training Data         Undetermined Directions         Determined Directions

and standardize the inputs.4 We then construct a Bayesian
neural network with two hidden layers each with 20 units, no    Figure 5. Left: The predictions on training data for a simple
biases, and tanh activations, placing independent Gaussian      Bayesian linear regression model with sinusoidal features for vari-
priors with variance 1 on all model parameters. We then         ous parameter settings. Right: The predictions over the entire test
run the No-U-Turn sampler (Hoffman & Gelman, 2014) for          domain. Both: Blue represents the MAP estimate as well as the
2000 burn-in iterations before saving the final 2000 samples    training points, orange represents the model after the parameters
                                                                have been perturbed in a direction in which the posterior has not
from the approximated posterior distribution. Using these
                                                                contracted, and green represents the model after parameters have
samples, we compute the effective dimensionality of the
                                                                been perturbed in a direction in which the posterior has contracted.
sample posterior covariance, Covp(θ|D) (θ), and Hessian of      Perturbing parameters in directions that have not been determined
the loss at the MAP estimate in Figure 4. The trends of         by the data gives not only identical predictions on training data,
effective dimensionality for Bayesian neural networks are       but the functions produced on the test set are nearly the same.
aligned with Bayesian linear regression, with the effective
dimensionality of the Hessian (corresponding to function
space) increasing while the effective dimensionality of the     data has not determined the parameters.
parameter space decreases.                                      Figure 5 demonstrates the result of Theorem 4.2 for a
                                                                Bayesian linear model with sinusoidal features. We compare
4.3. Function-Space Homogeneity                                 predictions made using the MAP estimate of the parame-
                                                                ters, θ∗ = argmaxθ p(θ|D), to predictions generated using
In order to understand how the function-space representation
                                                                perturbed parameters. As parameters are perturbed in direc-
varies as parameters are changed in directions undetermined
                                                                tions that have not been determined by the data (minimal
by the data, we first consider Bayesian linear models.
                                                                eigenvectors of the Hessian), the predictions on both train
Theorem 4.2 (Function-Space Homogeneity in Linear Mod-          and test remain nearly identical to those generated using
els). Let Φ = Φ(x) ∈ Rn×k be a feature map of n data            the MAP estimate. Perturbations in determined directions
observations, x, with n < k, and assign isotropic prior         (dominant eigenvectors of the Hessian) yield models that
β ∼ N (0k , α2 Ik ) for parameters β ∈ Rk . The minimal         perform poorly on the training data and significantly deviate
eigenvectors of the Hessian define a k − n dimensional          from the MAP estimate on the test set.
subspace in which parameters can be perturbed without
changing the training predictions in function space.            5. Loss Surfaces and Function Space
                                                                   Representations
We prove Theorem 4.2 and its extension to generalized
linear models in Appendix D.2. This theorem suggests that       Recent works have discussed the desirability of finding
although there may be large regions in parameter-space          solutions corresponding to flat optima in the loss surface,
that lead to low-loss models, many of these models may be       arguing that such parameter settings lead to better general-
homogeneous in function space.                                  ization (Izmailov et al., 2018; Keskar et al., 2017). There
We can interpret Theorem 4.2 in terms of the eigenvec-          are multiple notions of flatness in loss surfaces, relating to
tors of the Hessian indicating which directions in parame-      both the volume of the basin in which the solution resides
ter space have and have not been determined by the data.        and the rate of increase in loss as one moves away from
The dominant eigenvectors of the Hessian (those with the        the found solution. As both definitions correspond to low
largest eigenvalues) correspond to the directions in which      curvature in the loss surface, it is standard to use the Hessian
the parameters have been determined from the data and the       of the loss to examine structure in the loss surface (Madras
posterior has contracted significantly from the prior. The      et al., 2019; Keskar et al., 2017).
minimal eigenvectors (those with the smallest eigenvalues)      The effective dimensionality of the Hessian of the loss indi-
correspond to the directions in parameter space in which the    cates the number of parameters that have been determined
  4                                                             by the data. In highly over-parameterized models we hy-
    From the Bayesian neural network example in
NumPyro (Phan et al., 2019; Bingham et al., 2019):              pothesize that the effective dimensionality is substantially
https://github.com/pyro-ppl/numpyro/blob/                       less than the number of parameters, i.e. Nef f (Hθ , α)  p,
master/examples/bnn.py.                                         since we should be unable to determine many more parame-
                                             Effective Dimensionality Revisited

                                                                -1    Full Surface    -1     Top 3 Eigenvectors    -1Bottom 2000 Eigenvectors
ters than we have data observations.
                                                                                                                                                 2.5

Recall from Section 2.3 the large eigenvalues of the Hes-                                                                                        3.0

sian have eigenvectors corresponding to directions in which     0                      0                            0                            3.5

parameters are determined. Eq. (3) dictates that low effec-                                                                                      4.0

tive dimensionality (in comparison to the total number of                                                                                        4.5
                                                                1-1                  1 1-1                        1 1-1                          5.0
parameters) would imply that there are many directions in                  0                         0                          0          1

which parameters are not determined, and the Hessian has
eigenvalues that are near zero, meaning that in many direc-     Figure 6. Left: A random projection of the loss surface. Center:
tions the loss surface is constant. We refer to directions in   A projection of the loss surface in the top 3 directions in which
                                                                parameters have been determined. Right: A projection of the loss
parameter space that have not been determined as degener-
                                                                surface in the 2000 (out of 2181) directions in which parameters
ate for two reasons: (1) degenerate directions in parameter
                                                                have been determined the least. The rightmost plot shows that in
space provide minimal structure in the loss surface, shown      degenerate parameter directions the loss is constant.
in Section 5.1; (2) parameter perturbations in degenerate
directions do not provide diversity in the function-space
representation of the model, shown in Section 5.2. We refer     rections, if we deviate from the optimum far enough the
to the directions in which parameters have been determined,     loss will eventually become large. However to observe this
directions of high curvature, as determined.                    increase in loss requires perturbations to the parameters that
                                                                are significantly larger in norm than θ∗ .
To empirically test our hypotheses regarding degenerate di-
rections in loss surfaces and function space diversity, we
train a neural network classifier on 1000 points generated      5.2. Degenerate Parameters Lead to Homogeneous
from the two-dimensional Swiss roll data, with a similar             Models
setup to Huang et al. (2019), using Adam with a learning        In this section we show that degenerate parameter directions
rate of 0.01 (Kingma & Ba, 2015). The network is fully          do not contain diverse models. This result is not at odds
connected, consisting of 5 hidden layers each 20 units wide     with the notion that flat regions in the loss surface can lead
(plus a bias term), and uses ELU activations with a total       to diverse but high performing models. Rather, we find
of 2181 parameters. We choose a small model with two-           that there is a subspace in which the loss is constant and
dimensional inputs so that we can both tractably compute        one cannot find model diversity, noting that this subspace
all the eigenvectors and eigenvalues of the Hessian and vi-     is distinct from those employed by works such as Izmailov
sualize the functional form of the model. To demonstrate        et al. (2019) and Huang et al. (2019). This finding leads to
the breadth of these results, we provide comparable visual-     an interpretation of effective dimensionality as model com-
izations in the Appendix E, but for a convolutional network     pression, since the undetermined directions do not contain
trained on CIFAR-10.                                            additional functional information.

5.1. Loss Surfaces as Determined by the Hessian                 We wish to examine the functional form of models obtained
                                                                by perturbing the parameters found through training, θ∗ .
To examine the loss surface more closely, we visualize low      Perturbed parameters are computed as
dimensional projections. To create the visualizations, we
first define a basis given by a set of vectors, then choose a                                                 Bv
                                                                                           θ ← θ∗ + s                                           (5)
two random vectors, u and ve, within the span of the basis.                                                 ||Bv||2
We use Gram-Schmidt to orthogonalize ve with respect to
u, ultimately giving u and v with u ⊥ v. We then compute        where B ∈ Rk×d is a d dimensional basis in which we wish
the loss at parameter settings θ on a grid surrounding the      to perturb θ∗ , and v ∼ N (0, Id ), giving Bv as a random
optimal parameter set, θ∗ , which are given by                  vector from within the span of some specified basis (i.e. the
                                                                dominant or minimal eigenvectors). The value s is chosen
                    θ ← θ∗ + αu + βv                     (4)    to determine the scale of the perturbation, i.e. the length of
                                                                the random vector by which the parameters are perturbed.
for various α and β values such that all points on the grid
are evaluated.                                                  Experimentally, we find that in a region near the optimal pa-
                                                                rameters θ∗ , i.e. s ≤ ||θ∗ ||2 /2 the function-space diversity
By selecting the basis in which u and v are defined we can
                                                                of the model is contained within the subspace of determined
specifically examine the loss in determined and degenerate
                                                                directions. While the degenerate directions contain wide
directions. Figure 6 shows that in determined directions,
                                                                ranges of parameter settings with low loss, the models are
the optimum appears extremely sharp. Conversely, in all
                                                                equivalent in function space.
but the most determined directions, the loss surface loses
all structure and appears constant. Even in degenerate di-      Figure 7 shows the trained classifier and the differences
                                                                                  Effective Dimensionality Revisited
      Original Model               Low Curvature Differences          High Curvature Differences   1.05
15                            15                                 15
                                                                                                   0.90
                                                                                                                            by a model in terms of minimum description length, by
10                            10                                 10
                                                                                                                            examining the Occam factor (MacKay, 2003, Chapter 28).




                                                                                                      Absolute Difference
                                                                                                   0.75
 5                             5                                  5
 0                             0                                  0
                                                                                                   0.60                     For model M with parameters θ, we find the Occam factor
                                                                                                   0.45
 5                             5                                  5                                                         in decomposing the evidence as,
                                                                                                   0.30
10                            10                                 10
                                                                                                   0.15                                                                        1
15
     10     0      10
                              15
                                       10       0     10
                                                                 15
                                                                          10      0      10        0.00                     p(D|Mi ) ≈ p(D|θM P , M) × p(θM P |M)det− 2 (Hθ /2π),
                   Modified Decision Boundary          Original Decision Boundary
                                                                                                                                       |    {z     } |            {z           }
                                                                                                                             Evidence ≈      Likelihood ×         Occam Factor
Figure 7. Swiss roll data. Left: Adam trained feed-forward, fully                                                                                                               (6)
connected classifier. Center: Differences in original and per-                                                              in which Hθ is the Hessian of the loss, and θM P is the
turbed classifier when parameters are perturbed by in low curva-                                                            maximum a posteriori estimate of the parameters.
ture, degenerate directions. Right: Differences in the original
and perturbed classifier when parameters are perturbed in high                                                              As the eigenvalues of the Hessian decay and the effective
curvature directions. Note the perturbation in the center plot is                                                           dimensionality decreases, the determinant of the Hessian
approximately 100 times the size of that of the plot on the right.                                                          also decreases, causing the Occam factor to increase, and
                                                                                                                            the description length to decrease, providing a better com-
                                                                                                                            pression. MacKay (1992b) and MacKay (2003) contains a
                                                                                                                            further discussion of the connection between Occam factors
in function-space between the trained classifier and those
                                                                                                                            and minimum description length. These connections also
generated from parameter perturbations. We compare per-
                                                                                                                            help further explain the practical success of optimization
turbations of size ||θ∗ ||2 /2 ≈ 10 in the direction of the 500
                                                                                                                            procedures that select for flat regions of the loss (Izmailov
minimal eigenvectors and perturbations of size 0.1 in the
                                                                                                                            et al., 2018; Keskar et al., 2017).
directions of the 3 maximum eigenvectors. A perturbation
from the trained parameters in the directions of low curva-
ture (center plot in Figure 7) still leads to a classifier that                                                             6. Double Descent and Effective
labels all points identically. A perturbation roughly 100                                                                      Dimensionality
times smaller the size in directions in which parameters
have been determined leads to a substantial change in the                                                                   The principle of Occam’s razor suggests we want a model
decision boundary of the classifier.                                                                                        that is as simple as possible while still fitting the training
                                                                                                                            data. By the same token we ought to desire a model with low
However, the change in the decision boundary resulting                                                                      effective dimensionality. Low effective dimensionality indi-
from perturbations in determined directions is not neces-                                                                   cates that the model is making full use of a smaller number
sarily desirable. One need not perturb parameters in either                                                                 of parameters, providing a better compression of the data,
determined or degenerate directions to perform a down-                                                                      and thus likely better generalization. The phenomenon of
stream task such as ensembling. Here, we are showcasing                                                                     double descent of the generalization performance in both lin-
the degeneracy of the subspace of parameter directions that                                                                 ear and deep models has attracted recent attention (Nakkiran
have not been determined by the data. This result highlights                                                                et al., 2019; Belkin et al., 2019a); here, we explain double
that despite having many parameters the network could be                                                                    descent by effective dimensionality.
described by a relatively low dimensional subspace.
                                                                                                                            We find that for models in which the training loss converges
                                                                                                                            to near zero, the effective dimensionality corresponds re-
5.3. Effective Dimensionality as Compression
                                                                                                                            markably well to generalization performance, despite having
In Section 5.2 we showed that effective dimensionality re-                                                                  been determined only from training data. For models that
lates to the number of parameter directions in which the                                                                    are only just able to achieve zero training error, but general-
functional form of the model is sensitive to perturbations,                                                                 ize poorly due to overfitting, the effective dimension is high.
and that in the low curvature directions given by the Hessian                                                               In these cases high effective dimensionality is due the sensi-
eigenvectors with smallest eigenvalues the model outputs                                                                    tivity of the fit to the precise settings of the parameters. As
are largely unchanged by perturbations to the parameters.                                                                   the model changes and grows, there exist a greater variety
The presence of these degenerate directions suggests that                                                                   of subspaces which provide more effective compressions
we can disregard high dimensional subspaces that contain                                                                    of the data, and thus we achieve a lower effective dimen-
little information about the model, for compression into a                                                                  sionality. We demonstrate the correspondence of effective
smaller subspace containing only the most important pa-                                                                     dimensionality to generalization performance in the regime
rameter directions given by the eigenvalues of the Hessian.                                                                 with near-zero training loss for both linear models and deep
This observation helps explain the practical success of such                                                                neural networks.
subspace approaches (Izmailov et al., 2019; Li et al., 2018).
                                                                                                                            In short, double descent is an artifact of overfitting. As the
We can also understand the compression of the data provided                                                                 dimensionality of the parameter space continues to increase
                                                                Effective Dimensionality Revisited

                                                                                                       curve shown by Nakkiran et al. (2019).6 We compute the




                                                                            Effective Dimensionality
       2.0
                 Test Error                                                 6

       1.5
                 Train Error                                                                           effective dimensionality of the model using 100 eigenvalues
                 Effective Dimensionality                                   4
                                                                                                       as calculated from a GPU accelerated Lanczos in GPyTorch
Risk




       1.0
                                                                            2                          (Gardner et al., 2018). In Figure 1 we see effective di-
       0.5
                                                                                                       mensionality tracks remarkably well with generalization —
                                                                            0
       0.0
             0   50       100      150      200     250   300      350    400                          displaying the double descent curve that is seen in the test
                                    Number of Features                                                 error. We emphasize again that the effective dimensionality
                                                                                                       is computed using solely the training data, supporting the
Figure 8. Demonstration of double descent for linear models with                                       hypothesis that the eigenvalues of the Hessian matrix can
an increasing number of features. We plot the effective dimension-                                     provide a good proxy for generalization performance. In
ality of the Hessian of the loss. In the regime with near-zero train
                                                                                                       Appendix F, we test small neural networks on a problem for
error, the test error is almost entirely explained by the effective
                                                                                                       which we can compute all of the eigenvalues replicating a
dimensionality, which is computed on the train set alone. The
red region corresponds to underparameterized models, yellow to                                         similar finding to Figure 1 as width increases.
critically parameterized models, and green to overparameterized                                        In addition to test loss, we also demonstrate that effective
models.                                                                                                dimensionality tracks double descent in test error in Fig-
                                                                                                       ure A.7 (Appendix). Double descent is clearly present for
                                                                                                       test loss on CIFAR-100, but not test error. As we discussed
                                                                                                       at the beginning of Section 6, double descent is an artifact
past the point where the corresponding models achieve zero                                             of overfitting. To produce double descent for test error, we
training error, flat regions of the loss occupy a greatly in-                                          follow the setup in Nakkiran et al. (2019) and introduce 20%
creasing volume (Huang et al., 2019), and are thus more                                                label corruption, which increases the chance of overfitting.
easily discoverable by optimization procedures such as SGD.                                            We also show additional results for double descent in Fig-
These solutions have lower effective dimensionality, and                                               ures 9a and 9b, where we compare with other generalization
thus provide better lossless compressions of the data, as in                                           measures that are described in Section 7.
Section 5.3, and therefore better generalization. In concur-
rent work, Wilson & Izmailov (2020) show that exhaustive                                               6.3. Networks of Varying Width and Depth
Bayesian model averaging over multiple modes eliminates
                                                                                                       Double descent experiments typically only consider in-
double descent.
                                                                                                       creases in width. However, it is depth which has endowed
                                                                                                       neural networks with distinctive generalization properties.
6.1. Double Descent on Linear Models
                                                                                                       In Figure 2, we consider varying both the width and depth of
Although double descent is often associated with neural net-                                           a convolutional neural network on the CIFAR-100 dataset.
works, we here demonstrate similar behaviour with a linear                                             We measure effective dimensionality, training loss, and test-
model with a varying number of features: first drawing 200                                             ing loss. The yellow curves show networks with a con-
data points y ∼ N (0, 1) and then drawing 20 informative                                               stant number of parameters, indicating the simple parameter
features y + , where  ∼ N (0, 1), before drawing k − 20                                              counting is not a good proxy for generalization. However, in
features that are also just random Gaussian noise, where k                                             the region of near-zero training loss, separated by the green
is the total number of features in the model.5 For the test                                            curve, we see effective dimensionality closely matches gen-
set, we repeat the generative process. In Figure 8 we show                                             eralization performance. Moreover, wide but shallow mod-
a pronounced double descent curve in the test error as we                                              els tend to overfit, providing low training loss, but high effec-
increase the number of features, which is mirrored by the                                              tive dimensionality and test loss. On the other hand, deeper
effective dimensionality.                                                                              models have lower test loss and lower effective dimension-
                                                                                                       ality, showing that depth enables a better compression of
6.2. Double Descent for Deep Models                                                                    the data.

We demonstrate and explain double descent as a function
of the effective dimensionality for deep neural networks.                                              7. Effective Dimensionality as a
Nakkiran et al. (2019) demonstrated that double descent                                                   Generalization Measure
can also occur for modern deep neural networks including                                               We have shown, for the first time, that a generalization mea-
transformers, CNNs, and ResNets. Following their exper-                                                sure is able to track and explain double descent and width-
imental setup, we train ResNet18s (He et al., 2016) with                                               depth trade-offs in modern deep networks. Here we compare
varying width parameters, reproducing the double descent                                               effective dimensionality with alternative norm- and flatness-
  5
    From  https://github.com/ORIE4741/demos/                                                              6
                                                                                                              See Appendix G for training details.
blob/master/double-descent.ipynb.
                                                      Effective Dimensionality Revisited

based measures. We choose path-norm and a PAC-Bayesian                                           Test loss    Test Error     Gen. Gap
based sharpness measure, due to their good performance                      Nef f (Hessian)      0.9434        0.9188         0.9429
on other problems in prior work (Jiang et al., 2019; Keskar                  PAC-Bayes           −0.8443      −0.7372        −0.8597
et al., 2017; Neyshabur et al., 2017). We compute the norms                Mag. PAC-Bayes         0.7066       0.8270         0.6805
as in Jiang et al. (2019) for a neural network function f (x; θ)             Path-Norm            0.5598       0.7216         0.5259
with input x and weights θ.                                                Log Path-Norm          0.9397       0.9846         0.9257
The path-norm is the square root of the sum of the outputs               Table 1. Sample Pearson correlation with generalization on double
produced by a forwards pass on an input of all ones,                     descent for ResNet18s of varying width on CIFAR-100 with a
                                X             1/2                      training loss below 0.1.
            µpath-norm (f ) =        f (1; θ2 )     .            (7)
                                                                                                 Test loss    Test Error     Gen. Gap
with the parameters θ squared (Eq. 44 of Jiang et al. (2019)).              Nef f (Hessian)       0.9305       0.9461         0.9060
Through squaring the weights and taking the square root                      PAC-Bayes           −0.8619      −0.7916        −0.8873
of the output, we form a correspondence between the path-                  Mag. PAC-Bayes         0.8724       0.9225         0.8330
norm and the `2 norm of all paths within a network from an                   Path-Norm            0.7996       0.7721         0.7511
input node to an output node (Neyshabur et al., 2017).                     Log Path-Norm         0.9781        0.9402         0.9602
The PAC-Bayesian flatness measure of Jiang et al. (2019),                Table 2. Sample Pearson correlation with generalization for CNNs
adapted from Dziugaite & Roy (2017) and Keskar et al.                    of varying width and depth on CIFAR-100 with a training loss
(2017), is perturbation-based and computed as                            below 0.1.
                                               1
                 µpac-bayes-sharpness (f ) =      ,              (8)
                                               σ2                        by subtracting the sample mean and dividing by the sample
where σ is the largest value such that                                   standard deviation. We additionally show correlations with
                                                                         generalization in Tables 1 and 2.
       Eu∼N (0,σ2 I) [L(θ + u, D)] ≤ L(θ, D) + 0.1 .             (9)     There are several key take-aways: (1) effective dimension
                                                                         overall provides a better proxy for test loss and test error
In Equation 9, L(θ, D) is the prediction error on the training
                                                                         than the PAC-Bayes or path-norm measures for double de-
dataset of the network with weights θ as computed on data
                                                                         scent and width-depth trade-offs; (2) not all flatness-based
set D. This measure corresponds to a bound on parameter
                                                                         generalization measures are equivalent, and in fact different
perturbations such that increases in training error remain
                                                                         flatness measures can provide wildly different behaviour; (3)
beneath 0.1 in expectation as in Jiang et al. (2019).
                                                                         effective dimension is more stable than the other measures,
We additionally compare to the magnitude aware PAC-                      with relatively consistent behaviour across qualitatively sim-
Bayes bound,                                                             ilar datasets and models; (4) effective dimension is inter-
                                                                         pretable, providing a clear connection with function-space
                                                 1                       and an explanation for why a model should generalize, in
              µmag-pac-bayes-sharpness (f ) =        ,          (10)
                                                σ 02                     addition to an association with generalization.
where σ 0 is the largest value such that                                 In general, path-norm acts only on model parameters, and
                                                                         is thus not directly connected to function-space or the shape
  Eu∼N (0,σ02 |θ|+) [L(θ + u, D)] ≤ L(θ, D) + 0.1 . (11)                of the loss. It should therefore be used with particular cau-
                                                                         tion in comparing different architectures. Indeed, we found
In Equation 11 the variance of the perturbation to each
                                                                         that path-norm tends to quickly saturate with increases in
parameter is scaled according to the magnitude of that pa-
                                                                         model size, with no preference between larger models even
rameter, adding stability by accounting for differences in
                                                                         when these models provide very different generalization
scales, and, implicitly, the size of the perturbation with the
                                                                         performance. We exhaustively considered how path-norm
dimension of the parameter space. The value of  is taken
                                                                         could be made to provide reasonable performance on these
to be 0.001 as in Jiang et al. (2019) and serves to regularize
                                                                         problems. For smaller models, the path-norm is orders of
the distribution, preventing the distribution from collapsing
                                                                         magnitude larger than the path-norm computed on larger
in the presence of weights that are close to 0.
                                                                         models. We therefore performed a log transform, which
We extend the results of Figures 1 and 2 in Figure 9, for dou-           to our knowledge has not been considered before. We sur-
ble descent and wide-depth trade-offs, to include the path-              prisingly found the log transform dramatically improves the
norm and PAC-Bayesian flatness measures. We display test                 correlation of path-norm to generalization performance for
loss, test error, and generalization measures, standardized              comparing amongst large convolutional nets and residual
                                                                           Effective Dimensionality Revisited




                2                                                                                                           2


                1                                                                                                           1
Measure (std)




                                                                                                            Measure (std)
                0                                                                                                           0


                1                                                                                                           1


                2                                                                                                           2
                    10            20     30               40               50              60                                        10           20                          30       40       50          60
                                          Width                                                                                                                                Width
                          Test Loss    PAC Bayes                       Path Norm                                                          Test Loss                 PAC Bayes               Path Norm
                          Test Error   Mag. PAC Bayes                  Log Path Norm                                                      Test Error                Mag. PAC Bayes          Log Path Norm
                                       Neff(Hessian)                                                                                                                Neff(Hessian)

                         (a) Double Descent, No Label Noise                                                                            (b) Double Descent, 20% Label Noise
                                                                                Test Loss                         Test Error
                                                                       6                            6
                                                               Depth




                                                                       4                            4                                                  2.0
                                                                       2                            2
                                                                                                                                                       1.5
                                                                           20 28 36 44 52               20 28 36 44 52
                                                                                                                                                       1.0
                                                           Neff(Hessian)                        PAC Bayes                       Mag. PAC Bayes
                                                                                                                                                              Measure (std)
                                                      6                             6                                       6                          0.5
                                              Depth




                                                      4                             4                                       4                          0.0
                                                      2                             2                                       2                           0.5
                                                          20 28 36 44 52                   20 28 36 44 52                       20 28 36 44 52
                                                                                                                                                        1.0
                                                                                Path Norm               Log Path Norm
                                                                                                                                                        1.5
                                                                       6                            6
                                                               Depth




                                                                       4                            4                                                   2.0

                                                                       2                            2
                                                                           20 28 36 44 52               20 28 36 44 52
                                                                                  Width                                 Width

                                                                                          (c) Width vs. Depth

  Figure 9. Comparing effective dimensionality as a generalization measure to the path-norm, log path-norm, PAC-Bayes, and magnitude
  aware PAC-Bayes flatness measure from Jiang et al. (2019) for double descent without (a) and with (b) label noise, and (c) width-depth
  trade-offs. We find that among models that achieve low train loss, effective dimensionality most closely follows the trends in both test
  error and test loss. Path-norm is very large for small models where generalization performance is poor, and the PAC-Bayes measure grows
  with model size. In panel (c) the green curve separates models that achieve below 0.1 training error. Additionally, we standardize all
  measures and test error to 0 mean and unit variance for comparison.
                                              Effective Dimensionality Revisited

nets. However, this modified measure is still only associ-       ble descent, posterior contraction, loss surface structure,
ated with generalization, is highly sensitive to experimental    and function-space diversity of models. As we have seen,
details (e.g. size of models being compared), and does not       simple parameter counting can be a misleading proxy for
provide any direct intuition for model comparison given its      model complexity and generalization performance; models
reliance on parameters alone.                                    with many parameters combined with a particular functional
                                                                 form can give rise to simple explanations for data. Indeed,
In the PAC-Bayesian measure used in Jiang et al. (2019) we
                                                                 we have seen how depth and width have different effects on
consider flatness around the solution in arbitrary directions.
                                                                 generalization performance, regardless of the total number
In Eq. 9 we are considering an expectation over random per-
                                                                 of parameters in the model. In all cases, effective dimen-
turbations, ultimately measuring the size of the region of low
                                                                 sionality tracks generalization performance for models with
loss around an optimum in the loss surface. We see that this
                                                                 comparable training loss, helping to explain behaviour that
PAC-Bayesian measure actually increases with model size
                                                                 appears mysterious when measured against simple parame-
and is anti-correlated with generalization performance. For
                                                                 ter counting. Moving forward, we hope our work will help
a fixed value of σ the average magnitude of the perturbation,
                                                                 inspire a continued effort to capture the nuanced interplay
u, will increase as the number of parameters in the model
                                                                 between the statistical properties of parameter space and
increases. To combat the growth in magnitude of the pertur-
                                                                 function space in understanding generalization behaviour.
bation, σ must become smaller as the number of parameters
in the model (i.e. the dimensionality of u) grows. The nec-
essary decay in σ as models grow leads to the measure in         Acknowledgements
Eq. 8 becoming larger, as we see in practice. For the models     WJM, GB, and AGW were supported by an Amazon Re-
that overfit the training data between widths 8 and 12, the      search Award, Facebook Research, NSF I-DISRE 193471,
parameters are highly sensitive to perturbations, and PAC-       NIH R01 DA048764-01A1, NSF IIS-1563887, and NSF IIS-
Bayesian bounds increase by 3 to 4 orders of magnitude.          1910266. WJM was additionally supported by an NSF Grad-
Therefore, for clarity, we exclude the PAC-Bayesian bounds       uate Research Fellowship under Grant No. DGE-1839302.
for models under 15 units wide, as the presence of a small       We would like to thank Jayson Salkey and Pavel Izmailov
number of ill-behaved points prevents the overall structure      for helpful discussions and Coffee Project NY for their de-
of the bounds for larger models from being visible. This         constructed lattes.
effect is still pronounced in the experiment with label noise
in Figure 9b, making the significant increase in the mea-
sure with model size less visible (seen also in Figure A.8).
                                                                 References
We additionally compute the magnitude-aware PAC-Bayes            Achille, A. and Soatto, S. Emergence of invariance and
measure which helps mitigate these issues, though they still       disentanglement in deep representations. The Journal of
persist to an extent.                                             Machine Learning Research, 19(1):1947–1980, 2018.
Not all flatness-based generalization measures are equiv-        Bartlett, P. L., Long, P. M., Lugosi, G., and Tsigler, A.
alent. In contrast to the PAC-Bayesian flatness measure            Benign overfitting in linear regression. arXiv preprint
considered in Jiang et al. (2019), effective dimension essen-      arXiv:1906.11300, 2019.
tially computes the number of directions in parameter space
that are flat, as determined by the curvature of the loss sur-   Belkin, M., Hsu, D., Ma, S., and Mandal, S. Reconciling
face. Combined with our observations about function-space          modern machine-learning practice and the classical bias–
homogeneity in Section 5, we see that effective dimension          variance trade-off. Proceedings of the National Academy
provides a proxy for model compression, which is in in-            of Sciences, 116(32):15849–15854, 2019a.
formative about generalization performance, in addition
to providing correlation with performance. By contrast,          Belkin, M., Hsu, D., and Xu, J. Two models of double de-
the PAC-Bayes flatness measure considers the size of the           scent for weak features. arXiv preprint arXiv:1903.07571,
basin surrounding an optimum, and is highly sensitive to           2019b.
the sharpest direction. Accordingly, we find that effective
dimension tends to be significantly more robust to experi-       Bingham, E., Chen, J. P., Jankowiak, M., Obermeyer, F.,
mental details than both the PAC-Bayes flatness measure            Pradhan, N., Karaletsos, T., Singh, R., Szerlip, P., Hors-
and path-norm.                                                     fall, P., and Goodman, N. D. Pyro: Deep universal proba-
                                                                   bilistic programming. The Journal of Machine Learning
                                                                   Research, 20(1):973–978, 2019.
8. Conclusion
                                                                 Bös, S., Kinzel, W., and Opper, M. Generalization ability
We have shown how effective dimensionality can be used             of perceptrons with continuous outputs. Physical Review
to gain insight into a range of phenomena, including dou-          E, 47(2):1384, 1993.
                                              Effective Dimensionality Revisited

Caponnetto, A. and Vito, E. D. Optimal rates for the             Hastie, T., Montanari, A., Rosset, S., and Tibshirani, R. J.
  regularized least-squares algorithm. Foundations of              Surprises in High-Dimensional Ridgeless Least Squares
  Computational Mathematics, 7(3):331–368, 2007. doi:              Interpolation. arXiv:1903.08560, November 2019.
  10.1007/s10208-006-0196-8. URL https://doi.
  org/10.1007/s10208-006-0196-8.                                 He, K., Zhang, X., Ren, S., and Sun, J. Identity mappings
                                                                   in deep residual networks. In European conference on
Chaudhari, P., Choromanska, A., Soatto, S., LeCun, Y., Bal-        computer vision, pp. 630–645. Springer, 2016.
  dassi, C., Borgs, C., Chayes, J., Sagun, L., and Zecchina,
  R. Entropy-SGD: Biasing gradient descent into wide             Hinton, G. E. and Van Camp, D. Keeping the neural net-
  valleys. Journal of Statistical Mechanics: Theory and            works simple by minimizing the description length of the
  Experiment, 2019.                                                weights. In Proceedings of the sixth annual conference
                                                                   on computational learning theory, pp. 5–13, 1993.
Cleveland, W. S. Robust locally weighted regression and
  smoothing scatterplots. Journal of the American statisti-      Hochreiter, S. and Schmidhuber, J.     Flat Min-
  cal association, 74(368):829–836, 1979.                          ima.      Neural Computation, 9(1):1–42, 1997.
                                                                   URL            https://www.bioinf.jku.at/
Dobriban, E. and Wager, S. High-dimensional asymp-                 publications/older/3304.pdf.
  totics of prediction: Ridge regression and classifica-
  tion. Ann. Statist., 46(1):247–279, 02 2018. doi:              Hoffman, M. D. and Gelman, A. The no-u-turn sampler:
 10.1214/17-AOS1549. URL https://doi.org/10.                       adaptively setting path lengths in hamiltonian monte carlo.
 1214/17-AOS1549.                                                 Journal of Machine Learning Research, 15(1):1593–1623,
                                                                   2014.
Dziugaite, G. K. and Roy, D. M. Computing nonvacuous
  generalization bounds for deep (stochastic) neural net-        Huang, W. R., Emam, Z., Goldblum, M., Fowl, L., Terry,
  works with many more parameters than training data.             J. K., Huang, F., and Goldstein, T. Understanding
  Uncertainty in Artificial Intelligence (UAI), 2017.              generalization through visualizations. arXiv preprint
                                                                   arXiv:1906.03291, 2019.
Friedman, J., Hastie, T., and Tibshirani, R. The elements
  of statistical learning. Springer series in statistics New     Izmailov, P., Podoprikhin, D., Garipov, T., Vetrov, D., and
  York, 2001.                                                      Wilson, A. G. Averaging weights leads to wider optima
                                                                   and better generalization. In Uncertainty in Artificial
Fukumizu, K., Yamaguch, S., Mototake, Y.-i., and Tanaka,           Intelligence, 2018. URL arXiv:1803.05407.
  M. Semi-flat minima and saddle points by embedding
  neural networks to overparameterization. In Advances in        Izmailov, P., Maddox, W. J., Kirichenko, P., Garipov, T.,
  neural information processing systems, 2019.                     Vetrov, D., and Wilson, A. G. Subspace inference for
                                                                   bayesian deep learning. Uncertainty in Artificial Intelli-
Gardner, J. R., Pleiss, G., Bindel, D., Weinberger, K. Q., and     gence (UAI), 2019.
  Wilson, A. G. Gpytorch: Blackbox matrix-matrix gaus-
  sian process inference with gpu acceleration. In Advances      Jacot, A., Gabriel, F., and Hongler, C. Neural tangent kernel:
  in Neural Information Processing Systems, 2018.                  Convergence and generalization in neural networks. In
                                                                   Advances in neural information processing systems, pp.
Geman, S., Bienenstock, E., and Doursat, R. Neural net-            8571–8580, 2018.
  works and the bias/variance dilemma. Neural computa-
  tion, 4(1):1–58, 1992.                                         Jiang, Y., Neyshabur, B., Mobahi, H., Krishnan, D., and
                                                                    Bengio, S. Fantastic generalization measures and where
Ghorbani, B., Krishnan, S., and Xiao, Y. An investigation           to find them. arXiv preprint arXiv:1912.02178, 2019.
  into neural net optimization via hessian eigenvalue den-
  sity. In International Conference on Machine Learning,         Keskar, N. S., Mudigere, D., Nocedal, J., Smelyanskiy,
  2019. URL arXiv:1901.10159.                                      M., and Tang, P. T. P. On large-batch training for deep
                                                                   learning: Generalization gap and sharp minima. Interna-
Gull, S. F. Developments in maximum entropy data analysis.         tional Conference on Learning Representations (ICLR)
  In Maximum entropy and Bayesian methods, pp. 53–71.              arXiv:1609.04836, 2017.
  Springer, 1989.
                                                                 Kingma, D. P. and Ba, J. Adam: A method for stochas-
Hastie, T. and Tibshirani, R. Generalized additive models.         tic optimization. International Conference on Learning
  Chapman and Hall, London, 1990.                                  Representations (ICLR) arXiv:1412.6980, 2015.
                                              Effective Dimensionality Revisited

LeCun, Y., Boser, B., Denker, J. S., Henderson, D., Howard,      Muthukumar, V., Vodrahalli, K., and Sahai, A. Harmless
  R. E., Hubbard, W., and Jackel, L. D. Backpropagation           interpolation of noisy data in regression. arXiv preprint
  applied to handwritten zip code recognition. Neural Com-        arXiv:1903.09139, 2019.
  putation, 1(4):541–551, 1989. doi: 10.1162/neco.1989.1.
  4.541. URL https://doi.org/10.1162/neco.                       Nakkiran, P., Kaplun, G., Bansal, Y., Yang, T., Barak,
  1989.1.4.541.                                                    B., and Sutskever, I. Deep double descent: Where
                                                                   bigger models and more data hurt. arXiv preprint
LeCun, Y., Kanter, I., and Solla, S. A. Eigenvalues of covari-     arXiv:1912.02292, 2019.
  ance matrices: Application to neural-network learning.
  Physical Review Letters, 66(18):2396, 1991.                    Neal, R. M. and Zhang, J. High Dimensional Classifi-
                                                                   cation with Bayesian Neural Networks and Dirichlet
Lee, J., Xiao, L., Schoenholz, S. S., Bahri, Y., Sohl-
                                                                   Diffusion Trees. In Guyon, I., Nikravesh, M., Gunn,
  Dickstein, J., and Pennington, J. Wide neural networks of
                                                                   S., and Zadeh, L. A. (eds.), Feature Extraction: Foun-
  any depth evolve as linear models under gradient descent.
                                                                   dations and Applications, Studies in Fuzziness and
  In Advances in Neural Information Processing Systems,
                                                                   Soft Computing, pp. 265–296. Springer, Berlin, Heidel-
  2019.
                                                                   berg, 2006. ISBN 978-3-540-35488-8. doi: 10.1007/
Li, C., Farkhoor, H., Liu, R., and Yosinski, J. Measuring          978-3-540-35488-8 11. URL https://doi.org/
  the intrinsic dimension of objective landscapes. arXiv           10.1007/978-3-540-35488-8_11.
  preprint arXiv:1804.08838, 2018.
                                                                 Nelder, J. A. and Wedderburn, R. W. Generalized linear
MacKay, D. J. Bayesian model comparison and backprop               models. Journal of the Royal Statistical Society: Series A
 nets. In Advances in neural information processing sys-          (General), 135(3):370–384, 1972.
 tems, pp. 839–846, 1992a.
                                                                 Neyshabur, B., Bhojanapalli, S., McAllester, D., and Sre-
MacKay, D. J. Bayesian interpolation. Neural computation,          bro, N. Exploring generalization in deep learning. In
 4(3):415–447, 1992b.                                             Advances in Neural Information Processing Systems, pp.
MacKay, D. J. Information theory, inference and learning           5947–5956, 2017.
 algorithms. Cambridge university press, 2003.
                                                                 Opper, M., Kleinz, J., Kohler, H., and Kinzel, W. Basins
Maddox, W. J., Garipov, T., Izmailov, P., Vetrov, D., and          of attraction near the critical storage capacity for neural
 Wilson, A. G. A simple baseline for bayesian uncertainty          networks with constant stabilities. Journal of Physics A:
 in deep learning. In Advances in neural information              Mathematical and General, 22(9):L407, 1989.
 processing systems, 2019a.
                                                                 Opper, M., Kinzel, W., Kleinz, J., and Nehl, R. On the
Maddox, W. J., Tang, S., Moreno, P. G., Wilson, A. G.,             ability of the optimal perceptron to generalise. Journal
 and Damianou, A. On Linearizing Neural Networks                   of Physics A: Mathematical and General, 23(11):L581,
 for Transfer Learning. NeurIPS MetaLearn Workshop,               1990.
 2019b. URL http://metalearning.ml/2019/
 papers/metalearn2019-maddox.pdf.                                Papyan, V. The full spectrum of deepnet hessians at scale:
                                                                   Dynamics with sgd training and sample size. arXiv
Madras, D., Atwood, J., and D’Amour, A. Detecting                  preprint arXiv:1811.07062, 2018.
 extrapolation with local ensembles. arXiv preprint
 arXiv:1910.09573, 2019.                                         Phan, D., Pradhan, N., and Jankowiak, M. Composable
                                                                   effects for flexible and accelerated probabilistic program-
Mei, S. and Montanari, A. The generalization error of ran-
                                                                   ming in numpyro. arXiv preprint arXiv:1912.11554,
 dom features regression: Precise asymptotics and double
                                                                   2019.
 descent curve. arXiv preprint arXiv:1908.05355, 2019.
Moody, J. E. Note on generalization, regularization and          Rasmussen, C. E. and Williams, C. K. I. Gaussian processes
 architecture selection in nonlinear learning systems. In          for machine learning. Adaptive computation and machine
 Neural Networks for Signal Processing Proceedings of              learning. MIT Press, Cambridge, Mass., 3. print edition,
 the 1991 IEEE Workshop, pp. 1–10. IEEE, 1991.                     2008. ISBN 978-0-262-18253-9.

Moody, J. E. The effective number of parameters: An              Sagun, L., Bottou, L., and LeCun, Y. Eigenvalues of the
 analysis of generalization and regularization in nonlinear        hessian in deep learning: Singularity and beyond. In
 learning systems. In Advances in neural information               ICLR Workshop track, arXiv preprint arXiv:1611.07476,
 processing systems, pp. 847–854, 1992.                            2017.
                                             Effective Dimensionality Revisited

Shazeer, N., Mirhoseini, A., Maziarz, K., Davis, A., Le,
  Q., Hinton, G., and Dean, J. Outrageously large neural
  networks: The sparsely-gated mixture-of-experts layer.
  In International Conference on Learning Representations,
  2017. URL arXiv:1701.06538.
Smith, S. L. and Le, Q. V. A bayesian perspective on
  generalization and stochastic gradient descent. arXiv
  preprint arXiv:1710.06451, 2017.
Sun, S., Zhang, G., Shi, J., and Grosse, R. Functional
  variational bayesian neural networks. In International
  Conference on Learning Representations, 2019. URL
  arXiv:1903.05779.

Suzuki, T. Fast generalization error bound of deep learning
  from a kernel perspective. In Storkey, A. and Perez-Cruz,
  F. (eds.), Proceedings of the Twenty-First International
  Conference on Artificial Intelligence and Statistics, vol-
  ume 84 of Proceedings of Machine Learning Research,
  pp. 1397–1406, Playa Blanca, Lanzarote, Canary Islands,
  09–11 Apr 2018. PMLR.
Szegedy, C., Liu, W., Jia, Y., Sermanet, P., Reed, S.,
  Anguelov, D., Erhan, D., Vanhoucke, V., and Rabinovich,
  A. Going deeper with convolutions. In Proceedings
  of the IEEE conference on computer vision and pattern
  recognition, pp. 1–9, 2015.
van der Vaart, A. W. Asymptotic Statistics. Cambridge
  Series in Statistical and Probabilistic Mathematics.
  Cambridge University Press, Cambridge, 1998. ISBN
  978-0-521-78450-4. doi: 10.1017/CBO9780511802256.
  URL              https://www.cambridge.org/
  core/books/asymptotic-statistics/
  A3C7DAD3F7E66A1FA60E9C8FE132EE1D.
Wilson, A. G. and Izmailov, P. Bayesian deep learning and a
 probabilistic perspective of generalization. arXiv preprint
 arXiv:2002.08791, 2020.
Zhang, C., Bengio, S., Hardt, M., Recht, B., and Vinyals, O.
  Understanding deep learning requires rethinking general-
  ization. International Conference on Learning Represen-
  tations (ICLR) arXiv:1611.03530, 2017.

Zhang, T. Learning bounds for kernel regression using
  effective data dimensionality. Neural Computation, 17
  (9):2077–2098, 2005.
Zhou, W., Veitch, V., Austern, M., Adams, R. P., and Orbanz,
  P. Non-vacuous generalization bounds at the imagenet
  scale: a pac-bayesian compression approach. In Interna-
  tional Conference on Learning Representations, 2018.
                                               Effective Dimensionality Revisited

A. The Hessian and Effective Dimensionality                       With λi as the eigenvalues of A, we can see that
   over the Course of Training                                                           r                       r
                                                                                         X λi + α − λi           X     1
One possible limitation of using the Hessian as a measure-        r − Nef f (A, α) =                       =α
                                                                                         i=1
                                                                                               λi + α               λ +α
                                                                                                                 i=1 i
ment for posterior contraction for (Bayesian) deep learning                               r                 r
would be if the Hessian was constant through the training                                X    1      1     X        1
                                                                                     =                   =
procedure, or if the eigenvalues of the Hessian remained con-                            i=1
                                                                                             1/α λ i + α   i=1
                                                                                                               λ i /α +1
stant. Jacot et al. (2018) showed that in the limit of infinite                          r                    r
width neural networks, the Hessian matrix converges to a
                                                                                         X       1/λi        X      1/λi
                                                                                     =                     =
constant, in a similar manner to how the Fisher information                            i=1
                                                                                           1/λ  (λ
                                                                                               i i /α + 1)   i=1
                                                                                                                 1/α + 1/λi
matrix and Jacobian matrices converge to a constant limit,                           = Nef f (A+ , 1/α).
producing the neural tangent kernel (NTK) (Jacot et al.,
2018). However, Lee et al. (2019) recently showed that            When A is invertible, the result reduces to k−Nef f (A, α) =
while the infinite width NTK is a good descriptor of finitely     Nef f (A−1 , 1/α) for A ∈ Rk×k .
wide neural networks, the corresponding finite width NTK
is not constant throughout training. Similarly, the empirical     B.2. Predictive Risk for Bayesian Linear Models
observations of Papyan (2018), Sagun et al. (2017), and
Ghorbani et al. (2019) demonstrate that even for extremely        Dobriban & Wager (2018) and Hastie et al. (2019) have
wide neural networks, the Hessian is not constant through         extensively studied over-parameterized ridge regression. In
training.                                                         particular, Theorem 2.1 of Dobriban & Wager (2018) gives
                                                                  the predictive risk (e.g. the bias-variance decomposition of
Preliminary experiments with both the Fisher information          Geman et al. (1992)) as a function of effective dimensional-
matrix (using fast Fisher vector products as described in         ity and intrinsic noise. The critical aspect of their proof is
Maddox et al. (2019b)) and the NTK demonstrated similar           to decompose the variance of the estimate into the effective
empirical results in terms of double descent and effective        dimensionality and a second term which then cancels with
dimensionality as the Hessian matrix.                             the limiting bias estimate. For completeness, we restate
                                                                  Theorem 2.1 of Dobriban & Wager (2018) theorem for fixed
B. Further Statements on Effective                                feature matrices, Φ, and an explicit prior on the parameters,
   Dimensionality                                                 β ∼ N (0, α2 I), leaving the proof to the original work.
                                                                  Theorem B.1 (Predictive Risk of Predictive Mean for
In this section, we provide further results the effective di-     Ridge Regression). Under the assumption of model cor-
mensionality, including its connection to both the bias-          rect specification, y = Φβ + , with β drawn from the
variance decomposition of predictive risk (Geman et al.,          prior and  ∼ N (0, In ), and defining fˆ = Φβ̂, with
1992; Dobriban & Wager, 2018) as well as the Hilbert space
                                                                  β̂ = (Φ> Φ + α−2 I)−1 Φ> y (the predictive mean under
norm of the induced kernel (Rasmussen & Williams, 2008).
                                                                  the prior specification), then
B.1. Effective Dimensionality of the Inverse of A                                               1
                                                                   R(Φ) = E(||Y − fˆ||22 ) = 1 + Nef f (ΦΦ> , α−2 ). (13)
                                                                                                n
We show that
                                                                  B.3. Expected RKHS Norm
                                                                  Finally, we show another unexpected connection of the ef-
                                           +
     rank(A) − Nef f (A, α) = Nef f (A , 1/α),            (12)    fective dimensionality — that the reproducing kernel Hilbert
                                                                  space (RKHS) norm is in expectation, under model correct
                                                                  specification, the effective dimensionality. We follow the
                                                                  definition of Gaussian processes of Rasmussen & Williams
                                                                  (2008) and focus on the definition of the RKHS given in Ras-
formalizing the idea that as the effective dimensionality of      mussen & Williams (2008,
the covariance increases, the effective dimensionality of the                           PN Chapter 6), which is defined as
                                                                  ||f ||2H = hf, f iH = i=1 fi2 /λi , where λi are the eigen-
inverse covariance decreases. This statement is alluded to in     values associated with the kernel operator, K, of the RKHS,
the analysis of MacKay (1992b) but is not explicitly shown.       H.7 The kernel is the covariance matrix of the Gaussian pro-
We assume that A has rank r and that α 6= 0; we also assume       cess, and assuming that the response is drawn from the same
that A+ is formed by inverting the non-zero eigenvalues of           7
                                                                      Note that the expectation we take in the following is somewhat
A and leaving the zero eigenvalues fixed in the eigende-          separate than the expectation taken in Rasmussen & Williams
composition of A (i.e. the Moore-Penrose pseudo-inverse).         (2008) which is directly over fi .
                                                 Effective Dimensionality Revisited

model, then y ∼ N (0, K + σ 2 I), then a = (K + σ 2 I)−1 y,         C.1. Contraction in Function Space
where a is the optimal weights
                          PN of the function with respect           We can additionally consider the posterior contraction in
to the kernel, e.g. f = i=1 ai K(x, .). To compute the
                                                                    function space. For linear models, the posterior covariance
Hilbert space norm, we only need to compute the optimal
                                                                    on the training data in function space becomes
weights and the eigenvalues of the operator. For finite (de-
generate) Hilbert spaces this computation is straightforward:                                                 σ 2 −1 >
                                                                             ΦΣβ|D Φ> = σ 2 Φ(Φ> Φ +             Ip ) Φ ,          (16)
                                                                                                              α2
  Ep(y) (||f ||2H ) = Ep(y) (a> Ka)
        = Ep(y) (y > (K + σ 2 I)−1 K(K + σ 2 I)−1 y)                while the prior covariance in function space is given
                                                                    by α2 ΦΦ> . We will make the simplifying assumption
        = Ep(y) tr(y > (K + σ 2 I)−1 K(K + σ 2 I)−1 y)              that the features are normalized such that tr(ΦΦ> ) =
        = Ep(y) tr((K + σ 2 I)−1 K(K + σ 2 I)−1 yy > )              rank(ΦΦ> ) = r. Now, we can simplify
        = tr((K + σ 2 I)−1 K(K + σ 2 I)−1 (K + σ 2 I))               ∆post (f ) = tr(Covp(f ) (f ) − tr(Covp(f |D) (f ))
                        2
        = Nef f (K, σ )                                                                      Xr
                                                                                                       λi
                                                                                = α2 r − σ 2
with the second equality coming by plugging in the opti-                                     i=1
                                                                                                  λi + σ 2 /α2
mal a (see Rasmussen & Williams (2008, Chapter 6) and                                 r
                                                                                      X λi + σ 2 /α2
                                                                                                                 r
                                                                                                                 X       λi
Belkin et al. (2019a) as an example). As linear models                         = α2                       − σ2
                                                                                         λ + σ 2 /α
                                                                                      i=1 i
                                                                                                        2           λ
                                                                                                                 i=1 i
                                                                                                                       + σ 2 /α2
with Gaussian priors are Gaussian processes with a degener-
                                                                                        r                          r
ate feature expansion, the expected RKHS norm becomes                                   X     λi           X      1
Nef f (Φ> Φ, σ 2 /α2 ), which is the same value as our defini-          = (α2 − σ 2 )           2   2
                                                                                                      + σ2                .
                                                                                           λ + σ /α
                                                                                        i=1 i
                                                                                                              λ + σ 2 /α2
                                                                                                           i=1 i
tion of posterior contraction. Further research connecting
these two ideas is needed.
                                                                    Simplifying and recognizing these summations as the effec-
C. Measuring Posterior Contraction in                               tive dimensionalities of Φ> Φ and (Φ> Φ)+ , we get that
   Bayesian Generalized Linear Models
                                                                       ∆post (f ) = (α2 − σ 2 )Nef f (Φ> Φ, σ 2 /α2 )
We first consider the over-parametrized case, k > n:
                                                                                            + σ 2 Nef f ((Φ> Φ)+ , α2 /σ 2 )       (17)
                                                                                        2        2       2             >   2   2
                                                                                  = σ r + (α − 2σ )Nef f (Φ Φ, σ /α ),
   ∆post (θ) = tr(Covp(θ) (θ)) − tr(Covp(θ|D) (θ))                  thereby showing that the posterior contraction in function
                 k
                 X          n
                            X                 k
                                              X                     space is explicitly tied to the effective dimensionality of the
             =         α2 −   (λi + α−2 )−1 +   α2                  Gram matrix.
                 i=1        i=1                    i=n+1
                                       n
             = kα2 − (k − n)α2 −
                                       X
                                             (λi + α−2 )−1          D. Posterior Contraction and Function-Space
                                       i=1                             Homogeneity Proofs and Additional
                 n
                 X 1 − α2 (λi + α−2 )                                  Theorems
             =
                 i=1
                            λi + α−2                                In this section we complete the proofs to Theorems 4.1 and
                    n
                    X     λi                                        4.2 and extend the results from linear models to generalized
             = α2              ;                             (14)   linear models.
                       λ + α−2
                    i=1 i

where we have used Theorem 4.1 to assess the eigenvalues            D.1. Proof and Extensions to Theorem 4.1
of the posterior covariance. When n > k, we have the sim-           Theorem (Posterior Contraction in Bayesian Linear Mod-
plified setting where the summation becomes to k instead            els). Let Φ = Φ(x) ∈ Rn×k be a feature map of n data
of n, giving us that all of the eigenvalues are shifted from        observations, x, with n < k and assign isotropic prior
their original values to become λi + α−2 , and so                   β ∼ N (0k , S0 = α2 Ik ) for parameters β ∈ Rk . Assuming
                                  k
                                                                    a model of the form y ∼ N (Φβ, σ 2 In ) the posterior distri-
                                  X      λi                         bution of β has an p − k directional subspace in which the
             ∆post. (θ) = α−2                  ,             (15)
                                  i=1
                                      λi + α−2                      variance is identical to the prior variance.

where λi is the ith eigenvalue of Φ> Φ/σ 2 .                        Proof. The posterior distribution of β in this case is known
                                                   Effective Dimensionality Revisited

and given as                                                           we also rotate the feature matrix, Φ̃ = ΦR> ∈ Rn×k so
                                                                       that Φ̃β̃ = ΦR> Rβ = Φβ, showing that the likelihood and
            β|D ∼ N ((µ|D), (Σ|D))                                     posterior remain unchanged under such transformations.
            µ|D = (Φ> Φ/σ 2 + S0−1 )−1 Φ> y/σ 2               (18)     In the overparameterized regime, k > n, with linearly in-
            Σ|D = (Φ Φ/σ>      2
                                   + S0−1 )−1                          dependent features we have that Φ has rank at most k, and
                                                                       we can therefore choose R to be a rotation such that ΦR
We want to examine the distribution of the eigen-                      has exactly k − n columns that are all 0. This defines a
values of the posterior variance. Let Φ> Φ/σ 2 =                       k − n dimensional subspace of β ∈ Rk in which the the
V λn V > be the eigendecomposition with eigenvalues Λ =                likelihood is unchanged. Therefore the posterior remains no
diag(γ1 , . . . , γn , 0n+1 , . . . , 0k ); k − n of the eigenvalues   different from the prior distribution in this subspace, or in
are 0 since the gram matrix Φ> Φ is at most rank n by con-             other words, the posterior distribution has not contracted in
struction.                                                             k − n dimensions.
Substitution into the posterior variance of β yields,
                                                                       D.2. Function-Space Homogeneity
     (Φ> Φ/σ 2 + S0−1 )−1 = (V ΛV > + α−2 Ik )−1
                                                                       Theorem (Function-Space Homogeneity in Linear Mod-
                              = V (Λ + α−2 Ik )−1 V >         (19)     els). Let Φ = Φ(x) ∈ Rn×k be a feature map of n data
                              = V ΓV > .                               observations, x, with n < k and assign isotropic prior
                                                                       β ∼ N (0k , S0 = α2 Ik ) for parameters β ∈ Rk . The mini-
The      eigenvalues        of   the      posterior        covari-     mal eigenvectors of the Hessian define a k − n dimensional
ance matrix are given by the entries                       of  Γ,      subspace in which parameters can be perturbed without
 (γ1 + α−2 )−1 , . . . , (γn + α−2 )−1 , α2 , . . . , α2 , where
                                                        
                                                                       changing the training predictions in function-space.
there are k − n eigenvalues that retain a value of α2 .
Therefore the posterior covariance has p − n directions in             Proof. The posterior covariance matrix for the parameters
which the posterior variance is unchanged and n directions             is given by
in which it has contracted as scaled by the eigenvalues of                                   >                 −1
the gram matrix Φ> Φ.                                                                         Φ Φ        −2
                                                                                   Σβ|D =           +  α    I k     ,
                                                                                               σ2
Generalized linear models (GLMs) do not necessarily have a
closed form posterior distribution. However, Neal & Zhang
                                                                       and
                                                                        > therefore the Hessian of the log-likelihood is
                                                                         Φ Φ     −2
(2006) give a straightforward argument using the invariance               σ2 + α    Ik . By the result in Theorem 4.1 there are
of the likelihood of GLMs to orthogonal linear transfor-               k − n eigenvectors of the Hessian all with eigenvalue α−2 .
mation in order to justify the usage of PCA as a feature               If we have some perturbation to the parameter vector u that
selection step. We can adapt their result to show that over-           resides in the span of these eigenvectors we have
parameterized GLMs have a k − n dimensional subspace                                   >               
                                                                                        Φ Φ
in which the posterior variance is identical to the prior vari-                                    −2
                                                                                               + α Ik u = α−2 u,
ance.                                                                                    σ2
Theorem D.1 (Posterior Contraction in Generalized Linear               which implies u is in the nullspace of Φ> Φ. By the proper-
Models). We specify a generalized linear model, E[Y ] =                ties of gram matrices we have that the nullspace of Φ> Φ is
g −1 (Φβ) and V ar(Y ) = V (g −1 (Φβ)), where Φ ∈ Rn×k                 the same as that of Φ, thus u is also in the nullspace of Φ
is a feature matrix of n observations and k features and               Therefore any prediction using perturbed parameters takes
β ∈ Rk are the model parameters. In the overparameter-                 the form ŷ = Φ(β + u) = Φβ, meaning the function-space
ized setting with isotropic prior on β, there exists a k − n           predictions on training data under such perturbations are
dimensional subspace in which the posterior variance is                unchanged.
identical to the prior variance.
                                                                       Theorem D.2 (Function-Space Homogeneity in General-
Proof. First note that the likelihood of a GLM takes as                ized Linear Models). We specify a generalized linear model,
argument Φβ, thus transformations that leave Φβ unaffected             E[Y ] = g −1 (Φβ), where Φ ∈ Rn×k is a feature matrix of
leave the likelihood, and therefore the posterior distribution,        n observations and k features and β ∈ Rk are the model
unaffected.                                                            parameters. In the overparameterized setting with isotropic
                                                                       prior on β, there exists a k − n dimensional subspace in
Let R be an orthogonal matrix, R> R = RR> = Ip , and                   which parameters can be perturbed without changing the
β̃ = Rβ ∼ N (0, σ 2 I). If we assign a standard isotropic              training predictions in function-space or the value of the
prior, to β then β̃ = Rβ ∼ N (0, σ 2 RIk R> = σ 2 Ik ). If             Hessian.
                                                   Effective Dimensionality Revisited

       Top 2 Eigenvectors         Degenerate Directions 6.900




                                                                                                                                                                          Classification Homogeneity
                                                                                                       0.12                                                                                            1.0
-10                             -10




                                                                          Normalized Loss
                                                                                                       0.10                                                                                            0.9

                              10                                                                                                                                                                       0.8
                                                           6.875
                                                                                                       0.08

                                                                                                       0.06                                                                                            0.7

                              9                                                                                                                                                                        0.6

  0                               0                        6.850
                                                                                                       0.04




                                                                 Loss
                                                                                                                                                                                                       0.5
                                                                                                       0.02

                              8
                                                                                                           0.0         0.2         0.4        0.6           0.8     1.0                                  0.0   0.2           0.4   0.6         0.8          1.0
                                                                                                                                 Perturbation Size                                                                     Perturbation Size
                                                           6.825                                                                         Low Curvature              High Curvature                                   Train         Test

 10                           7 10
   -10         0         10       -10        0         10 6.800         Figure A.2. Left: Loss, normalized by dataset size, on both train
                                                                        and test sets as perturbations are made in high curvature directions
Figure A.1. Left: A visualization of the log-loss surface taken in      and degenerate directions. Right: Classification homogeneity, the
the direction of the top two eigenvectors of the Hessian of the         fraction of data points classified the same as the unperturbed model,
loss. Right: A visualization of a random projection of the log-loss     as perturbations are made in both high curvature and degenerate
surface in all parameter directions except the top 200 eigenvectors     directions.
of the Hessian. We can see that in nearly all directions the loss is
constant even as we move far from the optimal parameters. Note
the scale difference, even as we increase the resolution of the           directions, we still classify more than 99% of both training
degenerate loss surface we still see no structure.                        and testing points the same as the unperturbed classifier.

                                                                          F. More Classifiers
Proof. The Hessian of the log-likelihood for GLMs can
be written as a function of the feature map, Φ, and the                   Figures A.3 and A.4 provide more examples of perturbations
product of the feature map and the parameters, Φβ, i.e.                   in high and low curvature directions and the effect of the
β only appears multiplied by the feature map (Nelder &                    scale of the perturbation on function-space predictions for
Wedderburn, 1972). We can then write Hβ = f (Φβ, Φ)                       the two-spirals experiment in Section 5.
Additionally predictions are generated by y = g −1 (Φβ).
                                                                                                              Pert. Scale 0.00           Pert. Scale 0.56         Pert. Scale 1.11                              Pert. Scale 1.67         Pert. Scale 2.22
Since Φ ∈ Rn×p with n < p there is a nullspace of Φ with
dimension at least n − p. Thus for any u ∈ null(Φ) we have
                                                                        Low Curvature Perturbations




g −1 (Φ(β + u)) = g −1 (Φβ) = y and f (Φ(β + u), Φ) =
f (Φβ, Φ) = Hβ , which shows that the training predictions
                                                                                                              Pert. Scale 2.78           Pert. Scale 3.33         Pert. Scale 3.89                              Pert. Scale 4.44         Pert. Scale 5.00
and the Hessian remain unchanged.

E. Perturbations on CIFAR-10
To demonstrate that the results presented in Section 5 apply
to larger architectures similar to those seen in practice we
                                                                        Figure A.3. Classifiers as the parameters are shifted in random
train a convolutional classifier provided by Pytorch on the             directions within the span of the bottom 1500 eigenvectors of the
CIFAR-10 dataset.8 The network has approximately 62000                  Hessian of the loss. Scales of the perturbation range from 0 (upper
parameters and is trained on 50000 images.                              left) to 2 (lower right).
Figure A.1 shows the presence of degenerate directions in
parameter space. We compute the top 200 eigenvectors
of the Hessian of the loss and consider perturbations in                                                      Pert. Scale 0.00           Pert. Scale 0.06         Pert. Scale 0.11                              Pert. Scale 0.17         Pert. Scale 0.22

the directions of the top 2 eigenvectors, as well as in all
                                                                        High Curvature Perturbations




parameter directions except the top 200 eigenvectors of the
Hessian. We see that even for larger networks and more
complex datasets degenerate directions in parameter space                                                     Pert. Scale 0.28           Pert. Scale 0.33         Pert. Scale 0.39                              Pert. Scale 0.44         Pert. Scale 0.50
are still present and comprise most possible directions.
Figure A.2 demonstrates that the degenerate directions in
parameter space lead to models that are homogeneous in
function space on both training and testing data. As increas-
ingly large perturbations are made in degenerate parameter              Figure A.4. Classifiers as the parameters are shifted in random
   8
   The architecture is provided here: https://pytorch.                  directions within the span of the top 3 eigenvectors of the Hessian
org/tutorials/beginner/blitz/cifar10_                                   of the loss. Scales of the perturbation range from 0 (upper left) to
tutorial.html                                                           0.5 (lower right).
                                              Effective Dimensionality Revisited

G. Deep Neural Network Training and                                                      Test loss    Test Error    Gen. Gap
   Eigenvalue Computation                                           Nef f (Hessian)       0.8772       0.87608       0.8578
                                                                     PAC-Bayes            0.6644        0.6424       0.7758
Training Details For the double descent experiments in             Mag. PAC-Bayes         0.6933        0.6728       0.7956
Figures 1 and 2 we use neural network architectures from             Path-Norm            0.6722        0.6478       0.7937
the following sources:                                             Log Path-Norm         0.9585        0.9492        0.9836

  • CNNs          from https://gitlab.com/                       Table 3. Sample Pearson correlation between generalization mea-
    harvard-machine-learning/                                    sures and the test loss, test error, and generalization gap for
                                                                 ResNet18s of varying width trained on CIFAR-100 with 20%
    double-descent/-/blob/master/
                                                                 corruption that achieve a training loss below 0.1. Among these
    models/mcnn.py but also include an option                    models effective dimensionality and path-norm are most correlated
    to vary the depth,                                           with test loss, test error, and the generalization gap.

  • ResNet18    from     https://gitlab.
    com/harvard-machine-learning/                                and compute all of the eigenvalues of the Hessian at conver-
    double-descent/-/blob/master/                                gence (the largest model contains 6000 parameters). In the
    models/resnet18k.py,                                         left panel, we see a pronounced double descent curve with
                                                                 respect to both effective dimensionality and test loss as we
  • PreResNet-56 from https://github.com/                        vary depth. In the right panel, we use the same data points,
    bearpaw/pytorch-classification/                              but use three hidden layer networks, varying the width of
    blob/master/models/cifar/preresnet.                          each layer between one and 30 units per layer. Here, we see
    py.                                                          only a monotonic decrease in both test error and effective
                                                                 dimensionality with increasing width not helping that much
Specifically, we train with SGD with a learning rate of 10−2 ,   in terms of test error — the effective dimensionality is high-
momentum of 0.9, weight decay of 10−4 (thus correspond-          est for the models with smallest size and slowly decreases
ing approximately to a Gaussian prior of with variance 1000)     as the width is increased. These results serve as a sanity
for 200 epochs with a batch size of 128. The learning rate       check on our large-scale Lanczos results in the main text.
decays to 10−4 following the piecewise constant learning
                                                                 In Figure A.6, we plot the effective dimensionality against
rate schedule in Izmailov et al. (2018) and Maddox et al.
                                                                 the test error for the linear model example in Section 6. A
(2019a), beginning to decay at epoch 100. We use random
                                                                 clear linear-looking trend is observed, which corresponds
cropping and flipping for data augmentation — turning off
                                                                 to the models that have nearly zero training error. The
augmentations to compute eigenvalues of the Hessian.
                                                                 bend near the origin is explained by models that do not
                                                                 have enough capacity to fit — therefore, their effective
Lanczos Calculations We use GPU enabled Lanczos as               dimensionality is very small. We observe a similar trend for
implemented in Gardner et al. (2018) to compute the eigen-       ResNets and CNNs.
values approximately, running 100 steps to compute approx-
imately 100 of the top eigenvalues. We note that our esti-       In Figure A.7, we plot the effective dimensionality against
mates of the effective dimensionality are somewhat biased        the negative log likelihood for the ResNet18s trained on
from not including all of the small eigenvalues. However,        CIFAR-100 with 20% data corruption. We show the sam-
these small eigenvalues will contribute negligibly and Lanc-     ple Pearson correlation with respect to test loss, error, and
zos will converge to the true eigenvalues if we ran k steps      the generalization gap for the same dataset of effective di-
where k is the rank of the Hessian.                              mensionality along with PAC-Bayes, magnitude aware PAC-
                                                                 Bayes, path norm, and the logarithm of the path norm in
                                                                 Table 3.
H. Double Descent and Effective
   Dimensionality: Further Experiments                           Finally, in Figure A.8, we plot the PAC-Bayes and mag-
                                                                 nitude aware PAC-Bayes bounds on their raw scale for
Finally, we consider several further experiments on the two      ResNet18s trained on CIFAR-100 and on the 20% corrupted
spirals problem to test the effects of increasing depth and      CIFAR-100 dataset. The trends are similar for the bounds
width to serve as a sanity check for our results on both         across the two datasets, with the PAC-Bayes bound gener-
ResNets and CNNs. In Figure A.5, we fix the number of            ally increasing as width increases. The magnitude aware
data points to be 3000, and vary the depth of the neural net-    PAC-Bayes bounds also act similarly, decreasing as width
work (20 hidden units at each layer, ELU activations) using      increases.
between one and 15 hidden units, training for 4000 steps as
before. Here, we run each experiment with 25 repetitions
                                                                                                         Effective Dimensionality Revisited




                           20.0
                                          Increasing Depth                                                                                                                 5
                                                                                                                                                                                                             Increasing Width                                      0.5
                                                                                                                             1.6
                           17.5
Effective Dimensionality




                                                                                                                                                Effective Dimensionality
                                                                                                                             1.4                                           4                                                                                       0.4
                           15.0
                                                                                                                             1.2
                           12.5                                                                                                                                            3                                                                                       0.3
                                                                                                                             1.0




                                                                                                                               Loss




                                                                                                                                                                                                                                                                    Loss
                           10.0
                                                                                                                             0.8
                            7.5                                                                                                                                            2                                                                                       0.2
                                                                                                                             0.6
                            5.0                                                                                              0.4                                           1                                                                                       0.1
                            2.5                                                                                              0.2
                            0.0                                                                                              0.0                                           0                                                                                       0.0
                                  1000   2000     3000                                  4000            5000        6000                                                           0        250            500               750       1000   1250   1500   1750
                                            Number of Parameters                                                                                                                                         Number of Parameters
                                                                                                        Test Loss                      Effective Dim                                              Final Loss

  Figure A.5. Left: Increasing depth on the two spirals problem. Clearly seen is a double descent curve where the test loss first increases
  before decreasing as a function of depth. The effective dimensionality follows the same trend. Right: Increasing width on the two spirals
  problem. Here, increased width produces constant test performance after the training loss reaches zero, and the effective dimensionality
  stays mostly constant. Shading represents two standard deviations as calculated by 25 random generations of the spirals data.




                                                                              0.5



                                                                              0.4
                                                         Generalization Gap




                                                                              0.3



                                                                              0.2



                                                                              0.1



                                                                              0.0



                                                                              0.1
                                                                                    0                      1                   2                                               3                       4                           5
                                                                                                                                   Effective Dimensionality



  Figure A.6. Effective dimensionality plotted against generalization gap (test error − train error) for the linear model of Section 6. Note
  that all but the very smallest models with effective dimensionality track nearly linearly with generalization error.




                                                                                                   60                                                                                                      100
                                                                                                                                                                                                           98
                                                                                                   55
                                                                                                                                                                                                           96
                                                                                                                                                                                                           94
                                                                                                                                                                                                             Neff(Hessian)




                                                                                                   50
                                                                                          Test Error




                                                                                                                                                                                                           92
                                                                                                   45                                                                                                      90
                                                                                                                                                                                                           88
                                                                                                   40
                                                                                                                                                                                                           86
                                                                                                   35      10       20               30                    40                          50         60       84
                                                                                                                                       Width
                                                                                                                           Neff(Hessian)                      Test Error



  Figure A.7. Double descent with respect to test error as demonstrated on ResNet18 on CIFAR-100 with 20% corruption. The effective
  dimensionality again tracks the double descent curve, this time present in the test error rather than test loss.
                                               Effective Dimensionality Revisited




                    30000            PAC Bayes                     6000 Magnitude Aware PAC Bayes
                    25000                                          5000
                    20000                                          4000
            Bound




                                                               Bound



                    15000                                          3000
                    10000                                          2000
                     5000                                          1000
                        0 0        20          40      60             0 0          20        40 60
                                         Width                                         Width
                                              CIFAR100            CIFAR100 Label Noise

Figure A.8. PAC-Bayes and magnitude aware PAC-Bayes bounds displayed on their raw scale for both CIFAR-100 and the 20% corrupted
CIFAR-100. All have a significant spike near a width of 20 which is when training loss first reaches zero. The standard PAC-Bayes
bounds increase as width increases, while the magnitude aware ones seem to decrease towards zero.
