Conservative Uncertainty Estimation By Fitting  Prior Networks

1 INTRODUCTION . Deep learning has achieved huge success in many applications . In particular , increasingly often , it is used as a component in decision-making systems . In order to have confidence in decisions made by such systems , it is necessary to obtain good uncertainty estimates , which quantify how certain the network is about a given output . In particular , if the cost of failure is large , for example where the automated system has the capability to accidentally hurt humans , the availability and quality of uncertainty estimates can determine whether the system is safe to deploy at all ( Carvalho , 2016 ; Leibig et al. , 2017 ; Michelmore et al. , 2018 ) . Moreover , when decisions are made sequentially , good uncertainty estimates are crucial for achieving good performance quickly ( Bellemare et al. , 2016 ; Houthooft et al. , 2016 ; Ostrovski et al. , 2017 ; Burda et al. , 2018 ) . Because any non-Bayesian inference process is potentially sub-optimal ( De Finetti , 1937 ) , these uncertainty estimates should ideally be relatable to Bayesian inference with a useful prior . Deep ensembles ( Lakshminarayanan et al. , 2017 ) , one of the most popular methods available for uncertainty estimation in deep networks today , struggle with this requirement . While deep ensembles can be related ( Rubin , 1981 ) to Bayesian inference in settings where the individual models are trained on subsets of the data , this is not how they are used in practice . In order to improve data efficiency , all ensembles are typically trained using the same data ( Lakshminarayanan et al. , 2017 ) , resulting in a method which does not have a theoretical justification . Moreover , deep ensembles can give overconfident uncertainty estimates in practice . On the other hand , Monte-Carlo dropout can be viewed ( Gal & Ghahramani , 2016 ) as a certain form of Bayesian inference . However , doing so requires requires either a limit to be taken or a generalization of variational inference to a quasi-KL divergence ( Hron et al. , 2018 ) . In practice , MC dropout can give arbitrarily overconfident estimates ( Foong et al. , 2019 ) . More broadly , a category of approaches , known as Bayesian Neural Networks ( Blundell et al. , 2015 ; Welling & Teh , 2011 ; Neal , 1996 ) , maintains a distribution over the weights of the neural network . These methods have a sound Bayesian justification , but training them is both difficult and carries an accuracy penalty , particularly for networks with convolutional architectures ( Osawa et al. , 2019 ) . Moreover , tuning BNNs is hard and achieving a good approximation to the posterior is difficult ( Brosse et al. , 2018 ) . We use another way of obtaining uncertainties for deep networks , based on fitting random priors ( Osband et al. , 2018 ; 2019 ) . Random priors are easy to train and were found to work very well in practice ( Burda et al. , 2018 ) . To obtain the uncertainty estimates , Affiliations : 1 . Microsoft Research Cambridge ; 2 . ETH Zurich ; 3 . University of Cambridge . The second author was an intern at Microsoft when contributing to this work . we first train a predictor network to fit a prior . Two examples of prior-predictor pairs are shown in the top two plots of Figure 1.Faced with a novel input point , we obtain an uncertainty ( Figure 1 , bottom plot ) by measuring the error of the predictor network against this pattern . Intuitively , these errors will be small close to the training points , but large far from them . The patterns themselves are drawn from randomly initialized ( and therefore untrained ) neural networks . While this way of estimating uncertainties was known before ( Osband et al. , 2019 ) , it did not have a theoretical justification beyond Bayesian linear regression , which is too limiting for modern applications . Contributions We provide a sound theoretical framework for obtaining uncertainty estimates by fitting random priors , a method previously lacking a principled justification . Specifically , we justify estimates in the uncertainty of the output of neural networks with any architecture . In particular , we show in Lemma 1 and Proposition 1 that these uncertainty estimates are conservative , meaning they are never more certain than a Bayesian algorithm would be . Moreover , in Proposition 2 we show concentration , i.e . that the uncertainties become zero with infinite data . Empirically , we evaluate the calibration and out-of-distribution performance of our uncertainty estimates on typical computer vision tasks , showing a practical benefit over deep ensembles and MC dropout . 2 PRELIMINARIES . We are going to reason about uncertainty within the formal framework of stochastic processes . We now introduce the required notations . A stochastic process is a collection of random variables { f ( x ) } . We consider processes where x ∈ RK and the random-variable f ( x ) takes values in RM . A stochastic process has exchangeable outputs if the distribution does not change when permuting theM entries in the output vector . Allowing a slight abuse of notation , we denote the finite-dimensional distribution of the process { f ( x ) } for the set X = { xi } i=1 , ... , N as f ( x1 , . . . , xN ) = f ( X ) . In practice , the finite-dimensional distribution reflects the idea of restricting the process to points x1 , . . . , xN and marginalizing over all the other points . Inference can be performed on stochastic processes similarly to probability distributions . In particular , we can start with some prior process { f ( x ) } , observe a set of N training points X = { xi } i=1 , ... , N and labels y = { yi } i=1 , ... , N and then consider the posterior process { fXy ( x ) } , whose finite-dimensional distributions are given by fXy ( x ? 1 . . . x ? N ′ ) = f ( x ? 1 . . . x ? N ′ |x1 , . . . , xN , y1 , . . . , yN ) for any set of testing points x ? 1 . . . x ? N ′ . We use subscripts to denote conditioning on the dataset throughout the paper . We denote the variance of fXy ( x ? ) with σ2Xf ( x ? ) . A stochastic process is called Gaussian if if all its finite-dimensional distributions are Gaussian . Given a test point x ? , we denote the posterior GP mean with µXy ( x ? ) and posterior GP variance with σ2X ( x ? ) . We provide more background on GPs in Appendix D . 3 ESTIMATING UNCERTAINTY FROM RANDOM PRIORS . Intuition Uncertainties obtained from random priors have an appealing intuitive justification . Consider the networks in the top part of Figure 1 . We start with a randomly initialized prior network , shown in red . Whenever we see a datapoint , we train the predictor network ( green ) to match this prior . Uncertainties can then be obtained by considering the squared error between the prior and the predictor at a given point . An example uncertainty estimate is shown as the shaded blue area in the bottom of Figure 1 . While it may at first seem that the squared error is a poor measure of uncertainty because it can become very small by random chance , we formally show in Section 4.1 that this is very improbable . In Section 4.2 , we show that this error goes down to zero as we observe more data . Similarly to GP inference , uncertainty estimation in our framework does not depend on the regression label . The prediction mean ( blue curve in the bottom part of Figure 1 ) is obtained by fitting a completely separate neural network . In section 6 , we discuss how this framework avoids the overconfidence characteristic of deep ensembles ( Lakshminarayanan et al. , 2017 ) . Prior The process of obtaining network uncertainties involves randomly initialized prior networks , which are never trained . While this may at first appear very different from they way deep learning is normally done , these random networks are a crucial component of our method . We show in Section 4.1 that the random process that corresponds to initializing these networks can be interpreted as a prior of a Bayesian inference procedure . A prior conveys the information about how the individual data points are related . The fact that we are using random networks has both practical and theoretical benefits . Practically , since the prior does not depend on the data , there is no way that it can overfit . The use of random priors also has strong empirical support – randomly initialized networks have been recently used as priors to obtain state-of-the-art performance on computer vision tasks ( Ulyanov et al. , 2018 ; Cheng et al. , 2019 ) . Theoretically , using random priors satisfies the likelihood principle ( Robert , 2007 ) . Moreover , random priors can be viewed as a safe choice since they make the minimum reasonable assumption that the network architecture is appropriate for the task . In fact , whenever deep learning is used , with or without uncertainty estimates , practitioners are already implicitly making that assumption . Algorithm 1 Training the predictors . function TRAIN-UNCERTAINTIES ( X ) for i = 1 . . . B do f i ∼ { f ( x ) } . random prior hXfi ← FIT ( X , f i ( X ) ) end for return fi , hXfi end function function FIT ( X , f i ( X ) ) L ( h ) , ∑ x∈X ‖f i ( x ) − h ( x ) ‖2 hXfi ← OPTIMIZE ( L ) . SGD or similar return hXfi . return trained predictor end function Algorithm The process of training the predictor networks is shown in Algorithm 1 . The function TRAIN-UNCERTAINTIES first generates random priors , i.e . neural networks with random weights . In our notation , it corresponds to sampling functions from the prior process { f ( x ) } . These priors , evaluated at points from the dataset X = { xi } i=1 , ... , N are then used as labels for supervised learning , performed by the function FIT . After training , when we want to obtain an uncertainty estimate φ at a given test point x ? , we use the formula σ̂2 ( x ? ) = max ( 0 , σ̂ 2 µ ( x ? ) + βv̂σ ( x ? ) − σ2A ) . ( 1 ) Here , the quantity σ̂2µ is the sample mean of the squared error . We will show in Section 4 that it is an unbiased estimator of a variable that models the uncertainty . On the other hand , v̂σ is the samplebased estimate of the standard deviation of squared error across bootstraps , needed to quantify our uncertainty about what the uncertainty is . The hyper-parameter β controls the degree to which this uncertainty is taken into account . Formally , the quantities are defined as σ̂2µ ( x ? ) , ∑B i=1 1 MB ‖f ( x ? ) − hXfi ( x ? ) ‖ 2 , ( 2 ) v̂σ ( x ? ) , √∑B i=1 1 B ( σ̂ 2 µ ( x ? ) − 1M ‖f ( x ? ) − hXfi ( x ? ) ‖2 ) 2 . ( 3 ) In the above equations , B is the number of prior functions and each prior and predictor network has M outputs . Because the predictors are trained independently , uncertainty estimates obtained from each of the B predictor-prior pairs are independent . We defer the discussion of details of network architecture to Section 5 . Our experiments ( Section 7 ) show that it is often sufficient to use B = 1 in practice .

Summary: This work introduces a simple technique to obtain uncertainty estimates for deep neural networks. This is achieved by having a set of random networks (i.e. neural networks where their parameters are randomly initialized) and then computing an uncertainty value based on the difference in the predictions between those random networks and networks that are trained to mimic them on a finite collection of points. The authors further show that this method results into uncertainties that are conservative, meaning that they are higher than the uncertainty of a hypothetical posterior, and concentrate, i.e. they converge towards zero when we get more and more data. The authors further draw connections to ensemble methods and discuss how such a method can be effectively realized in practice. They then evaluate their approach on an out-of-distribution detection task, they measure the calibration of their uncertainty estimates and finally perform a small ablation study for their concentration result.