The Local Elasticity of Neural Networks

1 INTRODUCTION . Neural networks have been widely used in various machine learning applications , achieving comparable or better performance than existing methods without requiring highly engineered features ( Krizhevsky et al. , 2012 ) . However , neural networks have several intriguing aspects that defy conventional views of statistical learning theory and optimization , thereby hindering the architecture design and interpretation of these models . For example , despite having more parameters than training examples , deep neural networks generalize well without an explicit form of regularization ( Zhang et al. , 2017 ; Neyshabur et al. , 2017 ; Arora et al. , 2019a ) . Zhang et al . ( 2017 ) also observe that neural networks can perfectly fit corrupted labels while maintaining a certain amount of generalization power1 . In this paper , we complement this line of findings by proposing a hypothesis that fundamentally distinguishes neural networks from linear classifiers2 . This hypothesis is concerned with the dynamics of training neural networks using stochastic gradient descent ( SGD ) . Indeed , the motivation is to address the following question : How does the update of weights using SGD at an input x and its label y impact the prediction of the neural networks at another input x′ ? Taking this dynamic perspective , we make the following three contributions . First , we hypothesize that neural networks are locally elastic in the following sense : an extensive set of experiments on synthetic examples demonstrate that the impact on the prediction of x′ is significant if x′ is in a local vicinity of x and the impact diminishes as x′ becomes far from x in an elastic manner . In contrast , local elasticity is not observed in linear classifiers due to the leverage effect ( Weisberg , 2005 ) . Thus , at a high level , local elasticity must be inherently related 1This property also holds for the 1-nearest neighbors algorithm . 2Without using the kernel trick , these classifiers include linear regression , logistic regression , support vector machine , and linear neural networks . to the nonlinearity of neural networks and SGD used in updating the weights . This phenomenon is illustrated by Figure 1 . Additional synthetic examples and ImageNet ( Deng et al. , 2009 ) with a pretrained ResNet ( He et al. , 2016 ) in Appendix A.2 further confirm local elasticity . For completeness , we remark that the notion of local elasticity seems related to influence functions on the surface ( Koh & Liang , 2017 ) . The fundamental distinction , however , is that the former takes into account the dynamics of the training process whereas the latter does not . See Section 2 for a formal introduction of the notion of local elasticity . Furthermore , we devise a clustering algorithm by leveraging local elasticity of neural networks . In short , this algorithm records the relative change of the prediction on a feature vector to construct a similarity matrix of the training examples . Next , the similarity matrix is used by , for example , Kmeans to partition the points into different clusters . The experiments on MNIST ( LeCun , 1998 ) and CIFAR-10 ( Krizhevsky , 2009 ) demonstrate the effectiveness of this local elasticity-based clustering algorithm . For two superclasses ( e.g. , mammal and vehicle ) , the algorithm is capable of partitioning the mammal class into cat and dog , and the second superclass into car and truck . These empirical results , in turn , corroborate our hypothesis that neural networks ( with nonlinear activation ) are locally elastic . See the description of the algorithm in Section 3 and experimental results in Section 4 . Finally , this paper provides profound implications of local elasticity on memorization and generalization of neural networks , among others . In this spirit , this work seeks to shed light on some intriguing aspects of neural networks . Intuitively , the locality part of this property suggests that the neural networks can efficiently fit the label of an input without significantly affecting most examples that have been well fitted . This property is akin to the nearest neighbors algorithm ( see , e.g. , Papernot & McDaniel ( 2018 ) ) . Meanwhile , the elasticity part implies that the prediction surface is likely to remain smooth in the training process , in effect regularizing the complexity of the nets in a certain sense . These implications are discussed in detail in Section 5 . 1.1 RELATED WORK . There has been a line of work probing the geometric properties of the decision boundary of neural networks . Montufar et al . ( 2014 ) investigate the connection between the number of linear regions and the depth of a ReLU network and argue that a certain intrinsic rigidity of the linear regions may improve the generalization . Fawzi et al . ( 2017 ; 2018 ) observe that the learned decision boundary is flat along most directions for natural images . See Hanin & Rolnick ( 2019 ) for the latest development along this line and Fort et al . ( 2019 ) for a dynamic perspective on the landscape geometry . In another related direction , much effort has been expended on the expressivity of neural networks , starting from universal approximation theorems for two-layer networks ( Cybenko , 1989 ; Hornik et al. , 1989 ; Barron , 1993 ) . Lately , deep neural networks have been shown to possess better representational power than their shallow counterparts ( Delalleau & Bengio , 2011 ; Telgarsky , 2016 ; Eldan & Shamir , 2016 ; Mhaskar & Poggio , 2016 ; Yarotsky , 2017 ; Chen et al. , 2019 ) . From a nonparametric viewpoint , approximation risks are obtained for neural networks under certain smooth assumptions on the regression functions ( Schmidt-Hieber , 2017 ; Suzuki , 2018 ; Klusowski & Barron , 2018 ; Liang , 2018 ; Bauer & Kohler , 2019 ; E et al. , 2019a ) . A less related but more copious line of work focuses on optimization for training neural networks . A popular approach to tackling this problem is to study the optimization landscape of neural networks ( Choromanska et al. , 2015 ; Soudry & Hoffer , 2017 ; Zhou & Liang , 2017 ; Safran & Shamir , 2018 ; Du & Lee , 2018 ; Liang et al. , 2018 ; Soltanolkotabi et al. , 2018 ) . Another approach is to analyze the dynamics of specific optimization algorithms applied to neural networks ( Tian , 2017 ; Li & Yuan , 2017 ; Soltanolkotabi , 2017 ; Brutzkus & Globerson , 2017 ; Du et al. , 2018 ; Li & Liang , 2018 ; Allen-Zhu et al. , 2018 ; Zou et al. , 2018 ; Du et al. , 2019 ; Allen-Zhu et al. , 2019 ) . Alternatively , researchers have considered the evolution of gradient descent on two-layer neural networks using optimal transport theory ( Song et al. , 2018 ; Chizat & Bach , 2018 ; Sirignano & Spiliopoulos , 2019 ; Rotskoff & Vanden-Eijnden , 2018 ) . More recently , there is a growing recognition of intimate similarities between over-parameterized neural networks and kernel methods from an optimization perspective ( Zhang et al. , 2017 ; Daniely , 2017 ; Belkin et al. , 2018 ; Jacot et al. , 2018 ; Yang , 2019 ; Arora et al. , 2019b ; Lee et al. , 2019 ; E et al. , 2019b ) . For completeness , some work demonstrates a certain superiority of neural networks in generalization over the corresponding kernel methods ( Wei et al. , 2018 ; Allen-Zhu & Li , 2019 ; Ghorbani et al. , 2019 ) . 2 LOCAL ELASTICITY . This section formalizes the notion of local elasticity and proposes associated similarity measures that will be used for clustering in Section 3 . Denote by x ∈ Rd and y the feature vector and the label of an instance ( x , y ) , respectively . Let f ( x , w ) be the prediction with model parameters w , and write L ( f , y ) for the loss function . Consider using SGD to update the current parameters w using the instance ( x , y ) : w+ = w − ηdL ( f ( x , w ) , y ) dw = w − η ∂L ( f ( x , w ) , y ) ∂f · ∂f ( x , w ) ∂w . ( 1 ) In this context , we say that the classifier f is locally elastic at parameters w if |f ( x′ , w+ ) − f ( x′ , w ) | , the change in the prediction at a test feature vector x′ , is relatively large when x and x′ are similar/close , and vice versa . Here , by similar/close , we mean two input points x and x′ share many characteristics or are connected by a short geodesic path in the feature space . Intuitively , x and x′ are similar if x denotes an Egyptian cat and x′ denotes a Persian cat ; they are dissimilar if x denotes a German shepherd and x′ denotes a trailer truck . For illustration , Figure 2 ( a ) shows that the ( linear ) classifier is not locally elastic since the SGD update on x leads to significant impact on the prediction at x′ , though x′ is far from x ; on the other hand , the ( nonlinear ) classifier in Figure 2 ( b ) is locally elastic since the change at x′ is relatively small compared with that at x . In Section 2.3 , we provide some intuition why nonlinearity matters for local elasticity in two-layer neural nets . 2.1 RELATIVE SIMILARITY . The essence of local elasticity is that the change in the prediction has an ( approximate ) monotonic relationship with the similarity of feature vectors . Therefore , the change can serve as a proxy for the similarity of two inputs x and x′ : Srel ( x , x ′ ) : = |f ( x′ , w+ ) − f ( x′ , w ) | |f ( x , w+ ) − f ( x , w ) | . ( 2 ) In the similarity measure above , |f ( x , w+ ) − f ( x , w ) | is the change in the prediction of ( x , y ) used for the SGD update , and |f ( x′ , w+ ) − f ( x′ , w ) | is the change in the output of a test input x′ . Note that Srel ( x , x′ ) is not necessarily symmetric and , in particular , the definition depends on the weights w. Our experiments in Section 4 suggest the use of a near-optimal w ( which is also the case in the second definition of local elasticity in Section 2.2 ) . In the notion of local elasticity , locality suggests that this ratio is large when x and x′ are close , and vice versa , while elasticity means that this similarity measure decreases gradually and smoothly , as opposed to abruptly , when x′ moves away from x . Having evaluated this similarity measure for ( almost ) all pairs by performing SGD updates for several epochs , we can obtain a similarity matrix , whose rows are each regarded as a feature vector of its corresponding input . This can be used for clustering followed by K-means . 2.2 KERNELIZED SIMILARITY . Next , we introduce a different similarity measure that manifests local elasticity by making a connection to the neural tangent kernel ( Jacot et al. , 2018 ) . Taking a small learning rate η , for a new feature point x′ , the change in its prediction due to the SGD update in Equation ( 1 ) approximately satisfies : f ( x′ , w+ ) − f ( x′ , w ) = f ( x′ , w − η ∂L ∂f · ∂f ( x , w ) ∂w ) − f ( x′ , w ) ≈ f ( x′ , w ) − 〈 ∂f ( x′ , w ) ∂w , η ∂L ∂f · ∂f ( x , w ) ∂w 〉 − f ( x′ , w ) = −η ∂L ∂f 〈 ∂f ( x′ , w ) ∂w , ∂f ( x , w ) ∂w 〉 . The factor−η ∂L∂f does not involve x ′ , just as the denominator |f ( x , w+ ) −f ( x , w ) | in Equation ( 2 ) . This observation motivates an alternative definition of the similarity : Sker ( x , x ′ ) : = f ( x′ , w ) − f ( x′ , w+ ) η ∂L ( f ( x , w ) , y ) ∂f . ( 3 ) In the case of the ` 2 loss L ( f , y ) = 12 ( f − y ) 2 , for example , Sker ( x , x′ ) = f ( x′ , w ) −f ( x′ , w+ ) η ( f−y ) . In Section 3 , we apply the kernel K-means algorithm to this similarity matrix for clustering . The kernelized similarity in Equation ( 3 ) is approximately the inner product of the gradients of f at x and x′3 . This is precisely the definition of the neural tangent kernel ( Jacot et al. , 2018 ) ( see also Arora et al . ( 2019b ) ) if w is generated from i.i.d . normal distribution and the number of neurons in each layer tends to infinity . However , our empirical results suggest that a data-adaptive w may lead to more significant local elasticity . Explicitly , both similarity measures with pre-trained weights yield better performance of Algorithm 1 ( in Section 3 ) than those with randomly initialized weights . This is akin to the recent findings on a certain superioritiy of data-adaptive kernels over their non-adaptive counterparts ( Dou & Liang , 2019 ) .

Summary: This paper studies an interesting phenomenon in neural network models that the classifier's prediction at a one input will not be significantly perturbed after the classifier is updated via sgd at another input that is dissimilar from the former one. This phenomenon is termed as the local elasticity, which provides another perspective seeking to interpret the neural networks. They present that this local elasticity characteristic does not hold for linear models. To further investigate this property, the paper introduces the relative similarity and kernelized similarity based on which a k-means like clustering algorithm is developed to further find fine-grained clusters within a coarse-grained category, like dogs and cats from the mammal category. Interpreting neural networks is a hot research topic, and a paper advancing knowledge in this area is certainly welcome. The paper is well presented (with a small typo in the definition of S_ker(x,x)). In the experiments, it will be interesting to further investigate how the local elastic property changes with large batch size in that large batch size may encourage more diversity of the examples in a batch. Furthermore, it will be even more interesting to explore how these similarities can improve the performance of a simple k-nearest neighbor classifier.