Towards Understanding Hierarchical Learning: Benefits of Neural Representations
Minshuo Chen, Yu Bai, Jason D. Lee, Tuo Zhao, Huan Wang, Caiming Xiong, Richard Socher
Introduction
Deep neural networks have been empirically observed to be more powerful than their shallow counterparts on a variety of machine learning tasks . For example, on the ImageNet classification task, a -layer residual network can achieve %-% better top- accuracy than a shallower -layer ResNet . A widely held belief on why depth helps is that deep neural networks are able to perform efficient hierarchical learning, in which the layers learn representations that are increasingly useful for the present task. Such a hierarchical learning ability has been further leveraged in transfer learning. For example, and show that by combining with additional task-specific layers, the bottom layers of pre-trained neural networks for image classification and language modeling can be naturally transferred to other related tasks and achieve significantly improved performance.
Despite significant empirical evidence, we are in the lack of practical theory for understanding the hierarchical learning abilities of deep neural networks. Classical approximation theory has established a line of “depth separation” results which show that deep networks are able to approximate certain functions with much fewer parameters than shallow networks . These work often manipulates the network parameters in potentially pathological ways, and it is unclear whether the resulting networks can be efficiently found through gradient-based optimization. A more recent line of work shows that overparametrized deep networks can be provably optimized and generalize as well as the so-called Neural Tangent Kernels (NTKs) . However, these results do not take the hierarchical structure of the neural networks into account, and cannot justify any advantage of deep architectures. More recently, show that some NTK models of deep networks are actually degenerate, and their generalization performance are no better than those associated with shallow networks.
In this paper, we provide a new persepctive for understanding hierarchical learning through studying intermediate neural representations—that is, feeding fixed, randomly initialized neural networks as a representation function (feature map) into another trainable model. The prototypical model we consider is a wide two-layer neural network taking a representation function as the input, that is,
To demonstrate the importance of the representation function , we investigate the sample complexity for learning certain target functions using model (1). This is a fine-grained measure of the power of compared with other notions such as approximation ability. Indeed, we expect to be able to approximate any “regular” (e.g. Lipschitz) function of , whenever we use a non-degenerate and a sufficiently large width . However, different choices of can result in different ways (for the trainable two-layer network) to approximate the same target function, thereby leading to different sample complexity guarantees. We will specifically focus on understanding when learning with the neural representation is more sample efficient than learning with the raw input , which is a sensible baseline for capturing the benefits of representations.
As the optimization and generalization properties of a general two-layer network can be rather elusive, we consider more optimization aware versions of the prototype (1)—we replace the trainable two-layer network in by tractable alternatives such as its linearized model (also known as “lazy training” in ) or quadratic Taylor model :
When is the raw input (NTK-Raw, Quad-Raw), these are models with concrete convergence and generalization guarantees, and can approximate the training of the full two-layer network in appropriate infinite-width limits (e.g. ). However, for learning with other representation functions, these models are less understood. The goal of this paper is to provide a quantitative understanding of these models, in particular when is a one-hidden-layer neural network (NTK-Neural, Quad-Neural), in terms of their convergence, generalization, and sample complexities of learning.
The contributions of this paper are summarized as follows:
We show that the Quad- model has a benign optimization landscape, and prove generalization error bounds with a precise dependence on the norm of the features and weight matrices, as well as the conditioning of the empirical covariance matrix of the features (Section 3).
We study sample complexities of learning when the representation is chosen as a one-hidden-layer neural network (Quad-Neural model, Section 4). For achieving a small excess risk against a low-rank degree- polynomial, we show that the Quad-Neural model requires samples. When is large, this is significantly better than the best known upper bound for the Quad-Raw model, demonstrating the benefits of neural representations.
When the trainable network is instead a linearized model (or an NTK), we present a lower bound showing that neural representations are provably not beneficial: in a certain infinite-width limit, the NTK-Neural model requires at least samples for learning a degree- polynomial (Section 5). Since samples also suffice for learning with the NTK-Raw model, this shows that neural representations are not beneficial when fed into a linearized neural network.
We present the problem setup and algorithms in Section 2, review related work in Section 6, and provide conclusions as well as acknowledgments in Section 7.
Notations
Preliminaries
Given dataset , we define the empirical risk of a predictor as
Model, regularization, and representation
We consider the case where is either the linearized or the quadratic Taylor model of a wide two-layer network that takes a fixed representation function as the input:
For the Quad- model, we add a regularizer to the risk so as to encourage to have low norm. We use the regularizer , and consider minimizing the regularized empirical risk
Connection to a three-layer model
It is worth noticing that when is indeed a neural network, say (omitting bias for simplicity), our NTK- and Quad- models are closely related to the Taylor expansion of a three-layer network
Indeed, the {NTK-, Quad-} models correspond to the {linear, quadratic} Taylor expansion of the above network over , and is thus a part of the full Taylor expansion of the three-layer network. By studying these Taylor models, we gain understandings about how deep networks use its intermediate representation functions, which is lacking in existing work on Taylorized models.
Quadratic model with representations
We begin by studying the (non-convex) optimization landscape as well as the generalization properties of the model (Quad-), providing insights on what can be a good representation for such a model.
When is the raw input, model (Quad-) becomes
which is the quadratic Taylor model of a wide two-layer neural network. This model is analyzed by Bai and Lee who show that (1) the (regularized) risk enjoys a nice optimization landscape despite being non-convex, and (2) the generalization gap of the model is controlled by as well as . Building on these results, show that learning low-rank polynomials with (Quad-Raw) achieves a better sample complexity than with the NTK. Besides the theoretical investigation, empirically show that (Quad-Raw) model also approximates the training trajectories of standard neural networks better than the linearized model.
General case
We analyze optimization landscape and establish generalization guarantees when is a general representation function, extending the results in . We make the following assumption:
(Optimization) Given any , , and some radius , suppose the width and we choose a proper regularization coefficient . Then any second-order stationary point is a second-order stationary point (SOSP) of a twice-differentiable loss if and . (SOSP) of the regularized risk satisfies , and achieves
(Generalization) For any radius , we have with high probability (over ) that
Efficient optimization; role of feature isotropicity
Theorem 1 has two main implications: (1) With a sufficiently large width, any SOSP of the regularized risk achieves risk close to the optimum in a certain norm ball, and has controlled norm itself. Therefore, escaping-saddle type algorithms such as noisy SGD that can efficiently find SOSPs can also efficiently find these near global minima. (2) The generalization gap is controlled by , which involves the operator norm of . It is thus beneficial if our representation is (approximately) isotropic, so that , which is much lower than its naive upper bound 1. This will be a key insight for designing our neural representations in Section 4. The proof of Theorem 1 can be found in Appendix A.
Learning with neural representations
We now develop theories for learning with neural representations, where we choose to be a wide one-hidden-layer neural network.
We consider a fixed, randomly initialized one-hidden-layer neural network:
where and are the weights. Throughout this section we will use the indicator activation . We will also choose so that as well.We can use a non-smooth since are not trained. Our results can be extended to the situation where or is the relu activation as well.
We define the representation function as the whitened version of :
We summarize our overall learning algorithm (with the neural representation) in Algorithm 1.
2 Learning low-rank polynomials with neural representations
We now study the sample complexity of Algorithm 1 to achieve low excess test risk compared with the best low-rank degree- polynomial, that is, sum of polynomials of the form . This setting has been considered in a variety of prior work on learning polynomials as well as analyses of wide neural networks .
We need the following additional assumption on the random features.
where denotes a polynomial in and its degree is denoted as . For general distributions of , we show Assumption 2 still holds under certain moment conditions on the distribution of (see the formal statement and proof of both results in Appendix B).
We focus on low-rank polynomials of the form
We state our main result for the Quad-Neural model to achieve low excess risk over such functions.
Suppose Assumption 2 holds, and there exists some of the form (5) that achieves low risk: . Then for any and , choosing
, and a proper , Algorithm 1 achieves the following guarantee: with probability at least over the randomness of data and initialization, any second-order stationary point of satisfies
In particular, for any , we can achieve with sample complexity
According to Theorem 2, Quad-Neural can learn polynomials of any degree by doing the following: (1) Choose a sufficiently large , so that the neural representations are expressive enough; (2) Choose a large width in the quadratic model so as to enable a nice optimization landscape, where such only appears logarithmically in generalization error (Theorem 1).
Improved dimension dependence over Quad-Raw and NTK-Raw
In comparison, the sample complexity for learning with the Quad-Raw (quadratic neural network with the raw input) is
(see, e.g. [8, Thm 7]). Therefore, Theorem 2 shows that neural representations can significantly improve the sample complexity over the raw input, when fed into a quadratic Taylor model.
Overview of techniques
At a high level, the improved sample complexity achieved in Theorem 2 is due to the flexibility of the neural representation: the Quad- model can express polynomials hierarchically, using weight matrices with much smaller norms than that of a shallow learner such as the Quad-Raw model. This lower norm in turn translates to a better generalization bound (according to Theorem 1) and an improved sample complexity. We sketch the main arguments here, and leave the complete proof to Appendix C.
NTK with neural representations: a lower bound
In this section, we show that neural representations may not be beneficial over raw inputs when the trainable network is a linearized neural network through presenting a sample complexity lower bound for this method in the infinite width limit.
More concretely, we consider NTK-Neural, which learns a model of the form
(see e.g. for the derivation). Motivated by this, we consider kernel predictors of the form
as a proxy for (NTK-Neural), where denotes the RKHS (Reproducing Kernel Hilbert Space) norm associated with kernel . This set of predictors is a reliable proxy for the (NTK-Neural) method: for example, taking , it recovers the solution found by gradient descent (with a small stepsize) on the top layer of a wide three-layer network .
We now present a lower bound for the predictor , adapted from [27, Theorem 3].
that is, any predictor of the form (8) will not perform much better than the trivial zero predictor.
No improvement over NTK-Raw; benefits of neural representations
Related work
Approximation theory and depth separation. Extensive efforts have been made on the expressivity of neural networks and the benefits of increased depth. Two separate focuses were pursued: 1) Universal approximation theory for approximating dense function classes, e.g., Sobolev and squared integrable functions ; 2) depth separation theory demonstrating the benefits of increased depth on expressing certain structured functions, e.g., saw-tooth functions . More recently, the recent work merged the two focuses by studying unbounded-depth ReLU networks for approximating Sobolev functions. In all these work, the network parameters are constructed in potentially weird ways, and it is unclear whether such networks can be efficiently found using gradient-based optimization.
A growing body of recent work show the connection between gradient descent on the full network and the Neural Tangent Kernel (NTK) , from which one can prove concrete results about neural network training and generalization . Despite such connections, these results only show that neural networks are as powerful as shallow learners such as kernels. The gap between such shallow learners and the full neural network has been established in theory by and observed in practice . Higher-order expansions of the {network, training dynamics} such as Taylorized Training and the Neural Tangent Hierarchy have been recently proposed towards closing this gap. Finally, recent work by Allen-Zhu and Li shows that there exists a class of polynomials that can be efficiently learned by a deep network but not any “non-hiearchical” learners such as kernel methods or neural tangent kernels, thereby sheding light on how representations are learned hierarchically.
Learning low-rank polynomials in high dimension
In and , the authors propose a tensor unfolding algorithm to estimate a rank order tensor with samples. Under Gaussian input data, propose a Grassmanian manifold optimization algorithm with spectral initialization to estimate a polynomial over -dimensional subspace of variables of degree with samples, where suppresses unknown (super)-exponential dependence on and . However, these methods explicitly use knowledge about the data distribution. Neural networks can often learn polynomials in distribution-free ways. show that wide two-layer networks that simulate an NTK require samples to learn a degree- polynomial. show that samples is also asymptotically necessary for any rotationally invariant kernel. show that a randomized wide two-layer network requires samples instead by coupling it with the quadratic Taylor model. Our algorithm belongs to this class of distribution-free methods, but achieve an improved sample complexity when the distribution satisfies a mild condition.
Conclusion
This paper provides theoretical results on the benefits of neural representations in deep learning. We show that using a neural network as a representation function can achieve improved sample complexity over the raw input in a neural quadratic model, and also show such a gain is not present if the model is instead linearized. We believe these results provide new understandings to hiearchical learning in deep neural networks. For future work, it would be of interest to study whether deeper representation functions are even more beneficial than shallower ones, or what happens when the representation is fine-tuned together with the trainable network.
Acknowledgment
We thank the anonymous reviewers for the suggestions. We thank Song Mei for the discussions about the concentration of long-tailed covariance matrices. JDL acknowledges support of the ARO under MURI Award W911NF-11-1-0303, the Sloan Research Fellowship, and NSF CCF 2002272.
References
Appendix A Proofs for Section 3
We first derive the gradient and Hessian of empirical risk , which will be used throughout the rest of the proof. For a better presentation, we denote as inner product and
We compute the gradient and Hessian of along a given direction .
We denote as the empirical data distribution, and bound I and II separately.
where the last step used Cauchy-Schwarz on and , and the constant is the uniform upper bound on . Putting terms I and II together, we have
where is a constant to be determined.
We argue that any second order stationary point has to satisfy . We have for any that
Combining with the fact that , we have simultaneously for all that
Therefore we see that any stationary point has to satisfy
we get . The Hessian of along direction is
We used the fact . For a second order-stationary point of , its gradient vanishes and the Hessian is possitive definite. Therefore, we have
We choose and the above inequality implies
A.2 Proof of Generalization in Theorem 1
where is i.i.d. Rademacher random variables. The above Rademacher complexity can be bounded using the contraction theorem [51, Chapter 5]:
where the last step used the power mean (or Cauchy-Schwarz) inequality on and denotes the matrix nuclear norm (sum of singular values). Now it only remains to bound the expected max operator norm above. We apply the matrix concentration lemma Bai and Lee [8, Lemma 8] to deduce that
Appendix B Results on feature covariance
We first present a Lemma for relating the covariance of nonlinear random features to the covariance of certain polynomial bases, adapted from [27, Proposition 2].
For any , suppose for some , then we have with high probability as that
where is the Hadamard product: .
B.2 Lower bound on population covariance
then we have with high probability as , where is a constant that depends on (and the indicator activation) but not .
This falls into the setting of Lemma 1(b), applying which implies that with high probability (as ) we have
as the indicator function is not a polynomial of any degree (so that its projection onto polynomials of degree is not itself for any ).
Decay of eigenvalue lower bounds with uniform data.
We now provide a lower bound for the quantity , thereby giving a lower bound on defined in (10). Indeed, we have
is the Hermite decomposition of . By , we know that
We now calculate the decay of . By Stirling’s formula, we have
for some absolute constant . This means that for all we have for some (other) absolute constant , which gives
Therefore we have for all . ∎
Covariance lower bounds for non-uniform data.
Here the equality denotes two random variables following the same distribution. We apply the Hermite decomposition of indicator function to decompose the covariance matrix :
where and are given as follows,
We denote the normalized as , and derive a lower bound on the singular value of with
Using the tensor product notation, we rewrite as
Moreover, using Lemma 1(a), we have as we picked . Substituting into , we have
Therefore the smallest singular value of is lower bounded by , which is a constant only depending on but not . This finishes the proof. ∎
where . We assume we have
The not-too-correlated condition: there exists some such that for any , we have
For all large and , we have
where is a constant that depends on but not .
where applied the not-too-correlated condition. Repeating the above process for times leads to
Combining with existing lower bound (Lemma 1(a)), we see Assumption 2 holds with , a constant that depends on and independent of .
We further note that the above two conditions are all satisfied by the rescaled Gaussian distributions: Choosing (the -th Hermite polynomial) for all , the first condition holds with since , and the second condition holds with (as shown earlier). Combining with the fact they only assume things about the moments of (or ; since are polynomials), we see that they are indeed moment-based assumptions that contain Gaussian distributions with arbitrary covariances, and thus can be fairly general.
B.3 Relative concentration of covariance estimator
Further, when we have with probability at least that
where is a universal constant. On the same event, we have the relative concentration
which implies that .
We now prove the first statement, which builds on the following Rudelson’s inequality for controlling expected deviation of heavy-tailed sample covariance matrices:
Therefore, setting , we get that
Appendix C Proofs for Section 4
This section devotes to the proof of Theorem 2. The proof consists of two main parts: expressivity of neural representation (Sections C.1 and C.2) and generalization property of Quad-Neural (Section C.3). Besides, Section C.5 presents that using data dependent regularizer also achieves improved sample complexity.
We denote by the -th probabilistic Hermite polynomial. We pick
From expectation to finite neuron approximation.
For a given and , we choose and independently generate and for . Then with probability at least , we have
The desired bound can be obtained by Chebyshev’s inequality. We bound the second moment of the norm as
The last inequality invokes the identity . Therefore, choosing gives rise to
From single polynomial to sum of polynomials.
To this end, we set and define
The above inequality holds with probability by the union bound. We complete the proof. ∎
Lemma 7 showcases how to express a sum of polynomials by stacking neural random features for approximating individual polynomials. This technique will be extensively used in the remaining proofs.
C.2 Expressivity of Quad-𝐡𝐡\mathbf{h}
We show Quad-Neuralwith neural representation can approximate any function of the form
To ease the presentation, we temporarily assume all the are even. We extend to odd-degree polynomials in 9. Recall we denote
We whiten by the estimated covariance matrix to obtain . Note that is a -dimensional vector. The approximation of Quad- is stated in the following lemma.
For a given in the form of (12) with all even, and for small constants and , we choose , and . Let and for , then there exist proper such that with probability at least , we have
By definition, can be written as a sum of polynomials with leading coefficients . We partition neurons into two parts according to the sign of . We will use the positive part to express those polynomials with positive coefficient , and negative part to express those with negative coefficients. We first show for sufficiently large , the number of positive ’s exceeds with high probability. This follows from the tail bound of i.i.d. binomial random variables. By the Hoeffding’s inequality, we have
The remaining proof is built upon Lemma 7. We choose , so that with probability at least , there exists with . We further partition into consecutive groups of equal size , i.e., . Within a group, we aim to approximate with for some fixed . Accordingly, we choose for . We have
With probability at least , we have
The proof of the claim is deferred to Appendix C.4. Based on the claim, we are ready to finish proving (13). By the triangle inequality, we deduce
The above upper bound holds with probability no smaller than . Taking
for a small , with probability at least , the following
holds true for the -th group with . When , we simply set . As a result, in , we can express all the polynomial with a positive coefficient.
To express polynomials with negative coefficients, we use analogously. By evenly partitioning into consecutive groups, for a fixed and , we choose . Using exactly the same argument in , with probability at least , for , we also have
The last step for proving Lemma 8 is to combine and together and choose the remaining weight parameters identically for . Substituting into the Quad- model, with probability at least , we deduce
The width satisfies . Replacing completes the proof. ∎
Expressivity with odd-degree polynomials.
Quad- model can also efficiently express odd-degree polynomials. We rely on the following decomposition trick. Let be an integer. We rewrite a -degree polynomial as
Since QuadNTK can naturally implement the quadratic function, we only require that the neural representation can approximate . This is true since random indicator functions can approximate and due to Lemma 5. We denote in , and in . Then by stacking and , we have in . Therefore, we only need to augment the dimension of the neural representation to approximate odd-degree polynomials. We concretize this argument in the following lemma.
For a given in the form of (12), and small constants and , we choose , and . Let and for , then there exist proper such that with probability at least , we have
Applying Lemma 5 once, there exists such that , when is even and the corresponding .
For an odd , we apply the technique in Lemma 6. There exist and with corresponding random indicator features and such that
The corresponding neural representation dimension is . Combining the even and odd degrees together, we can choose
Lemma 9 now follows from Lemma 8 by merging as a single feature , and as a single weight vector so that can be chosen accordingly. Unifying the notation for even and odd degree polynomials, we have
C.3 Generalization of Quad-𝐡𝐡\mathbf{h}
For a given , using Chebyshev’s inequality, we have
Choosing , holds with probability at least . We further invoke Lemma 8 and Chebyshev’s inequality again on :
where the last inequality holds with probability at least . We set , which implies . Accordingly, the number of neurons in the top layer needs to be at least
and the dimension of the neural representation is
This gives us that with probability at least over the randomness of data and initializationTo achieve probability , we replace with , which only introduce a multiplicative constant in the size of and ., the empirical risk satisfies
Applying Theorem 1 part (2), for any second-order stationary point and proper regularization parameter , we have
Towards establishing the generalization bound of , we first find :
To bound , we first replace with . We denote , and observe is the optimal solution to the following least square problem
where the last inequality follows from Lemma 5. This gives rise to
To switch back to , we invoke Lemma 3 on the concentration of to . Specifically, with probability at least , choosing for some constant , we have
Consequently, by denoting , we have
Plugging into , we have
Therefore, we can set . Note that is independent of the width .
Bounding and .
The remaining ingredients are and . Conditioned on the event , we know . Therefore, we have
Note that he norm of is in the order of according to Assumption 2.
The last inequality holds, due to Lemma 3 and is obtained using independent samples. Conditioned on the same event , we have
Therefore, . Putting all the ingredients together and applying Theorem 1, by choosing
we establish for any SOSP , the generalization error bounded by:
We set the above probability upper bounded by , which requires
We can now bound as
which holds with probability at least .
Taking , the sample size grows in the order of . On the other hand, estimating covariance matrix requires samples, which is in the order of . Adding together, the sample complexity grows in the order of .
C.4 Proof of Claim 1
For a given , each is bounded in $1\mathbf{y}$, we have
Taking , with probability at least , we have
To bound the expectation, we observe that is jointly Gaussian with zero mean and the covariance matrix
Therefore, we find the following probability
This implies with probability at least ,
Combining (15) and (16) together, with probability at least , we deduce
holds with probability at least . ∎
C.5 Learning in Quad-Neural with data dependent regularizer
We consider using data dependent regularizer for learning with unwhitened features , which also yields improved sample complexity. The full learning algorithm is described Algorithm 2.
(Optimization) Given any and , , and some radius , suppose the width , sample size , and we choose a proper regularization coefficient . Then with probability over , any second-order stationary point of the regularized risk satisfies , and achieves
(Generalization) For any radius , we have with high probability (over ) that
We recall the second-order directional derivative of satisfies
where is to be determined. We argue that any second-order stationary point has to satisfy . We already know from proof A.1 that for any , holds.
we have simultaneously for all that
Therefore we see that any stationary point has to satisfy
we get . The second-order directional derivative of along direction is upper bounded by
We used the fact . For a second order-stationary point of , its gradient vanishes and the Hessian is positive definite. Therefore, we have
By Assumption 2, we have . Moreover, by Lemma 3, when , with probability at least , we have the following relative concentration of :
Combining these two ingredients together, we deduce
Exactly the same argument yields . Therefore, we choose and the above inequality implies
Plugging in the naive upper bound in , the proof is complete. ∎
where is i.i.d. Rademacher random variables. Recall that the whitened feature is . We further have
Consequently, the generalization error is still bounded by
When using Quad- to learn low-rank polynomials in the form of
we derive the following sample complexity bound.
Suppose Assumption 2 holds, and there exists some that achieves low risk: . Then for any and , choosing
, and a proper , Algorithm 2 achieves the following guarantee: with probability at least over the randomness of data and initialization, any second-order stationary point of satisfies
In particular, for any , we can achieve with sample complexity
The proof reproduces that for Quad- in Sections C.1, C.2, and C.3. Specifically, following the same argument in Lemma 9, we can establish the expressivity of Quad-, where for , we only need to choose
Remember where for and with . Compared to using whitened representation , we remove the multiplicative factor in (see Lemma 8). The corresponding representation dimension and the width remain unchanged. Then with probability , we have
The rest of the proof follows Section C.3, where we need to upper bound , , and , respectively. We use the naive upper bound on , since each entry of is bounded by . By definition, we have
Lastly, observe . An upper bound has been already derived in Section C.3, which is . As can be seen, quantities , , and all retain the same order as using the whitened neural representation (with possibly different absolute constants). Therefore, in order to achieve
and stays the same for the covariance estimation. This yields the same sample complexity (again with a potentially different absolute constant) as using the whitened representation . ∎