Title: Collapsed Inference for Bayesian Deep Learning
Venue: NeurIPS 2023
Accepted: yes
Keywords: Bayesian Model Averaging

Weighted Model Integration

Bayesian Deep Learning

Collapsed Inference
Abstract: Bayesian neural networks (BNNs) provide a formalism to quantify and calibrate uncertainty in deep learning. Current inference approaches for BNNs often resort to few-sample estimation for scalability, which can harm predictive performance, while its alternatives tend to be computationally prohibitively expensive. We tackle this challenge by revealing a previously unseen connection between inference on BNNs and volume computation problems. With this observation, we introduce a novel collapsed inference scheme that performs Bayesian model averaging using collapsed samples. It improves over a Monte-Carlo sample by limiting sampling to a subset of the network weights while pairing it with some closed-form conditional distribution over the rest. A collapsed sample represents uncountably many models drawn from the approximate posterior and thus yields higher sample efficiency. Further, we show that the marginalization of a collapsed sample can be solved analytically and efficiently despite the non-linearity of neural networks by leveraging existing volume computation solvers. Our proposed use of collapsed samples achieves a balance between scalability and accuracy. On various regression and classification tasks, our collapsed Bayesian deep learning approach demonstrates significant improvements over existing methods and sets a new state of the art in terms of uncertainty estimation as well as predictive performance.

Collapsed Inference for Bayesian Deep Learning

Abstract

Bayesian neural networks (BNNs) provide a formalism to quantify and calibrate uncertainty in deep learning. Current inference approaches for BNNs often resort to few-sample estimation for scalability, which can harm predictive performance, while its alternatives tend to be computationally prohibitively expensive. We tackle this challenge by revealing a previously unseen connection between inference on BNNs and volume computation problems. With this observation, we introduce a novel collapsed inference scheme that performs Bayesian model averaging using collapsed samples . It improves over a Monte-Carlo sample by limiting sampling to a subset of the network weights while pairing it with some closed-form conditional distribution over the rest. A collapsed sample represents uncountably many models drawn from the approximate posterior and thus yields higher sample efficiency. Further, we show that the marginalization of a collapsed sample can be solved analytically and efficiently despite the non-linearity of neural networks by leveraging existing volume computation solvers. Our proposed use of collapsed samples achieves a balance between scalability and accuracy. On various regression and classification tasks, our collapsed Bayesian deep learning approach demonstrates significant improvements over existing methods and sets a new state of the art in terms of uncertainty estimation as well as predictive performance.

1 Introduction

Uncertainty estimation is crucial for decision making. Deep learning models, including those in safetycritical domains, tend to estimate uncertainty poorly. To overcome this issue, Bayesian deep learning obtains a posterior distribution over the model parameters hoping to improve predictions and provide reliable uncertainty estimates. Among Bayesian inference procedures with neural networks, Bayesian model averaging (BMA) is particularly compelling (Wasserman, 2000; Fragoso et al., 2018; Maddox et al., 2019). However, computing BMAs is distinctly challenging since it involves marginalizing over posterior parameters, which possess some unusual topological properties such as mode-connectivity (Izmailov et al., 2021). We show that even with simple low-dimensional approximate parameter posteriors as uniform distributions, doing BMA requires integrating over highly non-convex and multi-modal distributions with discontinuities arising from non-linear activations (cf. Figure 1a). Accurately approximating the BMA can achieve significant performance gains (Izmailov et al., 2021). Existing methods mainly focus on general-purpose MCMC, which can fail to converge, or provides inaccurate few-sample predictions (Kristiadi et al., 2022), because running longer sampling chains is computationally expensive, and variational approaches that typically use a mean-field approximation that ignores correlations induced by activations (Jospin et al., 2022).

In this work, we are interested in developing collapsed samplers , also known as cutset or RaoBlackwellised samplers for BMA. A collapsed sampler improves over classical particle-based methods by limiting sampling to a subset of variables and further pairing each sample with a closed-form

5

4

3

2

1

0

1

2

3

1

0

1

2

3

4

5

6

0.2

0.0

0.2

0.4

0.6

0.8

1.0

1.2

5

4

3

2

1

0

1

2

3

1

0

1

2

3

4

5

6

0.2

0.0

0.2

0.4

0.6

0.8

1.0

1.2

representation of a conditional distribution over the rest whose marginalization is often tractable. Collapsed samplers are effective at variance reduction in graphical models (Koller & Friedman, 2009), however no collapsed samplers are known for Bayesian deep learning. We believe that this is due to the lack of a closed-form marginalization technique congruous with the non-linearity in deep neural networks. Our aim is to overcome this issue and improve BMA estimation by incorporating exact marginalization over (close approximate) conditional distributions into the inference scheme. Nevertheless, scalability and efficiency are guaranteed by the sampling part of our proposed algorithm.

Marginalization is made possible by our observation that BMA reduces to weighted volume computation. Certain classes of such problems can be solved exactly by so-called weighted model integration (WMI) solvers (Belle et al., 2015a). By closely approximating BMA with WMI, these solvers can provide accurate approximations to marginalization in BMA (cf. Figure 1b). With this observation, we propose CIBER, a collapsed sampler that uses WMI for computing conditional distributions. In the few-sample setting, CIBER delivers more accurate uncertainty estimates than the gold-standard Hamiltonian Monte Carlo (HMC) method (cf. Figure 2). We further evaluate the effectiveness of CIBER on regression and classification benchmarks and show significant improvements over other Bayesian deep learning approaches in terms of both uncertainty estimation and accuracy.

2 Bayesian Model Averaging as Weighted Volume Computation

In Bayesian Neural Networks (BNN) , given a neural network f w parameterized by weights w , instead of doing inference with deterministic w that optimize objectives such as cross-entropy or mean squared error, Bayesian learning infers a posterior p ( w | D ) over parameters w after observing data D . During inference, this posterior distribution is then marginalized to produce final predictions. This process is called Bayesian Model Averaging (BMA) . It can be seen as learning an ensemble of an infinite number of neural nets and aggregating their results. Formally, given input x , the posterior predictive distribution and the expected prediction for a regression task are

For classification, the (most likely) prediction is the class arg max y p ( y | x ) . BMA is intuitively attractive because it can be risky to base inference on a single neural network model. The marginalization in BMA gets around this issue by averaging over models according to a Bayesian posterior.

BMA requires approximations to compute posterior predictive distributions and expected predictions, as the integrals in Equation 1 are intractable in general. Deriving efficient and accurate approximations remains an active research topic (Izmailov et al., 2021). We approach this problem by observing that the marginalization in BMA with ReLU neural networks can be cast as weighted volume computation (WVC). Later we show that it can be generalized to any neural network when combined with sampling. In WVC, various tools exist for solving certain WVC problem classes (Baldoni et al.,

1.0

0.5

0.0

0.5

1.0

X

15

10

5

0

5

Y

ground truth

prediction

(a) HMC with 10 samples

1.0

0.5

0.0

0.5

1.0

X

15

10

5

0

5

Y

ground truth

prediction

(b) CIBER with

10

collapsed samples

1.0

0.5

0.0

0.5

1.0

X

15

10

5

0

5

Y

ground truth

prediction

(c) HMC with

2

k

samples

2014; Kolb et al., 2019; Zeng et al., 2020c). This section reveals the connection between BMA and WVC. It opens up a new perspective for developing BMA approximations by leveraging WVC tools.

Definition 1 (WVC) . A weighted volume computation (WVC) problem is defined by a pair ( GLYPH<28> , ϕ ) where a region GLYPH<28> is a conjunction of arithmetic constraints and weight ϕ : GLYPH<28> → R is an integrable function assigning weights to elements in GLYPH<28> . The task of WVC is to compute the integral ∫ GLYPH<28> ϕ ( x ) d x .

2.1 A Warm-Up Example

Consider a simple yet relevant setting where the predictive distribution p ( y | x , w ) is a Dirac delta distribution with zero mass everywhere except at f w ( x ) , such that ∫ y p ( y | x , w ) dy = f w ( x ) .

Example 2. Assume a model f w ( x ) = ReLU ( w · x ) with a uniform posterior over the parameter: p ( w | D ) = 1 6 with w ∈ [ -3 , 3] . Let the input be x = 1 . For parameter w ∈ [ -3 , 0] , the model f w always predicts 0 , and otherwise (i.e., w ∈ (0 , 3] ), it predicts w . Thus, the expected prediction (Equation 1) is E p ( y | x ) [ y ] = ∫ GLYPH<28> ⊥ 0 · 1 6 d w + ∫ GLYPH<28> ⊤ w · 1 6 d w . That is, a summation of two WVC problems ( GLYPH<28> ⊥ , 0) and ( GLYPH<28> ⊤ , w/ 6) with GLYPH<28> ⊥ = ( -3 ≤ w ≤ 0) and GLYPH<28> ⊤ = (0 ≤ w ≤ 3) . The BMA integral decomposes into WVC problems with different weights due to the ReLU activation.

These WVC problems have easy closed-form solutions. This is no longer the case in the following.

Example 3. Assume a model f w ( x ) and posterior distribution p ( w | D ) as in Example 2. Let the predictive distribution p ( y | x, w ) be a Gaussian distribution p N ( y ; f w ( x ) , 1) with mean f w ( x ) and variance 1. Given input x = 1 , the expected prediction (Equation 1) is

It is a summation of two WVC problems with GLYPH<28> ⊥ = ( -3 ≤ w ≤ 0) ∧ ( y ∈ R ) and GLYPH<28> ⊤ = (0 ≤ w ≤ 3) ∧ ( y ∈ R ) , whose joint integral surface is shown in Figure 1a.

These WVC problems do not admit closed-form solutions since they involve truncated Gaussian distributions. Moreover, Figure 1a shows that computing BMA, even in such a low-dimensional parameter space, requires integration over non-convex and multi-modal functions.

2.2 General Reduction of BMA to WVC

Let model f w be a ReLU neural net. Denote the set of inputs to its ReLU activations by R = { r i } R i =1 , where each r i is a linear combination of weights. For a given input x , the parameter space is partitioned by whether each ReLU activation outputs zero or not. This gives the WVC reduction

where B is a binary vector. The region GLYPH<28> B is defined as ∧ R i =1 ℓ i where arithmetic constraint ℓ i is r i ≥ 0 if B i = 1 and r i ≤ 0 otherwise. The expected prediction E p ( y | x ) [ y ] is analogous but includes an additional factor and variable of integration y in each WVC problem.

This general reduction, however, is undesirable since it amounts to a brute-force enumeration that implies a complexity exponential in the number of ReLU activations. Moreover, not all WVC

problems resulting from this reduction are amenable to existing solvers. We will therefore appeal to a framework called weighted model integration (WMI) that allows for a compact representation of these WVC problems, and a characterization of their tractability for WMI solvers (Kolb et al., 2019). This inspires us to approximate BMA by first reducing it to WVC problems and further closely approximating those with tractable WMI problems.

3 Approximating BMA by WMI

WMI is a modeling and inference framework that supports integration in the presence of logical and arithmetic constraints (Belle et al., 2015a,b). Various WMI solvers have been proposed in recent years (Kolb et al., 2019), ranging from general-purpose ones to others that assume some problem structures to gain scalability. However, even with the reduction from BMA to WVC from the previous section, WMI solvers are not directly applicable. Existing solvers have two main limitations: (i) feasible regions need to be defined by Boolean combinations of linear arithmetic constraints, and (ii) weight functions need to be polynomials. In this section, we show that these issues can be bypassed using a motivating example of how to form a close approximation to BMA using WMI.

In WMI, the feasible region is defined by satisfiability modulo theories (SMT) constraints (Barrett et al., 2010): an SMT formula is a (typically quantifier-free) expression containing both propositional and theory literals connected with logical connectives; the theory literals are often restricted to linear real arithmetic , where literals are of the form ( c T X ≤ b ) with variable X and constants c T and b .

Example 4. The ReLU model f ( x ) of Example 2 can be encoded as an SMT formula (see box).

w The curly bracket denotes logical conjunction, the symbol ⇒ is a logical implication, variable W is the weight, and variable Z denotes the model output.

The encoding of ReLU neural networks into SMT formulas is explored in existing work to enable verification of the behavior of neural networks and provide formal guarantees (Katz et al., 2017; Huang et al., 2017; Sivaraman et al., 2020). We propose to use this encoding to define the feasible region of WMI problems. Let x | = ∆ denote the satisfaction of an SMT formula ∆ by an assignment x , and x | = ∆ be its corresponding indicator function. We formally introduce WMI next.

J K Definition 5. (WMI) Let X be a set of continuous random variables. A weighted model integration problem is a pair M = (∆ , Φ) , where ∆ is an SMT formula over X and Φ is a set of per-literal weights defined as Φ = { ϕ ℓ } ℓ ∈L , where L is a set of SMT literals and each ϕ ℓ is a function defined over variables in literal ℓ . The task of weighted model integration is to compute

That is, the task is to integrate over the weighted assignments of X that satisfy the SMT formula ∆ . 1

An approximation to the BMA of Example 3 can be achieved with WMI using the following four steps:

Step 1. Encoding model f w ( x ) . This has been shown as the SMT formula ∆ ReLU in Example 4.

Step 2. Encoding posterior distribution p ( w | D ) . The uniform distribution p ( w | D ) = 1 6 with w ∈ [ -3 , 3] can be encoded as a WMI problem pair (∆ pos , Φ pos ) as follows:

Step 3. Approximate encoding of predictive distribution p ( y | w,x ) . Recall that p ( y | w,x ) = p N ( y ; f w ( x ) , 1) is Gaussian, which cannot be handled by existing WMI solvers. To approximate it with polynomial densities, we simply use a triangular distribution encoded as a WMI problem pair:

In this encoding, α is a constant that defines the shape of the triangular distribution. It is obtained by minimizing the L 2 distance between a standard normal distribution and the symmetric triangular distribution. We visualize this approximation in the right figure.

Step 4. Approximating BMA by calling WMI solvers. With the

3

2

1

0

1

2

3

0.0

0.1

0.2

0.3

0.4

p

(

x

)

Triangular

x above encodings, the predictive posterior p ( y | x ) (Equation 1) can be computed using two calls to a WMI solver. For example, the uncertainty of a prediction y = 1 for input x = 1 is

where ∆ = ∆ ReLU ∧ ∆ pos ∧ ∆ pred and Φ = Φ pos ∪ Φ pred . Similarly, the expected prediction E p ( y | x =1) [ y ] (Equation 1) can be computed using two calls to a WMI solver:

where Φ ∗ = Φ ∪{ ϕ ℓ ( Y ) = Y with ℓ = true } . The above formulations also work for unnormalized distributions since the WMI in the denominator serves to compute the partition function.

We visualize the integral surface of the resulting approximate BMA problem in Figure 1b. It is very close to the integral surface of the original BMA problem in Figure 1a. However, it can be exactly integrated using existing WMI solvers while the original one does not admit such solutions. Next, we show how this process can be generalized to a scalable and accurate approximation of BMA.

4 CIBER: Collapsed Inference for Bayesian Deep Learning via WMI

Given a BNN with a large number of weights, naively approximating it by WMI problems can lead to computational issues, since it involves doing integration over polytopes in arbitrarily high dimensions and this is known to be #P-hard (Valiant, 1979; De Loera et al., 2012; Zeng et al., 2020c). Further, weights involved with nonReLU activation might not be amenable to the WMI encoding. To tackle these issues, we propose to use collapsed samples to combine the strengths from two worlds: the scalability and flexibility from sampling and the accuracy from WMI solvers.

Definition 6. (Collapsed BMA) Let ( W s , W c ) be a partition of parameters W . A collapsed sample is a tuple ( w s , q ) , where w s is an assignment to the sampled parameters W s and q is a representation of the conditional posterior p ( W c | w s , D ) over the collapsed parameter set W c . Given collapsed samples S , collapsed BMA estimates the predictive posterior and expected prediction as

The size of the collapsed set W c determines the trade-off between scalability and accuracy. The more parameters in the collapsed set, the more accurate the approximation to BMA is. The fewer parameters in W c , the more efficient the computations of the integrals are since the integration is performed in a lower-dimensional space. Later in our experiments, we choose a subset of weights at the last or second-to-last hidden layer of the neural networks to be the collapsed set. This choice is known to be effective in capturing uncertainty as shown in Kristiadi et al. (2020); Snoek et al. (2015).

To develop an algorithm to compute collapsed BMA, we are faced with two main design choice questions: (Q1) how to sample w s from the posterior? (Q2) what should be the representation of the conditional posterior q such that the integrals in Equation 2 can be computed exactly? Next, we provide our answers to these two questions that together give our proposed algorithm CIBER.

4.1 Approximation to Posteriors

For (Q1) , we follow Maddox et al. (2019) and sample from the stochastic gradient descent (SGD) trajectory after convergence and use the information contained in SGD trajectories to efficiently approximate the posterior distribution over the parameters of the neural network, leveraging the interpretation of SGD as approximate Bayesian inference (Mandt et al., 2017; Chen et al., 2020).

Given a set of parameter samples W from the SGD trajectory, the sample set is defined as W s = { w s | w ∈ W} . For each assignment w s , an approximation q ( W c ) to the conditional posterior p ( W c | w s , D ) is necessary since the posteriors induced by SGD trajectories are implicit. Next, we discuss the choice of approximation to the conditional posterior that is amenable to WMI.

4.2 Encoding into WMI Problems

As shown in Section 3, if a BNN can be encoded as a WMI problem, the posterior predictive distribution and the expected prediction, which involve marginalization over the parameter space, can be computed exactly using WMI solvers. This inspires us to use the WMI framework as the closed-form representation for the conditional posteriors of parameters. The main challenge is how to approximate the integrand in Equation 2 using an SMT formula and a polynomial weight function in order to obtain a WMI problem amenable to existing solvers.

For the conditional posterior approximation q ( W c ) , we choose it to be a uniform distribution that can be encoded into a WMI problem as M pos = (∆ pos , Φ pos ) with the SMT formula being ∆ pos = ∧ i ∈ c ( l i ≤ W i ≤ u i ) and weights being Φ pos = { ϕ ℓ ( W c ) = 1 | ℓ = true } , where l i and u i are domain lower and upper bounds for the uniform distribution respectively. While seemingly over-simplistic, this choice of approximation to the conditional posterior is sufficient to robustly deliver surprisingly strong empirical performance as shown in Section 6. The intuition is that uniform distributions are better than a few samples. We further illustrate this point by comparing the predictive distributions of CIBER and HMC in a few-sample setting. Figure 2 shows that even with the same 10 samples drawn from the posterior distribution, since CIBER further approximates the 10 samples with a uniform distribution, it yields a predictive distribution closer to the ground truth than HMC, indicating that using a uniform distribution instead of a few samples forms a better approximation.

For the choice of predictive distribution p ( y | x , w ) , we propose to use piecewise polynomial densities. Common predictive distributions can be approximated by polynomials up to arbitrary precision in theory by the Stone-Weierstrass theorem (De Branges, 1959). For regression, the de facto choice is Gaussian and we propose to use triangular distribution as the approximation, i.e., p ( y | x , w ) = 1 r -1 r 2 | y -f w ( x ) | , with domain | y -f w ( x ) | ≤ r , and r := α √ σ 2 ( x ) where the constant α parameterizes the triangular distribution as described in Section 3. Here, σ 2 ( x ) is the variance estimate, which can be a function of input x depending on whether the BNN is homoscedastic or heteroscedastic. Then p ( y | x , w ) can be encoded into WMI as:

Similar piecewise polynomial approximations are adopted for classification tasks when the predictive distributions are induced by softmax functions. Those details are presented in the Appendix.

4.3 Exact Integration in Collapsed BMA

By encoding the collapsed BMA into WMI problems, we are ready to answer (Q2) , i.e., how to perform exact computation of the integrals shown in Equation 2.

Proposition 7. Let the SMT formula ∆ = ∆ ReLU ∧ ∆ pos ∧ ∆ pred , and the set of weights Φ = Φ pos ∪ Φ pred as defined in Section 4.2. Let the set of weights Φ ∗ = Φ ∪{ ϕ ℓ ( Y ) = Y with ℓ = true } . The integrals in collapsed BMA (Equation 2) can be computed by WMI solvers as

With both questions (Q1) and (Q2) answered, we summarize our proposed algorithm CIBER in Algorithm 1 in the Appendix. To quantitatively analyze how close the approximation delivered by CIBER is to the ground-truth BMA, we consider the following experiments with closed-form BMA.

2

0

2

4

6

8

y

0.02

0.01

0.00

0.01

0.02

0.03

0.04

|

p

(

y

|

x

)

q

(

y

|

x

)|

MC

CIBER(ours)

ground truth

60

80

100

120

140

number of samples

5.5

5.0

4.5

4.0

log KL divergence

MC

CIBER(ours, 50)

Regression. We consider a Bayesian linear regression setting where exact sampling from the posterior distribution is available. Both the likelihood and the weight posterior are Gaussian such that the ground-truth posterior predictive distribution is Gaussian as well. With samples drawn from the weight posterior, CIBER approximates the samples with a uniform distribution as posterior p ( w |D ) and further approximates the likelihood with a triangular distribution such that the integral p ( y | x , D ) = ∫ p ( y | x , w ) p ( w |D ) d w can be computed exactly by WMI.

We first evaluate the posterior predictive distribution estimated by CIBER and Monte Carlo (MC) method, using the same five samples drawn from the weight posterior. Results averaged over 10 trials are shown in Figure 3 where the estimations by CIBER are much closer to the ground truth posterior predictive distribution than those by the MC method. Further, the averaged KL divergence between the ground truth and CIBER is 0 . 069 while the one for MC estimations is 0 . 130 , again indicating that CIBER yields a better BMA approximation in the few-sample setting.

We further explore the question of how many samples the MC method needs to match the performance of CIBER. The performances of both approaches are evaluated using KL divergence between the ground-truth posterior distribution and the estimated one, averaged over 10 trials. The result is shown in Figure 4 where the dashed green line shows the performance of CIBER with 50 samples and the blue curve shows the performance of MC with an increasing number of samples. As expected, the MCmethod yields lower KL divergence as the number of samples increases; however, it takes more than 100 samples to match CIBER, indicating its low sample efficiency and that developing efficient and effective inference algorithms such as CIBER for estimating BMA is a meaningful question.

Classification. For analyzing classification performance, Kristiadi et al. (2022) propose to compute the integral I = ∫ σ ( f ∗ ) p N ( f ∗ ) df ∗ with σ being the sigmoid function and f ∗ = f ( x ∗ ; w ) that amounts to the posterior predictive distribution. We consider a simple case with f ( x ; w ) = w · x such that the ground-truth integral can be obtained. With a randomly chosen x , the ground-truth integral is I = 0 . 823 . The integral estimated by CIBER is I C = 0 . 826 while the MC estimate is I MC = 0 . 732 . That is, CIBER gives an estimate with a much lower error than the MC estimation error, indicating that CIBER is able to deliver high-quality approximations in classification tasks.

5 Related Work

Bayesian Deep Learning. Bayesian inference over deep neural networks (MacKay, 1992) is proposed to fix the issue that deep learning models give poor uncertainty estimations and suffer from overconfidence (Nguyen et al., 2015; Hein et al., 2019; Meronen et al., 2023, 2021). Some methods use samples from SGD trajectories to approximate the implicit true posteriors similar to us: Izmailov et al. (2020) (SI) proposes to perform Bayesian inference in a subspace of the parameter space spanned by a few vectors derived from principal component analysis (PCA+ESS(SI)) or variational inference (PCA+VI(SI)); SWAG (Maddox et al., 2019) proposes to approximate the full parameter space using an approximate Gaussian posterior whose mean and covariance are from a partial SGD trajectory with a modified learning rate scheduler.

Some other approaches using approximate posteriors include MC Dropout (MCD) (Gal & Ghahramani, 2015, 2016) which is one of the Bayesian dropout methods and recently, one of its modifications called Variational Structured Dropout (VSD) (Nguyen et al., 2021) using variational inference is pro-

posed. Other state-of-the-art approximate BNN inference methods including deterministic variational inference (DVI) (Wu et al., 2019), deep Gaussian processes (DGP) (Bui et al., 2016) with Gaussian process layers and variational inference (VI) (Kingma & Welling, 2013). Closely related to DGP is the deep kernel process (Aitchison et al., 2021) that writes DGPs as deep Wishart processes.

WMISolvers. WMI generalizes weighted model counting (WMC) Sang et al. (2005), a state-ofthe-art inference approach in many discrete probabilistic models, from discrete to mixed discretecontinuous domains Belle et al. (2015a,b). Recent research on WMI includes its tractability (Zeng et al., 2020c, 2021; Abboud et al., 2020) and the advancements in WMI solver development. Existing exact WMI solvers for arbitrarily structured problems include DPLL-based search with numerical Belle et al. (2015a); Morettin et al. (2017, 2019) or symbolic integration de Salvo Braz et al. (2016) and compilation-based algorithms Kolb et al. (2018); Zuidberg Dos Martires et al. (2019); Derkinderen et al. (2020) that use extended algebraic decision diagrams (XADDs) (Sanner et al., 2012) as a compilation target which is a powerful tool for inference on mixed domains (Sanner & Abbasnejad, 2012; Zamani et al., 2012). Some exact WMI solvers aiming to improve efficiency for a certain class of models are proposed such as SMI (Zeng & Van den Broeck, 2019) and MP-WMI (Zeng et al., 2020a) which are greatly scalable for WMI problems that satisfy certain structural constraints. Approximate solvers are also proposed including sampling-based ones (Zuidberg Dos Martires et al., 2020) and relaxation-based ones (Zeng et al., 2020c,b). Recent WMI efforts converge in the pywmi library (Kolb et al., 2019). The SMT formulas considered in this work can be seen as distributional constraints on continuous domains. There is also plenty of work in neuro-symbolic AI exploring the integration of discrete constraints into neural networks models including the architectures (Ahmed et al., 2022b, 2023) and the loss (Xu et al., 2018; Ahmed et al., 2022c,a).

6 Experiments

We conduct experimental evaluations of our proposed approach CIBER 1 on regression and classification benchmarks and compare its performance on uncertainty estimation as well as prediction accuracy with a wide range of baseline methods. More experimental details are presented in the Appendix.

6.1 Regression on Small and Large UCI Datasets

We experiment on 5 small UCI datasets: boston , concrete , yacht , naval and energy . We follow the setup of Izmailov et al. (2020) and use a fully connected network with a single hidden layer and 50 units with ReLU activations. We further experiment on 6 large UCI datasets: elevators , keggdirected , keggundirected , pol , protein and skillcraft . We use a feedforward network with five hidden layers of sizes [1000 , 1000 , 500 , 50 , 2] and ReLU activations on all datasets except skillcraft . For skillcraft , a smaller architecture is adopted with four hidden layers of size [1000 , 500 , 50 , 2] . All models have two outputs for the prediction and the heteroscedastic variance respectively.

We run CIBER with two different ways of choosing the collapsed parameter set: CIBER (last) chooses all the weights at the last layer to be the collapsed set; CIBER (second) chooses three out of all the weights at the second-to-last layer to be the collapsed set. The heuristic we use for choosing the weights is to look into the sampled weights from SGD trajectories to see which ones have the greatest variance. The intuition is that a greater variance indicates that the weight is prone to have greater uncertainty and thus one might want to perform a more accurate inference over it.

Baselines. We compare CIBER to the state-of-the-art approximate BNN inference methods. We separate these methods into two categories: those sampling from SGD trajectories as approximate posteriors, which includes SWAG (Maddox et al., 2019), PCA+ESS (SI) and PCA+VI (SI) (Izmailov et al., 2020), vs. those who do not, which includes the SGD baseline, deterministic variational inference (DVI) (Wu et al., 2019), Deep Gaussian Processes (DGP) (Bui et al., 2016), variational inference (VI) (Kingma & Welling, 2013), MC Dropout (MCD) (Gal & Ghahramani, 2015, 2016), and variational structured dropout (VSD) (Nguyen et al., 2021). These methods achieved stateof-the-art performance on the small UCI datasets. We also compare to baselines Bayesian final layers (NL) (Riquelme et al., 2018), deep kernel learning (DKL) (Wilson et al., 2016), orthogonally decoupled variational GPs (OrthVGP) (Salimbeni et al., 2018) and Fastfood approximate kernels (FF) (Yang et al., 2015), which have achieved state-of-the-art performance on the large UCI datasets.

Results. We present the test log likelihoods for small UCI datasets in Table 1 and those for large UCI datasets in Table 2. In both tables, the first block summarizes SGD-trajectory sampling-based approaches and the second summarizes the rest. Underlined results are the best among all and bold results are the best among SGD-trajectory sampling-based approaches. From the results, our CIBER has substantially better performance than all others on three out of the five small UCI datasets four out of six large UCI datasets, with comparable performance on the rest, demonstrating that CIBER provides accurate uncertainty estimation. We also present the test rooted-mean-squared error results in Appendix, where CIBER outperforms all other SGD-trajectory sampling-based baselines on four out of five small UCI datasets and four out of six large UCI datasets; it outperforms all baselines on two small UCI datasets and one large UCI datasets and has comparable performance on the rest. This further illustrates that exact marginalization over conditional approximate posteriors enabled by WMI solvers achieves accurate estimation of the true BMA and boosts predictive performance.

6.2 Image Classification

CIFAR datasets. We experiment with two image datasets: CIFAR-10 and CIFAR-100 (Krizhevsky et al., 2009) and evaluate the test performance using three metrics: 1) negative log likelihood (NLL)

that reflects the quality of both uncertainty estimation and prediction accuracy, 2) classification accuracy (ACC), and 3) expected calibration errors (ECE) (Naeini et al., 2015) that show the difference between predictive confidence and accuracy and should be close to zero for a well-calibrated approach.

We run CIBER by choosing the collapsed parameter set to be 10 weights and 100 weights at the last layer of the neural network models for CIFAR-10 and CIFAR-100 respectively. The weights are chosen using the same heuristic as the one for regression tasks, i.e., to choose the weights whose samples from the SGD trajectories have large variances. We compare CIBER with strong baselines including SWAG (Maddox et al., 2019) reproduced by their open-source implementation, standard SGD, SWA (Izmailov et al., 2018), SGLD (Welling & Teh, 2011) and KFAC (Ritter et al., 2018).

Transfer from CIFAR-10 to STL-10. We further consider a transfer learning task using the model trained on CIFAR-10 to be evaluated on dataset STL-10 (Coates et al., 2011). STL-10 shares nine out of ten classes with the CIFAR-10 dataset but has a different image distribution. It is a common benchmark in transfer learning to adapt models trained on CIFAR-10 to STL-10.

Results. We present the test classification performance on dataset CIFAR-10 and CIFAR-100 in Table 3 and that of transfer learning in Table 4. The neural network models used in the classification task are VGG-16 networks and the models used in the transfer learning task are VGG-16 and PreResNet164 . More results using different network architectures are presented in the Appendix. With the same number of samples as SWAG, CIBER outperforms SWAG and other baselines in most evaluations and delivers comparable performance otherwise, demonstrating the effectiveness of using collapsed samples in improving uncertainty estimation as well as classification performance.

7 Conclusions And Future Work

We reveal the connection between BMA, a way to perform Bayesian deep learning and WVC, which inspires us to approximate BMA using the framework of WMI. To further make this approximation scalable and flexible, we combine it with collapsed samples which gives our algorithm CIBER. CIBER compares favorably to Bayesian deep learning baselines on regression and classification tasks. A future direction would be to explore what other layers can be expressed as SMT formulas and thus amenable to SMT encoding. Also, the current WMI solvers are limited to polynomial weights, and thus the reduction to WMI problems is applicable to piecewise polynomial weights. This limitation might be alleviated in the future by the development of new WMI solvers that allow various weight function families.

Acknowledgments

We would like to thank Yuhang Fan and Kareem Ahmed for helpful discussions. We would also like to thank Wesley Maddox for answering queries on the implementation of baseline SWAG. This work was funded in part by the DARPA PTG Program under award HR00112220005, the DARPA ANSR program under award FA8750-23-2-0004, NSF grants #IIS-1943641, #IIS-1956441, #CCF-1837129, and a gift from RelationalAI. GVdB discloses a financial interest in RelationalAI. ZZ is supported by an Amazon Doctoral Student Fellowship.

References

Abboud, R., Ceylan, I. I., and Dimitrov, R. On the approximability of weighted model integration on DNF structures. arXiv preprint arXiv:2002.06726 , 2020.

Ahmed, K., Li, T., Ton, T., Guo, Q., Chang, K.-W., Kordjamshidi, P., Srikumar, V., Van den Broeck, G., and Singh, S. Pylon: A pytorch framework for learning with constraints. In Proceedings of the 36th AAAI Conference on Artificial Intelligence (Demo Track) , feb 2022a.

Ahmed, K., Teso, S., Chang, K.-W., Van den Broeck, G., and Vergari, A. Semantic probabilistic layers for neuro-symbolic learning. In Advances in Neural Information Processing Systems 35 (NeurIPS) , dec 2022b.

Ahmed, K., Wang, E., Chang, K.-W., and den Broeck, G. V. Neuro-symbolic entropy regularization. In The 38th Conference on Uncertainty in Artificial Intelligence , 2022c.

Ahmed, K., Zeng, Z., Niepert, M., and Van den Broeck, G. Simple: A gradient estimator for k-subset sampling. In Proceedings of the International Conference on Learning Representations (ICLR) , may 2023.

Aitchison, L., Yang, A., and Ober, S. W. Deep kernel processes. In International Conference on Machine Learning , pp. 130-140. PMLR, 2021.

Baldoni, V., Berline, N., De Loera, J. A., Dutra, B., Köppe, M., Moreinis, S., Pinto, G., Vergne, M., and Wu, J. A user's guide for latte integrale v1. 7.2. Optimization , 22(2), 2014.

Barrett, C., de Moura, L., Ranise, S., Stump, A., and Tinelli, C. The SMT-LIB initiative and the rise of SMT. In Proceedings of the 6th international conference on Hardware and software: verification and testing , pp. 3-3. Springer-Verlag, 2010.

Belle, V., Passerini, A., and Van den Broeck, G. Probabilistic inference in hybrid domains by weighted model integration. In Proceedings of IJCAI , pp. 2770-2776, 2015a.

Belle, V., Van den Broeck, G., and Passerini, A. Hashing-based approximate probabilistic inference in hybrid domains. In Proceedings of the 31st Conference on Uncertainty in Artificial Intelligence (UAI) , 2015b.

Bui, T., Hernández-Lobato, D., Hernandez-Lobato, J., Li, Y., and Turner, R. Deep gaussian processes for regression using approximate expectation propagation. In International conference on machine learning , pp. 1472-1481. PMLR, 2016.

Chen, X., Lee, J. D., Tong, X. T., and Zhang, Y. Statistical inference for model parameters in stochastic gradient descent. The Annals of Statistics , 48(1):251-273, 2020.

Coates, A., Ng, A., and Lee, H. An analysis of single-layer networks in unsupervised feature learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics , pp. 215-223. JMLR Workshop and Conference Proceedings, 2011.

De Branges, L. The stone-weierstrass theorem. Proceedings of the American Mathematical Society , 10(5):822-824, 1959.

De Loera, J. A., Dutra, B., Koeppe, M., Moreinis, S., Pinto, G., and Wu, J. Software for exact integration of polynomials over polyhedra. ACM Communications in Computer Algebra , 45(3/4): 169-172, 2012.

de Salvo Braz, R., O'Reilly, C., Gogate, V., and Dechter, R. Probabilistic inference modulo theories. In Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence , pp. 3591-3599. AAAI Press, 2016.

Derkinderen, V., Heylen, E., Dos Martires, P. Z., Kolb, S., and Raedt, L. Ordering variables for weighted model integration. In Conference on Uncertainty in Artificial Intelligence , pp. 879-888. PMLR, 2020.

Fragoso, T. M., Bertoli, W., and Louzada, F. Bayesian model averaging: A systematic review and conceptual classification. International Statistical Review , 86(1):1-28, 2018.

Gal, Y. and Ghahramani, Z. Bayesian convolutional neural networks with bernoulli approximate variational inference. arXiv preprint arXiv:1506.02158 , 2015.

Gal, Y. and Ghahramani, Z. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning , pp. 1050-1059. PMLR, 2016.

Hein, M., Andriushchenko, M., and Bitterwolf, J. Why relu networks yield high-confidence predictions far away from the training data and how to mitigate the problem. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition , pp. 41-50, 2019.

Huang, X., Kwiatkowska, M., Wang, S., and Wu, M. Safety verification of deep neural networks. In International conference on computer aided verification , pp. 3-29. Springer, 2017.

Izmailov, P., Podoprikhin, D., Garipov, T., Vetrov, D., and Wilson, A. G. Averaging weights leads to wider optima and better generalization. arXiv preprint arXiv:1803.05407 , 2018.

Izmailov, P., Maddox, W. J., Kirichenko, P., Garipov, T., Vetrov, D., and Wilson, A. G. Subspace inference for bayesian deep learning. In Uncertainty in Artificial Intelligence , pp. 1169-1179. PMLR, 2020.

Izmailov, P., Vikram, S., Hoffman, M. D., and Wilson, A. G. G. What are bayesian neural network posteriors really like? In International Conference on Machine Learning , pp. 4629-4640. PMLR, 2021.

Jospin, L. V., Laga, H., Boussaid, F., Buntine, W., and Bennamoun, M. Hands-on bayesian neural networks-a tutorial for deep learning users. IEEE Computational Intelligence Magazine , 17(2): 29-48, 2022.

Katz, G., Barrett, C., Dill, D. L., Julian, K., and Kochenderfer, M. J. Reluplex: An efficient smt solver for verifying deep neural networks. In International conference on computer aided verification , pp. 97-117. Springer, 2017.

Kingma, D. P. and Welling, M. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114 , 2013.

Kolb, S., Mladenov, M., Sanner, S., Belle, V., and Kersting, K. Efficient symbolic integration for probabilistic inference. In IJCAI , pp. 5031-5037, 2018.

Kolb, S., Morettin, P., Zuidberg Dos Martires, P., Sommavilla, F., Passerini, A., Sebastiani, R., and De Raedt, L. The pywmi framework and toolbox for probabilistic inference using weighted model integration. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI , pp. 6530-6532, 7 2019. doi: 10.24963/ijcai.2019/946.

Koller, D. and Friedman, N. Probabilistic graphical models. 2009.

Kristiadi, A., Hein, M., and Hennig, P. Being bayesian, even just a bit, fixes overconfidence in relu networks. In International conference on machine learning , pp. 5436-5446. PMLR, 2020.

Kristiadi, A., Eschenhagen, R., and Hennig, P. Posterior refinement improves sample efficiency in bayesian neural networks. In Koyejo, S., Mohamed, S., Agarwal, A., Belgrave, D., Cho, K., and Oh, A. (eds.), Advances in Neural Information Processing Systems , volume 35, pp. 30333-30346. Curran Associates, Inc., 2022.

Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images. 2009.

MacKay, D. J. The evidence framework applied to classification networks. Neural computation , 4(5): 720-736, 1992.

Maddox, W. J., Izmailov, P., Garipov, T., Vetrov, D. P., and Wilson, A. G. A simple baseline for bayesian uncertainty in deep learning. Advances in Neural Information Processing Systems , 32: 13153-13164, 2019.

Mandt, S., Hoffman, M. D., and Blei, D. M. Stochastic gradient descent as approximate bayesian inference. arXiv preprint arXiv:1704.04289 , 2017.

Meronen, L., Trapp, M., and Solin, A. Periodic activation functions induce stationarity. Advances in Neural Information Processing Systems , 34:1673-1685, 2021.

Meronen, L., Trapp, M., Pilzer, A., Yang, L., and Solin, A. Fixing overconfidence in dynamic neural networks. arXiv preprint arXiv:2302.06359 , 2023.

Morettin, P., Passerini, A., and Sebastiani, R. Efficient weighted model integration via SMT-based predicate abstraction. In Proceedings of IJCAI , pp. 720-728, 2017.

Morettin, P., Passerini, A., and Sebastiani, R. Advanced smt techniques for weighted model integration. Artificial Intelligence , 275:1-27, 2019.

Naeini, M. P., Cooper, G., and Hauskrecht, M. Obtaining well calibrated probabilities using bayesian binning. In Proceedings of the AAAI conference on artificial intelligence , volume 29, 2015.

Nguyen, A., Yosinski, J., and Clune, J. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In Proceedings of the IEEE conference on computer vision and pattern recognition , pp. 427-436, 2015.

Nguyen, S., Nguyen, D., Nguyen, K., Than, K., Bui, H., and Ho, N. Structured dropout variational inference for bayesian neural networks. Advances in Neural Information Processing Systems , 34, 2021.

Riquelme, C., Tucker, G., and Snoek, J. Deep bayesian bandits showdown: An empirical comparison of bayesian deep networks for thompson sampling. arXiv preprint arXiv:1802.09127 , 2018.

Ritter, H., Botev, A., and Barber, D. A scalable laplace approximation for neural networks. In 6th International Conference on Learning Representations, ICLR 2018-Conference Track Proceedings , volume 6. International Conference on Representation Learning, 2018.

Salimbeni, H., Cheng, C.-A., Boots, B., and Deisenroth, M. Orthogonally decoupled variational gaussian processes. Advances in neural information processing systems , 31, 2018.

Sang, T., Beame, P., and Kautz, H. A. Performing bayesian inference by weighted model counting. In AAAI , volume 5, pp. 475-481, 2005.

Sanner, S. and Abbasnejad, E. Symbolic variable elimination for discrete and continuous graphical models. In Twenty-Sixth AAAI Conference on Artificial Intelligence , 2012.

Sanner, S., Delgado, K. V., and De Barros, L. N. Symbolic dynamic programming for discrete and continuous state mdps. arXiv preprint arXiv:1202.3762 , 2012.

Sivaraman, A., Farnadi, G., Millstein, T., and Van den Broeck, G. Counterexample-guided learning of monotonic neural networks. In Advances in Neural Information Processing Systems 33 (NeurIPS) , dec 2020.

Snoek, J., Rippel, O., Swersky, K., Kiros, R., Satish, N., Sundaram, N., Patwary, M., Prabhat, M., and Adams, R. Scalable bayesian optimization using deep neural networks. In International conference on machine learning , pp. 2171-2180. PMLR, 2015.

Valiant, L. G. The complexity of enumeration and reliability problems. SIAM Journal on Computing , 8(3):410-421, 1979.

Wasserman, L. Bayesian model selection and model averaging. Journal of mathematical psychology , 44(1):92-107, 2000.

Welling, M. and Teh, Y. W. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th international conference on machine learning (ICML-11) , pp. 681-688, 2011.

Wilson, A. G., Hu, Z., Salakhutdinov, R., and Xing, E. P. Deep kernel learning. In Artificial intelligence and statistics , pp. 370-378. PMLR, 2016.

Wu, A., Nowozin, S., Meeds, E., Turner, R. E., Hernandez-Lobato, J. M., and Gaunt, A. L. Deterministic variational inference for robust bayesian neural networks. In International Conference on Learning Representations , 2019.

Xu, J., Zhang, Z., Friedman, T., Liang, Y., and Van den Broeck, G. A semantic loss function for deep learning with symbolic knowledge. In International conference on machine learning , pp. 5502-5511. PMLR, 2018.

Yang, Z., Wilson, A., Smola, A., and Song, L. A la carte-learning fast kernels. In Artificial Intelligence and Statistics , pp. 1098-1106. PMLR, 2015.

Zamani, Z., Sanner, S., and Fang, C. Symbolic dynamic programming for continuous state and action mdps. In Proceedings of the AAAI Conference on Artificial Intelligence , volume 26, pp. 1839-1845, 2012.

Zeng, Z. and Van den Broeck, G. Efficient search-based weighted model integration. Proceedings of UAI , 2019.

Zeng, Z., Morettin, P., Yan, F., Vergari, A., and Broeck, G. V. d. Scaling up hybrid probabilistic inference with logical and arithmetic constraints via message passing. In Proceedings of the International Conference of Machine Learning (ICML) , 2020a.

Zeng, Z., Morettin, P., Yan, F., Vergari, A., and Van den Broeck, G. Relax, compensate and then integrate. In Proceedings of the ECML-PKDD Workshop on Deep Continuous-Discrete Machine Learning (DeCoDeML) , 2020b.

Zeng, Z., Morettin, P., Yan, F., Vergari, A., and Van den Broeck, G. Probabilistic inference with algebraic constraints: Theoretical limits and practical approximations. Advances in Neural Information Processing Systems , 33:11564-11575, 2020c.

Zeng, Z., Morettin, P., Yan, F., Passerini, A., Van den Broeck, G., et al. Is parameter learning via weighted model integration tractable? In The 4th Workshop on Tractable Probabilistic Modeling , 2021.

Zuidberg Dos Martires, P. M., Dries, A., and De Raedt, L. Exact and approximate weighted model integration with probability density functions using knowledge compilation. In Proceedings of the 30th Conference on Artificial Intelligence . AAAI Press, 2019.

Zuidberg Dos Martires, P. M. et al. Monte carlo anti-differentiation for approximate weighted model integration. In Proceedings of the Ninth International Workshop on Statistical Relational AI . International Workshop on Statistical Relational AI, 2020.

A Proofs

Proposition 7 Let the SMT formula ∆ = ∆ ReLU ∧ ∆ pos ∧ ∆ pred , and the set of weights Φ = Φ pos ∪ Φ pred as defined in Section 4.2. Let the set of weights Φ ∗ = Φ ∪{ ϕ ℓ ( Y ) = Y with ℓ = true } . The integrals in collapsed BMA (Equation 2) can be computed by WMI solvers as

Proof. By construction, it holds that

Thus, we have that the likelihood weighted by the approximate posterior would be

or equivalently,

By integrating over the collapsed set W c , it further holds that

which proves the first equation. Similarly, we have that

By integrating over the collapsed set W c and prediction y , it holds that

which finishes our proof.

Algorithm 1 CIBER

Input : input x , sampled weights W , neural network model f w , prediction ground truth y ∗ Ouput : predictions and likelihoods

1: Choose a partition ( W s , W c ) for network parameters

2: Derive approximate posterior q ( w c ) from sampled weights { w c | w ∈ W} // cf. Section 4.2

3: Encode posterior q ( w c ) into WMI problem M pos = (∆ pos , Φ pos ) // cf. Section 4.2

4: Y ← ∅ , P ← ∅ // Initialization

5: for sample w s in { w s | w ∈ W} do

6: Encode neural network model f ReLU parameterized by ( w s , W c ) into an SMT formula ∆ f w

7: Encode predictive p ( Y | x , w s , W c ) into a WMI problem M pred = (∆ pred , Φ pred )

8: SMT formula ∆ ← ∆ ReLU ∧ ∆ pos ∧ ∆ pred

9: Weights Φ ← Φ pos ∪ Φ pred

11: Add prediction y = WMI (∆ , Φ ∗ ) / WMI (∆ , Φ) to prediction set Y // cf. Section 4.3

10: Weights Φ ∗ ← Φ ∪ { ϕ ℓ ( Y ) = Y with ℓ = true }

12: Add likelihood p = WMI (∆ ∧ ( Y = y ∗ ) , Φ) / WMI (∆ , Φ) to set P // cf. Section 4.3

13: return y = MEAN ( Y ) , p ( y ∗ | x ) = MEAN ( P )

B Pseudo Code for CIBER

We summarize our proposed algorithm CIBER , C ollapsed I nference B ayesian D E ep Lea R ning, for regression tasks, in Algorithm 1. For the classification task, the algorithm is basically the same except the encoding of the predictive of the distribution. Specifically, for a given class y , the predictive distribution p ( y | x , w ) can be encoded into a WMI problem as shown below:

where ϕ ℓ 1 is a cubic polynomial that approximates the sigmoid function such that the posterior predictive distribution p ( y | x ) can be solved by WMI solvers by p ( y | x ) = WMI (∆ , Φ) . Further, the prediction of BMA for classification tasks is made by y ∗ = arg max y p ( y | x ) .

C Additional Experiments

C.1 Toy Regression in Figure 2

We evaluate the predictive distributions obtained by our CIBER and HMC respectively, in a toy dataset generated by sampling 10 input x uniformly distributed in the interval [ -1 , -0 . 5] and interval [0 . 5 , 1] . For each input x , the corresponding target y is computed from a cubic polynomial with Gaussian noises. We apply to these data a Bayesian neural network which is a ReLU neural network with two hidden layers, where both parameter priors and likelihood are Gaussian distributions. We compare HMC and our CIBER in a few-sample setting which is common in most Bayesian deep learning applications, with 10 samples from the posterior distribution. An estimation generated by HMC with a sufficiently large number of samples of size 2 , 000 is further presented as a ground truth.

The results are shown in Figure 2. Even with the same 10 samples drawn from the posterior distribution, since CIBER further approximates the 10 samples with a uniform distribution as q ( w ) , it yields a predictive distribution p ( y | x ) closer to the ground truth than HMC. The intuition behind is that using a uniform distribution instead of a few samples forms a better approximation to the true posterior since the uniform distribution in a collapsed sample represents uncountably many models.

C.2 Regression on Small and Large Datasets

Sampling from SGD Trajectories. During training, we use Gaussian log likelihood as the objective for obtaining smooth gradients and use early stopping to prevent over-fitting. At convergence, we start the sampling process by keeping running SGD and collecting the weights. At deployment time, we approximate the Gaussian predictive distribution with the triangular distributions.

Hyperparameters. The hyperparameters including learning rates and weight decay are tuned by performing a grid search to maximize the Gaussian log likelihood using a validation split.

Additional Results. Following the set-up of Izmailov et al. (2020), the test performance on small UCI datasets are averaged over 20 trials and the test performance of large UCI datasets are averaged over 10 trials. The test log likelihood results for small UCI datasets are unnormalized while those for large UCI datasets are normalized. Besides the log likelihood results as shown in Section 6.1, root-mean-squared-error (RMSE) results for small UCI datasets are further presented in Table 5 and RMSE results for large UCI datasets are presented in Table 6.

C.3 Image Classification

Sampling from SGD Trajectories. All the network models are trained for 300 epochs using SGD. We start the weight collection after epoch 160 with step size 5 . We follow exactly the same hyperparameters as Maddox et al. (2019) including learning rates and weight decay parameters.

Additional Results. Following the set-up of Maddox et al. (2019), we run experiments with VGG-16, PreResNet-164 and WideResNet network models on both the image classification task and the transfer learning task. For the image classification task on CIFAR datasets, we present the log likelihood results in Table 7, the accuracy results in Table 8, and ECE results in Table 9. For the transfer learning task from dataset CIFAR-10 to dataset STL-10, we present the results for model VGG16 and PreResNet164 in Table 4 and the results for model WideResNet in Table 10.

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper presents a new method for calculating Bayesian integrals such as the Bayesian model average (BMA) based on volume computation schemes. Specifically, the authors draw inspiration from a weighted volume computation (WVC) problem. Since the WVC is intractable for common neural networks they approximate it with weighted model integration (WMI) that can compute volumes of literals connected with logical connectivities. Some approximations are used to accommodate WMI solvers, such as approximating a Gaussian likelihood with a triangular distribution, and using the WMI solver on part of the network (usually a few dozens of parameters). Results show superior performance compared to sgd-based Bayesian methods and comparable results to Bayesian last-layer methods.\n\nSTRENGTHS:\nOverall I liked the idea of the paper and the novel view it provides for computing Bayesian integrals. Strengths:\n* Novel and interesting characterization of the BMA as a volume computation problem\n* Novel way of approximating the BMA and other integrals using WMI \n* The authors suggested practical and efficient ways to accommodate WMI to the Bayesian learning framework\n* The use of a motivating example throughout is a good idea\n* For the most part the paper is written clearly\n\nWEAKNESSES:\nThere are several issues I would like the authors to address:\n\n**Method.**\n* The assumption of a uniform posterior is a bit odd and I didn't understand the intuition as presented in L199 in the main text and L510 in the appendix. It is very reasonable to assume that the posterior is not uniform, even when evaluated only on part of the network. A proper justification or intuition for this choice is missing. Also, the good empirical results can be a byproduct of being Bayesian on only part of the network as evident in [1].\n\n**Experiments.**\n* In my opinion, the authors exaggerate in how they present their method performance (e..g, \"significant improvements\", \"new state of the art\"). First, the method is not compared against all relevant Bayesian methods so it cannot be considered as SoTA. Second, the improvements are generally mild, and when factoring Bayesian last-layer methods (which are for some reason presented in the Appendix), the method is only comparable to them. Furthermore, with more modern NNs CIBER performance is usually inferior to several baseline methods.\n* It is not clear why the authors didn't present the performance of Bayesian last layer methods on the CIFAR datasets. In my opinion, it's as important as presenting SGD-based Bayesian methods.\n * A quantification of the method complexity (e.g., wall-clock time) is missing. To me, it is not clear how expensive WMI solvers are and how it grows with the number of parameters. I would have expected to see a comparison to baseline methods w.r.t that aspect as well.\n* Experimental details are severely lacking (e.g., was there a validation split? What were the hyper-parameters? Did you do a grid search over hyper-parameters? If so, on what values? ).\n* Information about how to choose some of the constants such as $\\alpha, l_i, u_i$ is missing. Have you searched for possible values? In general, how did you set their values? \n* Code wasn't added to the submission. When factoring this bullet and the last 2 bullets, in my opinion, the results in this paper are not reproducible and this harms this paper's score.\n\n**Clarity of presentation.**\n* I think a short background on the main concepts of SMT will make the paper self-contained and easier to read.\n* In Fig. 2 it would help to plot the training points as well.\n\n[1] Sharma, M., Farquhar, S., Nalisnick, E., & Rainforth, T. (2023, April). Do Bayesian Neural Networks Need To Be Fully Stochastic?. In International Conference on Artificial Intelligence and Statistics (pp. 7694-7722). PMLR.\n\nQUESTIONS:\n* Perhaps I do not understand something, since some SMT formulas are built from logical conjunction with conflicting conditions, such as the Relu one, how can they be satisfied? There is no $W$ that satisfies both conditions for the same $x$, no?\n* Why did you approximate the Gaussian likelihood with a triangular distribution instead of a truncated Taylor series for the exponential function?\n* Have you tested your method's sensitivity to temperature scaling?\n\nLIMITATIONS:\nThe authors did not address the limitations of their method. Please see the weaknesses/questions sections.", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 2, "DATE": "2023-06-29"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper provides a closed-form approximation for the posterior predictive distribution in Bayesian deep learning, in both regression and classification. The paper is overall clear and quite well written. The theory seems reasonable, however a theoretical analysis on the approximation error, depending either on the number of model parameters or on the number of predictive samples, is not provided. Currently, it is not particularly clear to me the sensitivity of the results to the number of samples. As Monte Carlo will eventually win for a large number of samples, I believe it is important to understand up to what point the proposed method is better.\n\nSTRENGTHS:\nThe paper is quite well written. It attempts to provide closed-form approximation for the posterior predictive distribution in Bayesian deep learning, which is a meaningful efforts considering that Monte Carlo samples can be expensive. The approximations proposed by the paper seem reasonable. The paper proposes a number of experiments and benchmarks against several methods.\n\nWEAKNESSES:\n- The paper lacks of a sensitivity analysis to the number of samples.\n\n- It would be great if the error for some of the approximations could also be expressed analytically. For example, can we say anything about the error of a triangular approximation?\n\n- If we strip the paper of its motivating terminologies (WMI and collapsed samples), seems similar in spirit to partially stochastic Bayesian inference, with a uniform posterior approximation and a triangular approximation of the likelihood to work out a closed-form approximation for the predictive. There does not seem to be a direct connection/comparison with this part of the literature.\n\nQUESTIONS:\nSome more granular comments below.\n\n- I find Figure (2) not very convincing. The authors claim that the predictive uncertainty using 10 samples from CIBER is closer than the one using 10 sample from HMC to the benchmark approximation given by 2k samples from HMC. First of all, the blue prediction from CIBER seems further off than HMC with 10 samples. Consequently, the uncertainty interval is wider. While it is positive that the larger uncertainty is adjusted to to the wider prediction error, to me HMC-10 seems closer to HMC-2000 than CIBER-10. It would also be interesting to see what happens with a few more samples, say 20 or 30, which is still low but often possible. Also, I assume the 10 samples were taken in the asymptotic regime, that is after HMC converged?\n\n- Also in Figure 3, the authors use 5 samples only. As this is very low, it would be interesting to see at what point MC becomes better. E.g. is it 7 samples? 10? 100? 1000? This would give the reader a more clear perspective of when an algorithm should be used instead of the other.\n\n- Line 128: It would be good to expand on the meaning of this definition. The example below clarifies a bit, but, being the terminology non-standard, it is still not immediate to understand what \"satisfaction of an SMT formula\" means, and the idea underlying the definition of WMI.\n\n- I cannot find in the appendix the piecewise polynomial approximations for classification mentioned at line 213. \n\n- In proposition 7, the authors derive expressions for predictive density and predictive mean. What about other statistics, like variance and entropy? Can these be derived in closed form as well? If so, it would be good to provide an expression.\n\n- To me the definition of collapsed BMA remind a lot partially stochastic neural networks, that is when Bayesian inference is performed on part of the network only. In fact, give a posterior distribution p(w|D), where w=[w_c, w_s], you can always decompose p(w|D)=p(w_c|w_s, D)p(w_s|D). If you approximate p(w_s|D) with an empirical distribution at a bunch of samples, there you have collapsed BMA. In partially stochastic neural networks, usually p(w_s|D) is just a single Dirac delta rather than an ensemble. In this paper, instead, w_c are taken along the trajectory of SGD, similarly as in SWAG. Perhaps it would be worth to explain the connection.\n\n- In the conditional posterior approximation, how are the lower and upper limits of the uniform distribution defined?\n\n- The paper mentions [Kristiadi et al. 2022] a few times. In these paper, the authors also provide a closed-form approximation for the predictive distribution in classification, i.e. the multi-class probit approximation. Since their rationale is similar as for this paper (closed-form approximations in a low-sample regime), it would be good to see a comparison.\n\nLIMITATIONS:\nThere does not seem to be much discussion about limitations. The authors could better discuss in which scenarios their approximation is better or worse than other methods.", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2023-07-05"}

comments: SUMMARY:
The paper proposes to use techniques from weighted volume computation to deterministically marginalize over (a subset of) the weights in a BNN rather than sampling them when computing the predictive posterior. The experiments find the method to perform competitively with some standard baselines from the literature on UCI and CIFAR benchmarks

I think this is a nice methodological contribution, although I wish the experiments reported the computational cost and explored the impact of only being able to select a subset of the weights for volume computation (i.e. more detailed analysis of the limitations). So overall I would lean towards acceptance.

STRENGTHS:
* Using volume computation for BNNs is new as far as I am aware, and I find work that connects different sub-fields in the literature generally quite valuable.
* The paper is very well written, I found the low-dimensional running example used throughout the paper very effective.
* The method seems to perform well in the experiments.

WEAKNESSES:
* The paper mentions that applying volume computation over all weights would not be feasible, but does not report how expensive it is on the subset that it select.
* Similarly, I would have liked to see some analysis of the compute time-performance tradeoff as one varies the number of weights that are used in volume computation rather than sampled.

QUESTIONS:
I’d mainly like to see some discussion on the points mentioned in the weaknesses.

LIMITATIONS:
The computational cost is mentioned but not further substantiated by runtime figures and comparisons.
TITLE: Official Review
SOUNDNESS_CORRECTNESS: 3
DATE: 2023-07-06

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe authors propose to tackle the intractable problem of Bayesian model averaging (BMA) in Bayesian neural networks by re-formulating it as “collapsed BMA”, where a small number of “collapsed” samples from a subset of the parameter space (e.g., the last layer) is equipped with a posterior conditioned on the remainder. The key contribution is to cast the marginalization over this conditional posterior as a weighted volume computation (WVC) problem, computing integrals over feasible regions of arithmetic constraints that are to be inferred from binary ReLU activation patterns. As such enumeration of constraints is computationally infeasible, a weighted model integration (WMI) framework is used to solve BMA in a multi-step procedure of encoding the involved distributions and calling existing WMI solvers. The proposed algorithm competes favorably against a number of baselines.\n\nSTRENGTHS:\n* [S1] **Significance**. The authors address an important problem with a focus on practical application.\n* [S2] **Originality**. The proposed solution seems novel and creative.\n* [S3] **Structure**. Structural elements like enumerated steps and questions are helpful to follow the argumentation.\n* [S4] **Intuition**. The authors make an effort to build intuition with several examples and illustrations.\n\nWEAKNESSES:\n* [W1] **Storyline**. While the authors clearly try to establish a coherent structure with well-motivated steps, the many components make it hard to follow and not lose sight of the key idea.\n   * The main topic, collapsed inference, is not addressed until page 5 – not being familiar with WVC/WMI, I felt somewhat lost in notation and descriptions of approximate procedures until the concept is even formally introduced.\n   * I would recommend to have Def. 6 early on, and to map the 4-step procedure in Section 3 directly to the collapsed BMA problem.\n   * I It would be helpful to provide more intuition around all the notation around WVC/WM – to readers mainly familiar with Bayesian inference and Bayesian deep learning, these concepts might appear quite foreign.\n   * I Also, if space constraints allow it, I would move the central CIBER algorithm into the main paper.\n * [W2] **Simplifications**. The concept seems to rely on a number of simplifying assumptions that I feel are not properly defended. \n   * I Encoding the posterior predictive distribution with polynomial densities\n   * I Choosing the conditional posterior, a key object in your proposal, to be uniform with an explanation that reads like “better than not doing it at all”\n* [W3] **Evidence**. The empirical results do not quite support the claims made.\n   * I Some of the figures/examples do not seem convincing to me, see Q2–Q4.\n   * I Your claim of “set[ting] a new state of the art” is not thoroughly funded in my opinion. \n     * I cannot find details on how the architecture was chosen for the large datasets.\n     * Baselines: In the transfer learning task, the comparison seems limited (SWA and SWAG are quite similar, and I would not consider SGD a “strong” baseline). Also, I miss Laplace approximation and especially deep ensembles as popular inference schemes that arguably operate in the few-sample setting as well.\n     * The methods are evaluated on small-scale UCI tasks, and the results are not entirely conclusive.\n   * I miss an ablation w.r.t. the number of collapsed samples, which should be an important hyperparameter of your method.\n* [W4] **No code**. With a novel method of computing BMAs, it would be helpful to have a look at the code. Also, it would allow to inspect implementation details of the experiments.\n\nQUESTIONS:\n* RE [W2]\n  * [Q1] Can you elaborate on the appropriateness for the approximation with polynomial densities, especially for (a) the Gaussian case in high dimensions, and (b) the classification case?\n  * [Q2] Have you explored any alternatives to the uniform distribution for the conditional posterior? The empirical evidence provided in Fig. 2 is also not clear to me: (a) How can HMC and CIBER use the “same 10 samples” when HMC recovers the true posterior after convergence, and CIBER samples from the SGD trajectory? (b) I fail to see how Fig. 2b is closer to 2c than 2a.\n* RE [W3]\n  * [Q3] Fig. 3: Did you repeat the sampling process? If not, the superiority of CIBER established from 5 samples might be a lucky shot.\n  * [Q4] Classification example (l. 240): Kindly elaborate on this, I do not understand the origin of the presented numbers.\n* [Q5] l. 37: How does collapsed sampling limit to a subset of *variables*? From your descriptions, this should be a subset of *weights*.\n* [Q6] l. 99: Should one of the inequality signs be a strict “greater” or “lesser”?\n* [Q7] l. 161: CIBER claims to resolve the issue of WMI-encoding non-ReLU networks. How is this achieved? Proposition 7 still contains * $\\Delta_{ReLU}$.\n* [Q8] Eq. 2: The sum is over tuples $(w_s, q)$ but $w_s$ never appears in the summand and $q$ is the same for all $w_s$. Can you make more explicit how the running index enters the sum? On a related note, I do not understand the definition of $W_s$ (l. 183) because I don’t quite see how $w_s$ and $w$ are connected.\n* [Q9] l. 283: Could you elaborate on what you mean by “greater variance indicates that the weight is prone to have greater uncertainty and thus one might want to perform more accurate inference over it”?\n* [Q10] l. 314: Should the number of collapsed samples not depend on network architecture rather than number of classes in the final layer? \n\n—\n\nMinor remarks\n\n* l. 31: I would not agree that “existing methods mainly focus on MCMC” in BNN; approximate schemes like deep ensembles are quite popular.\n* l. 39: The claim that “collapsed samplers are effective at variance reduction in graphical models” seems irrelevant in the context of your proposal.\n* l. 62: “it can be risky to base inference on a single neural network model” sounds fairly hand-wavy.\n* l. 79 (example 2): The notation is mixing up bold and non-bold w.\n* l. 148: How is that the “uncertainty” of the prediction?\n* l. 183: The definition of $W_s$ seems overly complicated, why not just say “given a set of parameter samples $W_s$”?\n* l. 265: What is DPLL?\n* l. 272: I would recommend removing the “Boston” dataset due to its racism issues.\n* l. 300: There seems to be an “and” missing before “four”.\n* l. 302: “root mean-squared error”, not “rooted-mean-squared-errors”.\n* Some references could be added in\n  * l. 35/36 (cutset / Rao-Blackwellised samplers)\n  * l. 51 (HMC)\n  * l. 110/111 (“various” solvers; single reference)\n\nLIMITATIONS:\nI miss a discussion of the limitations, especially since there are numerous approximations and heuristics involved. Societal impacts (or rather, the absence of such) are indeed mentioned.", "TITLE": "Official Review", "RECOMMENDATION": 4, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2023-07-06"}