Dense Associative Memory is Robust to Adversarial Inputs

Deep neural networks (DNN) trained in a supervised way suffer from two known problems. First, the minima of the objective function used in learning correspond to data points (also known as rubbish examples or fooling images) that lack semantic similarity with the training data. Second, a clean input can be changed by a small, and often imperceptible for human vision, perturbation, so that the resulting deformed input is misclassified by the network. These findings emphasize the differences between the ways DNN and humans classify patterns, and raise a question of designing learning algorithms that more accurately mimic human perception compared to the existing methods. Our paper examines these questions within the framework of Dense Associative Memory (DAM) models. These models are defined by the energy function, with higher order (higher than quadratic) interactions between the neurons. We show that in the limit when the power of the interaction vertex in the energy function is sufficiently large, these models have the following three properties. First, the minima of the objective function are free from rubbish images, so that each minimum is a semantically meaningful pattern. Second, artificial patterns poised precisely at the decision boundary look ambiguous to human subjects and share aspects of both classes that are separated by that decision boundary. Third, adversarial images constructed by models with small power of the interaction vertex, which are equivalent to DNN with rectified linear units (ReLU), fail to transfer to and fool the models with higher order interactions. This opens up a possibility to use higher order models for detecting and stopping malicious adversarial attacks. The presented results suggest that DAM with higher order energy functions are closer to human visual perception than DNN with ReLUs.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 4

page 5

page 6

page 8

page 9

08/06/2021

Higher-order motif analysis in hypergraphs

A deluge of new data on social, technological and biological networked s...
01/31/2021

Superposition with Lambdas

We designed a superposition calculus for a clausal fragment of extension...
06/10/2021

Neural Higher-order Pattern (Motif) Prediction in Temporal Networks

Dynamic systems that consist of a set of interacting elements can be abs...
02/24/2020

Utilizing a null class to restrict decision spaces and defend against neural network adversarial attacks

Despite recent progress, deep neural networks generally continue to be v...
12/22/2018

Dissociable neural representations of adversarially perturbed images in deep neural networks and the human brain

Despite the remarkable similarities between deep neural networks (DNN) a...
10/09/2020

Deep Autoencoder based Energy Method for the Bending, Vibration, and Buckling Analysis of Kirchhoff Plates

In this paper, we present a deep autoencoder based energy method (DAEM) ...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Deep neural networks are highly sensitive to small well-designed perturbations of the inputs, known as adversarial perturbations, which lead to misclassifications of these perturbed inputs. Consider images as an example of the data. A raw image, which is correctly classified by the neural network, can be modified in a small (and often imperceptible to our vision) way, so that the resulting deformed image is classified as a different class [1]. A related problem is that DNN classify certain images as belonging to some class, although they are unrecognizable to humans as exemplars of any class [2]

. These rubbish or fooling images correspond to patches of the image space that have a small value of the objective function used in training and are located far away from any of the training data. These observations has challenged the integrity of DNN classification and has led to an opinion that their predictions are untrustworthy (see discussion of this issue in numerous blogs), though similar problems are shared by many other machine learning techniques, such as logistic regression, support vector machines, K-nearest neighbors and others

[3].

Further investigation have shown that both adversarial images and rubbish images can be transferred between many different models having distinct architectures, different hyperparameters, and even trained on different training sets

[1, 2]. Moreover, some of the adversarial and rubbish images can be transferred between a diverse set of models in machine learning [3]. This opens up a possibility for a potential adversarial attack, when a hacker can train his own model and create a set of images that are misclassified by it, and then deploy this set of images against another victim model, which will also misclassify them. Realistic attacks were studied in [3, 4, 5]. Often they do not require any internal knowledge of the victim model.

In addition to being a security issue, transferability suggests that various computational models learn very similar representations of the data. It also suggests that in order to address these problems, one might have to design training algorithms that learn a very different representation of the data compared to the existing methods. An ideal solution to these issues should be an algorithm that assigns small values of the objective function only to those areas of the image space that are recognizable by humans as images of the corresponding class. It should also require a substantial and recognizable by humans deformation of the initial correctly classified image towards a different target class before the label changes. In spite of a substantial amount of work on these problems [6, 7, 8, 9, 10], no algorithm have been identified so far which satisfies these requirements and at the same time is competitive to state of the art algorithms in terms of classification accuracy.

In a recent paper [11]

it was proposed that Dense Associative Memory (DAM) models with higher order interactions in the energy function learn representations of the data, which strongly depend on the power of the interaction vertex. The network extracts features form the data for small values of this power, but as the power of the interaction vertex is increased there is a gradual shift to a prototype-based representation, the two extreme regimes of pattern recognition known in cognitive psychology. Remarkably, there is a broad range of powers of the energy function, for which the representation of the data is already in the prototype regime, but the accuracy of classification is still competitive to the best available algorithms (based on DNN with ReLUs). This suggests that the DAM models might behave very differently compared to the standard methods used in deep learning with respect to adversarial deformations.

In the present paper we report three main results. First, using a gradient decent in the pixel space, a set of “rubbish” images is constructed that correspond to the minima of the objective function used in training. This is done on the MNIST dataset of handwritten digits using different values of the power of the interaction vertex, which is denoted by . For small values of the power these images indeed look like speckled rubbish noise, and do not have any semantic content for human vision, a result consistent with [2]. However, as the power of the interaction vertex is increased the images gradually become less speckled and more semantically meaningful. In the limit of very large , these images are no longer rubbish at all. They represent plausible images of handwritten digits that could have possibly been produced by a human. Second, starting from clean images from the dataset a set of adversarial images is constructed in such a way that each image is placed exactly on the decision boundary between two label classes. For small powers these images look very similar to the initial clean image with a little bit of speckled noise added, but are misclassified by the neural network, a result consistent with [1]. However, as the power of the interaction vertex is increased these adversarial images become less and less similar to the initial clean image. In the limit of very large powers these adversarial images look either like a morphed image of two digits (the initial clean image and another digit from the class that the deformation targets), or the initial digit superimposed on a “ghost” image from the target class. Either way the interpretation of the artificial patterns generated by the neural net on the decision boundary requires the presence of another digit from the target class in addition to the initial seed from the dataset, and cannot be explained by simply adding noise to the initial clean image. Third, adversarial and rubbish images generated by models with small can be transferred to and fool another model with small (but possibly different) value . However, they fail to transfer to models with large . Thus rubbish and adversarial images generated by models with small cannot fool models with large . In contrast, the “rubbish” images generated by models with large can be transferred to models with small , but this is not a problem since those “rubbish” images are actually not rubbish at all and look like credible handwritten digits. These results suggest that the DAMs with a large power of the interaction vertex in the energy function better mimic the psychology of human visual perception than DAMs with a small power. The latter are equivalent to DNNs with ReLUs [11].

2 Data representation in networks

In order to illustrate these results in the simplest possible setting we trained a family of DAM networks for several values of the power of the energy function on the MNIST pixel permutation invariant task.

Figure 1: Architecture of the neural network. Visible neurons are equal to the intensities of the pixels, so that the -bit intensities are linearly mapped onto the segment . There are visible neurons , and classification neurons, which are initialized in the “off” state and then updated once to the final state using (1). The model has memories, with visible parts and recognition part , index . Parameter regulates the slope of the function.

The model is defined by a set of weights and and the feedforward update rule

(1)

where summation over repeated index is assumed. The functions are rectified polynomials [11]

(2)

As we explained in [11], the argument of the update rule (1) is the difference of two energies, corresponding to the initial and the final states of the neurons. For this reason the functions are called the energy functions in the rest of the paper, and the integer

is called the power of the interaction vertex. The weights are learned using a backpropagation algorithm (see Appendix A of

[11]) starting from random initial seeds by minimizing the objective function

(3)

where

is the target output (

for the wrong classes and for the correct class). Hyperparameter regulates the shape of the objective function.

In [11] we investigated this model for varying powers of the energy functions and discovered that the network learns feature-based representations of the data for small and prototype-based representations for large . This is clear from the Fig.2. For small each feature detector describes a feature which is useful for recognizing several different digit classes.

Figure 2: Feature to prototype transition for powers of the energy function . For each model 25 randomly selected feature (or prototype) detectors are shown. The value of the -th element of a detector is plotted in the location of the -th pixel to which it couples in the update rule (1). The weights are normalized so that . The color code is explained by the color bar.

As the power is increased, most of the feature detectors specialize and become responsible for recognizing one possible prototype, which is a constructed representation and is not simply a copy of one image from the training set. Importantly, throughout the range the classification accuracy remains approximately the same, . This is comparable to the best result , achieved by the standard DNNs trained with backpropagation alone [12].

3 Rubbish examples in networks

Once the training is complete, the neural network can be used to inspect the minima of the objective function. In order to do that one can define a set of objective functions each penalizing the deviations from the corresponding class

(4)

with the target output

A random image generated from a gaussian distribution can then be deformed into 10 images (sufficiently close to the initial one in the pixel space) corresponding to the 10 label classes by following the (negative) gradient of the objective functions according to the iterative rule

(5)

where is a unit vector, which points in the direction of the gradient of the objective function , and is the size of the update step. This dynamics flows towards the minimum of the objective function, thus for a good learning algorithm we expect to see a recognizable image of the corresponding digit once it reaches the fixed point. The actual results are shown in Fig.3.

Figure 3: Examples of images generated from a gaussian noise by following the gradient of the 10 objective functions corresponding to 10 digit classes for model (1) with . For and each final image is labeled. For and the labels are clear from the images. Throughout this paper we use grayscale intensities for representation of the image plane. They should not be confused with the color images, like the one in Fig.2, which shows the network’s weights.

For small the dynamics converges to local minima which are not recognizable as digits by humans. These are the rubbish minima of [2]. The training algorithm has learned them while trying to minimize the classification error on the training set. In contrast, for large the dynamics flows towards a minimum of the objective function that corresponds to a recognizable image of the corresponding digit. Thus this simple experiment demonstrates that for DAM with large the minima of the objective function have semantic meaning in the image space, while for models with small these minima are semantically meaningless. All this is achieved by training the network in a purely supervised way on the pixel permutation invariant task.

4 Adversarial deformations

A clean image, which is classified by a neural network as belonging to a certain class, can be modified by a small perturbation so that the deformed image is classified as a different class. What makes this statement a problem is that the perturbation, which is sufficient for changing the label, is small and typically is a speckled pattern that lacks semantic meaning. The most common technique for generating adversarial images is the sign of the gradient method of [13]. For our purposes it is necessary to generate images that are placed exactly on the decision boundary between the classes and not just in its vicinity. For this reason we use a slightly different method.

For each input image the vector of labels can be calculated by using (1). The elements of this vector can be sorted from largest to smallest value. The largest value of the output corresponds to the top classification choice of the network, the second largest output corresponds to the second choice, etc.

Figure 4: (Top panel) Logarithm of the top-choice and second-choice objective functions as the iterative dynamics following the negative gradient of the second-choice objective function (red) progresses. The crossing point defines the decision boundary. (Bottom panel) A set of triplets of images for , three per model. The first image in each triplet is a natural image from the dataset, the middle image is an artificial image corresponding to the crossing point of the two objective functions (decision boundary), the third image corresponds to the final point of the iterative dynamics, when the second-choice objective function (red curve) reaches zero.

The initial image can then be iteratively deformed along the (negative) gradient of the objective function corresponding to the second choice of the label made by the network. During this iterative process the first choice objective function will increase, and the second choice objective function will decrease (see top panel in Fig.4). The image itself should gradually change from the initial clean image to an image that the network thinks should correspond to the second choice label. At some iteration the two objective functions become equal. This is the mathematical definition of the decision boundary. From the point of view of the neural network the image that corresponds to this point on the deformation trajectory is exactly in the middle between the two classes. The question is whether a human observer would agree with this interpretation, in other words whether or not this image looks ambiguous to humans.

This method of generating the adversarial images has an advantage compared to [13] since it guarantees that the image at the crossing point of the two objective functions is placed exactly on the decision boundary, and not just close to it. Also, in contrast to [13], it does not require a careful choice of the iteration step in (5), provided that it is sufficiently small. The procedure will simply need more steps in order to find the correct image corresponding to the crossing point, if the step is too small. The drawback of this method compared to [13] is that it is slower.

In Fig.4 one can find a set of triplets of images generated by models with different values of power . In each triplet, the first image is the initial clean image from the dataset, the second image is the one that the neural network has generated on the decision boundary, and the third one is the image that the network has generated when the iterative procedure (5) has converged to the second choice label of the initial clean image. Two observations can be made from this figure. First, as the power of the interaction vertex is increased, the third image in each triplet becomes more semantically meaningful. This is in accord with the results of Fig.3. Second, as the power of the interaction vertex is increased, the adversarial image (the middle image) on the decision boundary becomes more meaningful as well. For or , the middle image looks almost the same as the initial clean image with a little bit of added speckled noise. The noise does not share much similarity with the second choice label. In contrast, for , the deformation does not look like noise at all. The middle image looks as if the two digits (the initial seed and a digit from the target class) were morphed together in one image, or as if the second digit was added as a “ghost” image to the initial digit. These results suggest that models with large powers not only learn semantically meaningful set of minima of the objective function, but also learn semantically meaningful deformations between the classes. This is achieved by training the network on the pixel permutation invariant classification task, not by training it as a generative model. In principle, the target class does not have to necessarily coincide with the second choice of the initial classification decision. This convention is used for convenience. To the best of our knowledge, the results do not change qualitatively if instead of the second choice label, the initial image is deformed towards any other label but the top one.

5 Transferability between the models with various

The most intriguing finding about rubbish and adversarial images is that they can be transferred between a diverse set of machine learning models. In order to test this phenomenon within the DAM framework we designed two experiments: one concerns the transfer of adversarial images and the other one concerns the transfer of rubbish images.

Figure 5: Transfer table of adversarial examples. The MNIST test set was used to construct four test sets of adversarial images, poised one step behind the decision boundary, for . These four datasets were cross-classified by the same four models. Each dataset has 10000 images. The number at the intersection of the -th row and the -th column is the error rate of the -th model on the adversarial dataset constructed using the -th model. On the right the error rates of the four models on the original MNIST test set.

In the first experiment the MNIST test set was used to generate adversarial examples by the four models with , resulting in four datasets each having 10000 images. For each clean image from the test set the procedure described in section 4 was used to generate an artificial image placed one iteration step behind the decision boundary defined in Fig.4. The resulting image is thus classified as the second choice of the network on the original image. These four adversarial datasets were used for the cross-classification by the same four models. The error rates are shown in Fig.5. The diagonal elements of this table are close to , which is guaranteed by the design of the datasets333The reason why the error rate is around 99% instead of 100% is because the classification error on the clean dataset is about 1.5%, and in about 1% of the cases the second choice of the network is the correct answer. Thus in these rare cases the adversarial deformation used to generate the dataset actually turns the incorrect answer into the correct one.. The most important aspect of this table is that the adversarial images generated by models with and do not transfer to the model with . These images share semantic similarity with the clean image that was used as an initial seed for crafting them, but do not generally have semantic features of the target class of the deformation. The model with can detect this similarity with the initial image and can still correctly classify of these cases. In contrast the adversarial images crafted using the model with can be transferred to models with . However, as we argued in the previous section this is expected since these images share semantic similarities with both the initial seed and the target class of the deformation. Thus, any machine learning algorithm or a human subject should misclassify a substantial fraction of them.

Figure 6:

Transfer table. Each raw corresponds to a model that was used to generate an artificial data set (100 images per digit class, 1000 images in total) by following the gradient of the objective function. Each column corresponds to a model that was used to recognize these images. The number at the intersection is the mean confidence (the probability of the most probable label) produced by the test model. On the right one sample from the artificial dataset per label class. The labels of the images are shown in green at the bottom of each column. A single value

is used in this experiment. The results remain qualitatively similar if each model uses its own value of in test time.

In the second experiment an artificial dataset was created, so that data correspond to the minima of the 10 objective functions . For each sample a random noise image was generated from a gaussian distribution, which was then iteratively changed in the direction of the negative gradient according to (5) until convergence. The dataset has 100 images of each label class, 1000 images in total. This procedure was repeated for each value of . The resulting four datasets were used for cross-classification by the same four models. The results are shown in Fig.6, but to discuss them we need to first introduce the notion of confidence.

Confidence

The output of the network (1) is a collection of numbers . For the following discussion it is convenient to define a measure of confidence that the neural network has in making a classification decision. If the actual outputs are approximately equal to the target output, the confidence is high. In contrast, if the outputs are all approximately zero, with one being slightly larger than the rest , the confidence is low. To quantify this effect, it is useful to pass the outputs through a softmax function to define a probability of each label given the input

where the parameter is a number that regulates the steepness of the soft-max function. For each input image the confidence of the network is defined as the probability of the most probable label. Thus if the network is confident that the presented image belongs to a certain class , while if the network is unsure about what is shown in the image the distribution of labels is flat, and (in case of 10 classes for MNIST). The parameter should be chosen in such a way that the average confidence of the network on a dataset matches its error on the test set. If the outputs of the network were exactly equal to the target outputs for all inputs, then the average confidence on a dataset would be equal to (since there is one correct choice and nine incorrect ones)

The error rate of all our models is of the order of , which defines the right hand side of the above equation. This results in . Since the outputs of the networks are in general slightly different from the target outputs, the actual values of are different for the four models that are discussed. They are: , , , . However, all the conclusions presented below remain true, for any values of as long as they stay within the range .

Figure 7: The 10000 images from the MNIST test set are binned in groups having a certain value of confidence. The classification error for each group is calculated. The values of the slope are: , , , .

The images from the MNIST test set can be binned into groups having certain confidence and the classification error can be calculated on each bin. The results are shown in Fig.7. The probability of error decreases as the confidence increases, a result suggesting that the confidence measure is a meaningful quantity. Now we return to the discussion of the second experiment pertaining to the analysis of “rubbish” images.

In Fig.6 the mean confidence of the 16 cross-classification pairs is reported together with 10 sample images from each dataset, one for each class, for the four data sets. The bottom row corresponds to the data generated by the model with . The samples look like rubbish images, in accord with Fig.3. These rubbish images are recognized by the network with at the average confidence , which is the result of the particular choice of the value . These rubbish images can be transferred to the model with , which is also very confident that they correspond to the correct labels. However, if one tries to transfer these rubbish images to the models with or , these higher order models immediately detect that these images do not correspond to any class and produce an average confidence . This accurately mimics the behavior of a human subject who would immediately detect that these rubbish images are semantically meaningless, thus should not belong to any class. The same conclusion applies to the dataset constructed by the model with . In contrast, the dataset constructed by the model with is composed of nice images of digits, which are recognizable by humans. These images can be transferred to any model with without loss in confidence. These results suggest that models with large better mimic human visual cognition, compared to models with small , both at generation and at testing.

From the security perspective these results suggest that the models with large can be used to detect and stop a potential hacker attack, which is devised by exploiting conventional machine learning techniques (for example DNNs with ReLUs). At the same time, if the adversary tries to use models with large for mounting the attack and deploys it against models with any (small or large) , this does not possess a security issue, because the interpretations that any model gives to these images are consistent with human visual perception.

From this perspective the models with large can be valuable even if their classification accuracy is slightly lower than that of models with small . They can be used in pair with another model that has a good classification accuracy, but that is vulnerable to adversarial/rubbish examples. The first model (with large ) detects a potential adversarial attack. In cases when it is confident, and its label disagrees with the other more accurate model, one can use the prediction of the more accurate model for the final classification decision. However if the large model is unconfident of a particular input, that input should be labeled as junk and not processed by the more accurate/vulnerable model.

6 Discussion and conclusions

Although modern machine learning techniques outperform humans on many classification tasks, there is a serious concern that they do not understand the structure of the training data. A clear demonstration of this lack of understanding was presented in [1, 2], who showed two examples of nonsensical predictions of DNNs that contradict to human visual perception: adversarial images and rubbish images. In the present paper we propose that DAM with higher order interactions in the energy function produce more sensible interpretations (consistent with human vision) of adversarial and rubbish images. We argue that these models better mimic human visual perception than DNNs with ReLUs.

A possible explanation of adversarial examples, pertaining to neural networks being too linear, was given in [13]. Our explanation follows the same line of thought with some differences. One result of [11]

is that DAMs with large powers of the interaction vertex in the energy function are dual to feed-forward neural nets with highly non-linear activation functions - the rectified polynomials of higher degrees. From the perspective of this duality, one might expect that by simply replacing the ReLUs in DNNs by the higher rectified polynomials one might solve the problem of adversarial and rubbish images for a sufficiently large power of the activation function. We tried that and discovered that although DNNs with higher rectified polynomials alone perform better than DNNs with ReLUs from the adversarial perspective, they are worse than DAMs with the update rule (

1). These observations need further comprehensive investigation. Thus, simply changing ReLUs to higher rectified polynomials is not enough to get rid of adversarial problems, and other aspects of the training algorithm presented in section 2 are important.

For thinking about neurobiology the energy functions with higher order interactions considered in [11] and in this paper should be thought of as effective theories that arise after excluding the auxiliary variables from the microscopic description. The microscopic realization in terms of biological neurons will be discussed elsewhere.

There are two straightforward ideas for possible extensions of this work. First, it would be interesting to complement the proposed training procedure with adversarial training. In other words to train the network using the algorithm of section 2 but on a combination of clean images and adversarial images, along the lines of [9, 13]. We expect that this should further increase the robustness to adversarial examples and increase the classification accuracy on the clean images. Second, it would be interesting to investigate the proposed methods in the convolutional setting. Naively, one expects that the adversarial problems are more severe in the fully connected networks than in the convolutional networks. For this reason we used the fully connected networks for our experiments. We expect that the training algorithm of section 2 can be combined with convolutional layers to better describe images.

Although more work is required to fully resolve the problem of adversarial and rubbish images, we believe that the present paper has identified a promising computational regime of the neural networks that significantly mitigates the vulnerability of DNNs to adversarial and rubbish images and that remains little investigated.

References