S PARSE
U NCERTAINTY
R EPRESENTATION IN D EEP L EARNING WITH I NDUCING W EIGHTS
Anonymous authors
Paper under double-blind review
A BSTRACT
Bayesian neural networks and deep ensembles represent two modern paradigms of uncertainty quantiﬁcation in deep learning.
Yet these approaches struggle to scale mainly due to memory inefﬁciency issues, since they require parameter storage several times higher than their deterministic counterparts.
To address this, we augment the weight matrix of each layer with a small number of inducing weights, thereby projecting the uncertainty quantiﬁcation into such low dimensional spaces.
We further extend Matheron’s conditional Gaussian sampling rule to enable fast weight sampling, which enables our inference method to maintain reasonable run-time as compared with ensembles.
Importantly, our approach achieves competitive performance to the state-of-the-art in prediction and uncertainty estimation tasks with fully connected neural networks and ResNets, while reducing the parameter size to ≤ 47 .
9% of that of a single neural network.
I NTRODUCTION
Deep learning models are becoming deeper and wider than ever before.
From image recognition models such as ResNet-101 (He et al., 2016a) and DenseNet (Huang et al., 2017) to BERT (Xu et al., 2019) and GPT-3 (Brown et al., 2020) for language modelling, deep neural networks have found consistent success in ﬁtting large-scale data.
As these models are increasingly deployed in real-world applications, calibrated uncertainty estimates for their predictions become crucial, especially in safety-critical areas such as healthcare.
In this regard, Bayesian neural networks (BNNs) (MacKay, 1995; Blundell et al., 2015; Gal & Ghahramani, 2016; Zhang et al., 2020) and deep ensembles (Lakshminarayanan et al., 2017) represent two popular paradigms for estimating uncertainty, which have shown promising results in applications such as (medical) image processing (Kendall & Gal, 2017; Tanno et al., 2017) and out-of-distribution detection (Ovadia et al., 2019).
Though progress has been made, one major obstacle to scaling up BNNs and deep ensembles is the computation cost in both time and space complexities.
Especially for the latter, both approaches require the number of parameters to be several times higher than their deterministic counterparts.
Recent efforts have been made to improve their memory efﬁciency (Louizos & Welling, 2017;
Swiatkowski et al., 2020; Wen et al., 2020; Dusenberry et al., 2020).
Still, these approaches require storage memory that is higher than storing a deterministic neural network.
Perhaps surprisingly, when taking the width of the network layers to the inﬁnite limit, the resulting neural network becomes “parameter efﬁcient”.
Indeed, an inﬁnitely wide BNN becomes a Gaussian process (GP) that is known for good uncertainty estimates (Neal, 1995; Matthews et al., 2018; Lee et al., 2018).
Effectively, the “parameters” of a GP are the datapoints, which have a considerably smaller memory footprint.
To further reduce the computational burden, sparse posterior approximations with a small number of inducing points are widely used (Snelson & Ghahramani, 2006; Titsias, 2009), rendering sparse GPs more memory efﬁcient than their neural network counterparts.
Can we bring the advantages of sparse approximations in GPs – which are inﬁnitely-wide neural networks – to ﬁnite width deep learning models?
We provide an afﬁrmative answer regarding memory efﬁciency, by proposing an uncertainty quantiﬁcation framework based on sparse uncertainty representations.
We present our approach in BNN context, but the proposed approach is applicable to deep ensembles as well.
In details, our contributions are as follows:
• We introduce inducing weights as auxiliary variables for uncertainty estimation in deep neural networks with efﬁcient (approximate) posterior sampling.
Speciﬁcally: – We introduce inducing weights — lower dimensional counterparts to the actual weight matrices — for variational inference in BNNs, as well as a memory efﬁcient parameterisation and an extension to ensemble methods (Section 3.1).
– We extend Matheron’s rule to facilitate efﬁcient posterior sampling (Section 3.2).
– We show the connection to sparse (deep) GPs, in that inducing weights can be viewed as projected noisy inducing outputs in pre-activation output space (Section 3.3).
– We provide an in-depth computation complexity analysis (Section 3.4), showing the signiﬁcant advantage in terms of parameter efﬁciency.
• We apply the proposed approach to both BNNs and deep ensembles.
Experiments in classiﬁcation, model robustness and out-of-distribution detection tasks show that our inducing weight approaches achieve competitive performance to their counterparts in the original weight space on modern deep architectures for image classiﬁcation, while reducing the parameter count to less than half of that of a single neural network.
V ARIATIONAL INFERENCE WITH INDUCING VARIABLES
This section lays out the basics on variational inference and inducing variables for posterior approximations, which serve as foundation and inspiration for this work.
Given observations D
=
{ X , Y } with X =
[ x 1 , ..., x N ] , Y =
[ y 1 , ..., y N ] , we would like to ﬁt a neural network p ( y | x , W 1: L ) with weights W 1: L to the data.
BNNs posit a prior distribution p ( W 1: L ) over the weights, and construct an approximate posterior q ( W 1: L ) to the intractable exact posterior p ( W 1: L |D )
∝ p ( D| W 1: L ) p ( W 1: L ) , where p ( D| W 1: L ) =
p ( Y | X , W 1: L ) = (cid:81)
Nn =1 p ( y n | x n , W 1: L ) .
Variational inference Variational inference (Jordan et al., 1999; Zhang et al., 2018a) constructs an approximation q ( θ ) to the posterior p ( θ |D )
∝ p ( θ ) p ( D| θ ) by maximising a variational lower-bound:
[Equation]
For BNNs, θ = { W 1: L } , and a simple choice of q is a fully factorised Gaussian (FFG): q ( W 1: L ) =
(cid:81)
Ll =1 (cid:81)
d lout i =1 (cid:81)
d lin j =1 N ( m ( i,j ) l , v ( i,j ) l ) , with m ( i,j ) l , v ( i,j ) l the mean and variance of W ( i,j ) l and d lin , d lout the respective number of inputs and outputs to layer l .
The variational parameters are then φ = { m ( i,j ) l , v ( i,j ) l } Ll =1 .
Gradients of (1) w.r.t. φ can be estimated with mini-batches of data (Hoffman et al., 2013) and with Monte Carlo sampling from the q distribution (Titsias & L ´ azaroGredilla, 2014; Kingma & Welling, 2014). By setting q to an FFG, a variational BNN can be trained with similar computational requirements as a deterministic network (Blundell et al., 2015).
Improved posterior approximation with inducing variables Auxiliary variable
approaches (Agakov & Barber, 2004; Salimans et al., 2015; Ranganath et al., 2016) construct the q ( θ ) distribution with an auxiliary variable a : q ( θ ) = (cid:82) q
( θ | a ) q ( a ) da , with the hope that a potentially richer mixture distribution q ( θ ) can achieve better approximations.
As then q ( θ ) becomes intractable, an auxiliary variational lower-bound is used to optimise q ( θ [Equation] a ) :
[Equation]
Here r ( a | θ ) is an auxiliary distribution that needs to be speciﬁed, where existing approaches often use a “reverse model” for r ( a | θ ) .
Instead, we deﬁne r ( θ | a ) in a generative manner: r ( a | θ ) is the “posterior” of the following “generative model”, whose “evidence” is exactly the prior of θ :
[Equation]
such that ˜ p
[Equation]
Plugging in (3) to (2) immediately leads to:
[Equation]
This approach returns an efﬁcient approximate inference algorithm, translating the complexity of inference in θ to a , if dim ( a ) < dim ( θ ) and q ( θ, a ) =
q ( θ | a ) q ( a ) has the following properties:
A “pseudo prior” ˜
p
( a )˜ p ( θ | a ) is deﬁned such that (cid:82) ˜ p ( a )˜
p
( θ | a ) da = p ( θ ) ; 2.
The conditional distributions q ( θ | a ) and ˜ p ( θ | a ) are in the same parametric family, so that they can share parameters; 3.
Both sampling θ ∼ q ( θ ) and computing KL [ q ( θ | a ) ||
˜ p ( θ | a )] can be done efﬁciently; 4.
The designs of q ( a ) and ˜ p ( a ) can potentially provide extra advantages (in time and space complexities and/or optimisation easiness).
We call a the inducing variable of θ , which is inspired by varationally sparse GP (SVGP) with inducing points (Snelson & Ghahramani, 2006; Titsias, 2009).
Indeed SVGP is a special case: θ = f , a = u , the GP prior is p ( f | X )
=
GP ( 0 , K XX ) , p ( u ) =
GP ( 0 , K ZZ ) , ˜ p ( f , u ) =
p ( u ) p ( f | X , u ) , q ( f | u ) = p ( f | X , u ) , q ( f , u ) = p ( f | X , u ) q ( u ) , and Z are the optimisable inducing inputs.
The variational lower-bound is L ( q ( f , u )) =
E q ( f ) [log p
( Y | f )] − KL [ q ( u )
|| p ( u )] , and the variational parameters are φ = { Z , distribution parameters of q ( u ) } .
SVGP satisﬁes the marginalisation constraint (3) by deﬁnition, and it has KL [ q ( f | u ) ||
˜ p ( f | u )]
= 0 .
Also by using small M = dim ( u ) and exploiting the q distribution design, SVGP reduces run-time from O ( N 3 ) to O ( NM 2 ) where N is the number of inputs in X , meanwhile it also makes storing a full Gaussian q ( u ) affordable.
Lastly, u can be whitened, leading to the “pseudo prior” ˜ p ( f , v ) =
p ( f | X , u = K 1 / 2 ZZ v )˜
p ( v ) , ˜ p ( v ) =
N ( v ; 0 , I ) which could bring potential beneﬁts in optimisation.
In the rest of the paper we assume the “pseudo prior” ˜ p
( θ, a ) satisﬁes the marginalisation constraint (3), allowing us to write p ( θ, a ) :
=
˜ p
( θ, a ) .
It might seem unclear how to design ˜
p
( θ, a ) for an arbitrary probabilistic model, however, for a Gaussian prior on θ the rules for computing conditional
Gaussian distributions can be used to construct ˜ p .
In section 3 we exploit these rules to develop an efﬁcient approximate inference method for Bayesian neural networks with inducing weights.
S PARSE UNCERTAINTY REPRESENTATION WITH INDUCING WEIGHTS 3. I NDUCING WEIGHTS FOR NEURAL NETWORK PARAMETERS
Following the design principles of inducing variables, we introduce to each network layer l a smaller inducing weight matrix U l , and construct joint approximate posterior distributions for inference.
In the rest of the paper we assume a factorised prior across layers p ( W 1: L ) =
(cid:81) l p ( W l ) , and for notation ease we drop the l indices when the context is clear.
Augmenting network layers with inducing weights Suppose the weight W ∈ R d out × d in has a Gaussian prior p ( W )
=
p (vec( W ))
=
N (0 , σ 2 I ) where vec( W ) concatenates the columns of the weight matrix into a vector.
A ﬁrst attempt to augment p (vec( W )) with an inducing weight variable U ∈ R M out × M in may be to construct a multivariate Gaussian p (vec( W ) , vec( U )) , such that (cid:82) p (vec( W ) , vec( U ))
dU =
N (0 , σ 2 I ) . This means for the joint covariance matrix of (vec( W ) , vec( U )) , it requires the block corresponding to the covariance of vec( W ) to match the prior covariance σ 2 I . We are then free to parameterise the rest of the entries in the joint covariance matrix, as long as this full matrix remains positive deﬁnite. Now the conditional distribution p ( W | U ) is a function of these parameters, and the conditional sampling from p ( W | U ) is further discussed in Appendix A.1.
Unfortunately, as dim (vec( W )) is typically large (e.g. of the order of 10 7 ), using a full covariance Gaussian for p (vec( W ) , vec( U )) becomes computationally intractable.
This issue can be addressed using matrix normal distributions (Gupta & Nagar, 2018).
Notice that the prior p (vec( W )) =
N ( 0 , σ 2 I ) has an equivalent matrix normal distribution form as p ( W ) =
MN (0 , σ 2 r I, σ 2 c I ) , with σ r , σ c > 0 the row and column standard deviations satisfying σ = σ r σ c .
Now we introduce the inducing variables in matrix space, in addition to U we pad in two auxiliary variables U r ∈ R M out ×
d
in , U c ∈ R d out × M in , so that the full augmented prior is: (cid:18) W U c U r
U (cid:19) ∼ p ( W, U c , U r , U ) : =
MN (0 , Σ r , Σ c ) , (5) with L r = (cid:18) σ r
I
Z r
D r (cid:19) s.t.
Σ r =
L r L (cid:62) r = (cid:18) σ 2 r I σ r Z (cid:62) r σ r Z r
Z r Z (cid:62) r
+ D 2 r (cid:19) , and L c = (cid:18) σ c
I
Z c D c (cid:19) s.t. Σ c =
L c L (cid:62) c = (cid:18)
[Equation]
[Figure]
[Figure]
See Figure 1(a) for a visualisation.
Matrix normal distributions have similar marginalization and conditioning properties as multivariate Gaussian distributions.
Therefore the marginalisation constraint (3) is satisﬁed for any Z c , Z r , D c and D r .
The marginal distribution of the inducing weight is p ( U ) =
MN (0 , Ψ r , Ψ c ) with Ψ r =
Z r Z (cid:62) r + D 2 r and Ψ c
= Z c Z (cid:62) c
+ D 2 c .
In the experiments we use whitened inducing weights which transforms U so that p ( U ) =
MN (0 , I, I ) (Appendix E), but for clarity, we continue using the formulas presented above in the main text.
The matrix normal parameterisation introduces two additional variables U r , U c without providing additional expressiveness.
Hence it is desirable to integrate them out, leading to a joint multivariate normal with Khatri-Rao product structure for the covariance:
[Equation]
As the dominating memory complexity here is O ( d out M out + d in M in ) which comes from storing Z r and Z c , we see that the matrix normal parameterisation of the augmented prior is memory efﬁcient.
Posterior approximation in the joint space We construct a factorised posterior approximation across the layers: q ( W 1: L , U 1: L ) =
(cid:81) l [Equation]
[Equation] l | U l [Equation] q
[Equation] U
[Equation]
The simplest option for q ( W | U ) is q ( W | U )
=
p (vec( W ) | vec( U ))
=
N ( µ W | U , Σ W | U ) , similar to sparse GPs.
A slightly more ﬂexible variant rescales the covariance matrix while keeping the mean tied, i.e. q ( W | U ) =
q (vec( W ) | vec( U ))
=
N ( µ W | U , λ 2 Σ W | U ) , which still allows for the KL term to be calculated efﬁciently (see Appendix B):
[Equation]
Plugging θ = { W 1: L } , a = { U 1: L } into (4) results in the following variational lower-bound
L
[Equation]
q
[Equation]
with λ l the associated scaling parameter for q ( W l | U l ) .
Therefore the variational parameters are now φ = { Z c , Z r , D c , D r , λ, dist.
params.
of q ( U ) }
for each network layer.
q U )
A simple choice is FFG q (vec( U ))
=
N ( m u , diag ( v u )) , which performs mean-ﬁeld inference in U space (
c.f. Blundell et al., 2015), and in this case KL [ q ( U )
|| p ( U )] has a closed-form solution.
Another choice is a “mixture of delta measures” q ( U )
= 1 K (cid:80)
Kk =1 δ ( U =
U ( k ) ) .
In other words, we keep K distinct sets of parameters { U ( k ) 1: L } Kk =1 in inducing space that are projected back into the original parameter space via the shared conditional distributions q ( W l | U l ) to obtain the weights.
This approach can be viewed as constructing “deep ensembles” in U space, and we follow ensemble methods (e.g. Lakshminarayanan et al., 2017) to drop KL [ q ( U )
|| p ( U )] in (8).
Often the inducing weight U is chosen to have signiﬁcantly lower dimensions compared to W .
Combining with the fact that q ( W | U ) and p ( W | U ) only differ in the covariance scaling constant, we see that U can be regarded as a sparse representation of uncertainty for the network layer, as the major updates in (approximate) posterior belief is quantiﬁed by q ( U ) .
3. E FFICIENT SAMPLING WITH EXTENDED M ATHERON ’ S RULE
Computing the variational lower-bound (8) requires samples from q ( W ) , which asks for an efﬁcient sampling procedure for the conditional q ( W | U ) .
Unfortunately, q ( W | U ) derived from (6) with X h X h
ReLU noisy proj.
X U Z c T X f
Z c T u 1 c
X f
Z c T u 2 c noisy proj.
ReLU covariance rescaling is not a matrix normal, so direct sampling remains prohibitively expensive.
To address this challenge, we extend Matheron’s rule (Journel & Huijbregts, 1978; Hoffman & Ribak, 1991; Doucet, 2010) to efﬁciently sample from q ( W | U ) .
The idea is that one can sample from a conditional Gaussian by transforming a sample from the joint distribution.
In detail, we derive in
Appendix C the extended Matheron’s rule to sample W ∼ q ( W | U ) :
[Equation]
Here ¯ W, ¯ U ∼ p ( ¯ W, ¯ U c , ¯ U r , ¯ U ) means we sample ¯ W,
¯ U c , ¯ U r , ¯ U from the joint and drop ¯ U c , ¯ U r .
In fact ¯ U c , ¯ U r are never computed: as shown in Appendix C, the samples ¯ W, ¯ U can be obtained by:
[Equation]
Therefore the major extra cost to pay is O (2 M 3 out +2 M 3 in + d out M out M in + M in d out d in ) required by inverting Ψ r , Ψ c , computing ˆ L r , ˆ L c , and the matrix multiplications.
The extended Matheron’s rule is visualised in Figure 1 with a comparison to the original Matheron’s rule for sampling from q (vec( W ) | vec( U )) .
This clearly shows that our recipe avoids computing big matrix inverses and multiplications, resulting in a signiﬁcant speed-up for conditional sampling.
3. U NDERSTANDING INDUCING WEIGHTS : A FUNCTION - SPACE PERSPECTIVE
We present the proposed approach again but from a function-space inference perspective.
Assume a network layer computes the following transformation of the input X
=
[ x 1 , ..., x N ] , x i [Equation]
d [Equation]
[Equation]
As W has a Gaussian prior p (vec( W ))
=
N (0 , σ 2 I ) , each of the rows in F =
[ f 1 , ..., f d out ] (cid:62) , f i ∈ R N ×has a Gaussian process form with linear kernel: f i | X ∼ GP ( 0 , K XX ) , K XX ( m, n ) =
σ 2 x (cid:62) m x n .
Inference on F directly has O ( N 3 + d out N 2 ) cost, so a sparse approximation is needed.
Slightly different from the usual approach, we introduce auxiliary variables
U c
=
[ u c 1 , ..., u cd out ] (cid:62) ∈
R d out × M in as follows, using shared “inducing inputs” Z (cid:62)
[Equation]
M in :
[Equation]
[Equation] By marginalising out the “noiseless inducing outputs” { ˆ u i } (derivations in Appendix D), we can compute the marginal distributions as p ( U c ) :
= p ( { u ci } ) = MN ( 0 , σ 2 r I, Ψ c ) and
[Equation]
Note that p ( W | U c ) = MN (cid:0) U c Ψ − 1 c σ c Z c , σ 2 r I, σ 2 c ( I − Z (cid:62) c Ψ − 1 c Z c ) (cid:1) (see Appendix A.2).
Since W ∼ MN ( M , Σ 1 , Σ 2 ) leads to W X d ∼ MN ( MX , Σ 1 , X (cid:62) Σ 2 X ) , this means p ( F | X , U c ) is the push-forward distribution of p ( W | U c ) for the operation F = W X :
[Equation] As { u ci } are the “noisy” versions of { ˆ u i } in f space, U c can thus be viewed as “scaled noisy inducing outputs” in function space (see the red bars in the 2nd column of Figure 2). So far the inducing variables U c is used as a compact representation of the correlation between columns of F only. In other words the output dimension d out for each f i (and u ci ) remains large (e.g. > 1000 in a fully connected layer).
Therefore dimensionality reduction can be applied to the
We assume W ∈ R d out × d in , U ∈ R M out × M in , and K forward passes are made for each of the N inputs.
( ∗ It uses a parallel computing friendly vectorisation technique (Wen et al., 2020) for further speed-up.) [Table] column vectors of U c and F . In Appendix D we present a generative approach to do so by extending probabilistic PCA (Tipping & Bishop, 1999) to matrix normals: p ( U c )
= (cid:82) p ( U c | U ) p ( U ) dU , where the projection’s parameters are { Z r , D r } [Table]
and p ( U c , U ) matches the marginals of (5).
This means U can be viewed as the “noisy projected inducing output” of the GP whose corresponding “inducing inputs” are Z (cid:62) c (see the red bar in the 1st column of Figure 2). Similarly the column vectors in U r X can be viewed as the noisy projections of the column vectors in F .
In Appendix D we further show that the push-forward distribution q ( F | X , U ) of q ( W | U ) only differs from p ( F | X , U ) in the covariance matrices up to the same scaling constant λ . Therefore the resulting function-space variational objective is almost identical to (8), except for scaling coefﬁcients that are added to the R ( λ l ) terms to account for the change in dimensionality from vec( W ) to vec( F ) . This result nicely connects posterior inference in weight- and function-space.
3. C OMPUTATIONAL COMPLEXITIES
In Table 1 we report the computational complexity ﬁgures for two types of inducing weight approaches: FFG q ( U ) (FFG- U ) and Delta mixture q ( U ) (Ensemble- U ).
Baseline approaches include: Deterministic- W , variational inference with FFG q ( W ) (FFG- W , Blundell et al., 2015), deep ensemble in W (Ensemble- W , Lakshminarayanan et al., 2017), as well as parameter efﬁcient approaches such as matrix-normal q ( W ) (Matrix-normal- W , Louizos & Welling (2017)), variational inference with k -tied FFG q ( W ) ( k -tied FFG- W , Swiatkowski et al.
(2020)), and rank-1 BNN
(Dusenberry et al., 2020).
The gain in memory is signiﬁcant for the inducing weight approaches, in fact with M in < d in and M out < d out the parameter storage requirement is smaller than a single deterministic neural network.
The major overhead in run-time comes from the extended Matheron’s rule for sampling q ( W | U ) .
Some of the computations there are performed only once, and in our experiments we show that by using a relatively low-dimensional U , the overhead is acceptable.
E XPERIMENTS
We evaluate the inducing weight approaches on regression, classiﬁcation and related uncertainty estimation tasks.
The goal is to demonstrate competitive performance to popular W -space uncertainty estimation methods while using signiﬁcantly fewer parameters.
The evaluation baselines are: (1) variational inference with FFG q ( W ) (FFG- W , Blundell et al., 2015)
v.s. FFG q ( U ) (FFG- U , ours); (2) ensemble methods in W space (Ensemble- W Lakshminarayanan et al., 2017)
v.s. ensemble in U space (Ensemble- U , ours).
Another baseline is training a deterministic neural network with maximum likelihood.
Details and additional results can be found in Appendix F and G.
4. S YNTHETIC 1-D REGRESSION
We follow Foong et al.
(2019) to construct a synthetic regression task, by sampling two clusters of inputs x 1 ∼ U [ − 1 , − 0 .
7] , x 2 ∼ U [0 . 5 , 1] , and targets y ∼ N (cos(4 x + 0 .
As ground truth we show the exact posterior results using the NUTS sampler (Hoffman & Gelman, 2014).
The results are visualised in Figure 3 with the noiseless function in black, predictive mean in blue, and 2  (a) FFG- W  2  (b) FFG- U  2  (c) FCG- W  2  (d) FCG- U  2  (e) Ensemble- U  2  (f) NUTS [Table]
speed model size deterministic FFG-W FFG-U up to three standard deviations as shaded area. Similar to prior results in the literature, FFG- W fails to represent the increased uncertainty away from the data and in between clusters.
While underestimating predictive uncertainty overall, FFG- U show a small increase in predictive uncertainty away from the data.
In contrast, a per-layer full covariance Gaussian in both weight (FCG- W ) and inducing space (FCG- U ) as well as Ensemble-
U better captures the increased predictive variance, although the mean function is more similar to that of FFG- W .
4. C LASSIFICATION AND IN - DISTRIBUTION CALIBRATION
As the core empirical evaluation, we train Resnet-18 models (He et al., 2016b) on CIFAR-10 and
CIFAR-100 (Krizhevsky et al., 2009).
To avoid underﬁtting issues with FFG-W, a useful trick is to set an upper limit σ 2 max on the variance of q ( W ) (Louizos & Welling, 2017).
This trick is similarly applied to the U -space methods, where we cap λ ≤ λ max for q ( W | U ) , and for FFG- U we also set σ 2 max for the variance of q ( U ) .
In convolution layers, we treat the 4D weight tensor W of shape ( c out , c in , h, w ) as a c out × c in hw matrix.
We use U matrices of shape 128 × 128 for all layers (i.e. M = M in =
M out = 128 ), except that for CIFAR-10 we set M out = 10 for the last layer.
In Table 2 we report test accuracy and test expected calibration error (ECE) (Guo et al., 2017) as a ﬁrst evaluation of the uncertainty estimates.
Overall, Ensemble- W achieves the highest accuracy, but is not as well-calibrated as variational methods.
For the inducing weight approaches, EnsembleU outperforms FFG- U on both datasets.
It is overall the best performing approach on the more challenging CIFAR-100 dataset (close-to-Ensemble- W accuracy and lowest ECE).
In Figure 4 we show prediction run-times on trained models, relative to those of an ensemble of deterministic networks, as well as relative parameter sizes to a single ResNet-18.
The extra run-time costs for the inducing methods come from computing the extended Matheron’s rule.
However, as they can be calculated once and then cached when drawing multiple samples, the overhead reduces to a small factor when using larger number of samples K and large batch-size N .
More importantly, when compared to a deterministic ResNet-18 network, the inducing weight models reduce the parameter count by over 50% ( 5 , 352 , 853 vs. 11 , 173 , 962 , 47 . 9% ) even for a large M = 128 .
Hyper-parameter choices We visualise in Figure 5 the accuracy and ECE results for the inducing weight models with different hyper-parameters.
It is clear from the right-most panels that performances in both metrics improve as the U matrix size M is increased, and the results for M = 64 and
M = 128 are fairly similar.
Also setting proper values for λ max , σ max is key to the improved performances.
The left-most panels show that with ﬁxed σ max values (or with ensemble in U space), the preferred conditional variance cap values λ max are fairly small (but still larger than 0 which corresponds to a point estimate for W given U ).
For σ max which controls variance in U space, we see from the top middle panel that the accuracy metric is fairly robust to σ max as long as λ max is not too large.
But for ECE, a careful selection of σ max is required (bottom middle panel). [Figure]
4. M ODEL ROBUSTNESS AND O UT - OF - DISTRIBUTION DETECTION
To investigate the inducing weight’s robustness to dataset shift, we compute predictions on corrupted
CIFAR datasets (Hendrycks & Dietterich, 2019) after training on clean data.
Figure 6 shows accuracy and ECE results.
Ensemble- W is the most accurate model across skew intensities, while FFGW , though performing well on clean data, returns the worst accuracy under perturbation.
The inducing weight methods perform competitively to Ensemble- W , although FFG- U surprisingly maintains slightly higher accuracy on CIFAR-100 than Ensemble- U despite being less accurate on the clean data.
In terms of ECE, the inducing weight methods again perform competitively to Ensemble- W , with Ensemble-
U sometimes being the best among the three.
Interestingly, while the accuracy of
FFG- W decays quickly as the data is perturbed more strongly, its ECE remains roughly constant.
We further present in Table 3 the utility of the maximum predicted probability for out-of-distribution (OOD) detection when presented with both the in-distribution data (CIFAR10 and CIFAR100 test sets) and an OOD dataset (CIFAR100/SVHN and CIFAR10/SVHN).
The metrics are the area under the receiver operator characteristic (AUROC) and the area under the precision-recall curve (AUPR).
Again Ensemble- W performs the best in most settings, but more importantly, the inducing weight methods achieve very close results despite using the smallest number of parameters.
R ELATED W ORK
Parameter-efﬁcient uncertainty quantiﬁcation methods Recent research has proposed Gaussian posterior approximations for BNNs with efﬁcient covariance structure (Ritter et al., 2018;
Zhang et al., 2018b; Mishkin et al., 2018).
The inducing weight approach differs from these in introducing structure via a hierarchical posterior with low-dimensional auxiliary variables.
Another line of work reduces the memory overhead via efﬁcient parameter sharing (Louizos & Welling, 2017; Wen et al.,
[Table] Swiatkowski et al., 2020; Dusenberry et al., 2020).
They all maintain a “mean parameter” for the weights, making the memory footprint at least that of storing a deterministic neural network.
Instead [Table] our approach shares parameters via the augmented prior with efﬁcient low-rank structure, reducing the memory use compared to a deterministic network.
In a similar spirit to our approach, Izmailov et al.
(2019) perform inference in a d -dimensional sub-space obtained from PCA on weights collected from an SGD trajectory.
However, this approach does not leverage the layer-structure of neural networks and requires d × memory of a single network.
Sparse GP and function-space inference As BNNs and GPs are closely related (Neal, 1995;
Matthews et al., 2018; Lee et al., 2018), recent efforts have introduced GP-inspired techniques to
BNNs (Ma et al., 2019; Sun et al., 2019; Khan et al., 2019; Ober & Aitchison, 2020).
Compared to weight-space inference, function-space inference is appealing since its uncertainty is more directly relevant for many predictive uncertainty estimation tasks.
While the inducing weight approach performs computations in weight-space, Section 3.3 establishes the connection to function-space posteriors.
Our approach is related to sparse deep GP methods with U c having similar interpretations as inducing outputs in e.g. Salimbeni & Deisenroth (2017).
The major difference is that U lies in a low-dimensional space, projected from the pre-activation output space of a network layer.
Priors on neural network weights Hierarchical priors for weights has also been explored (Louizos et al., 2017; Krueger et al., 2017;
Atanov et al., 2019; Ghosh et al., 2019; Karaletsos & Bui, 2020).
However, we emphasise that ˜ p ( W, U ) is a pseudo prior that is constructed to assist posterior inference rather than to improve model design.
Indeed, parameters associated with the inducing weights are optimisable for improving posterior approximations.
Our approach can be adapted to other priors, e.g. for a Horseshoe prior p ( θ, ν ) =
p ( θ | ν ) p ( ν ) =
N ( θ ; 0 , ν 2 ) C
+ ( ν ; 0 , 1) , the pseudo prior can be deﬁned as ˜ p
( θ, ν, a ) =
˜
p
( θ | ν, a )˜ p
( a ) p ( ν ) such that (cid:82) ˜
p ( θ | ν, a )˜ p ( a ) da
= p ( θ | ν ) .
In general, pseudo priors have found broader success in Bayesian computation (Carlin & Chib, 1995).
C ONCLUSION
We have proposed a parameter-efﬁcient uncertainty quantiﬁcation framework for neural networks.
It augments each of the network layer weights with a small matrix of inducing weight, and by extending Matheron’s rule to matrix-normal related distributions, maintains a relatively small run-time overhead as compared with ensemble methods.
Critically, experiments on prediction and uncertainty estimation tasks demonstrate the competence of the inducing weight methods to the state-of-the-art, while reducing the parameter count to less than half of a deterministic ResNet-18.
Several directions are to be explored in the future.
First, modelling correlations across layers might further improve the inference quality.
We outline an initial approach leveraging inducing variables in Appendix E. Second, based on the function-space interpretation of inducing weights, better initialisation techniques can be inspired from the sparse GP and dimension reduction literature.
Lastly, the small run-time overhead of our approach can be mitigated by a better design of the inducing weight structure as well as vectorisation techniques amenable to parallelised computation.