O N THE S PECTRAL B IAS OF N EURAL N ETWORKS
Anonymous authors
Paper under double-blind review
A BSTRACT
Neural networks are known to be a class of highly expressive functions able to ﬁt even random input-output mappings with 100% accuracy.
In this work we present properties of neural networks that complement this aspect of expressivity.
By using tools from Fourier analysis, we show that deep ReLU networks are biased towards low frequency functions, meaning that they cannot have local ﬂuctuations without affecting their global behavior.
Intuitively, this property is in line with the observation that over-parameterized networks ﬁnd simple patterns that generalize across data samples.
We also investigate how the shape of the data manifold affects expressivity by showing evidence that learning high frequencies gets easier with increasing manifold complexity, and present a theoretical understanding of this behavior.
Finally, we study the robustness of the frequency components with respect to parameter perturbation, to develop the intuition that the parameters must be ﬁnely tuned to express high frequency functions.
I NTRODUCTION
While universal approximation properties of neural networks have been known since the early 90s (Hornik et al., 1989; Cybenko, 1989; Leshno et al., 1993), recent research has shed light on the mechanisms underlying such expressivity (Montufar et al., 2014;
Raghu et al., 2016; Poole et al., 2016).
At the same time, deep neural networks, despite being massively over-parameterized, have been remarkably successful at generalizing to natural data.
This fact is at odds with the traditional notions of model complexity and their empirically demonstrated ability to ﬁt arbitrary random data to perfect accuracy (Zhang et al., 2017a; Arpit et al., 2017).
It highlights the need of asking not just if a neural network can express a given function, but also how it comes to expressing it.
In this work, we connect the if to the how by utilizing a potent mathematical toolbox that has seen wide application in the natural sciences and beyond – Fourier analysis 1 .
The Fourier transform affords a natural way of measuring how fast a function can change within a small neighborhood in its input domain - and as such, it is a strong candidate for quantifying and analyzing the sensitivityof a model (cf.
Novak et al.
We thus take a closer look at neural networks and their learning dynamics through the lens of Fourier analysis and focus the discussion on ReLU networks, whose piece-wise linear structure enables an analytic treatment.
Several conclusions can be drawn from our analysis.
While neural networks can approximate arbitrary functions, we ﬁnd that they favour low frequency ones; in other words, they exhibit a bias towards smooth functions, a phenomenon we call the spectral bias 3 .
We ﬁnd that this bias manifests itself not just in the process of learning, but also in the parameterization of the model itself: a fact we illustrate by showing that the lower frequencies of trained networks are more robust with respect to random parameter perturbations.
We also exhibit and analyze the rather intricate interplay between the geometry of the data manifold and the spectral bias by showing that the latter is attenuated by the fact that higher frequency functions deﬁned on more complex manifolds can be expressed by lower frequency network functions deﬁned in the ambient input space.
C ONTRIBUTIONS
We exploit the piecewise-linear structure of ReLU networks to evaluate and bound its Fourier spectrum.
We demonstrate the peculiar behaviour of neural networks with illustrative and minimal experiments and ﬁnd evidence of a spectral bias : i
e. lower frequencies are learned ﬁrst.
We illustrate how the manifold hypothesis adds a layer of subtlety by showing how the geometry of the data manifold attenuates the spectral bias in a non-trivial way.
We present a theoretical analysis of this phenomenon and derive conditions on the manifolds that facilitate learning higher frequencies.
Given a trained network, we investigate the relative robustness of the lower frequencies with respect to random perturbations of the network parameters.
The paper is organized as follows.
In Section 2, we derive the Fourier spectrum of deep ReLU networks.
Section 3 presents minimal experiments that demonstrate the spectral bias of ReLU networks.
In Section 4, we study and discuss the role of the geometry of the data manifold.
In Section 5, we empirically illustrate and theoretically explain our robustness result.
F OURIER ANALYSIS OF R E LU NETWORKS 2. P RELIMINARIES
Consider the class of scalar functions f : R d (cid:55)→ R deﬁned by a ReLU network with L hidden layers of widths d 1 , · · · d L and a single output neuron:
[Equation]
where each T ( k ) : R d k − 1 → R d k is an afﬁne function ( d 0 = d and d L +1 = 1 ) and σ ( u ) i = max(0 , u i ) denotes the ReLU activation function acting elementwise on a vector u
= ( u 1 , · · · u n ) .
In the standard basis, T ( k ) ( x ) =
W ( k ) x + b ( k ) for some weight matrix W ( k ) and bias vector b ( k ) .
ReLU networks are known to be continuous piece-wise linear (CPWL) functions, where the linear regions are convex polytopes (Raghu et al., 2016;
Montufar et al., 2014; Zhang et al., 2018; Arora et al., 2018).
Remarkably, the converse is also true: every CPWL function can be represented by a ReLU network (Arora et al., 2018, Theorem 2.1), which in turn endows ReLU networks with universal approximation properties.
Given the ReLU network f from Eqn. 1, we can make the piecewise linearity explicit by writing,
[Equation]
where (cid:15) is an index for the linear regions P (cid:15) and 1 P (cid:15) is the indicator function on P (cid:15) .
As shown in
Appendix C in more detail, each region corresponds to an activation pattern 4 of all hidden neurons of the network, which is a binary vector with components conditioned on the sign of the input of the respective neuron.
The 1 × d matrix W (cid:15) is given by
[Equation]
where W ( k ) (cid:15) is obtained from the original weight W ( k ) by setting its j th column to zero whenever the neuron j of the k th layer is inactive.
We will henceforth assume that the input data lies in a bounded domain of R d , say X =
[ − A, A ] d for some A > 0 and thus restrict ourselves to ReLU networks with bounded support 5 .
2. F OURIER S PECTRUM
In the following, we study the structure of ReLU networks in the Fourier domain, which is deﬁned as:
[Equation]
where dx , dk are the uniform Lebesgue measure on R d and ˜ f denotes the Fourier transform of f (see Appendix B for a short recap of the Fourier transform).
Lemmas 1 and 2 (proved in appendix
D) yield the explicit form of the Fourier components.
Lemma 1.
The Fourier transform of ReLU networks decomposes as,
[Equation]
where k = (cid:107) k (cid:107) and ˜1 P ( k )
=
(cid:82) P e − i k · x dx is the Fourier transform of the indicator function of P .
The Fourier transform of a polytope appearing in Eqn.
5 is a fairly intricate mathematical object;
Diaz et al.
(2016) develop an elegant procedure for evaluating it in arbitrary dimensions via a recursive application of Stokes theorem.
We describe this procedure in detail in Appendix D.2, and present here its main corollary.
Lemma 2.
Let P be a full dimensional polytope in R d .
The Fourier spectrum of its indicator function ˜
P satisﬁes the following:
[Equation] [Equation]
where 1 ≤ ∆ ( P ) k ≤ d , and ∆ ( P ) k
= j when k lies orthogonal to some ( d − j ) -dimensional face of P .
Note that since a polytope has a ﬁnite number of facets (of any dimension), the k ’s for which ∆ ( P ) k
= j for some j < d lie on a ﬁnite union of j -dimensional subspaces of R d .
The Lebesgue measure of all such lower dimensional subspaces for all such j equals 0 , leading us to the conclusion that the spectrum decays as O ( k − d ) for almost all directions ˆk of the frequency vector k in R d .
Lemmas 1, 2 together yield the main result of this section.
Given a ReLU network f , its linear regions form a cell decomposition of R d as union of polytopes; we denote by F the set of faces (of any dimension) of all such polytopes.
For k ∈ R d , let ∆ k be the minimum integer 1 ≤ j ≤ d such that k lies orthogonal to some ( d − j ) -dimensional face in F .
Theorem 1.
The Fourier components of the ReLU network f satisfy the following:
[Equation]
where N f is the number of linear regions and L f = max (cid:15) (cid:107) W (cid:15) (cid:107) 2 is the Lipschitz constant of f .
Several remarks are in order:
(a) The spectral decay of ReLU networks is highly anisotropic in large dimensions.
In almost all directions ˆk of R d , we have ∆ k
=
d , i.e. a O ( k − d − 1 ) decay.
However, the decay can be as slow as O ( k − 2 ) in speciﬁc directions orthogonal to the facets bounding linear regions 6 .
As we prove in Appendix D.3, the Lipschitz constant L f can be bounded as,
[Equation]
where (cid:107) · (cid:107) is the spectral norm, W is the ravelled parameter vector of the network and (cid:107) · (cid:107) ∞ is the max-norm.
This makes the bound on L f scale exponentially in depth and polynomial in width.
As for the number N f of linear regions, Montufar et al.
(2014) and Raghu et al.
(2016) obtain tight bounds that exhibit the same scaling behaviour (Raghu et al., 2016, Theorem 1).
This makes the overall bound in Eqn. 7 – and with it, the ability to express larger frequencies – scale exponentially in
[Figure]
depth and polynomially in width 7 .
This result complements the well-known universal approximation property of neural networks by explicitly incorporating a control on the capacity 8 of the network, namely the width, depth and the norm of parameters.
(b) For a given architecture (i.e. ﬁxed width and depth), the high frequency contributions of the network can be increased by increasing the norm of the parameters.
Assuming the weight norm increases with training iterations, this suggests that the training of ReLU networks is biased towards lower frequencies.
We investigate this fact empirically in the next section.
L OWER F REQUENCIES ARE L EARNED F IRST
In this section and the ones that follow, we present experiments that illustrate the peculiar behaviour of deep ReLU networks in the Fourier domain.
We begin with an experiment to demonstrate that networks tend to ﬁt lower frequencies ﬁrst during training.
We refer to this phenomenon as the spectral bias , and discuss it in light of the results of Section 2.
Experiment 1.
The setup is as follows 9 : Given frequencies κ = ( k 1 , k 2 , ... ) with corresponding amplitudes α
=
( A 1 , A 2 , ... ) , and phases φ = ( ϕ 1 , ϕ 2 , ... ) , we consider the mapping λ : [0 , 1] → R given by
[Equation]
A 6-layer deep 256-unit wide ReLU network f θ is trained to regress λ with κ = (5 , 10 , ..., 45 , 50) and N = 200 input samples spaced equally over [0 , 1] ;
its spectrum ˜ f θ ( k ) in expectation over ϕ
i ∼ U (0 , 2 π ) is monitored as training progresses.
In the ﬁrst setting, we set equal amplitude
A i = 1 for all frequencies and in the second setting, the amplitude increases from A 1 = 0 .
1 to
A 10 = 1 .
Fig 1 shows the normalized magnitudes | ˜ f
θ ( k i ) | /A
i at various frequencies, as training progresses.
The result is that lower frequencies (i.e. smaller k
i ’s) are regressed ﬁrst, regardless of their amplitudes.
Discussion.
Multiple theoretical aspects may underlie these observations.
First, for a ﬁxed architecture, the bound in Theorem 1 allows for larger Fourier coefﬁcients at higher frequencies if the parameter norm is large.
However, the parameter norm can increase only gradually during training by gradient descent, which leads to the higher frequencies being learned late in the optimization process.
To conﬁrm that the bound indeed increases as the model ﬁts higher frequencies, we plot in Fig 1 the spectral norm of weights of each layer during training for both cases of constant and increasing amplitudes.
Second, consider the Mean Squared Error MSE [ f θ , λ ] in terms of the Fourier components: letting z i
= i/N be the training sample points, we have:
[Equation]
where the second equality follows from Plancherel theorem.
We make two observations – ﬁrst, the square error in input space translates into square error in Fourier domain, with a priori no structural bias towards any particular frequency component 10 , i.e. all frequencies are weighted the same.
Since the same cannot be said about e.g. cross-entropy loss, we use the MSE loss in most of our experiments to avoid a potential confounding factor.
Second, the parameterization of the network can be exploited by considering the gradient of the MSE loss w.r.t.
parameters,
[Equation]
where Re( z ) denotes the real part of z .
We ﬁnd that a bias naturally emerges as a consequence of the spectral decay rate found in Theorem 1, in the sense that the magnitude of the residual | ˜ f θ ( k ) − ˜ λ ( k ) | contributes less to the net gradient for large k .
This generalizes the argument made in Xu (2018) for two layer sigmoid networks by observing that the gradient w.r.t parameters of the network function inherits the spectral decay rate of the function itself 11 .
In Section 5, we use that the integral of ˜ f θ w.r.t
[Equation]
the standard measure in parameter space dθ also inherits the spectral decay rate of f to make a statement about the robustness of ˜ f
θ ( k ) against random parameter perturbations.
N OT ALL M ANIFOLDS ARE L EARNED E QUAL
In this section, we investigate the subtleties that arise when the data lies on a lower dimensional manifold embedded in the higher dimensional input space of the model (Goodfellow et al., 2016).
As we show, the shape of the data-manifold impacts expressivity in a non-trivial way.
To systematically investigate this impact, we demonstrate results in an illustrative minimal setting 12 .
We also present a mathematical exposition of the relationship between the Fourier spectrum of the network, the spectrum of the target function deﬁned on the manifold, and the geometry of the manifold itself.
Manifold hypothesis.
We consider the case where the data lies on a lower dimensional data manifold M ⊂ R d embedded in input space, which we assume to be the image γ
([0 , 1] m ) of some injective mapping γ : [0 , 1] m → R d deﬁned on a lower dimensional latent space [0 , 1] m .
Under this hypothesis and in the context of the standard regression problem, a target function τ : M → R deﬁned on data manifold can identiﬁed with a function λ = τ ◦ γ deﬁned on the latent space.
Regressing τ is therefore equivalent to ﬁnding f : R d → R such that f ◦ γ matches λ .
Further, assuming that the data probability distribution µ supported on M is induced by γ from the uniform distribution U in the latent space [0 , 1] m , the mean square error can be expressed as,
[Equation]
Observe that there is a vast space of degenerate solutions f that minimize the mean squared error – namely all functions on R d that yield the same function when restricted to the data manifold M .
Our ﬁndings from the previous section suggest that neural networks are biased towards expressing a particular subset of such solutions, namely those that are low frequency.
It is also worth noting that there exist methods that restrict the space of solutions: notably adversarial training (Goodfellow et al., 2014) and Mixup (Zhang et al., 2017b).
Experimental set up.
The experimental setting is designed to afford control over both the shape of the data manifold and the target function deﬁned on it.
We will consider the family of curves in Rgenerated by mappings γ L : [0 , 1] → R 2 given by
[Equation]
Here, γ L ([0 , 1]) deﬁnes the data-manifold and corresponds to a ﬂower-shaped curve with L petals, or a unit circle when L = 0 (see e.g. Fig 2).
Given a signal λ : [0 , 1] → R deﬁned on the latent space [0 , 1] , the task entails learning a network f : R 2 → R such that f ◦ γ L matches the signal λ .
Experiment 2.
The set-up is similar to that of Experiment 1, and λ is as deﬁned in Eqn.
9 with frequencies κ = (20 , 40 , ..., 180 , 200) , and amplitudes A i = 1 ∀
i .
The model f is trained on the dataset { γ L ( z i ) , λ ( z i ) } N i =1 with N = 1000 uniformly spaced samples
z i between 0 and 1 .
The spectrum of f ◦ γ L in expectation over ϕ i ∼ U (0 , 2 π ) is monitored as training progresses, and the result shown in Fig 3 for L = 0 , 4 , 10 , 16 .
Fig 3e shows the corresponding mean squared error curves.
More experimental details in appendix A.2.
The results demonstrate a clear attenuation of the spectral bias as L grows.
Moreover, Fig 3e suggests that the larger the L , the easier the learning task. [Figure]
Experiment 3.
Here, we adapt the setting of Experiment 2 to binary classiﬁcation by simply thresholding the function λ at 0 .
5 to obtain a binary target signal.
To simplify visualization, we only use signals with a single frequency mode k , such that λ ( z ) =
sin(2 πkz + ϕ ) .
We train the same network on the resulting classiﬁcation task with cross-entropy loss 13 for k ∈ { 50 , 100 , ..., 350 , 400 } and L ∈ { 0 , 2 , ..., 18 , 20 } .
The heatmap in Fig 4 shows the classiﬁcation accuracy for each ( k, L ) pair.
Fig 2 shows visualizations of the functions learned by the same network, trained on ( k, L ) =
(200 , 20) under identical conditions up to random initialization.
Observe that increasing L (i.e. going up a column in Fig 4) results in better (classiﬁcation) performance for the same target signal. This is the same behaviour as we observed in Experiment(Fig 3a-d), but now with binary cross-entropy loss instead of the MSE.
Discussion.
These experiments hint towards a rich interaction between the shape of the manifold and the effective difﬁculty of the learning task.
The key technical reason underlying this phenomenon (as we formalize below) is that the relationship between frequency spectrum of the network f and that of the ﬁt f ◦ γ L is mediated by the embedding map γ L .
In particular, we will argue that a given signal deﬁned on the manifold is easier to ﬁt when the coordinate functions of the manifold embedding itself has high frequency components.
Thus, in our experimental setting, the same signal embedded in a ﬂower with more petals can be captured with lower frequencies of the network.
To understand this mathematically, we address the following questions: given a target function λ , how small can the frequencies of a solution f be such that f ◦ γ = λ ?
And further, how does this relate to the geometry of the data-manifold M induced by γ ?
To ﬁnd out, we write the Fourier transform of the composite function,
[Equation]
where P γ
[Equation] l , k [Equation] The kernel P γ depends on only γ and elegantly encodes the correspondence between frequencies k ∈ R d in input space and frequencies l ∈ R m in the latent space [0 , 1] m .
Following a procedure from Bergner et al.
, we can further investigate the behaviour of the kernel in the regime where the stationary phase approximation is applicable, i.e. when l 2 + k 2 → ∞ (cf. section 3.2. of Bergner et al.).
In this regime, the integral P γ is dominated by critical points ¯ z of its phase, which satisfy
[Equation]
where J γ ( z ) ij = ∇ i γ j ( z ) is the m × d Jacobian matrix of γ .
Non-zero values of the kernel correspond to pairs ( l , k ) such that Eqn 15 has a solution.
Further, given that the components of γ (i.e. its coordinate functions) are deﬁned on an interval [0 , 1] m , one can use their Fourier series representation together with Eqn 15 to obtain a condition on their frequencies (shown in appendix D.4).
More precisely, we ﬁnd that the i -th component of the RHS in Eqn 15 is proportional to p ˜ γ
i [ p ] k i
where p ∈
Z m is the frequency of the coordinate function γ i .
This yields that we can get arbitrarily large frequencies
l i if ˜ γ i [ p ] is large 14 enough for large p , even when k i is ﬁxed.
This is precisely what Experiments 2 and 3 demonstrate in a minimal setting.
From Eqn 13, observe that the coordinate functions have a frequency mode at L .
For increasing L , it is apparent that the frequency magnitudes l (in the latent space) that can be expressed with the same frequency k
(in the input space) increases with increasing L .
This allows the remarkable interpretation that the neural network function can express large frequencies on a manifold ( l ) with smaller frequencies w.r.t its input domain ( k ), provided that the coordinate functions of the data manifold embedding itself has high-frequency components 15 .
L OWER FREQUENCIES ARE MORE ROBUST
The goal of this section is to show that lower frequency components of trained networks are more robust than their higher frequency counterparts with respect to random perturbations in parameter space.
More precisely, we observe that in the neighbourhood of a solution in parameter space, the high frequency components decay faster than the low frequency ones.
This property does not directly depend on the training process, but rather on the parametrization of the trained model.
We present empirical evidence and a theoretical explanation of this phenomenon.
Experiment 4.
The set up is the same as in Experiment 1, where λ is given by Eqn. 9.
Training is performed for the frequencies κ = (10 , 15 , 20 , ..., 45 , 50) and amplitudes A i = 1 ∀ i .
After convergence to θ ∗ , we consider random (isotropic) perturbations θ
= θ ∗ + δ ˆ θ of given magnitude δ , where ˆ θ ∼ U ( S dim ( θ ∗ ) ) is a unit vector.
We evaluate the network function f
θ at the perturbed parameters, and compute the magnitude of its discrete Fourier transform at frequencies
k i , | ˜ f
θ ( k i ) | .
We also average over 100 samples of ˆ θ to obtain | ˜ f
E θ ( k i ) | , which we normalize by | ˜ f
θ ∗ ( k i ) | .
The result, shown in Figure 5, demonstrate that higher frequencies are signiﬁcantly less robust than the lower ones.
Discussion.
The interpretation is as follows: parameters that contribute towards expressing highfrequency components occupy a small volume in the parameter space.
To formalize this intuition, given a bounded domain Θ of parameter space, let us deﬁne,
[Equation]
to be the set of parameters such that f θ has Fourier components larger than (cid:15) for some k (cid:48) with larger norm than k .
Then the following Proposition holds (proved in appendix E).
Proposition 1.
The volume ratio,
[Equation]
inherits the spectral decay rate of | ˜ f
θ ( k ) | , given by Theorem 1.
Intuitively, expressing larger frequencies requires the parameters to be ﬁnely-tuned to work together.
R ELATED W ORK
Our work follows the ongoing line of research on the analysis of expressivity of deep networks.
While we focus on showing the spectral bias of deep ReLU networks towards learning functions with dominant lower frequency components, most of existing work has focused on showing that in theory, these networks are capable of learning arbitrarily complex functions.
Hornik et al.
Cybenko (1989); Leshno et al.
(1993) have showed that neural networks can be universal approximators when given sufﬁcient width.
More recently, Montufar et al.
(2014) show that the deep ReLU networks partition the input space of the network into number of linear regions which grows polynomially with width and exponentially with depth.
Raghu et al.
(2016) generalize this result and provide an asymptotically tight bound for the number of linear regions deep ReLU networks and deep tanh networks partition the input space into.
Poole et al.
(2016) show that deep networks can efﬁciently represent complex functions through their compositional structure that shallow networks are incapable of doing.
Lu et al.
(2017) show that networks with bounded width are also universal approximators.
These analysis on the expressive power of deep neural networks can in part explain why over-parameterized networks can perfectly learn random input-output mappings (Zhang et al., 2017a).
Our analysis of deep ReLU networks using the tool of Fourier transform also shows their expressive power grows with width and depth, but more interestingly reveals their spectral bias towards learning simple functions.
Thus our work may be seen as a formalization of the ﬁndings of Arpit et al.
(2017), where it is empirically shown that deep networks prioritize learning simple functions during training.
A few other works studied neural networks through the lens of harmonic analysis.
For example,
Cand ` es (1999) used the ridgelet transform to build constructive procedures for approximating a given function by neural networks, in the case of oscillatory activation functions.
This approach has been recently generalized to unbounded activation functions by Sonoda & Murata (2017).
In a work done independently from ours, and made available online almost at the same time, Xu et al.
(2018) make the same observation that lower frequencies are learned ﬁrst.
The subsequent work by
Xu (2018) proposes a theoretical analysis of the phenomenon in the case of 2-layer networks with sigmoid activation, based on the spectrum of the sigmoid function.
In light of our ﬁndings, it is worth comparing the case of neural networks and other popular algorithms such that kernel machines (KM) and K -nearest neighbor classiﬁers.
We refer to the Appendix
F for a detailed discussion and references.
In summary, our discussion there suggests that 1.
DNNs strike a good balance between function smoothness and expressivity/parameter-efﬁciency compared with KM; 2.
DNNs learn a smoother function compared with K NNs since the spectrum of the DNN decays faster compared with K NNs in the experiments shown there.
C ONCLUSION
We studied deep ReLU networks through the lens of Fourier analysis.
Several conclusions can be drawn from our analysis.
While neural networks can approximate arbitrary functions, we ﬁnd that they favour low frequency ones – hence they exhibit a bias towards smooth functions – a phenomenon that we called spectral bias .
We also illustrated how the geometry of the data manifold impacts expressivity in a non-trivial way, as high frequency functions deﬁned on complex manifolds can be expressed by lower frequency network functions deﬁned in input space.
Finally, we found that the parameters contributing towards expressing lower frequencies are more robust to random perturbations than their higher frequency counterparts.
We view future work that explore the properties of neural networks in Fourier domain as promising.
For example, the Fourier transform affords a natural way of measuring how fast a function can change within a small neighborhood in its input domain ; as such, it is a strong candidate for quantifying and analyzing the sensitivity of a model – which in turn provides a natural measure of complexity (Novak et al., 2018).
We hope to encourage more research in this direction.
A E XPERIMENTAL D ETAILS A. E XPERIMENT
We ﬁt a 6 layer ReLU network with 256 units per layer f
θ to the target function λ , which is a superposition of sine waves with increasing frequencies:
[Equation]
where k i = (5 , 10 , 15 , ..., 50) , and ϕ i is sampled from the uniform distribution U (0 , 2 π ) .
In the ﬁrst setting, we set equal amplitude for all frequencies, i.e. A i = 1 ∀ i , while in the second setting we assign larger amplitudes to the higher frequencies, i.e. A i = (0 . 1 , 0 .
We sample λ onuniformly spaced points in [0 , 1] and train the network for 80000 steps of full-batch gradient descent with Adam (Kingma & Ba, 2014).
Note that we do not use stochastic gradient descent to avoid the stochasticity in parameter updates as a confounding factor.
We evaluate the network on the samepoint grid every 100 training steps and compute the magnitude of its (single-sided) discrete fourier transform at frequencies k i which we denote with | ˜ f
k i | .
Finally, we plot in ﬁgure 1 the normalized magnitudes | ˜ f ki
|
A
i averaged over 10 runs (with different sets of sampled phases ϕ i ).
We also record the spectral norms of the weights at each layer as the training progresses, which we plot in ﬁgurefor both settings (the spectral norm is evaluated with 10 power iterations).
In ﬁgure 6, we show an example target function and the predictions of the network trained on it (over the iterations), and in ﬁgure 7 we plot the loss curves. [Figure]
[Figure]
A. E XPERIMENT
We use the same 6-layer deep 256-unit wide network and deﬁne the target function
[Equation]
where k i = (20 , 40 , ..., 180 , 200) ,
A i = 1 ∀ i and ϕ ∼ U (0 , 2 π ) .
We sample φ on a grid withuniformly spaced points between 0 and 1 and map it to the input domain via γ L to obtain a dataset { ( γ L ( z j ) , λ ( z j )) } 999 j =0 , on which we train the network with 50000 full-batch gradient descent steps of Adam.
On the same 1000-point grid, we evaluate the magnitude of the (single-sided) discrete
Fourier transform of f θ ◦ γ L every 100 training steps at frequencies k i and average over 10 runs (each with a different set of sampled z i ’s).
Fig 3 shows the evolution of the spectrum as training progresses for L = 0 , 4 , 10 , 16 , and Fig 3e shows the corresponding loss curves.
A. Q UALITATIVE A BLATION OVER A RCHITECTURES
Theorem 1 exposes the relationship between the fourier spectrum of a network and its depth, width and max-norm of parameters.
The following experiment is a qualitative ablation study over these variables.
Experiment 5.
In this experiment, we ﬁt various networks to the δ -function at x = 0 .
5 (see Fig 8a).
Its spectrum is constant for all frequencies (Fig 8b), which makes it particularly useful for testing how well a given network can ﬁt large frequencies.
Fig 11 shows the ablation over weight clip (i.e. max parameter max-norm), Fig 9 over depth and Fig 10 over width.
Fig 12 exemplarily shows how the network prediction evolves with training iterations.
All networks are trained for 60K iterations of full-batch gradient descent under identical conditions (Adam optimizer with lr = 0 .
0003 , no weight decay).
We make the following observations.
[Figure]
[Figure]
[Figure]
[Figure]
[Figure]
(a) Fig 9 shows that increasing the depth (for ﬁxed width) signiﬁcantly improves the network’s ability to ﬁt higher frequencies (note that the depth increases linearly).
(b) Fig 10 shows that increasing the width (for ﬁxed depth) also helps, but the effect is considerably weaker (note that the width increases exponentially).
(c) Fig 11 shows that increasing the weight clip (or the max parameter max-norm) also helps the network ﬁt higher frequencies.
The above observations are all consistent with Theorem 1, and further show that lower frequencies are learned ﬁrst (i.e. the spectral bias, cf.
Experiment 1).
A. MNIST: A P ROOF OF C ONCEPT
In the following experiment, we show that given two manifolds of the same dimension – one ﬂat and the other not – the task of learning random labels is harder to solve if the input samples lie on the same manifold.
We demonstrate on MNIST under the assumption that the manifold hypothesis is true, and use the fact that the spectrum of the target function we use (white noise) is constant in expectation, and therefore independent of the underlying coordinate system when deﬁned on the manifold.
Experiment 6.
In this experiment, we investigate if it is easier to learn a signal on a more realistic data-manifold like that of MNIST (assuming the manifold hypothesis is true), and compare with a ﬂat manifold of the same dimension.
To that end, we use the 64 -dimensional feature-space E of a denoising 16 autoencoder as a proxy for the real data-manifold of unknown number of dimensions.
The decoder functions as an embedding of E in the input space X = R 784 , which effectively amounts to training a network on the reconstructions of the autoencoder.
For comparision, we use an injective embedding 17 of a 64-dimensional hyperplane in X .
The latter is equivalent to sampling 784 -dimensional vectors from U ([0 , 1]) and setting all but the ﬁrst 64 components to zero.
The target function is white-noise, sampled as scalars from the uniform distribution U ([0 , 1]) .
Two identical networks are trained under identical conditions, and Fig 13 shows the resulting loss curves, each averaged over 10 runs.
This result complements the ﬁndings of Arpit et al.
(2017) and Zhang et al.
(2017a), which show that it’s easier to ﬁt random labels to random inputs if the latter is deﬁned on the full dimensional input space (i.e. the dimension of the ﬂat manifold is the same as that of the input space, and not that of the underlying data-manifold being used for comparison).
A. C IFAR -10: I T ’ S A LL C ONNECTED
We have seen that deep neural networks are biased towards learning low frequency functions.
This should have as a consequence that isolated bubbles of constant prediction are rare.
This in turn implies that given any two points in the input space and a network function that predicts the same class for the said points, there should be a path connecting them such that the network prediction does not change along the path.
In the following, we present an experiment where we use a path ﬁnding method to ﬁnd such a path between all Cifar-10 input samples indeed exist. [Figure]
Experiment 7.
Using AutoNEB Kolsbjerg et al.
, we construct paths between (adversarial)
Cifar-10 images that are classiﬁed by a ResNet20 to be all of the same target class.
AutoNEB bends a linear path between points in some space R m so that some maximum energy along the path is minimal.
Here, the space is the input space of the neural network, i.e. the space of 32 × 32 ×images and the logit output of the ResNet20 for a given class is minimized.
We construct paths between the following points in image space:
• From one training image to another, • from a training image to an adversarial, • from one adversarial to another.
We only consider pairs of images that belong to the same class c (or, for adversarials, that originate from another class (cid:54)
=
c , but that the model classiﬁes to be of the speciﬁed class c ).
For each class, we randomly select 50 training images and select a total of 50 random images from all other classes and generate adversarial samples from the latter.
Then, paths between all pairs from the whole set of images are computed.
The AutoNEB parameters are chosen as follows: We run four NEB iterations with 10 steps of SGD with learning rate 0 . 001 and momentum 0 .
This computational budget is similar to that required to compute the adversarial samples.
The gradient for each NEB step is computed to maximize the logit output of the ResNet-20 for the speciﬁed target class c .
We use the formulation of NEB without springs Draxler et al.
[Figure] The result is very clear: We can ﬁnd paths between all pairs of images for all CIFAR10 labels that do not cross a single decision boundary.
This means that all paths belong to the same connected component regarding the output of the DNN.
This holds for all possible combinations of images in the above list.
Figure 15 shows connecting training to adversarial images and Figure 14 paths between pairs of adversarial images.
Paths between training images are not shown, they provide no further insight.
Note that the paths are strikingly simple: Visually, they are hard to distinguish from the linear interpolation.
Quantitatively, they are essentially (but not exactly) linear, with an average length (3 . 0 ± 0 .
3)% longer than the linear connection.
B B RIEF R ECAPITULATION OF F OURIER A NALYSIS
The Fourier transform is a powerful mathematical tool used to represent functions as a weighted sum of oscillating functions, given that the function satisﬁes certain conditions.
In the realm of signal processing and beyond, it is used to represent a time (space) domain signal f as a sum of sinusoids of various (spatial) frequencies k , where the weights are referred to as the Fourier coefﬁcients ˜ f ( k ) .
Let f : R n → R be a squared-integrable function 18 , i.e. such that (cid:82) [Equation] is ﬁnite, or f ∈
L 2 ( R n ) .
With the Fourier inversion theorem, it holds:
[Equation]
Informally, equation 17 expresses the function f ( x ) as a weighted sum (the integral) of plane waves e ± i k · x of the angular wavenumber k , where the unit vector ˆ k gives the direction of the corresponding wave in n -D space and the magnitude k is inversely proportional to the wavelength.
Equationgives the expression for ˜ f ( k ) , which is called the Fourier transform or the Fourier spectrum or simply the spectrum of f .
The 12 π coefﬁcient and sign in the exponential functions are matters of convention.
The asymptotic behaviour of ˜ f for k → ∞ is a measure of smoothness of f .
In Bachmann-Landau or asymptotic notation 19 , we say ˜ f
= O ( k − 1 ) if for k → ∞ , the function ˜ f decays at least as fast as 1 k .
A function whose spectrum is O ( k − 2 ) is in a sense smoother than one whose spectrum is
O ( k − 1 ) , while the spectrum of an inﬁnitely differentiable (or smooth ) function must decay faster than any rational function of k , assuming the function is integrable, i.e. the integral of its absolute value over its domain is ﬁnite (or the function is L 1 ).
Intuitively, the higher-frequency oscillations in a smoother function must vanish faster.
Formally, this is a straightforward consequence of the
Riemann-Lebesgue lemma, stating that the spectrum of any L 1 function must vanish at inﬁnity (potentially arbitrarily slowly), taken together with the well known property of the Fourier transform that it diagonalizes the differential operator i.e. [ (cid:103) ∇ x f ]( k ) =
k ˜ f ( k ) .
C T HE C ONTINUOUS P IECEWISE L INEAR S TRUCTURE OF D EEP R E LU N ETWORKS
We consider the class of ReLU network functions f : R d (cid:55)→ R deﬁned by Eqn. 1.
Following the terminology of Raghu et al.
(2016); Montufar et al.
(2014), each linear region of the network then corresponds to a unique activation pattern , wherein each hidden neuron is assigned an activation variable (cid:15) ∈ {− 1 , 1 } , conditioned on whether its input is positive or negative.
ReLU networks can be explictly expressed as a sum over all possible activation patterns, as in the following lemma.
Lemma 3.
Given L binary vectors (cid:15) (1) , · · · (cid:15) ( L ) with (cid:15) ( k ) ∈ {− 1 , 1 } d k , let T ( k ) (cid:15) ( k ) :
R d k − 1 → R d k the afﬁne function deﬁned by T ( k ) (cid:15) ( k ) ( u ) i =
( T ( k ) ( u ))
i if ( (cid:15) k ) i
= 1 , and 0 otherwise.
ReLU network functions, as deﬁned in Eqn. 1, can be expressed as
[Equation]
where 1 P denotes the indicator function of the subset P ⊂ R d , and P f,(cid:15) is the polytope deﬁned as the set of solutions of the following linear inequalities (for all k = 1 , · · · , L ):
[Equation]
f is therefore afﬁne on each of the polytopes P f,(cid:15) , which ﬁnitely partition the input space R d to convex polytopes.
Remarkably, the correspondence between ReLU networks and CPWL functions goes both ways: Arora et al.
(2018) show that every CPWL function is be represented by a ReLU network, which in turn endows ReLU networks with the universal approximation property.
Finally, in the standard basis, each afﬁne map T ( k ) :
R d k − 1 → R d k is speciﬁed by a weight matrix
W ( k ) ∈ R
d k − 1 × R d k and a bias vector b ( k ) ∈ R d k .
In the linear region P f,(cid:15) , f can be expressed as f (cid:15) ( x ) =
W (cid:15) x
+ b (cid:15) , where in particular
[Equation]
[Equation] where W ( k ) (cid:15) is obtained from W ( k ) by setting its j th column to zero whenever ( (cid:15) k )
j = − 1 .
D F OURIER A NALYSIS OF R E LU N ETWORKS D. P ROOF OF L EMMA
Proof.
The vector-valued function k f ( x ) e i k · x is continuous everywhere and has well-deﬁned and continuous gradients almost everywhere.
So by Stokes’ theorem (see e.g Spivak (2018)), the integral of its divergence is a pure boundary term.
Since we restricted to functions with compact support, the theorem yields
[Equation]
[Equation] [Equation] The integrand is ( k · ( ∇ x f )( x ) − ik 2 f ( x ))
e − i k · x , so we deduce,
[Equation]
[Equation]
Now, within each polytope of the decomposition (19), f is afﬁne so its gradient is a constant vector, ∇ x f (cid:15)
=
W T(cid:15) , which gives the desired result (1).
D. F OURIER T RANSFORM OF P OLYTOPES D.2. T HEOREM 1 OF D IAZ ET AL . (2016)
Let F be a m dimensional polytope in R n , such that 1 ≤ m ≤ n .
Denote by k ∈ R n a vector in the Fourier space, by φ k ( x ) = − k · x the linear phase function, by ˜ F the Fourier transform of the indicator function on F , by ∂F the boundary of F and by vol m the m -dimensional (Hausdorff) measure.
Let Proj F ( k ) be the orthogonal projection of k on to F (obtained by removing all components of k orthogonal to F ).
Given a m − 1 dimensional facet G of F , let N F ( G ) be the unit normal vector to G that points out of F .
It then holds:
If Proj F ( k ) = 0 , then φ k ( x ) =
Φ k is constant on F , and we have:
[Equation]
But if Proj F ( k ) (cid:54) = 0 , then:
[Equation]
D.
[Equation]
. D ISCUSSION
The above theorem provides a recursive relation for computing the Fourier transform of an arbitrary polytope.
More precisely, the Fourier transform of a m -dimensional polytope is expressed as a sum of fourier transforms over the m − 1 dimensional boundaries of the said polytope (which are themselves polytopes) times a O ( k − 1 ) weight term (with k = (cid:107) k
(cid:107) ).
The recursion terminates if
Proj F ( k ) = 0 , which then yields a constant.
To structure this computation, Diaz et al.
(2016) introduce a book-keeping device called the face poset of the polytope.
It can be understood as a weighted tree diagram with polytopes of various dimensions as its nodes.
We start at the root node which is the full dimensional polytope P (i.e. we initially set m = n ).
For all of the codimension-one boundary faces F of P , we then draw an edge from the root P to node F and weight it with a term given by:
[Equation]
and repeat the process iteratively for each F .
Note that the weight term is O ( k − 1 ) where Proj F ( k ) (cid:54) = 0 .
This process yields tree paths P → F 1 → ...
→ F q where each F i +1 has one dimension less than F i .
For a given path and k , the terminal node for this path, F q , is the ﬁrst polytope for which
Proj F q ( k ) = 0 .
The ﬁnal Fourier transform is obtained by multiplying the weights along each path and summing over all paths.
It is then shown that for a generic vector k , all paths terminate at the zero-dimensional vertices of the original polytope, i.e. dim ( F q ) = 0 , implying the length of the path q equals the number of dimensions n , yielding a O ( k − n ) spectrum.
The exceptions occur if a path terminates prematurely, because k happens to lie orthogonal to some n − r -dimensional face F r in the path, in which case we are left with a O ( k − r ) term (with r < n ) which dominates asymptotically.
Note that all vectors orthogonal to the n − r dimensional face F r lie on a r -dimensional subspace of R n .
Since a polytope has a ﬁnite number of faces (of any dimension), the k ’s for which the Fourier transform is
O ( k − r ) (instead of O ( k − n ) ) lies on a ﬁnite union of closed subspaces of dimension r (with r < n ).
The Lebesgue measure of all such lower dimensional subspaces for all such r is 0 , leading us to the conclusion that the spectrum decays as O ( k − n ) for almost all k ’s.
We formalize this in the following corollary.
Corollary 1.
Let P be a full dimensional polytope in R n .
The Fourier spectrum of its indicator function ˜
P satisﬁes the following:
[Equation]
where 1 ≤ ∆ k ≤ n , and ∆ k = j for k on a ﬁnite union of j -dimensional subspaces of R n .
D. P ROOF OF THE L IPSCHTIZ BOUND
Proposition 2.
The Lipschitz constant L f of the ReLU network f is bound as follows (for all (cid:15) ):
[Equation]
Proof.
The ﬁrst equality is simply the fact that L f = max (cid:15) (cid:107) W [Equation] (cid:107) , and the second inequality follows trivially from the parameterization of a ReLU network as a chain of function compositions 20 , together with the fact that the Lipschitz constant of the ReLU function is 1 (cf.
Miyato et al.
(2018), equation 7).
To see the third inequality, consider the deﬁnition of the spectral norm of a I × J matrix
W :
[Equation]
Now, (cid:107) W h (cid:107) =
(cid:112)(cid:80) i | w i · h | , where w i is the i -th row of the weight matrix W and i = 1 , ..., I .
Further, if (cid:107) h (cid:107) = 1 , we have | w i · h | ≤ (cid:107) w i (cid:107)(cid:107) h (cid:107)
=
(cid:107) w i (cid:107) .
Since (cid:107) w i (cid:107) =
(cid:113)(cid:80)
j | w ij | (with j = 1 , ..., J ) and | w ij | ≤ (cid:107) θ (cid:107) ∞ , we ﬁnd that (cid:107) w i (cid:107) ≤ √ J (cid:107) θ (cid:107) ∞ .
Consequently, (cid:112)(cid:80) i | w i · h | ≤ √
IJ (cid:107) θ (cid:107) ∞
and we obtain:
[Equation]
Now for W = W ( k ) , we have I =
d k − 1 and J = d k .
In the product over k , every d k except the ﬁrst and the last occur in pairs, which cancels the square root.
For k = 1 , d k − 1 =
d (for the d input neurons) and for k = L + 1 , d k = 1 (for a single output neuron).
The ﬁnal inequality now follows.
D. T HE F OURIER T RANSFORM OF A F UNCTION C OMPOSITION
Consider Equation 14.
The general idea is to investigate the behaviour of P γ ( l , k ) for large frequencies l on manifold but smaller frequencies k in the input domain.
In particular, we are interested in the regime where the stationary phase approximation is applicable to P γ , i.e. when l 2 + k 2 → ∞ (cf. section 3.2.
of Bergner et al.)
In this regime, the integrand in P γ ( k , l ) oscillates fast enough such that the only constructive contribution originates from where the phase term u ( z )
= k · γ ( z ) − l
z does not change with changing z .
This yields the condition that ∇ z u ( z ) = 0 , which translates to the condition (with Einstein summation convention implied and ∂ ν = ∂ / ∂x ν ):
[Equation]
ν [Equation] [Equation] Now, we impose periodic boundary conditions 21 on the components of γ , and without loss of generality we let the period be 2 π .
Further, we require that the manifold be contained in a box 22 of some size in R d .
The µ -th component γ µ can now be expressed as a Fourier series:
[Equation]
Equation 29 can be substituted in equation 27 to obtain:
[Equation]
where we have split k µ and l ν in to their magnitudes k and l and directions ˆ k ν and ˆ l µ (respectively).
We are now interested in the conditions on γ under which the RHS can be large in magnitude, even when k is ﬁxed.
Recall that γ is constrained to a box – consequently, we can not arbitrarily scale up ˜ γ µ .
However, if ˜ γ µ [ p ] decays slowly enough with increasing p , the RHS can be made arbitrarily large (for certain conditions on z , ˆ l µ and ˆ k ν ).
E V OLUME IN P ARAMETER S PACE AND P ROOF OF P ROPOSITION
For a given neural network, we now show that the volume of the parameter space containing parameters that contribute (cid:15) -non-negligibly to frequency components of magnitude k (cid:48) above a certain cut-off k decays with increasing k .
For notational simplicity and without loss of generality, we absorb the direction ˆ k of k in the respective mappings and only deal with the magnitude k .
Deﬁnition 1.
Given a ReLU network f θ of ﬁxed depth, width and weight clip K with parameter vector θ , an (cid:15) > 0 and Θ = B ∞ K (0) a L ∞ ball around 0 , we deﬁne:
[Equation]
as the set of all parameters vectors θ ∈ Ξ (cid:15) ( k ) that contribute more than an (cid:15) in expressing one or more frequencies k (cid:48) above a cut-off frequency k .
Remark 1.
If k 2 ≥ k 1 , we have Ξ (cid:15) ( k 2 ) ⊆
Ξ (cid:15) ( k 1 ) and consequently vol (Ξ (cid:15) ( k 2 )) ≤ vol (Ξ (cid:15) ( k 1 )) , where vol is the Lebesgue measure.
Lemma 4.
Let 1 (cid:15)k ( θ ) be the indicator function on Ξ (cid:15) ( k ) .
Then:
[Equation]
Proof.
From theorem 1, we know that 23 | ˜ f θ ( k ) | =
O ( k − ∆ − 1 ) for an integer 1 ≤ ∆ ≤ d .
In the worse case where ∆ = 1 , we have that ∃ M < ∞ : | ˜ f
θ ( k ) | < Mk 2 .
Now, simply select a κ > (cid:113) M(cid:15)
such that Mκ 2 < (cid:15) .
This yields that | ˜ f θ ( κ ) | <
Mκ 2 < (cid:15) , and given that Mκ 2 ≤ Mk 2 ∀ k ≥ κ , we ﬁnd | ˜ f θ ( k ) | < (cid:15) ∀ k ≥ κ .
Now by deﬁnition 1, θ (cid:54)∈ Ξ (cid:15) ( κ ) , and since Ξ (cid:15) ( k ) ⊆
Ξ (cid:15) ( κ ) (see remark 1), we have θ (cid:54)∈ Ξ (cid:15) ( k ) , implying 1 (cid:15)k ( θ ) = 0 ∀ k ≥ κ .
Remark 2.
We have 1 (cid:15)k ( θ ) ≤ | ˜ f
θ ( k ) | for large enough k (i.e. for k ≥ κ ), since | ˜ f θ ( k ) | ≥ 0 .
Proposition 1.
The relative volume of Ξ (cid:15) ( k ) w.r.t.
Θ is O
( k − ∆ − 1 ) where 1 ≤ ∆ ≤ d .
Proof.
The volume is given by the integral over the indicator function, i.e.
[Equation]
For a large enough k , we have from remark 2, the monotonicity of the Lebesgue integral and theorem 1 that:
[Equation]
F K ERNEL M ACHINES AND KNN S
In this section, in light of our ﬁndings, we want to compare DNNs with K-nearest neighbor (k-NN) classiﬁer and kernel machines which are also popular learning algorithms, but are, in contrast to
DNNs, better understood theoretically.
F. K ERNEL M ACHINES VS DNN S
Given that we study why DNNs are biased towards learning smooth functions, we note that kernel machines (KM) are also highly Lipschitz smooth (Eg. for Gaussian kernels all derivatives are bounded).
However there are crutial differences between the two.
While kernel machines can approximate any target function in principal (Hammer & Gersmann, 2003), the number of Gaussian kernels needed scales linearly with the number of sign changes in the target function (Bengio et al., 2009).
Ma & Belkin (2017) have further shown that for smooth kernels, a target function cannot be approximated within (cid:15) precision in any polynomial of 1 /(cid:15) steps by gradient descent.
Deep networks on the other hand are also capable of approximating any target function (as shown by the universal approximation theorems Hornik et al.
; Cybenko (1989)), but they are also parameter efﬁcient in contrast to KM.
For instance, we have seen that deep ReLU networks separate the input space into number of linear regions that grow polynomially in width of layers and exponentially in the depth of the network (Montufar et al., 2014; Raghu et al., 2016).
A similar result on the exponentially growing expressive power of networks in terms of their depth is also shown in (Poole et al., 2016).
In this paper we have further shown that DNNs are inherently biased towards lower frequency (smooth) functions over a ﬁnite parameter space.
This suggests that DNNs strike a good balance between function smoothness and expressibility/parameter-efﬁciency compared with
KM.
F. K-NN C LASSIFIER VS . DNN CLASSIFIER
K -nearest neighbor ( K NN) also has a historical importance as a classiﬁcation algorithm due to its simplicity.
It has been shown to be a consistent approximator Devroye et al.
(1996), i.e., asymptotically its empirical risk goes to zero as K → ∞ and K/N → 0 , where N is the number of training samples.
However, because it is a memory based algorithm, it is prohibitively slow for large datasets.
Since the smoothness of a K NN prediction function is not well studied, we compare the smoothness between K NN and DNN.
For various values of K , we train a K NN classiﬁer on a k = 150 frequency signal (which is binarized) deﬁned on the L = 20 manifold (see section 4), and extract probability predictions on a box interval in R 2 .
On this interval, we evaluate the 2D FFT and integrate out the angular components to obtain ζ ( k ) :
[Equation]
Finally, we plot ζ ( k ) for various K in ﬁgure 16e.
Furthermore, we train a DNN on the very same dataset and overlay the radial spectrum of the resulting probability map on the same plot.
We ﬁnd that while DNN’s are as expressive as a K = 1 KNN classiﬁer at lower (radial) frequencies, the frequency spectrum of DNNs decay faster than KNN classiﬁer for all values of K considered, indicating that the DNN is smoother than the K NNs considered.
We also repeat the experiment corresponding to Fig.
4 with KNNs (see Fig. 16) for various K ’s, to ﬁnd that unlike DNNs, KNNs do not necessarily perform better for larger L ’s, suggesting that KNNs do not exploit the geometry of the manifold like DNNs do.
[Figure]