The Compact Support Neural Network

Neural networks are popular and useful in many fields , but they have the problem of giving high confidence responses for examples that are away from the training data . This makes the neural networks very confident in their prediction while making gross mistakes , thus limiting their reliability for safety critical applications such as autonomous driving , space exploration , etc . In this paper , we present a neuron generalization that has the standard dot-product based neuron and the RBF neuron as two extreme cases of a shape parameter . Using ReLU as the activation function we obtain a novel neuron that compact support , which means its output is zero outside a bounded domain . We show how to avoid difficulties in training a neural network with such neurons , by starting with a trained standard neural network and gradually increasing the shape parameter to the desired value . Through experiments on standard benchmark datasets , we show the promise of the proposed approach , in that it can have good prediction on in-distribution samples , while being able to consistently detect and have low confidence on out of distribution samples . 1 INTRODUCTION . Neural networks have been proven to be extremely useful in all sorts of applications , including object detection , speech and handwriting recognition , medical imaging , etc . They have become the state of the art in these applications , and in some cases they even surpass human performance . However , neural networks have been observed to have a major disadvantage : they don ’ t know when they don ’ t know , i.e . don ’ t know when the input is far away from the type of data they have been trained on . Instead of saying “ I don ’ t know ” , they give some output with high confidence ( Goodfellow et al. , 2015 ; Nguyen et al. , 2015 ) . An explanation of why this is happening for ReLU based networks has been given in Hein et al . ( 2019 ) . This issue is very important for safety-critical applications such as space exploration , autonomous driving , medical diagnosis , etc . In these cases it is important that the system know when the input data is outside its nominal range , to alert the human ( e.g . driver for autonomous driving or radiologist for medical diagnostic ) to take charge in such cases . In this paper we suspect that the root of this problem is actually the neuron design , and propose a different type of neuron to address what we think are its issues . The standard neuron can be written as f ( x ) = σ ( wTx + b ) , which can be regarded as a projection ( dot product ) x → wTx + b onto a direction w , followed by a nonlinearity σ ( · ) . In this design , the neuron has a large response for vectors x ∈ Rp that are in a half-space . This can be an advantage when training the NN since it creates high connectivity in the weight space and makes the neurons sensitive to far-away signals . However , it is a disadvantage when using the trained NN , since it can lead to the neurons unpredictably firing with high responses to far-away signals , which can result ( with some probability ) in high confidence responses of the whole network for examples that are far away from the training data . To address these problems , we use a type of radial basis function neuron ( Broomhead & Lowe , 1988 ) , f ( x ) = g ( ‖x − µ‖2 ) , which we modify to have a high response only for examples that are close to µ , and to have zero response at distance at least R from µ . Therefore the neuron has compact support , and the same applies to a layer formed entirely of such neurons . Using one such compact support layer before the output layer we can guarantee that the space where the NN has a non-zero response is bounded , obtaining a more reliable neural network . In this formulation , the parameter vector µ is directly comparable to the neuron inputs x , thus µ has a simple and direct interpretation as a `` template '' . A layer consisting of such neurons forms can be interpreted as a sparse coordinate system on the manifold containing the inputs of that layer . Because of the compact support , the loss function of such a compact support NN has many flat areas and it can be difficult to training it directly by backpropagation . However , we will show how to train such a NN , by starting with a trained regular NN and gradually bending the neuron decision boundaries to make them have smaller and smaller support . The contributions of this paper are the following : • We introduce a type of neuron formulation that generalizes the standard neuron and the RBF neuron as two extreme cases of a shape parameter . Moreover one can smoothly transition from a regular neuron to a RBF neuron by gradually changing this parameter . We introduce the RBF correspondent to a ReLU neuron and observe that it has compact support , i.e . its output is zero outside a bounded domain . • The above construction allows us to smoothly bend the decision boundary of a standard ReLU based neuron , obtaining a compact support neuron . We use this idea to train a compact support neural network ( CSNN ) starting from a pre-trained regular neural network . • We show through experiments on standard datasets that the proposed CSNN can achieve comparable test errors with regular CNNs , and at the same time it can detect and have low confidence on out-of-distribution data . 1.1 RELATED WORK . A common way to address the problem of high confidence predictions for out of distribution ( OOD ) examples is through ensembles ( Lakshminarayanan et al. , 2017 ) , where multiple neural networks are trained with different random initializations and their outputs are averaged in some way . The reason why ensemble methods have low confidence on OOD samples is that the high-confidence domain of each NN is random outside the training data , and the common high-confidence domain is therefore shrunk by the averaging process . This reasoning works well when the representation space ( the space of the NN before the output layer ) is high dimensional , but it fails when this space is low dimensional ( see van Amersfoort et al . ( 2020 ) for example ) . Another popular approach is adversarial training ( Madry et al. , 2018 ) , where the training set is augmented with adversarial examples generated by maximizing the loss starting from slightly perturbed examples . This method is modified in adversarial confidence enhanced training ( ACET ) ( Hein et al. , 2019 ) where the adversarial samples are added through a hybrid loss function . However , we believe that training with out of distribution samples could be a computationally expensive if not hopeless endeavor , since the instance space is extremely vast when it is high dimensional . Consequently , a finite number of training examples can only cover an insignificant part of it and no matter how many out-of-distribution examples are used , there always will be other parts of the instance space that have not been explored . Other methods include the estimation of the uncertainty using dropout ( Gal & Ghahramani , 2016 ) , softmax calibration ( Guo et al. , 2017 ) , and the detection of out-of-distribution inputs ( Hendrycks & Gimpel , 2017 ) . CutMix Yun et al . ( 2019 ) is a method to generate training samples with larger variability , which help improve generalization and OOD detection . All these methods are complementary to our approach and could be used together with our classifiers to improve accuracy and OOD detection . In Ren et al . ( 2019 ) are trained two auto-regressive models , one for the foreground in-distribution data and one for the background , and the likelihood ratio is used to decide for each observation whether it is OOD or not . This is a generative model , while our model is discriminative . A number of works assume that the distance in the representation space ( the space of outputs of the last layer before the final classification layer ) is meaningful . They will be reviewed next . Recently , Jiang et al . ( 2018 ) proposed a trust score that measures the agreement between a given classifier and a modified version of a k-nearest neighbor classifier . While this approach does consider the distance of the test samples to the training set , it only does so to a certain extent since the k-NN does not have a concept of “ too far ” , and is also computationally expensive . A simple method based on the Mahalanobis distance is presented in Lee et al . ( 2018 ) . It assumes that the observations are normally distributed in the representation space , with a shared covariance matrix for all classes . While we also assume that the distance in the representation space is meaningful , we make a much weaker assumption that the observations for each class are clustered in a number of clusters , not necessarily Gaussian . In our representation , each class is usually covered by more than one compact support neuron , and each neuron could be involved in multiple classes . Furthermore , the method in Lee et al . ( 2018 ) simply replaces the last layer of the NN with their Mahalanobis measure and makes no attempt to further train the new model , while we can train our layers together with the whole network . The Generalized ODIN Hsu et al . ( 2020 ) decomposes the output prediction into the ratio of a classspecific function hi ( x ) and a common denominator g ( x ) , both defined over instances x from the representation space . Good results are obtained using hi based on the Euclidean distance or the cosine similarity . Again , this approach assumes that the observations are grouped in a single cluster for each class , which explains it uses very deep models ( with 34-100 layers ) that are more capable to obtain representations where this assumption is satisfied . Our method does not make the single cluster per class assumption , and can use deep or shallow models . The Deterministic Uncertainty Quantification ( DUQ ) ( van Amersfoort et al. , 2020 ) method uses an RBF network and a special gradient penalty to decrease the prediction confidence away from the training examples . The authors also propose a centroid updating scheme to handle the difficulties in training an RBF network . In contrast , our paper proposes a generalized neuron model that has the RBF neurons and the standard neurons as two extreme cases , and trains all models starting from a standard NN where the local minima are more well behaved . 2 THE COMPACT SUPPORT NEURAL NETWORK . The compact support neural network consists of a number of layers , where the last layer before the output layer contains only compact support neurons , which will be described next . The other layers could be regular neural network or convolutional neural network layers , or compact support layers . The final output layer is a regular linear layer without a bias term , so that it can output a vector of all zeros when appropriate .

Summary: The authors propose a new neural network unit and training algorithm in order to improve OOD detection. Units can smoothly be changed between standard (dot-product) and RBF type through a shape hyperparameter. During training, this hyperparameter is slowly moved in the direction of the RBF shape. Empirical comparisons on three OOD problems are presented, showing that the proposed approach is competitive.