FlatNN
Some trial and error regarding the Paper: https://arxiv.org/abs/1706.05394
view repo
We examine the role of memorization in deep learning, drawing connections to capacity, generalization, and adversarial robustness. While deep networks are capable of memorizing noise data, our results suggest that they tend to prioritize learning simple patterns first. In our experiments, we expose qualitative differences in gradientbased optimization of deep neural networks (DNNs) on noise vs. real data. We also demonstrate that for appropriately tuned explicit regularization (e.g., dropout) we can degrade DNN training performance on noise datasets without compromising generalization on real data. Our analysis suggests that the notions of effective capacity which are dataset independent are unlikely to explain the generalization performance of deep networks when trained with gradient based methods because training data itself plays an important role in determining the degree of memorization.
READ FULL TEXT VIEW PDF
Background: It is still an open research area to theoretically understan...
read it
Why does training deep neural networks using stochastic gradient descent...
read it
Deep neural networks have gained tremendous popularity in last few years...
read it
A robust theoretical framework that can describe and predict the
general...
read it
We study gradientbased regularization methods for neural networks. We m...
read it
Previous work has examined the ability of larger capacity neural network...
read it
Despite their overwhelming capacity to overfit, deep learning architectu...
read it
Some trial and error regarding the Paper: https://arxiv.org/abs/1706.05394
The traditional view of generalization holds that a model with sufficient capacity (e.g. more parameters than training examples) will be able to “memorize” each example, overfitting the training set and yielding poor generalization to validation and test sets (Goodfellow et al., 2016). Yet deep neural networks (DNNs) often achieve excellent generalization performance with massively overparameterized models. This phenomenon is not wellunderstood.
From a representation learning perspective, the generalization capabilities of DNNs are believed to stem from their incorporation of good generic priors (see, e.g., Bengio et al. (2009)). Lin & Tegmark (2016) further suggest that the priors of deep learning are well suited to the physical world. But while the priors of deep learning may help explain why DNNs learn to efficiently represent complex realworld functions, they are not restrictive enough to rule out memorization.
On the contrary, deep nets are known to be universal approximators, capable of representing arbitrarily complex functions given sufficient capacity (Cybenko, 1989; Hornik et al., 1989). Furthermore, recent work has shown that the expressiveness of DNNs grows exponentially with depth (Montufar et al., 2014; Poole et al., 2016). These works, however, only examine the representational capacity, that is, the set of hypotheses a model is capable of expressing via some value of its parameters.
Because DNN optimization is not wellunderstood, it is unclear which of these hypotheses can actually be reached by gradientbased training (Bottou, 1998). In this sense, optimization and generalization are entwined in DNNs. To account for this, we formalize a notion of the effective capacity (EC) of a learning algorithm (defined by specifying both the model and the training procedure, e.g.,“train the LeNet architecture (LeCun et al., 1998)
for 100 epochs using
stochastic gradient descent (SGD) with a learning rate of ”) as the set of hypotheses which can be reached by applying that learning algorithm on some dataset. Formally, using setbuilder notation:where represents the set of hypotheses that is reachable by on a dataset ^{1}^{1}1 Since can be stochastic, is a set. .
One might suspect that DNNs effective capacity is sufficiently limited by gradientbased training and early stopping to resolve the apparent paradox between DNNs’ excellent generalization and their high representational capacity. However, the experiments of Zhang et al. (2017) suggest that this is not the case. They demonstrate that DNNs are able to fit pure noise without even needing substantially longer training time. Thus even the effective capacity of DNNs may be too large, from the point of view of traditional learning theory.
By demonstrating the ability of DNNs to “memorize” random noise, Zhang et al. (2017) also raise the question whether deep networks use similar memorization tactics on real datasets. Intuitively, a bruteforce memorization approach to fitting data does not capitalize on patterns shared between training examples or features; the content of what is memorized is irrelevant. A paradigmatic example of a memorization algorithm is knearest neighbors (Fix & Hodges Jr, 1951). Like Zhang et al. (2017), we do not formally define memorization; rather, we investigate this intuitive notion of memorization by training DNNs to fit random data.
We operationalize the definition of “memorization” as the behavior exhibited by DNNs trained on noise, and conduct a series of experiments that contrast the learning dynamics of DNNs on real vs. noise data. Thus, our analysis builds on the work of Zhang et al. (2017) and further investigates the role of memorization in DNNs.
Our findings are summarized as follows:
There are qualitative differences in DNN optimization behavior on real data vs. noise. In other words, DNNs do not just memorize real data (Section 3).
DNNs learn simple patterns first, before memorizing (Section 4). In other words, DNN optimization is contentaware, taking advantage of patterns shared by multiple training examples.
Regularization techniques can differentially hinder memorization in DNNs while preserving their ability to learn about real data (Section 5).
We perform experiments on MNIST (LeCun et al., 1998) and CIFAR10 (Krizhevsky et al., )
datasets. We investigate two classes of models: 2layer multilayer perceptrons (MLPs) with rectifier linear units (ReLUs) on MNIST and convolutional neural networks (CNNs) on CIFAR10. If not stated otherwise, the MLPs have 4096 hidden units per layer and are trained for
epochs with SGD and learning rate . The CNNs are a small Alexnetstyle CNN^{2}^{2}2Input Crop(2,2) Conv(200,5,5) BN ReLU MaxPooling(3,3) Conv(200,5,5) BN ReLU MaxPooling(3,3) Dense(384) BN ReLU Dense(192) BN ReLU Dense(classes) Softmax. Here Crop(. , .) crops height and width from both sides with respective values. (as in Zhang et al. (2017)), and are trained using SGD with momentum= and learning rate of , scheduled to drop by half every 15 epochs.Following Zhang et al. (2017)
, in many of our experiments we replace either (some portion of) the labels (with random labels), or the inputs (with i.i.d. Gaussian noise matching the real dataset’s mean and variance) for some fraction of the training set. We use
randX and randY to denote datasets with (100%, unless specified) noisy inputs and labels (respectively).Zhang et al. (2017) empirically demonstrated that DNNs are capable of fitting random data, which implicitly necessitates some high degree of memorization. In this section, we investigate whether DNNs employ similar memorization strategy when trained on real data. In particular, our experiments highlight some qualitative differences between DNNs trained on real data vs. random data, supporting the fact that DNNs do not use bruteforce memorization to fit real datasets.
A bruteforce memorization approach to fitting data should apply equally well to different training examples. However, if a network is learning based on patterns in the data, some examples may fit these patterns better than others. We show that such “easy examples” (as well as correspondingly “hard examples”) are common in real, but not in random, datasets. Specifically, for each setting (real data, randX, randY), we train an MLP for a single epoch starting from 100 different random initializations and shufflings of the data. We find that, for real data, many examples are consistently classified (in)correctly after a single epoch, suggesting that different examples are significantly easier or harder in this sense. For noise data, the difference between examples is much less, indicating that these examples are fit (more) independently. Results are presented in Figure
1.For randX, apparent differences in difficulty are well modeled as random Binomial noise. For randY, this is not the case, indicating some use of shared patterns. Visualizing firstlevel features learned by a CNN supports this hypothesis (Figure 2).
To further investigate the difference between real and fully random inputs, we propose a proxy measure of memorization via gradients. Since we cannot measure quantitatively how much each training sample is memorized, we instead measure the effect of each sample on the average loss. That is, we measure the norm of the loss gradient with respect to a previous example after SGD updates. Let be the loss after updates; then the sensitivity measure is given by
The parameter update from training on influences all future indirectly by changing the subsequent updates on different training examples. We denote the average over after steps as , and refer to it as losssensitivity. Note that we only report norm results, but that results stay very similar using norm and infinity norm.
We compute by unrolling
SGD steps and applying backpropagation over the unrolled computation graph, as done by
Maclaurin et al. (2015). Unlike Maclaurin et al. (2015), we only use this procedure to compute , and do not modify the training procedure in any way.We find that for real data, only a subset of the training set has high , while for random data, is high for virtually all examples. We also find a different behavior when each example is given a unique class; in this scenario, the network has to learn to identify each example uniquely, yet still behaves differently when given real data than when given random data as input.
We visualize (Figure 3) the spread of as training progresses by computing the Gini coefficient over ’s. The Gini coefficient (Gini, 1913) is a measure of the inequality among values of a frequency distribution; a coefficient of 0 means exact equality (i.e., all values are the same), while a coefficient of 1 means maximal inequality among values. We observe that, when trained on real data, the network has a high
for a few examples, while on random data the network is sensitive to most examples. The difference between the random data scenario, where we know the neural network needs to do memorization, and the real data scenario, where we’re trying to understand what happens, leads us to believe that this measure is indeed sensitive to memorization. Additionally, these results suggest that when being trained on real data, the neural network probably does not memorize, or at least not in the same manner it needs to for random data.
In addition to the different behaviors for real and random data described above, we also consider a class specific losssensitivity: , where is the term in the crossentropy sum corresponding to class . We observe that the losssensitivity w.r.t. class for training examples of class is higher when , but more spread out for real data (see Figure 4). An interpretation of this is that for real data there are more interesting crosscategory patterns that can be learned than for random data.
In this section, we investigate the impact of capacity and effective capacity on learning of datasets having different amounts of random input data or random labels.
In a first experiment, we study how overall model capacity impacts the validation performances for datasets with different amounts of noise. On MNIST, we found that the optimal validation performance requires a higher capacity model in the presence of noise examples (see Figure 5). This trend was consistent for noise inputs on CIFAR10, but we did not notice any relationship between capacity and validation performance on random labels on CIFAR10.
This result contradicts the intuitions of traditional learning theory, which suggest that capacity should be restricted, in order to enforce the learning of (only) the most regular patterns. Given that DNNs can perfectly fit the training set in any case, we hypothesize that that higher capacity allows the network to fit the noise examples in a way that does not interfere with learning the real data. In contrast, if we were simply to remove noise examples, yielding a smaller (clean) dataset, a lower capacity model would be able to achieve optimal performance.
Our next experiment measures timetoconvergence, i.e. how many epochs it takes to reach 100% training accuracy. Reducing the capacity or increasing the size of the dataset slows down training as well for real as for noise data^{3}^{3}3 Regularization can also increase timetoconvergence; see section 5. . However, the effect is more severe for datasets containing noise, as our experiments in this section show (see Figure 6).
Effective capacity of a DNN can be increased by increasing the representational capacity (e.g. adding more hidden units) or training for longer. Thus, increasing the number of hidden units decreases the number of training iterations needed to fit the data, up to some limit. We observe stronger diminishing returns from increasing representational capacity for real data, indicating that this limit is lower, and a smaller representational capacity is sufficient, for real datasets.
Increasing the number of examples (keeping representational capacity fixed) also increases the time needed to memorize the training set. In the limit, the representational capacity is simply insufficient, and memorization is not feasible. On the other hand, when the relationship between inputs and outputs is meaningful, new examples simply give more (possibly redundant) clues as to what the input output mapping is. Thus, in the limit, an idealized learner should be able to predict unseen examples perfectly, absent noise. Our experiments demonstrate that timetoconvergence is not only longer on noise data (as noted by Zhang et al. (2017)), but also, increases substantially as a function of dataset size, relative to real data. Following the reasoning above, this suggests that our networks are learning to extract patterns in the data, rather than memorizing.




This section aims at studying how the complexity of the hypotheses learned by DNNs evolve during training for real data vs. noise data. To achieve this goal, we build on the intuition that the number of different decision regions into which an input space is partitioned reflects the complexity of the learned hypothesis (Sokolic et al., 2016). This notion is similar in spirit to the degree to which a function can scatter random labels: a higher density of decision boundaries in the data space allows more samples to be scattered.
Therefore, we estimate the complexity by measuring how densely points on the data manifold are present around the model’s decision boundaries. Intuitively, if we were to randomly sample points from the data distribution, a smaller fraction of points in the proximity of a decision boundary suggests that the learned hypothesis is simpler.
Here we introduce the notion of a critical sample, which we use to estimate the density of decision boundaries as discussed above. Critical samples are a subset of a dataset such that for each such sample , there exists at least one adversarial example in the proximity of
. Specifically, consider a classification network’s output vector
for a given input sample from the data manifold. Formally we call a dataset sample a critical sample if there exists a point such that,(1)  
where is a fixed box size. As in recent work on adversarial examples (Kurakin et al., 2016) the above definition depends only on the predicted label of , and not the true label (as in earlier work on adversarial examples, such as Szegedy et al. (2013); Goodfellow et al. (2014)).
Following the above argument relating complexity to decision boundaries, a higher number of critical samples indicates a more complex hypothesis. Thus, we measure complexity as the critical sample ratio (CSR), that is, the fraction of datapoints in a set for which we can find a critical sample: .
To identify whether a given data point is a critical samples, we search for an adversarial sample within a box of radius . To perform this search, we propose using Langevin dynamics applied to the fast gradient sign method (FGSM, Goodfellow et al. (2014)) as shown in algorithm 1^{4}^{4}4In our experiments, we set , and
is samples from standard normal distribution.
. We refer to this method as Langevin adversarial sample search (LASS). While the FGSM search algorithm can get stuck at a points with zero gradient, LASS explores the box more thoroughly. Specifically, a problem with first order gradient search methods (like FGSM) is that there might exist training points where the gradient is 0, but with a large derivative corresponding to a large change in prediction in the neighborhood. The noise added by the LASS algorithm during the search enables escaping from such points.We now show that the number of critical samples is much higher for a deep network (specifically, a CNN) trained on noise data compared with real data. To do so, we measure the number of critical samples in the validation set^{5}^{5}5 We also measure the number of critical samples in the training sets. Since we train our models using log loss, training points are pushed away from the decision boundary even after the network learns to classify them correctly. This leads to an initial rise and then fall of the number of critical samples in the training sets. , throughout training^{6}^{6}6We use a box size of 0.3, which is small enough in a 0255 pixel scale to be unnoticeable by a human evaluator. Different values for were tested but did not change results qualitatively and lead to the same conclusions. Results are shown in Figure 9. A higher number of critical samples for models trained on noise data compared with those trained on real data suggests that the learned decision surface is more complex for noise data (randX and randY). We also observe that the CSR increases gradually with increasing number of epochs and then stabilizes. This suggests that the networks learn gradually more complex hypotheses during training for all three datasets.
In our next experiment, we evaluate the performance and critical sample ratio of datasets with to of the training data replaced with either input or label noise. Results for MNIST and CIFAR10 are shown in Figures 7 and 8, respectively. For both randX and randY datasets, the CSR is higher for noisier datasets, reflecting the higher level of complexity of the learned prediction function. The final and maximum validation accuracies are also both lower for noisier datasets, indicating that the noise examples interfere somewhat with the networks ability to learn about the real data.
More significantly, for randY datasets (Figures 7(b) and 8(b)), the network achieves maximum accuracy on the validation set before achieving high accuracy on the training set. Thus the model first learns the simple and general patterns of the real data before fitting the noise (which results in decreasing validation accuracy). Furthermore, as the model moves from fitting real data to fitting noise, the CSR greatly increases, indicating the need for more complex hypotheses to explain the noise. Combining this result with our results from Section 3.1, we conclude that real data examples are easier to fit than noise.
Here we demonstrate the ability of regularization to degrade training performance on data with random labels, while maintaining generalization performance on real data. Zhang et al. (2017) argue that explicit regularizations are not the main explanation of good generalization performance, rather SGD based optimization is largely responsible for it. Our findings extend their claim and indicate that explicit regularizations can substantially limit the speed of memorization of noise data without significantly impacting learning on real data.
We compare the performance of CNNs trained on CIFAR10 and randY with the following regularizers: dropout (with dropout rates in range ), input dropout (range 
), input Gaussian noise (with standard deviation in range
), hidden Gaussian noise (range ), weight decay (range ) and additionally dropout with adversarial training (with weighting factor in range  and dropout in rate range ).^{7}^{7}7We perform adversarial training using critical samples found by LASS algorithm with default parameters. We train a separate model for every combination of dataset, regularization technique, and regularization parameter.The results are summarized in Figure 10. For each combination of dataset and regularization technique, the final training accuracy on randY (xaxis) is plotted against the best validation accuracy on CIFAR10 from amongst the models trained with different regularization parameters (yaxis). Flat curves indicate that the corresponding regularization technique can reduce memorization when applied on random labeling, while resulting in the same validation accuracy on the clean validation set. Our results show that different regularizers target memorization behavior to different extent – dropout being the most effective. We find that dropout, especially coupled with adversarial training, is best at hindering memorization without reducing the model’s ability to learn. Figure 11
additionally shows this effect for selected experiments (i.e. selected hyperparameter values) in terms of train loss.
Our work builds on the experiments and challenges the interpretations of Zhang et al. (2017). We make heavy use of their methodology of studying DNN training in the context of noise datasets. Zhang et al. (2017)
show that DNNs can perfectly fit noise and thus that their generalization ability cannot be explained through traditional statistical learning theory (e.g., see
(Vapnik & Vapnik, 1998; Bartlett et al., 2005)). We agree with this finding, but show in addition that the degree of memorization and generalization in DNNs depends not only on the architecture and training procedure (including explicit regularizations), but also on the training data itself^{8}^{8}8We conclude the latter part based on experimental findings in sections 3 and 4.2.Another direction we investigate is the relationship between regularization and memorization. Zhang et al. (2017) argue that explicit and implicit regularizers (including SGD) might not explain or limit shattering of random data. In this work we show that regularizers (especially dropout) do control the speed at which DNNs memorize. This is interesting since dropout is also known to prevent catastrophic forgetting (Goodfellow et al., 2013) and thus in general it seems to help DNNs retain patterns.
A number of arguments support the idea that SGDbased learning imparts a regularization effect, especially with a small batch size (Wilson & Martinez, 2003) or a small number of epochs (Hardt et al., 2015). Previous work also suggests that SGD prioritizes the learning of simple hypothesis first. Sjoberg et al. (1995) showed that, for linear models, SGD first learns models with small parameter norm. More generally, the efficacy of early stopping shows that SGD first learns simpler models (Yao et al., 2007). We extend these results, showing that DNNs trained with SGD learn patterns before memorizing, even in the presence of noise examples.
Various previous works have analyzed explanations for the generalization power of DNNs. Montavon et al. (2011) use kernel methods to analyze the complexity of deep learning architectures, and find that network priors (e.g. implemented by the network structure of a CNN or MLP) control the speed of learning at each layer. Neyshabur et al. (2014) note that the number of parameters does not control the effective capacity of a DNN, and that the reason for DNNs’ generalization is unknown. We supplement this result by showing how the impact of representational capacity changes with varying noise levels. While exploring the effect of noise samples on learning dynamics has a long tradition (Bishop, 1995; An, 1996), we are the first to examine relationships between the fraction of noise samples and other attributes of the learning algorithm, namely: capacity, training time and dataset size.
Multiple techniques for analyzing the training of DNNs have been proposed before, including looking at generalization error, trajectory length evolution (Raghu et al., 2016), analyzing Jacobians associated to different layers (Wang, ; Saxe et al., 2013), or the shape of the loss minima found by SGD (Im et al., 2016; Chaudhari et al., 2016; Keskar et al., 2016). Instead of measuring the sharpness of the loss for the learned hypothesis, we investigate the complexity of the learned hypothesis throughout training and across different datasets and regularizers, as measured by the critical sample ratio. Critical samples refer to real datapoints that have adversarial examples (Szegedy et al., 2013; Goodfellow et al., 2014) nearby. Adversarial examples originally referred to imperceptibly perturbed datapoints that are confidently misclassified. (Miyato et al., 2015) define virtual adversarial examples via changes in the predictive distribution instead, thus extending the definition to unlabeled datapoints. Kurakin et al. (2016) recommend using this definition when training on adversarial examples, and it is the definition we use.
Two contemporary works perform indepth explorations of topics related to our work. Bojanowski & Joulin (2017)
show that predicting random noise targets can yield state of the art results in unsupervised learning, corroborating our findings in Section
3.1, especially Figure 2. Koh & Liang (2017) use influence functions to measure the impact on parameter changes during training, as in our Section 3.2. They explore several promising applications for this technique, including generation of adversarial training examples.Our empirical exploration demonstrates qualitative differences in DNN optimization on noise vs. real data, all of which support the claim that DNNs trained with SGDvariants first use patterns, not brute force memorization, to fit real data. However, since DNNs have the demonstrated ability to fit noise, it is unclear why they find generalizable solutions on real data; we believe that the deep learning priors including distributed and hierarchical representations likely play an important role. Our analysis suggests that memorization and generalization in DNNs depend on network architecture and optimization procedure, but also on the data itself. We hope to encourage future research on how properties of datasets influence the behavior of deep learning algorithms, and suggest a datadependent understanding of DNN capacity as a research goal.
We thank Akram Erraqabi, Jason Jo and Ian Goodfellow for helpful discussions. SJ was supported by Grant No. DI 2014/016644 from Ministry of Science and Higher Education, Poland. DA was supported by IVADO, CIFAR and NSERC. EB was financially supported by the Samsung Advanced Institute of Technology (SAIT). MSK and SJ were supported by MILA during the course of this work. We acknowledge the computing resources provided by ComputeCanada and CalculQuebec. Experiments were carried out using Theano
(Theano Development Team, 2016)and Keras
(Chollet et al., 2015).Foundations and trends® in Machine Learning
, 2(1):1–127, 2009.Approximation by superpositions of a sigmoidal function.
Mathematics of Control, Signals, and Systems (MCSS), 2(4):303–314, 1989.The mnist database of handwritten digits, 1998.
Comments
There are no comments yet.