Uncertainty Estimation Using a Single Deep Deterministic Neural Network - ML Reproducibility Challenge
Anonymous Author(s)
AfﬁliationAddress email
Reproducibility SummaryScope of Reproducibility
The investigated paper claims RBF network when trained with BCE loss along with two-sided gradient penaltyoutperforms deep ensemble in the task of out of distribution(OoD) detection along with competitive accuracy to softmaxbased models.
The Paper claims to outperform AUROC on Fashion-MNIST vs MNIST and CIFAR-10 vs SVHN.
Theproposed algorithm is reported to detect both aleatoric and epistemic uncertainty as OoD. Authors mention the need fora formal way to distinguish between the two kinds of uncertainty and pose it as an interesting future research avenue.
The scope of this report is to reproduce the results related to OoD detection presented in the paper.
Alongwith the reproduction of results, we propose an extension for explicit detection of aleatoric and epistemic uncertainty asintended by the authors.
Methodology
The author’s training code is available on GitHub.
Additionally, we have made available all the experimentation codesin the form of notebooks.
We provide all the results and analysis on the models described in the paper and trained on
NVIDIA Tesla T4 GPU.
Results
Overall our reproduction supports the claims of the paper, we can replicate trends and plots as described in the paper.
Most of the results are within 1% of the value reported.
Notably, AUROC(M) of DUQ in OoD detection of FashionMNIST vs MNIST is off by 1.5% and we got a different optimal value for gradient penalty weight ( λ ) in it.
Also, the results of our proposed extension and its analysis are encouraging.
Our proposed extension provided anincrease of 1.8% in AUROC(M) in Fashion-MNIST vs MNIST and provided explicit control over the aleatoric andepistemic uncertainty.
What was
easy
The proposed approach is quite simple and elegant.
The availability of the author’s code made the implementation ofvarious experiments easy.
What was difﬁcult
Understanding of proposed approach requires advanced knowledge of calculus related to the Lipschitz constant and itsrole to quantify the upper bound of the sensitivity of any function.
Communication with original authors
We discussed our report with the authors, they ﬁnd our analysis on aleatoric uncertainty interesting and appreciate our proposed extension and its encouraging results
Introduction
Reliable uncertainty quantiﬁcation has been a challenge in deep learning, models giving overconﬁdent wrongpredictions can not be deployed for practical purposes and if deployed can even be fatal.
The investigated paper
Uncertainty Estimation Using a Single Deep Deterministic Neural Network [1] presents a method of training deepneural networks to detect out of distribution(OoD) points in a single forward pass along with classiﬁcation.
Authors deﬁne a set of feature vectors called centroids each corresponding to a certain class.
Distance between featurevectors predicted by model and centroids are used for class prediction.
This architecture along with BCE loss employsa two-sided-gradient penalty to make the model sensitive to input and hence providing OoD detection ability, thisapproach is called deterministic uncertainty quantiﬁcation, DUQ.
Scope of reproducibility
The proposed algorithm outperforms the state-of-the-art techniques for OoD detection on Fashion-MNIST vs MNIST,
CIFAR-10 vs SVHN in terms of AUROC as well as computational time.
DUQ, an RBF network-based algorithmprovides competitive accuracy to softmax models along with strong OoD detection ability.
The scope of this report is asfollows.2.
Addressed claims from the original paper
• OoD detection ability on various datasets as reported in paper.
• Role of different hyperparameters (Ablation Study).
2.2 Other experiments
• Noise sensitivity of proposed algorithm.
• Propose extension E-DUQ for explicit detection of aleatoric and epistemic uncertainty .
Methodology
3.1 Model descriptions
Figure 1 represents the complete algorithm, ﬁrst, the features are computed through a standard feature extractor ( f θ )after this extracted features are passed through class-speciﬁc layers ( W c ) to calculate the feature vector for each class.
Distance ( K c ) of this vector from the centroid in a kernel space represents uncertainty in prediction.
The centroid iscalculated for each batch as described in the equations below.n c,t = γ × n c,t − 1 + (1- γ ) × n c,t m c,t = γ × m
[Equation]
e c
[Equation]
Where n c,t is number of images of class c in a particular batch at time t , m c,t is weighted sum of feature vectorsthrough different mini batches and γ is the momentum for updating centroids.
x c,t,i is the element i of minibatch attime t of class c.
Total cost comprises of two-loss functions, one is the BCE loss which is the sum of cross-entropy of a binary one-hotvector with the actual label of that class as described in the equation below.
[Equation]
Usually, deep learning models suffer from feature collapse where the presence of some non-robust discriminativefeatures in input space will map inputs to same outputs, the degree to which a model prevents this feature collapse is its sensitivity , a two-sided gradient penalty loss is used to enforce sensitivity to our model which is deﬁned as:
Two-sided GP loss = λ · (cid:104) (cid:107)∇ x (cid:80) c K c (cid:107) 22 - 1 (cid:105) 277 Which essentially keeps the norm of Jacobian above a threshold and prevents feature extractor from collapsing to a constant function.
Another version of gradient penalty can be a single-sided loss as:
Single-sided GP loss = λ · max (0 , (cid:107)∇ x (cid:80) c K c (cid:107) 2 F - 1)
The investigated paper claims two-sided gradient penalty can enforce sensitivity in the model while a single-sidedpenalty is not able to do so.
We will verify these claims empirically in sections to go.
[Figure]
3.2.1 Two-moons dataset
[Figure]
It is a two-dimensional dataset.
As the name suggests, it has two intertwined classes on the shape of the crescent.
Weobtain it using Sciket-learn implementation as described by the authors.
[Figure]
3.2.2 Fashion-MNIST and MNIST
[Figure]
Fashion-MNIST is a dataset of 28x28 grayscale images consisting of a training set of 60,000 images and a test set of10,000 images each belonging to either of 10 classes.
MNIST is a database of 28x28 grayscale handwritten digit imageshaving a training set of 60,000 and a test set of 10,000 images.
We obtain both datasets using Pytorch’s dataset module.
As we are testing the proposed algorithm on out-of-distribution detection Fashion-MNIST, MNIST has been a notablydifﬁcult pair for this task [2].
3.2.3 CIFAR-10 and SVHN
CIFAR-10 is a dataset of 60,000 32x32 colour images in 10 classes, having 50,000 training images and 10,000 testimages
3.3 Experimental setup
[Figure]
The author’s training code is available on GitHub which was quite useful for us.
We have addedour codes for all analysis and experimentation on https://drive.google.com/drive/folders/1bBrn2jRnRTIhxrAi7BXLOPkzCuUKlizF?usp=sharing .
We trained all models on NVIDIA Tesla T4 GPU.
Execution of the code is not computationally extensive.
In the described experimental settings training on MNIST takes15 minutes while training on CIFAR-10 takes 4 hours.
Maximum 3 GB of GPU and 4 GB of RAM is sufﬁcient to runthe code.
We followed the Appendix of the reported paper for architecture, optimization, the number of epochs, batch size andgenerating data in the case of two-moons.
Additionally, we also ﬁnd and recommend applying early stopping in training on CIFAR10 at around 60 epochs toavoid over-training.
Results
In this section, we provide our empirical analysis on claims in Section 2, ﬁrst on toy dataset, two-moons, and thenextend the analysis for Fashion-MNIST and CIFAR-10.
Our experiments verify the claims of paper with similar resultson these datasets.
4.1 Two-moon
[Figure]
Our implementation on two-moons for the deep ensemble, DUQ without gradient penalty, with single and with atwo-sided penalty are shown in Figs 2-5.
The yellow colour represents the region of certainty while the blue regionshows uncertainty.
It can be seen DUQ with a two-sided penalty is certain only near the training data and uncertain elsewhere, henceshowing the best uncertainty estimation over the region as compared to other methods.
These ﬁgures validate theimportance of the two-sided penalty in enforcing sensitivity.
ble
4.2 Fashion-MNIST
[Figure]
DUQ is trained on Fashion-MNIST and its ability to detect MNIST datapoints as OoD is measured by AUROC, largerbeing the better.
In this section, we provide our results and analysis for DUQ on Fashion MNIST claimed by theauthors.
[Table]
In Table 1, we compare DUQ with deep ensemble, DUQ outperforms deep ensemble in AUROC as well as on trainingand inference time.
We observe a difference of 1.5% in AUROC of DUQ from the original paper.
In an algorithm that can detect OoD points, another measure of performance could be rejection classiﬁcation, in whichwe mix two-datasets and reject points based on uncertainty predicted by the model and expect an increase in accuracy.
In Fig 8 we ﬁnd that rejection classiﬁcation performance on Fashion-MNIST vs MNIST for DUQ in comparison withdeep ensemble gives more accuracy increase per rejection as the area below DUQ curve is more that area below DE.
These experiments broadly support the claims made by the authors.
4.2.1 Aleatoric sensitivity
Authors provide OoD detection analysis on Fashion-MNIST vs MNIST datapoints which are fundamentally differentdatasets.
The paper mentions that DUQ captures both aleatoric and epistemic uncertainty but doesn’t provide anyanalysis on these datasets.
To evaluate the noise detection sensitivity of DUQ, we plot the rejection classiﬁcation performance of DUQ on
Fashion-MNIST vs Noisy Fashion-MNIST as shown in Fig 6.
Noisy Fashion-MNIST is Fashion MNIST added with azero-centered gaussian noise with an std of 0.05 which is imperceptible to the human eye.
We have used full test-dataset(1:1 proportion) for the mix.
It can be seen that DUQ can even detect Noisy Fashion-MNIST datapoints with this low noise whereas deep ensembleis unable to do so.
This clearly states that DUQ is very sensitive to noise and deems even very low noise datapoints as OoD which can even be undesirable for practical purposes, as extreme sensitivity will harm the model’sdecision-making ability.
This observation is due to the imposed sensitivity to the model by gradient penalty loss.
Weaddress this issue in the next subsection and propose an extension.
2 Learnable
noise
We propose to incorporate noise computation by predicting length scale( σ ) for each data point rather than keeping itconstant as done by [3].
Authors of [3] showed how learning length scale can make model learn to attenuate loss from erroneous labels.
We name this extended approach Explicit-DUQ or E-DUQ as it gives us explicit control over aleatoricand epistemic uncertainty.
[Figure]
If noisy points are predicted with high σ , it will increase RBF score as shown in Fig 1 hence, disabling the model topredict noisy points as OoD. Hence E-DUQ should label only fundamentally different data distributions (i.e. epistemicuncertainty) as OoD. In E-DUQ, the feature extractor outputs features along with one extra logit for length scale, it willbe very similar to the model described in Fig 1, but now along with f θ ( x ) length scale( σ ) will also be provided by themodel to compute K c .
Fig 7 shows the histogram of the magnitude of σ predicted by E-DUQ on Fashion-MNIST and Noisy Fashion-MNISTtest set, it can be seen that model predicts higher values of σ for noisy data points.
Also, Rejection classiﬁcation plot of E-DUQ (Aleatoric section, Fig 6) lies well below than that of DUQ which validates
E-DUQ does not label noisy points as OoD and is robust to noise.
[Figure]
Table 1 illustrates E-DUQ outperforms DUQ trained on Fashion-MNIST in AUROC(M), this is because MNISTdatapoints are OoD with respect to Fashion-MNIST in terms of epistemic uncertainty, which E-DUQ models explicitly.
With the above empirical analysis, we can say it is possible to predict epistemic and aleatoric uncertainties independentlyusing RBF score( K c ) and length scale( σ ) respectively.
4.2.3 Other Hyperparameters and Ablations
In the following tables, ablations are done over centroid dimension, gradient penalty factor, and gradient penaltyconstant respectively (averaged over 5 runs).
All other hyper-parameters are same as given in the original paper.
Table 2 shows how the performance of the model varies with the dimension of the centroid vector ( z ), we note AUROCﬁrst increases with z and then saturates while accuracy remains unaffected.
Authors used z = 256 which according tous is a descent choice.
In Table 3, we show how the performance of DUQ varies with the value of λ , we observe ﬁrst increase and thendecrease in AUROC score which is also claimed by authors.
We ﬁnd a 1.5% deviation in the best AUROC(M) score asreported by the authors.
They also mentioned best AUROC(NM) coincides with best AUROC(M) but we are not able tosee this in our reproduction.
We also experiment how varying the constant number( α ) in two-sided gradient penalty (cid:104) (cid:107) ∆ x (cid:80) c K c (cid:107) 22 - α (cid:105) 2 affecttraining in Table 4.
We ﬁx λ
=1 and experiment for different values for α , we ﬁnd its performance to be better thanmodel trained with optimal λ (in table 3).
Thus, we infer that α can be a crucial hyperparameter.
Overall ablation study supports the claims of the paper with minor deviations, also we show some important hyperparameters which are not stressed by the authors.
[Table]
[Table] [Table] [Table]
[Table]
Till now, we have validated the central claim of the paper on the Fashion-MNIST dataset, in this subsection we providefew experiments to validate the claims made by authors about DUQ on CIFAR-10. Method Accuracy [Table]
Train time
[Table]
Inference time(in sec)
Deep Ensemble
[Table]
[Table]
[Table]
[Table]
DUQ ( λ = 0.5) 93.45 ±
[Table]
0.931 ±
[Table] Result comparison on model trained on CIFAR-10 by deep ensemble and DUQ, AUROC reported is for separating CIFAR-10 from SVHN (averaged over 3 runs) In Table 4.3, we compare DUQ with deep ensemble trained on CIFAR-10, the deep ensemble performs slightlybetter(1%) than DUQ in terms of accuracy and AUROC however DUQ is better in terms of computational time.
We getsimilar values as in the original paper with a deviation of 0.5% in the values.
We obtain a similar rejection classiﬁcation plot for CIFAR-10 vs SVHN as reported in the paper i.e. we see both DUQand deep ensemble capture equal area as shown in Fig 9.
We provide a prediction histogram of DUQ on CIFAR-10 vs SVHN as shown in Fig 10.
As datasets are of differentsizes, we made the frequencies of histograms in proportion to dataset size as done by authors.
We get the same graph asin the paper where the plot for CIFAR-10 is skewed towards the right extreme depicting higher certainty whereas auniform plot for SVHN indicates uncertainty.
These results support the claims on CIFAR-10 from the paper.
Additionally, we provide an analysis of the behavior of DUQ on noisy CIFAR-10 data points.
In Figure [-
-]11, Noisy
CIFAR-10 is CIFAR-10 added with a zero-centered gaussian noise with an std of 0.1. And all plots are made in proportion to the dataset size.
We run the experiment with both the models and can see that DUQ is unconﬁdent with Noisy
CIFAR-10 points whereas deep ensemble can classify them with certainty, this ﬁnding is in line with that of Section 4.2.1.
Discussion
A simple approach along with data and models involved being in our computational limits helped us in the reproductionof results.
We can validate most of the results and trends as reported in the paper.
Section 4.2 shows the overall behavior of DUQ and validates most of the claims made by authors like the importanceof two-sided gradient penalty in the loss for enforcing the desired sensitivity which can show the state of the art
OoD detection performance with a modest RBF network.
Our additional experiments for understanding the nature ofsensitivity of DUQ show how the addition of noise which is imperceptible to human eyes makes DUQ vulnerable forpractical purposes.
Paper mentioned work on aleatoric and epistemic uncertainty detection is required, our naive extension of predicting σinspired by [3] can even outperform the author’s results on Fashion-MNIST along with explicit control over uncertaintydetection which is required for practical purposes.
These preliminary results are encouraging for future research to bedone in this direction.
Section 4.3 shows the scalability of different analyses for DUQ on larger datasets.
Overall we conclude that our reproduction results support different claims by authors of DUQ, it is an easy to implement,time-efﬁcient algorithm with high sensitivity to input making it a good choice for OoD detection.