Title: THE LOCAL ELASTICITY OF NEURAL NETWORKS

Abstract: This paper presents a phenomenon in neural networks that we refer to as local elasticity. Roughly speaking, a classifier is said to be locally elastic if its prediction at a feature vector x is not significantly perturbed, after the classifier is updated via stochastic gradient descent at a (labeled) feature vector x that is dissimilar to x in a certain sense. This phenomenon is shown to persist for neural networks with nonlinear activation functions through extensive simulations on real-life and synthetic datasets, whereas this is not observed in linear classifiers. In addition, we offer a geometric interpretation of local elasticity using the neural tangent kernel (Jacot et al., 2018) . Building on top of local elasticity, we obtain pairwise similarity measures between feature vectors, which can be used for clustering in conjunction with K-means. The effectiveness of the clustering algorithm on the MNIST and CIFAR-10 datasets in turn corroborates the hypothesis of local elasticity of neural networks on real-life data. Finally, we discuss some implications of local elasticity to shed light on several intriguing aspects of deep 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 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.,

x:

x'

(a) Linear classifier updated by SGD.

x x':

(b) Neural networks updated by SGD.

Figure 2 : An illustration of linear regression and neural networks updated via SGD. The prediction of x changes a lot after an SGD update on x in the linear case, though x is far away from x. In contrast, the change in the prediction at x is rather small in the neural networks case.

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) .

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 ∈ R d 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):

EQUATION

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 :

EQUATION

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 S rel (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:

EQUATION

In the case of the

2 loss L(f, y) = 1 2 (f -y) 2 , for example, S ker (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 x3 . 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) .

2.3. INTERPRETATION VIA TWO-LAYER NETWORKS:

We provide some intuition for the two similarity measures in Equation ( 2) and Equation (3) with two-layer neural networks. Letting x = (x , 1) ∈ R d+1 , denote the networks by f (x, w) = m r=1 a r σ(w r x), where σ(•) is the ReLU activation function (σ(x) = x for x ≥ 0 and σ(x) = 0 otherwise) and w = (w 1 , . . . , w r ) ∈ R m(d+1) . For simplicity, we set a k ∈ {-1, 1}. Note that this does not affect the expressibility of this net due to the positive homogeneity of ReLU.

Assuming w are i.i.d. normal random variables and some other conditions, in the appendix we show that this neural networks with the SGD rule satisfies

f (x , w + ) -f (x , w) f (x, w + ) -f (x, w) = (1 + o(1)) (x x + 1) m r=1 I{w T r x ≥ 0}I{w r x ≥ 0} ( x 2 + 1) m r=1 I{w T r x ≥ 0} . (4) Above, • denotes the 2 norm. For comparison, we get f (x ,w + )-f (x ,w) f (x,w + )-f (x,w) = x x +1

x 2 +1 for the linear neural networks f (x) := r=1 a r w r x. For both cases, the change in the prediction at x resulting from an SGD update at (x, y) involves a multiplicative factor of x x . However, the distinction is that the nonlinear classifier f gives rise to a dependence of the signed S ker (x, x ) on the fraction of neurons that are activated at both x and x . Intuitively, a close similarity between x and x can manifest itself with a large number of commonly activated neurons. This is made possible by the nonlinearity of the ReLU activation function. We leave the rigorous treatment of the discussion here for future work.

3. THE LOCAL ELASTICITY ALGORITHM FOR CLUSTERING:

This section introduces a novel algorithm for clustering that leverages the local elasticity of neural networks. We focus on the setting where all (primary) examples are from the same (known) superclass (e.g., mammal) and the interest is, however, to partition the primary examples into finer-grained (unknown) classes (e.g., cat and dog). To facilitate this process, we include an auxiliary dataset with all examples from a different superclass (e.g., vehicle). See Figure 3 for an illustration of the setting. To clear off any confusion, we remark that the aim is to corroborate the hypothesis of local elasticity by showing the effectiveness of this clustering algorithm.

The centerpiece of our algorithm is the dynamic construction of a matrix that records pairwise similarities between all primary examples. In brief, the algorithm operates as if it were learning to distinguish between the primary examples (e.g., mammals) and the auxiliary examples (e.g., vehicles) via SGD. On top of that, the algorithm evaluates the changes in the predictions for any pairs of primary examples during the training process, and the recorded changes are used to construct the pairwise similarity matrix based on either the relative similarity in Equation (2) or the kernelized similarity in Equation (3). Taking the mammal case as earlier, the rationale of the algorithm is that local elasticity is likely to yield a larger similarity score between two cats (or two dogs), and a smaller similarity score between a cat and a dog.

Algorithm 1 The Local Elasticity Based Clustering Algorithm. Input: primary dataset P = {x i } n i=1 , auxiliary dataset A = { x j } m j=1 , classifier f (x, w), initial weights w 0 , loss function L, learning rate η t , option o ∈{relative, kernelized} 1: combine D = {(x i , y i = 1) for x i ∈ P} {(x i , y i = -1) for x i ∈ A} 2: set S to n × n matrix of all zeros 3: for t = 1 to n + m do 4: sample (x, y) from D w/o replacement 5:

w t = SGD(w t-1 , x, y, f, L, η t ) 6: if y = 1 then 7: p t = Predict(w t , P, f ) 8: find 1 ≤ i ≤ n such that x = x i ∈ P 9:

if o = relative then 10:

s t = |pt-pt-1| |pt(i)-pt-1(i)| 11:

else 12: This method is formally presented in Algorithm 1, with elaboration as follows. While the initial parameters w 0 are often set to i.i.d. random variables, our experiments suggest that "pre-trained" weights can lead to better clustering performance. Hence, we use a warm-up period to get nearly optimal w 0 by training on the combined dataset D. When the SGD is performed at a primary example x i (labeled y i = 1) during the iterations, the function Predict(w i , P, f ) ∈ R n evaluates the predictions for all primary examples at w i , and these results are used to compute similarity measures between x i and other primary feature vectors using Equation (2) or Equation (3), depending on the option. If one chooses to use the kernelized similarity, the function GetGradient is called to the gradient of the loss function L at w t-1 , (x, y) with respect to f . In practice, we can repeat the loop multiple times and then average the similarity matrices over the epochs. Finally, using the symmetrized S symm , we apply an off-theshelf clustering method such as K-means (for relative similarity) or kernel K-means (for kernel similarity) to partition the primary dataset P into subclasses.

g t = GetGradient(w t-1 , x, y, f, L) 13: s t = pt-

4. EXPERIMENTS:



4.1. EXPERIMENTAL SETTINGS:

We evaluate the performance of Algorithm 1 on MNIST (LeCun, 1998) and CIFAR-10 (Krizhevsky, 2009) . For the MNIST dataset, we choose the 6 pairs of digits that are the most difficult for the binary K-means clustering. Likewise, 6 pairs of classes are selected from CIFAR-10. For each pair (e.g., 5 and 8), we construct the primary data set by randomly sampling a total of 1000 examples equally from the two classes in the pair. The auxiliary dataset consists of 1000 examples that are randomly drawn from one or two different classes (in the case of two classes, evenly distribute the 1000 examples across the two classes).

Our experiments consider two-layer feedforward neural networks (FNN, which is also used in Figure 1 ), CNN (Krizhevsky et al., 2012) , and ResNet (He et al., 2016) . We use 40960 neurons with the ReLU activation function for two-layer FNN and details of the other architectures can be found in Appendix A.4. We consider two types of loss functions, the 2 loss and the cross-entropy loss L(f, y) = -y log(f ). Note that neural networks with the cross-entropy loss have an extra sigmoid layer on top of all layers. We run Algorithm 1 in one epoch. For comparison, linear neural networks (with the identity activation function) with the same architectures of their nonlinear counterparts are used as baseline models. Here, the use of linear neural networks instead of linear regression is to prevent possible influence of over-parameterization on our experimental results4 . We also consider K-means and principal component analysis (PCA) followed by K-means as simple baselines.

4.2. RESULTS:

Comparison between relative and kernelized similarities. Table 1 and Table 2 display the results on MNIST and CIFAR-10, respectively. The relative similarity based method with the 2 loss performs best on CIFAR-10, while the kernelized similarity based method with the 2 loss outperforms the other methods on MNIST. Overall, our methods outperform both linear and simple baseline models. These results demonstrate the effectiveness of Algorithm 1 and confirm our hypothesis of local elasticity in neural nets as well.

Comparison between architectures. The results of Algorithm 1 with the aforementioned three types of neural networks, namely FNN, CNN, and ResNet on MNIST are presented in Table 3 . The results show that CNN in conjunction with the kernelized similarity has high classification accuracy.

In contrast, the simple three-layer ResNet seems to not capture local elasticity.

Published as a conference paper at ICLR 2020 To further evaluate the effectiveness of the local elasticity based Algorithm 1, we compare this clustering algorithm using CNN with two types of feature extraction approaches: autoencoder5 and pre-trained ResNet-152 (He et al., 2016 ). An autoencoder reconstructs the input data in order to learn its hidden representation. ResNet-152 is pre-trained on ImageNet (Deng et al., 2009) and can be used to extract features of images. The performance of those models on MNIST6 are shown in 

5. IMPLICATIONS AND FUTURE WORK:

In this paper, we have introduced a notion of local elasticity for neural networks. This notion enables us to develop a new clustering algorithm, and its effectiveness on the MNIST and CIFAR-10 datasets provide evidence in support of the local elasticity phenomenon in neural networks. While having shown the local elasticity in both synthetic and real-world datasets, we acknowledge that a mathematical foundation of this notion is yet to be developed. Specifically, how to rigorous formulate this notion for neural networks? A good solution to this question would involve the definition of a meaningful similarity measure and, presumably, would need to reconcile the notion with possible situations where the dependence between the prediction change and the similarity is not necessarily monotonic. Next, can we prove that this phenomenon occurs under some geometric structures of the dataset? Notably, recent evidence suggests that the structure of the training data has a profound im-pact on the performance of neural networks (Goldt et al., 2019) . Moreover, how does local elasticity depend on network architectures, activation functions, and optimization strategies?

Broadly speaking, local elasticity implies that neural networks can be plausibly thought of as a local method. We say a method is local if it seeks to fit a data point only using observations within a window of the data point. Important examples include the k-nearest neighbors algorithm, kernel smoothing, local polynomial regression (Fan, 2018) , and locally linear embedding (Roweis & Saul, 2000) . An exciting research direction is to formally relate neural networks to local methods. As opposed to the aforementioned classic local methods, however, neural networks seem to be capable of choosing the right bandwidth (window size) by adapting the data structure. It would be of great interest to show whether or not this adaptivity is a consequence of the elasticity of neural networks.

In closing, we provide further implications of this notion by seeking to interpret various aspects of neural networks via local elasticity. Our discussion lacks rigor and hence much future investigation is needed.

Memorization. Neural networks are empirically observed to be capable of fitting even random labels perfectly (Zhang et al., 2017) , with provable guarantees under certain conditions (Allen-Zhu et al., 2019; Du et al., 2019; Oymak & Soltanolkotabi, 2019) . Intuitively, local elasticity leads neural nets to progressively fit the examples in a vicinity of the input via each SGD update, while remaining fitting (most) labels that have been learned previously. A promising direction for future work is to relate local elasticity to memorization in a more concrete fashion.

Stability and generalization. Bousquet & Elisseeff (2002) demonstrate that the uniform stability of an algorithm implies generalization on a test dataset. As noted by Kuzborskij & Lampert (2018) , due to its distribution-free and worst-case nature, uniform stability can lead to very loose bounds on generalization. The local elasticity of neural networks, however, suggests that the replace of one training point by another imposes limited perturbations on the predictions of most points and thus the loss might be more stable than expected. In this regard, it is possible to introduce a new notion of stability that relies on the metric of the input space for better generalization bounds.

Data normalization and batch normalization. The two normalization techniques are commonly used to improve the performance of neural networks (Gonzalez & Woods, 2002; Ioffe & Szegedy, 2015) . The local elasticity viewpoint appears to imply that these techniques allow for a more solid relationship between the relative prediction change and a certain distance between feature vectors. Precisely, writing the lifting map ϕ(x) ≈ ∂f (x,w) ∂w , Section 2.2 reveals that the kernelized similarity approximately satisfies 2S ker (x, x ) ≈ ϕ(x) 2 + ϕ(x ) 2 -d(x, x ) 2 , where d(x, x ) = ϕ(x)ϕ(x ) . To obtain a negative correlation between the similarity and the distance, therefore, one possibility is to have the norms of ϕ(x) and ϕ(x ) about equal to a constant. This might be made possible by employing the normalization techniques. See some empirical results in Appendix A.4. A venue for future investigation is to consolidate this implication on normalization techniques.

A EXPERIMENTAL DETAILS AND ADDITIONAL RESULTS:



A.1 CONSTRUCTION OF THE SYNTHETIC EXAMPLES IN FIGURE 1:

The blue examples in the torus function (Figure 1(a) ) can be defined parametrically by:

x(θ) = (8 + sin(4θ)) cos θ y(θ) = (8 + sin(4θ)) sin θ z(θ) = cos(4θ) (5)

Similarly, the red examples in the torus function are defined by:

x(θ) = (8 -sin(4θ)) cos θ y(θ) = (8 -sin(4θ)) sin θ z(θ) = -cos(4θ) (6)

The blue examples in the two folded boxes function (Figure 1(d) ) are sampled from:

EQUATION

Similarly, the red examples in the two folded boxes function are defined as:

EQUATION

Geodesic distance is used to measure the shortest path between two points in a surface, or more generally in a Riemannian manifold. For example, in Figure 1 , the geodesic distance for the torus function and the two folded boxes function is the distance in the curve and the distance in the surface rather than the Euclidean distance.

A.2 MORE SIMULATIONS:

More simulations can be found in Figure 4 .

We further explore the local elasticity of ResNet-152 on ImageNet. We find that, when the pretrained ResNet-152 are updated on a tabby cat via SGD, the predictions of tiger cats change more drastically than the predictions of warplanes. We randomly pick 50 examples from the tabby cat synset as updating points, 25 examples from the tiger cat synset and 25 examples from the warplane synset as testing points. After updating on a tabby cat, we can get the average change of predictions on the 25 tiger cats and that on the 25 warplanes. By conducting a Wilcoxon rank-sum test with SGD updates on 50 different tabby cats, we find that the average change of the predictions on the tiger cat are significantly more drastic than that on the warplane with a p-value of 0.0007. The overall average relative similarity between the tiger cats and the tabby cats is 4.4, while the overall average similarity between the warplanes and the tabby cats is 6.6. Note that the relative similarity is computed from the relative KL divergence between the original prediction and the updated prediction.

Specifically, we find that the change of the predictions (KL divergence of 0.03) on the tiger cat (Figure 5 (b)) is more drastic than that (KL divergence of 0.002) on the warplane (Figure 5 (c)) after a SGD update on the tabby cat (Figure 5 (a)), although the Euclidean distance (511) between the warplane and the tabby cat is smaller than that (854) between the tiger cat and the tabby cat.

Moreover, we conduct a simulation study to examine local elasticity in the case of using mini-batch SGD for updates. Specifically, we consider updating the weights of ResNet-152 in one iteration using two images. The training and test images are displayed in Figure 6 . We find that the changes of the predictions on the tabby cat (Figure 6 

A.3 SOME CALCULATIONS:

We brief explain how to obtain Equation (4) under the same assumptions of Li & Liang (2018) .

f (x , w + ) -f (x , w) = m r=1 a r σ((w + r ) x ) - m r=1 a r σ(w r x ) = m r=1 a r σ w r -η ∂L ∂f a r xI{w T r x ≥ 0} x - m r=1 a r σ(w r x ) = m r=1 a r σ w r x -η ∂L ∂f a r x x I{w T r x ≥ 0} - m r=1 a r σ(w r x ) = ∆ 1 + ∆ 2 ,

where

∆ 1 = -η ∂L ∂f m r=1 x x I{w T r x ≥ 0}I{w r x ≥ 0} = -η ∂L ∂f x x m r=1 I{w T r x ≥ 0}I{w r x ≥ 0}

and

∆ 2 ≤ m r=1 -a r η ∂L ∂f a r x x I{w T r x ≥ 0} • I w r x -η ∂L ∂f a r x x I{w T r x ≥ 0} ≥ 0 -I{w r x ≥ 0} = η ∂L ∂f x x m r=1 I{w T r x ≥ 0} I w r x -η ∂L ∂f a r x x I{w T r x ≥ 0} ≥ 0 -I{w r x ≥ 0} = η ∂L ∂f x x m r=1 I{w T r x ≥ 0} I w r x -η ∂L ∂f a r x x ≥ 0 -I{w r x ≥ 0} .

As shown in Li & Liang (2018) , only a vanishing fraction of the neurons lead to different patterns between I w r x -η ∂L ∂f a r x x ≥ 0 and I{w r x ≥ 0}. Consequently, we get

|∆ 2 | |∆ 1 |, thereby certifying f (x , w + ) -f (x , w) = -(1 + o(1))η ∂L ∂f x x m r=1 I{w T r x ≥ 0}I{w r x ≥ 0} = (1 + o(1)) x x m r=1 I{w T r x ≥ 0}I{w r x ≥ 0} x 2 m r=1 I{w T r x ≥ 0} (f (x, w + ) -f (x, w)).

A supports the intuition that we can learn detailed features of primary examples to better distinguish them from auxiliary examples. The results of two different types of parameter initialization are shown in Table 5 .

Auxiliary examples. In general, we can choose those samples that are similar to primary examples as auxiliary examples, so they can help neural nets better learn primary examples. We analyze the primary examples pair 5 and 8 in MNIST with 6 different settings of auxiliary examples. We find that the choice of auxiliary examples are crucial. For example, in our case 9 is close to 5 and 3 is close to 8 based on K-means clustering results, so that we can choose 9 and 3 as auxiliary examples for models to better distinguish 5 and 8. The results of different auxiliary examples for 5 vs 8 on MNIST are shown in Table 6 .

Normalized kernelized similarity. The normalized kernelized similarity is S ker (x, x ) := S ker (x, x )/ S ker (x, x)S ker (x , x ).

The normalized kernelized similarity can achieve more stable local elasticity. We compare clustering algorithms based on kernelized similarity and normalized kernelized similarity in MNIST. We find that the performance of the normalized kernelized similarity based methods is slightly better than that of kernelized similarity based methods with the 2 loss, although this conclusion no longer holds true with cross-entropy loss. The results of the normalized kernelized similarity are shown in Table 7 .

Expected relative change. We compute the average relative change of two-layer neural nets and linear neural networks fitting the torus function. The average relative change of two-layer neural nets and linear neural networks are 0.44 and 0.68, indicating that SGD updates of two-layer neural nets are more local than that of two-layer linear neural networks. These findings further support our local elasticity theory of neural nets.

Activation patterns. The key difference between our methods and linear baselines is nonlinear activation. We analyze the relations between the patterns of ReLU activation function of two-layer neural nets and corresponding Euclidean distances. For each input x, we use a to denote the binary activation pattern of each neuron. The similarity between binary activation patterns is computed from the cosine similarity function. We find that the activation similarity is linearly dependent on the Euclidean distance, meaning that closer points in the Euclidean space will have more similar activation patterns. The activation analysis of neural nets local elasticity are shown in Figure 7 (a).

Activation functions. We experiment on another standard activation function, sigmoid, to see its local elasticity. We find that sigmoid can also provide neural nets with the local elasticity. The local elasticity of two-layer neural nets with sigmoid activation function on the torus function is shown in Figure 7 (b).

Data normalization. The performance of the methods without data normalization are shown in Table 8 . The results show that normalization is important for our methods, which are consistent with our analysis in Section 5.

:

This property also holds for the 1-nearest neighbors algorithm.

Without using the kernel trick, these classifiers include linear regression, logistic regression, support vector machine, and linear neural networks.

Papernot & McDaniel (2018)). Meanwhile, the elasticity part implies that the prediction surface is

As opposed to the relative similarity, this definition does not take absolute value in order to retain its interpretation as an inner product.

In fact, our experiments show that the two models exhibit very similar behaviors.

We use the autoencoder in https://github.com/L1aoXingyu/pytorch-beginner/blob/ master/08-AutoEncoder/conv_autoencoder.py.

Here, the comparison between our methods and ResNet-152 on CIFAR-10 is not fair since ResNet-152 is trained using samples from the same classes as CIFAR-10.

As a remark, here we do not compare with other clustering methods that are based on neural networks, such as DEC(Xie et al., 2016). We can replace K-means by other clustering algorithms to possibly improve the performance in some situations.

Figures and Tables:

(a) The torus. (b) Two-layer nets fitting the torus. (c) Two-layer linear nets fitting the torus. (d) The two folded boxes. (e) Three-layer nets fitting the boxes.(f) Three-layer linear nets fitting the boxes.

Figure 1: Comparisons between ReLU neural networks and linear neural networks in terms of local elasticity. In the left column, the red points form one class and the blue points form the other class. The linear nets are of the same sizes as their non-linear counterparts. The details on how to construct the torus and boxes can be found in Appendix A.1 and the network architectures are described in Appendix A.4. During the training process of the neural networks, we plot the geodesic distance (see more details in Appendix A.1) between two blue points x and x , and their relative prediction changes (see its definition in Equation (2)) in (b), (c), (e), and (f). The correlations of (b), (c), (e), and (f) are -0.97, -0.48, -0.92, and -0.14, respectively. (b) and (e) show that the distance and the relative change exhibit decreasing monotonic relationship, thereby confirming local elasticity, while no monotonic relationship is found in (c) and (f).

Figure 3: Illustration of the primary dataset and auxiliary dataset taken as input by the local elasticity based clustering algorithm.

(c), KL divergence of 0.021) and on the warplane(Figure 6(d), KL divergence of 0.024) are more substantial than that on the tree frog (Figure6(e), KL divergence of 0.0004) after an SGD update on the minibatch composed of a tabby cat (Figure6(a)) and a warplane(Figure 6(b)).

(a) Two cosine functions. (b) The local elasticity of two-layer neural nets fitting these two cosine functions. (c) The double helix function. (d) The local elasticity of two-layer neural nets fitting the double helix function. (e) Two cycle functions. (f) The local elasticity of two-layer neural nets fitting two cycle functions. (g) Two sphere functions. (h) The local elasticity of two-layer neural nets fitting two sphere functions.

Figure 4: More simulations of the local elasticity.

Figure 5: Simulations in real data. We show specific examples for a tabby cat, a tiger cat and a warplane.

Figure 6: Simulations showing local elasticity with mini-batch SGD.

(a) Activation analysis of two-layer neural nets with ReLU activation function on the torus function. (b) The local elasticity of two-layer neural nets with sigmoid activation function on the torus function.

Figure 7: The activation analysis and the activation function analysis of neural nets local elasticity. The Pearson correlation between the cosine similarity based on activation patterns and the corresponding Euclidean distances is -0.97 on the torus function. The cosine similarity within activation patterns indicates the Euclidean distance between two data points. The Pearson correlation between the relative similarity based on two-layer neural nets with sigmoid activation function and the geodesic distance is -0.99. It indicates that two-layer neural nets with sigmoid activation function also have a strong local elastic effect.

Classification accuracy of Algorithm 1 and other methods on the MNIST dataset. BCE stands for the binary cross-entropy loss. We use K-means for relative similarity based clustering algorithms, and kernel K-means for kernelized similarity based clustering algorithms. For example, BCE-kernelized (linear) denotes the setting that uses the BCE loss, kernelized similarity and the linear activation function. The highest accuracy score in each study is in boldface.

Table content: <table><tr><td colspan="2">Primary Examples</td><td colspan="6">5 vs 8 4 vs 9 7 vs 9 5 vs 9 3 vs 5 3 vs 8</td></tr><tr><td colspan="2">Auxiliary Examples</td><td>3, 9</td><td>5, 7</td><td>4, 5</td><td>4, 8</td><td>8, 9</td><td>5</td></tr><tr><td colspan="2">K-means</td><td>50.4</td><td>54.5</td><td>55.5</td><td>56.3</td><td>69.0</td><td>76.5</td></tr><tr><td colspan="2">PCA + K-means</td><td>50.4</td><td>54.5</td><td>55.7</td><td>56.5</td><td>70.7</td><td>76.4</td></tr><tr><td colspan="2">2 -relative(linear)</td><td>51.0</td><td>54.6</td><td>51.3</td><td>58.8</td><td>58.3</td><td>58.7</td></tr><tr><td colspan="2">2 -kernelized (linear)</td><td>50.1</td><td>55.5</td><td>55.5</td><td>56.3</td><td>69.3</td><td>76.1</td></tr><tr><td colspan="2">BCE-relative (linear)</td><td>50.1</td><td>50.0</td><td>50.2</td><td>50.6</td><td>51.4</td><td>50.1</td></tr><tr><td colspan="2">BCE-kernelized (linear)</td><td>50.7</td><td>56.7</td><td>62.3</td><td>55.2</td><td>53.9</td><td>51.6</td></tr><tr><td colspan="2">2 -relative (ours)</td><td>75.9</td><td>55.6</td><td>62.5</td><td>89.3</td><td>50.3</td><td>74.7</td></tr><tr><td colspan="2">2 -kernelized (ours)</td><td>71.0</td><td>63.8</td><td>64.6</td><td>67.8</td><td>71.5</td><td>78.8</td></tr><tr><td colspan="2">BCE-relative (ours)</td><td>50.2</td><td>50.5</td><td>51.9</td><td>55.7</td><td>53.7</td><td>50.2</td></tr><tr><td colspan="2">BCE-kernelized (ours)</td><td>52.1</td><td>59.3</td><td>64.5</td><td>58.2</td><td>52.5</td><td>51.8</td></tr><tr><td>Primary Examples</td><td colspan="7">Car vs Cat Car vs Horse Cat vs Bird Dog vs Deer Car vs Bird Deer vs Frog</td></tr><tr><td>Auxiliary Examples</td><td>Bird</td><td>Cat, Bird</td><td/><td>Car</td><td>Frog</td><td>Cat</td><td>Dog</td></tr><tr><td>K-means</td><td>50.3</td><td>50.9</td><td/><td>51.1</td><td>51.6</td><td>51.8</td><td>52.4</td></tr><tr><td>PCA + K-means</td><td>50.6</td><td>51.0</td><td/><td>51.1</td><td>51.6</td><td>51.7</td><td>52.4</td></tr><tr><td>2 -relative (linear)</td><td>50.0</td><td>56.8</td><td/><td>55.2</td><td>50.6</td><td>56.3</td><td>52.5</td></tr><tr><td>2 -kernelized (linear)</td><td>50.4</td><td>50.7</td><td/><td>51.1</td><td>51.3</td><td>51.9</td><td>52.8</td></tr><tr><td>BCE-relative (linear)</td><td>50.4</td><td>50.9</td><td/><td>50.2</td><td>50.6</td><td>55.3</td><td>50.2</td></tr><tr><td>BCE-kernelized (linear)</td><td>55.7</td><td>58.1</td><td/><td>52.0</td><td>50.5</td><td>55.8</td><td>53.0</td></tr><tr><td>2 -relative (ours)</td><td>53.7</td><td>50.2</td><td/><td>58.4</td><td>54.2</td><td>63.0</td><td>53.5</td></tr><tr><td>2 -kernelized (ours)</td><td>52.1</td><td>50.5</td><td/><td>53.6</td><td>52.7</td><td>50.5</td><td>53.0</td></tr><tr><td>BCE-relative (ours)</td><td>51.1</td><td>53.5</td><td/><td>50.7</td><td>51.1</td><td>55.6</td><td>50.3</td></tr><tr><td>BCE-kernelized (ours)</td><td>58.4</td><td>59.7</td><td/><td>56.6</td><td>51.2</td><td>55.0</td><td>51.8</td></tr></table>

Classification accuracy of Algorithm 1 and other methods on the CIFAR-10 dataset.

Table content: <table/>

Comparison of different architectures for the local elasticity based clustering algorithm. We only consider the 2 loss on MNIST here for the sake of simplicity.

Table content: <table><tr><td>Primary Examples</td><td colspan="6">5 vs 8 4 vs 9 7 vs 9 5 vs 9 3 vs 5 3 vs 8</td></tr><tr><td>Auxiliary Examples</td><td>3, 9</td><td>5, 7</td><td>4, 5</td><td>4, 8</td><td>8, 9</td><td>5</td></tr><tr><td>2 -relative (FNN)</td><td>75.9</td><td>55.6</td><td>62.5</td><td>89.3</td><td>50.3</td><td>74.7</td></tr><tr><td>2 -kernelized (FNN)</td><td>71.0</td><td>63.8</td><td>64.6</td><td>67.8</td><td>71.5</td><td>78.8</td></tr><tr><td>2 -relative (CNN)</td><td>54.2</td><td>53.7</td><td>89.1</td><td>50.1</td><td>50.1</td><td>83.0</td></tr><tr><td>2 -kernelized (CNN)</td><td>64.1</td><td>69.5</td><td>91.3</td><td>97.6</td><td>75.3</td><td>87.4</td></tr><tr><td>2 -relative (ResNet)</td><td>50.7</td><td>55.0</td><td>55.5</td><td>78.3</td><td>52.3</td><td>52.3</td></tr><tr><td>2 -kernelized (ResNet)</td><td>50.2</td><td>60.4</td><td>54.8</td><td>76.3</td><td>66.9</td><td>68.8</td></tr><tr><td>Primary Examples</td><td colspan="6">5 vs 8 4 vs 9 7 vs 9 5 vs 9 3 vs 5 3 vs 8</td></tr><tr><td>Auxiliary Examples</td><td>3, 9</td><td>5, 7</td><td>4, 5</td><td>4, 8</td><td>8, 9</td><td>5</td></tr><tr><td>AutoEncoder</td><td>50.9</td><td>54.0</td><td>61.8</td><td>70.0</td><td>64.3</td><td>67.1</td></tr><tr><td>ResNet-152</td><td>85.2</td><td>94.2</td><td>93.1</td><td>82.0</td><td>65.8</td><td>96.0</td></tr><tr><td>2 -relative (ours)</td><td>54.2</td><td>53.7</td><td>89.1</td><td>50.1</td><td>50.1</td><td>83.0</td></tr><tr><td>2 -kernelized (ours)</td><td>64.1</td><td>69.5</td><td>91.3</td><td>97.6</td><td>75.3</td><td>87.4</td></tr></table>

Comparison with other feature extraction methods. For simplicity, we only consider CNN with 2 loss on MNIST. The features from autoencoder and ResNet-152 are clustered by K-means.

Table content: <table/>

Overall, autoencoder yields worst results. Although ResNet-152 performs quite well in general, yet our methods outperform it in some cases. It is an interesting direction to combine the strength of our algorithm and ResNet-152 in classification tasks that are very different from ImageNet. Moreover, unlike ResNet-152, our methods do not require a large number of examples for pre-training 7 . To better appreciate local elasticity and Algorithm 1, we study the effect of parameter initialization, auxiliary examples and normalized kernelized similarity in Appendix A.4. More discussions on the expected relative change, activation patterns, and activation functions can also be found in Appendix A.4.

Table content: <table/>

Comparison of two different settings, random and optimal (default), for parameter initialization. For simplicity, we only consider 2 loss on MNIST here.Architectures. We use 40960 neurons with ReLU activation function for two-layer neural nets in simulations and experiments. We use 8192 neurons for each hidden layer with ReLU activation function in three-layer neural networks in simulations. The ResNet we use in experiments is a three-layer net that contains 4096 neurons and a ReLU activation function in each layer. The CNN for MNIST we use in experiments is the same architecture as that in https://github.com/ pytorch/examples/blob/master/mnist/main.py.

Table content: <table><tr><td colspan="3">.4 MORE ASPECTS ON THE EXPERIMENTS</td><td/><td/><td/><td/></tr><tr><td>Primary Examples</td><td colspan="6">5 vs 8 4 vs 9 7 vs 9 5 vs 9 3 vs 5 3 vs 8</td></tr><tr><td>Auxiliary Examples</td><td>3, 9</td><td>5, 7</td><td>4, 5</td><td>4, 8</td><td>8, 9</td><td>5</td></tr><tr><td>2 -relative (random)</td><td>50.9</td><td>55.2</td><td>51.2</td><td>59.0</td><td>58.5</td><td>59.9</td></tr><tr><td>2 -kernelized (random)</td><td>50.4</td><td>55.5</td><td>55.7</td><td>56.6</td><td>68.4</td><td>75.9</td></tr><tr><td>2 -relative (ours)</td><td>75.9</td><td>55.6</td><td>62.5</td><td>89.3</td><td>50.3</td><td>74.7</td></tr><tr><td>2 -kernelized (ours)</td><td>71.0</td><td>63.8</td><td>64.6</td><td>67.8</td><td>71.5</td><td>78.8</td></tr><tr><td colspan="7">Weights. As discussed in Section 3, parameter initialization is important for local elasticity based</td></tr><tr><td colspan="7">clustering methods. We find that the optimal setting always outperforms the random setting. It</td></tr><tr><td>Primary Examples</td><td colspan="6">5 vs 8 5 vs 8 5 vs 8 5 vs 8 5 vs 8 5 vs 8</td></tr><tr><td>Auxiliary Examples</td><td>3, 9</td><td>6, 9</td><td>2, 3</td><td>2, 6</td><td>3</td><td>9</td></tr><tr><td>2 -relative (ours)</td><td>75.9</td><td>53.7</td><td>54.3</td><td>51.2</td><td>53.9</td><td>60.6</td></tr><tr><td>2 -kernelized (ours)</td><td>71.0</td><td>54.4</td><td>50.2</td><td>51.6</td><td>50.6</td><td>54.4</td></tr><tr><td>BCE-relative (ours)</td><td>50.2</td><td>50.4</td><td>50.1</td><td>50.2</td><td>52.3</td><td>50.1</td></tr><tr><td>BCE-kernelized (ours)</td><td>52.1</td><td>52.7</td><td>51.6</td><td>52.4</td><td>50.3</td><td>50.3</td></tr></table>

Comparison of different auxiliary examples for 5 vs 8 on MNIST.

Table content: <table><tr><td>Primary Examples</td><td colspan="6">5 vs 8 4 vs 9 7 vs 9 5 vs 9 3 vs 5 3 vs 8</td></tr><tr><td>Auxiliary Examples</td><td>3, 9</td><td>5, 7</td><td>4, 5</td><td>4, 8</td><td>8, 9</td><td>5</td></tr><tr><td>2 -kernelized (ours)</td><td>71.0</td><td>63.8</td><td>64.6</td><td>67.8</td><td>71.5</td><td>78.8</td></tr><tr><td>BCE-kernelized (ours)</td><td>52.1</td><td>59.3</td><td>64.5</td><td>58.2</td><td>52.5</td><td>51.8</td></tr><tr><td>2 -normalized-kernelized (ours)</td><td>71.3</td><td>62.3</td><td>64.8</td><td>68.0</td><td>73.0</td><td>79.5</td></tr><tr><td>BCE-normalized-kernelized (ours)</td><td>52.0</td><td>57.5</td><td>61.0</td><td>56.9</td><td>50.1</td><td>75.2</td></tr></table>

Comparison between the kernelized similarity based methods and the normalized kernelized similarity based methods on MNIST.

Table content: <table><tr><td>Primary Examples</td><td colspan="6">5 vs 8 4 vs 9 7 vs 9 5 vs 9 3 vs 5 3 vs 8</td></tr><tr><td>Auxiliary Examples</td><td>3, 9</td><td>5, 7</td><td>4, 5</td><td>4, 8</td><td>8, 9</td><td>5</td></tr><tr><td>2 -relative (unnormalized)</td><td>51.5</td><td>58.4</td><td>55.9</td><td>53.0</td><td>69.9</td><td>75.5</td></tr><tr><td>2 -kernelized (unnormalized)</td><td>51.4</td><td>56.1</td><td>55.3</td><td>57.2</td><td>62.1</td><td>75.1</td></tr><tr><td>BCE-relative (unnormalized)</td><td>50.1</td><td>50.3</td><td>50.7</td><td>53.2</td><td>50.9</td><td>50.1</td></tr><tr><td>BCE-kernelized (unnormalized)</td><td>50.6</td><td>56.9</td><td>59.6</td><td>54.4</td><td>52.2</td><td>50.8</td></tr><tr><td>2 -relative (ours)</td><td>75.9</td><td>55.6</td><td>62.5</td><td>89.3</td><td>50.3</td><td>74.7</td></tr><tr><td>2 -kernelized (ours)</td><td>71.0</td><td>63.8</td><td>64.6</td><td>67.8</td><td>71.5</td><td>78.8</td></tr><tr><td>BCE-relative (ours)</td><td>50.2</td><td>50.5</td><td>51.9</td><td>55.7</td><td>53.7</td><td>50.2</td></tr><tr><td>BCE-kernelized (ours)</td><td>52.1</td><td>59.3</td><td>64.5</td><td>58.2</td><td>52.5</td><td>51.8</td></tr></table>



Table content: <table/>

Peer review (iclr2020):
[Summary] This paper proposes and studies the “local elasticity”, a quantitative measure for the ability of neural networks to only locally change its prediction (around x) after a stochastic gradient step at x. The paper verifies experimentally that nonlinear neural nets are locally elastic through showing that an elasticity-motivated similarity score can perform clustering well. [Pros] The notion of local elasticity is interesting and has the potential of opening up lots of further directions. The way I understand it is to relate to memorization (as the authors have indeed discussed) --- I think “local elasticity” can be viewed as some sort of “local memorization ability”, in that the NN is able to change its prediction only in a small neighborhood of x---without affecting predictions at other remote x’s---after one SGD step on x. Conceptually this is something not covered by the existing narratives in deep learning theory, yet the phenomenon itself is quite convincing and could provide a new perspective into lots of things. [Cons] It feels like the experimental results in the present paper is a rather indirect evidence for the local elasticity -- that the similarity score coming from the elasticity works well for a downstream clustering task. Could there be some more direct evidence about the local elasticity? How would the elasticity compare on different architectures? In the present form the experiments perhaps at most says that the similarity score makes sense, not yet that a fully quantitative characterization of the local elasticity. I’m also a little bit concerned about the fairness of the clustering experiment, in that the elasticity-motivated clustering algorithm utilizes an auxiliary dataset whereas simple baselines such as K-means and PCA K-means are not able to use that. Is there a way of modifying the K-means and PCA K-means so that they can also use this auxiliary dataset while still giving a sensible algorithm for the primary 2-class clustering task?