Uncertainty Quantification and Deep Ensembles

1 Introduction . Overparametrized deep models can memorize datasets with labels entirely randomized [ 48 ] . It is consequently not entirely clear why such extremely flexible models are able to generalize well on unseen data and trained with algorithms as simple as stochastic gradient descent , although a lot of progress on these questions have recently been reported [ 8 , 19 , 2 , 31 , 39 , 10 ] . The high capacity of neural network models , and their ability to easily overfit complex datasets , makes them especially vulnerable to calibration issues . In many situations , standard deep-learning approaches are known to produce probabilistic forecasts that are over-confident [ 16 ] . In this text , we consider the regime where the size of the training sets is very small , which typically amplifies these issues . This can lead to problematic behaviors when deep neural networks are deployed in scenarios where a proper quantification of the uncertainty is necessary . Indeed , a host of methods [ 22 , 30 , 40 , 12 , 37 ] have been proposed to mitigate these calibration issues , even though no gold standard has so far emerged . Many different forms of regularization techniques [ 35 , 48 , 50 ] have been shown to reduce overfitting in deep neural networks . Importantly , practical implementations and 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . approximations of Bayesian methodologies [ 30 , 44 , 3 , 14 , 27 , 38 , 28 ] have demonstrated their worth in several settings . However , some of these techniques are not entirely straightforward to implement in practice . Ensembling approaches such as drop-outs [ 12 ] have been widely adopted , largely due to their ease of implementation . Recently , [ 1 ] provides a study on different ensembling techniques and describes pitfalls of certain metric for in-domain uncertainty quantification . Also subsequent to our work , several articles also studied the interaction between data-augmentation and calibration issues . Importantly , the CAMixup approach is proposed as a promising solution in [ 42 ] . Furthermore , [ 47 ] analyzes the under-confidence of ensembles due to augmentations from a theoretical perspective . In this text , we investigate the practical use of Deep-Ensembles [ 22 , 4 , 25 , 41 , 9 , 16 ] , a straightforward approach that leads to state-of-the-art performances in most regimes . Although deep-ensembles can be difficult to implement when training datasets are large ( but calibration issues are less pronounced in this regime ) , the focus of this text is the data-scarce setting where the computational burden associated with deep-ensembles is not a significant problem . Contributions : We study the interaction between three of the most simple and widely used methods for adopting deep-learning to the low-data regime : ensembling , temperature scaling , and mixup data augmentation . • Despite the widely-held belief that model averaging improves calibration properties , we show that , in general , standard ensembling practices do not lead to better-calibrated models . Instead , we show that averaging the predictions of a set of neural networks generally leads to less confident predictions : that is generally only beneficial in the oft-encountered regime when each network is overconfident . Although our results are based on Deep Ensembles , our empirical analysis extends to any class of model averaging , including sampling-based Bayesian Deep Learning methods . • We empirically demonstrate that networks trained with the mixup data-augmentation scheme , a widespread practice in computer vision , are typically under-confident . Consequently , subtle interactions between ensembling techniques and modern data-augmentation pipelines have to be considered for proper uncertainty quantification . The typical distributional shift induced by the mixup data-augmentation strategy influences the calibration properties of the resulting trained neural networks . In these settings , a standard ensembling approach typically worsens the calibration issues . • Post-processing techniques such as temperature scaling are sometimes regarded as competing methods when comparing the performance of many modern model-averaging techniques . Instead , to mitigate the under-confidence of model averaging , temperature scaling should be used in conjunction with deep-ensembling methods . More importantly , the order in which the aggregation and the calibration procedures are carried out greatly influences the resulting uncertainty quantification . These findings lead us to formulate the straightforward Pool-Then-Calibrate strategy for post-processing deep-ensembles : ( 1 ) in a first stage , separately train deep models ( 2 ) in a second stage , fit a single temperature parameter by minimizing a proper scoring rule ( eg . cross-entropy ) on a validation set . In the low data regime , this simple procedure can halve the Expected Calibration Error ( ECE ) on a range of benchmark classification problems when compared to standard deep-ensembles . Although straightforward to implement , to the best of our knowledge this strategy has not been investigated in the literature prior to our work . 2 Background . Consider a classification task with C ≥ 2 possible classes Y ≡ { 1 , . . . , C } . For a sample x ∈ X , the quantity p ( x ) ∈ ∆C = { p ∈ RC+ : p1 + . . . + pC = 1 } represents a probabilistic prediction , often obtained as p ( x ) = σSM [ fw ( x ) ] for a neural network fw : X → RC with weight w ∈ RD and softmax function σSM : RC → ∆C . We set ŷ ( x ) ≡ arg maxc pc ( x ) and p̂ ( x ) = maxp ( x ) . Augmentation : Consider a training dataset D ≡ { xi , yi } Ni=1 and denote by y ∈ ∆C the one-hot encoded version of the label y ∈ Y . A stochastic augmentation process Aug : X ×∆C → X ×∆C maps a pair ( x , y ) ∈ X × ∆C to another augmented pair ( x ? , y ? ) . In computer vision , standard augmentation strategies include rotations , translations , brightness and contrast manipulations . In this text , in addition to these standard agumentations , we also make use of the more recently proposed mixup augmentation strategy [ 49 ] that has proven beneficial in several settings . For a pair ( x , y ) ∈ X ×∆C , its mixup-augmented version ( x ? , y ? ) is defined as x ? = γ x+ ( 1− γ ) xJ and y ? = γ y + ( 1− γ ) yJ for a random coefficient γ ∈ ( 0 , 1 ) drawn from a fixed mixing distribution often chosen as Beta ( α , α ) , and a random index J drawn uniformly within { 1 , . . . , N } . Model averaging : Ensembling methods leverage a set of models by combining them into an aggregated model . In the context of deep learning , Bayesian averaging consists of weighting the predictions according to the Bayesian posterior π ( dw | Dtrain ) on the neural weights . Instead of finding an optimal set of weights by minimizing a loss function , predictions are averaged . Denoting by pw ( x ) ∈ ∆C the probabilistic prediction associated to sample x ∈ X and neural weight w , the Bayesian approach advocates to consider ( prediction ) ≡ ∫ pw ( x ) π ( dw | Dtrain ) ∈ ∆C . ( 1 ) Designing sensible prior distributions is still an active area of research , and data-augmentation schemes , crucial in practice , are not entirely straightforward to fit into this framework . Furthermore , the high-dimensional integral ( 1 ) is ( extremely ) intractable : the posterior distribution π ( dw|Dtrain ) is multi-modal , high-dimensional , concentrated along low-dimensional structures , and any local exploration algorithm ( eg . MCMC , Langevin dynamics and their variations ) is bound to only explore a tiny fraction of the state space . Because of the typically large number of degrees of symmetries , many of these local modes correspond to essentially similar predictions , indicating that it is likely not necessary to explore all the modes in order to approximate ( 1 ) well . A detailed understanding of the geometric properties of the posterior distribution in Bayesian neural networks is still lacking , although a lot of recent progress has been made . Indeed , variational approximations have been reported to improve , in some settings , over standard empirical risk minimization procedures . Deep-ensembles can be understood as crude , but practical , approximations of the integral in Equation ( 1 ) . The high-dimensional integral can be approximated by a simple non-weighted average over several modes w1 , . . . , wK of the posterior distribution found by minimizing the negative log-posterior , or some approximations of it , with standard optimization techniques : ( prediction ) ≡ 1 K { pw1 ( x ) + . . .+ pwK ( x ) } ∈ ∆C . We refer the interested reader to [ 34 , 29 , 45 , 3 ] for different perspectives on Bayesian neural networks . Although simple and not well understood , deep-ensembles have been shown to provide highly robust uncertainty quantification when compared to more sophisticated approaches [ 22 , 4 , 25 , 41 ] . Post-processing Calibration Methods : The article [ 16 ] proposes a class of post-processing calibration methods that extend the more standard Platt Scaling approach [ 36 ] . Temperature Scaling , the simplest of these methods , transforms the probabilistic outputs p ( x ) ∈ ∆C into a tempered version Scale [ p ( x ) , τ ] ∈ ∆C defined through the scaling function Scale ( p , τ ) ≡ σSM ( logp/τ ) = 1 Z ( p 1/τ 1 , . . . , p 1/τ C ) ∈ ∆C , ( 2 ) for a temperature parameter τ > 0 and normalization Z > 0 . The optimal parameter τ ? > 0 is usually found by minimizing proper-scoring rules [ 13 ] , often chosen as the negative log-likelihood , on a validation dataset . Crucially , during this post-processing step , the parameters of the probabilistic model are kept fixed : the only parameter being optimized is the temperature τ > 0 . In the low-data regime , the validation set being also extremely small , we have empirically observed that the more sophisticated Vector and Matrix scaling post-processing calibration methods [ 16 ] do not offer any significant advantage over temperature scaling approach and in fact overfit the extremely small validation dataset as chosen by our setup . Calibration Metrics : The Expected Calibration Error ( ECE ) measures the discrepancy between prediction confidence and empirical accuracy . For a partition 0 = c0 < . . . < cM = 1 of the unit interval and a labelled set { xi , yi } Ni=1 , set Bm = { i : cm−1 < p̂ ( xi ) ≤ cm } . The quantity ECE is then defined as ECE = M∑ m=1 |Bm| N ∣∣ confm− accm ∣∣ ( 3 ) where accm = 1 |Bm| ∑ i∈Bm 1 ( ŷ ( xi ) = yi ) and confm = 1 |Bm| ∑ i∈Bm p̂ ( xi ) . ( 4 ) A model is calibrated if accm ≈ confm for all 1 ≤ m ≤ M . It is often instructive to display the associated reliability curve , i.e . the curve with confm on the x-axis and the difference ( accm− confm ) on the y-axis . Figure 1 displays examples of such reliability curves . A perfectly calibrated model is flat ( i.e . accm− confm = 0 ) , while the reliability curve associated to an under-confident ( resp . over-confident ) model prominently lies above ( resp . below ) the flat line accm− confm = 0 . We sometimes also report the value of the Brier score [ 5 ] defined as 1N ∑N i=1 ‖p ( xi ) − yi‖22 . Setup and implementation details : For our experiments , we use standard neural architectures . For CIFAR10/100 [ 21 ] we use ResNet18 , ResNet34 [ 17 ] for Imagenette/Imagewoof [ 18 ] , and for the Diabetic Retinopathy [ 7 ] , similar to [ 26 ] we use the architecture ( not containing any residual connection ) from the 5th place solution of the associated Kaggle challenge . We also include the results for LeNet [ 23 ] trained on the MNIST [ 24 ] dataset in the supplementary . A very low number of training examples ( CIFAR10 : 1000 , CIFAR100 : 5000 , Image { nette , woof } : 5000 , MNIST : 500 ) was used for all the datasets . However , we also show that our observations extend to full-data setups in 4 . The validation dataset is chosen from the leftover training dataset . The test dataset is kept as the original and is hidden during both training and validation step .

Summary: This paper focuses on the calibration performance of deep ensembles of over-parameterized models. In particular, this work studies the interaction between data augmentation, ensembling and post-processing calibration such as temperature scaling. Each of the technique improves calibration when applied alone. However, the authors demonstrated that both mixup and temperature scaling might hurt calibration when naively combined with ensembling. The empirical evaluation identifies the underconfidence as the core issue in calibration degradation. It also shows that the proposed modification to temperature scaling can greatly improve calibration.