SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Also according to Apostolakis [1991] and Helton [1997], the epistemic uncertainty is the uncertainty about the parameters  $\boldsymbol{w}$  of the distribution, that is, a difference measure between  $\boldsymbol{w}$  and the true parameters  $\boldsymbol{w}^*$ . We use as a measure for the epistemic uncertainty the Kullback-Leibler divergence:
$$
\mathrm {D} _ {\mathrm {K L}} \left(p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) \| p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w} ^ {*})\right). \tag {18}
$$
The total uncertainty is the aleatoric uncertainty plus the epistemic uncertainty, which is the cross-entropy between  $p(\pmb{y} \mid \pmb{x}, \pmb{w})$  and  $p(\pmb{y} \mid \pmb{x}, \pmb{w}^*)$ :
$$
\operatorname {C E} \left[ p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}), p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w} ^ {*}) \right] = \mathrm {H} \left[ p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) \right] + \mathrm {D} _ {\mathrm {K L}} \left(p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) \| p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w} ^ {*})\right). \tag {19}
$$
However, we do not know the true parameters  $\boldsymbol{w}^*$ . The posterior  $p(\tilde{\boldsymbol{w}}\mid \mathcal{D})$  gives us the likelihood of  $\tilde{\boldsymbol{w}}$  being the true parameters  $\boldsymbol{w}^*$ . We assume that the true model is revealed later. Therefore we use the expected Kullback-Leibler divergence for the epistemic uncertainty:
$$
\int_ {\mathcal {W}} \mathrm {D} _ {\mathrm {K L}} (p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) \| p (\boldsymbol {y} \mid \boldsymbol {x}, \tilde {\boldsymbol {w}})) p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}}. \tag {20}
$$
Consequently, the total uncertainty is
$$
\mathrm {H} [ p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) ] + \int_ {\mathcal {W}} \mathrm {D} _ {\mathrm {K L}} (p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) \| p (\boldsymbol {y} \mid \boldsymbol {x}, \tilde {\boldsymbol {w}})) p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}}. \tag {21}
$$
The total uncertainty can therefore be expressed by the expected cross-entropy as it was in setting (a) (see Eq. (16)), but between  $p(\boldsymbol{y} \mid \boldsymbol{x}, \boldsymbol{w})$  and  $p(\boldsymbol{y} \mid \boldsymbol{x}, \tilde{\boldsymbol{w}})$ :
$$
\begin{array}{l} \int_ {\mathcal {W}} \operatorname {C E} [ p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}), p (\boldsymbol {y} \mid \boldsymbol {x}, \tilde {\boldsymbol {w}}) ] p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}} \tag {22} \\ = \int_ {\mathcal {W}} \left(\mathrm {H} [ p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) ] + \mathrm {D} _ {\mathrm {K L}} (p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) \| p (\boldsymbol {y} \mid \boldsymbol {x}, \tilde {\boldsymbol {w}}))\right) p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}} \\ = \mathrm {H} [ p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) ] + \int_ {\mathcal {W}} \mathrm {D} _ {\mathrm {K L}} (p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) \| p (\boldsymbol {y} \mid \boldsymbol {x}, \tilde {\boldsymbol {w}})) p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}}. \\ \end{array}
$$
We follow Depeweg et al. [2018] and measure the predictive uncertainty in a regression setting using the differential entropy  $\mathrm{H}[p(y\mid x,w)] = -\int_{\mathcal{V}}p(y\mid x,w)\log p(y\mid x,w)\mathrm{d}y$  of the predictive distribution  $p(y\mid x,w)$  of a probabilistic model. In the following, we assume that we are modeling a Gaussian distribution, but other continuous probability distributions e.g. a Laplace lead to similar results. The model thus has to provide estimators for the mean  $\mu (\boldsymbol {x},\boldsymbol {w})$  and variance  $\sigma^2 (\boldsymbol {x},\boldsymbol {w})$  of the Gaussian. The predictive distribution is given by
$$
p (y \mid \boldsymbol {x}, \boldsymbol {w}) = (2 \pi \sigma^ {2} (\boldsymbol {x}, \boldsymbol {w})) ^ {- \frac {1}{2}} \exp \left\{- \frac {(y - \mu (\boldsymbol {x} , \boldsymbol {w})) ^ {2}}{2 \sigma^ {2} (\boldsymbol {x} , \boldsymbol {w})} \right\}. \tag {23}
$$
The differential entropy of a Gaussian distribution is given by
$$
\begin{array}{l} \mathrm {H} [ p (y \mid \boldsymbol {x}, \boldsymbol {w}) ] = - \int_ {\mathcal {Y}} p (y \mid \boldsymbol {x}, \boldsymbol {w}) \log p (y \mid \boldsymbol {x}, \boldsymbol {w}) \mathrm {d} y \tag {24} \\ = \frac {1}{2} \log \left(\sigma^ {2} (\boldsymbol {x}, \boldsymbol {w})\right) + \log (2 \pi) + \frac {1}{2}. \\ \end{array}
$$
The KL divergence between two Gaussian distributions is given by
$$
\begin{array}{l} \mathrm {D} _ {\mathrm {K L}} (p (y \mid \boldsymbol {x}, \boldsymbol {w}) \| p (y \mid \boldsymbol {x}, \tilde {\boldsymbol {w}})) \tag {25} \\ = - \int_ {\mathcal {Y}} p (y \mid \boldsymbol {x}, \boldsymbol {w}) \log \left(\frac {p (y \mid \boldsymbol {x} , \boldsymbol {w})}{p (y \mid \boldsymbol {x} , \tilde {\boldsymbol {w}})}\right) d y \\ = \frac {1}{2} \log \left(\frac {\sigma^ {2} (\boldsymbol {x} , \tilde {\boldsymbol {w}})}{\sigma^ {2} (\boldsymbol {x} , \boldsymbol {w})}\right) + \frac {\sigma^ {2} (\boldsymbol {x} , \boldsymbol {w}) + (\mu (\boldsymbol {x} , \boldsymbol {w}) - \mu (\boldsymbol {x} , \tilde {\boldsymbol {w}})) ^ {2}}{2 \sigma^ {2} (\boldsymbol {x} , \tilde {\boldsymbol {w}})} - \frac {1}{2}. \\ \end{array}
$$
Setting (a): Expected uncertainty when selecting a model. Depeweg et al. [2018] consider the differential entropy of the Bayesian model average  $p(y \mid x, \mathcal{D}) = \int_{W} p(y \mid x, \tilde{w}) p(\tilde{w} \mid \mathcal{D}) \, \mathrm{d}\tilde{w}$ , which is equal to the expected cross-entropy and can be decomposed into the expected differential entropy and Kullback-Leibler divergence. Therefore, the expected uncertainty when selecting a model is given by
$$
\begin{array}{l} \int_ {\mathcal {W}} \operatorname {C E} [ p (y \mid \boldsymbol {x}, \tilde {\boldsymbol {w}}), p (y \mid \boldsymbol {x}, \mathcal {D}) ] p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}} = \mathrm {H} [ p (y \mid \boldsymbol {x}, \mathcal {D}) ] \tag {26} \\ = \int_ {\mathcal {W}} \mathrm {H} [ p (y \mid \boldsymbol {x}, \tilde {\boldsymbol {w}}) ] p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}} + \int_ {\mathcal {W}} \mathrm {D} _ {\mathrm {K L}} (p (y \mid \boldsymbol {x}, \tilde {\boldsymbol {w}}) \| p (y \mid \boldsymbol {x}, \mathcal {D})) p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}} \\ = \int_ {\mathcal {W}} \frac {1}{2} \log \left(\sigma^ {2} (\boldsymbol {x}, \tilde {\boldsymbol {w}})\right) p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) d \tilde {\boldsymbol {w}} + \log (2 \pi) \\ + \int_ {\mathcal {W}} \mathrm {D} _ {\mathrm {K L}} (p (y \mid \boldsymbol {x}, \tilde {\boldsymbol {w}}) \| p (y \mid \boldsymbol {x}, \mathcal {D})) p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}}. \\ \end{array}
$$
Setting (b): Uncertainty of a given, pre-selected model. Synonymous to the classification setting, the uncertainty of a given, pre-selected model  $\boldsymbol{w}$  is given by
$$
\begin{array}{l} \int_ {\mathcal {W}} \operatorname {C E} [ p (y \mid \boldsymbol {x}, \boldsymbol {w}), p (y \mid \boldsymbol {x}, \tilde {\boldsymbol {w}}) ] p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}} \tag {27} \\ = \mathrm {H} [ p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) ] + \int_ {\mathcal {W}} \mathrm {D} _ {\mathrm {K L}} (p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}) \| p (\boldsymbol {y} \mid \boldsymbol {x}, \tilde {\boldsymbol {w}})) p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}} \\ = \frac {1}{2} \log \left(\sigma^ {2} (\boldsymbol {x}, \boldsymbol {w})\right) + \log (2 \pi) \\ + \int_ {\mathcal {W}} \frac {1}{2} \log \left(\frac {\sigma^ {2} (\boldsymbol {x} , \tilde {\boldsymbol {w}})}{\sigma^ {2} (\boldsymbol {x} , \boldsymbol {w})}\right) + \frac {\sigma^ {2} (\boldsymbol {x} , \boldsymbol {w}) + (\mu (\boldsymbol {x} , \boldsymbol {w}) - \mu (\boldsymbol {x} , \tilde {\boldsymbol {w}})) ^ {2}}{2 \sigma^ {2} (\boldsymbol {x} , \tilde {\boldsymbol {w}})} p (\tilde {\boldsymbol {w}} \mid \mathcal {D})   \mathrm {d} \tilde {\boldsymbol {w}}  . \\ \end{array}
$$
Homoscedastic, Model Invariant Noise. We assume, that noise is homoscedastic for all inputs  $\pmb{x} \in \mathcal{X}$ , thus  $\sigma^2(\pmb{x}, \pmb{w}) = \sigma^2(\pmb{w})$ . Furthermore, most models in regression do not explicitly model the variance in their training objective. For such a model  $\pmb{w}$ , we can estimate the variance on a validation dataset  $\mathcal{D}_{\mathrm{val}} = \{(x_n, y_n)\}_{n=1}^N$  as
$$
\hat {\sigma} ^ {2} (\boldsymbol {w}) = \frac {1}{N} \sum_ {n = 1} ^ {N} \left(y _ {n} - \mu \left(\boldsymbol {x} _ {n}, \boldsymbol {w}\right)\right) ^ {2}. \tag {28}
$$
If we assume that all reasonable models under the posterior will have similar variances  $(\hat{\sigma}^2(\boldsymbol{w}) \approx \sigma^2(\tilde{\boldsymbol{w}})$  for  $\tilde{\boldsymbol{w}} \sim p(\tilde{\boldsymbol{w}} \mid \mathcal{D})$ , the uncertainty of a prediction using the given, pre-selected model  $\boldsymbol{w}$  is given by
$$
\begin{array}{l} \int_ {\mathcal {W}} \operatorname {C E} [ p (y \mid \boldsymbol {x}, \boldsymbol {w}), p (y \mid \boldsymbol {x}, \tilde {\boldsymbol {w}}) ] p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) \mathrm {d} \tilde {\boldsymbol {w}} \tag {29} \\ \approx \frac {1}{2} \log (\hat {\sigma} ^ {2} (\boldsymbol {w})) + \log (2 \pi) \\ + \int_ {\mathcal {W}} \frac {1}{2} \log \left(\frac {\hat {\sigma} ^ {2} (\boldsymbol {w})}{\hat {\sigma} ^ {2} (\boldsymbol {w})}\right) + \frac {\hat {\sigma} ^ {2} (\boldsymbol {w}) + (\mu (\boldsymbol {x} , \boldsymbol {w}) - \mu (\boldsymbol {x} , \tilde {\boldsymbol {w}})) ^ {2}}{2 \hat {\sigma} ^ {2} (\boldsymbol {w})} p (\tilde {\boldsymbol {w}} \mid \mathcal {D})   \mathrm {d} \tilde {\boldsymbol {w}} \\ = \frac {1}{2} \log (\hat {\sigma} ^ {2} (\boldsymbol {w})) + \frac {1}{\hat {\sigma} ^ {2} (\boldsymbol {w})} \int_ {\mathcal {W}} \left(\mu (\boldsymbol {x}, \boldsymbol {w}) - \mu (\boldsymbol {x}, \tilde {\boldsymbol {w}})\right) ^ {2} p (\tilde {\boldsymbol {w}} \mid \mathcal {D}) d \tilde {\boldsymbol {w}} + \frac {1}{2} + \log (2 \pi). \\ \end{array}
$$
B.2 Mixture Importance Sampling for Variance Reduction
The epistemic uncertainties in Eq. (1) and Eq. (2) are expectations of KL divergences over the posterior. We have to approximate these integrals.
If the posterior has different modes, a concentrated importance sampling function has a high variance of estimates, therefore converges very slowly [Steele et al., 2006]. Thus, we use mixture importance sampling (MIS) [Hesterberg, 1995]. MIS uses a mixture model for sampling, instead of a unimodal model of standard importance sampling [Owen and Zhou, 2000]. Multiple importance sampling Veach and Guibas [1995] is similar to MIS and equal to it for balanced heuristics [Owen and Zhou, 2000]. More details on these and similar methods can be found in Owen and Zhou [2000], Cappé et al. [2004], Elvira et al. [2015, 2019], Steele et al. [2006], Raftery and Bao [2010]. MIS has been very successfully applied to estimate multimodal densities. For example, the evidence lower bound (ELBO) [Kingma and Welling, 2014] has been improved by multiple importance sampling ELBO [Kviman et al., 2022]. Using a mixture model should ensure that at least one of its components will locally match the shape of the integrand. Often, MIS iteratively enrich the sampling distribution by new modes [Raftery and Bao, 2010].
In contrast to iterative enrichment, which finds modes by chance, we are able to explicitly search for posterior modes, where the integrand of the definition of epistemic uncertainty is large. For each of these modes, we define a component of the mixture from which we then sample. We have the huge advantage to have explicit expressions for the integrand. The integrand of the epistemic uncertainty in Eq. (1) and Eq. (2) has the form
$$
\mathrm {D} \left(p (\boldsymbol {y} \mid \boldsymbol {x}, \boldsymbol {w}), p (\boldsymbol {y} \mid \boldsymbol {x}, \tilde {\boldsymbol {w}})\right) p (\tilde {\boldsymbol {w}} \mid \mathcal {D}), \tag {30}
$$
where  $\mathrm{D}(\cdot, \cdot)$  is a distance or divergence of distributions which is computed using the parameters that determine those distributions. The distance/divergence  $\mathrm{D}(\cdot, \cdot)$  eliminates the aleatoric uncertainty, which is present in  $p(\boldsymbol{y} \mid \boldsymbol{x}, \boldsymbol{w})$  and  $p(\boldsymbol{y} \mid \boldsymbol{x}, \tilde{\boldsymbol{w}})$ . Essentially,  $\mathrm{D}(\cdot, \cdot)$  reduces distributions to functions of their parameters.
Importance sampling is applied to estimate integrals of the form
$$
s = \int_ {\mathcal {X}} f (\boldsymbol {x}) p (\boldsymbol {x}) \mathrm {d} \boldsymbol {x} = \int_ {\mathcal {X}} \frac {f (\boldsymbol {x}) p (\boldsymbol {x})}{q (\boldsymbol {x})} q (\boldsymbol {x}) \mathrm {d} \boldsymbol {x}, \tag {31}
$$
with integrand  $f(x)$  and probability distributions  $p(\pmb{x})$  and  $q(\pmb{x})$ , when it is easier to sample according to  $q(\pmb{x})$  than  $p(\pmb{x})$ . The estimator of Eq. (31) when drawing  $\pmb{x}_n$  according to  $q(\pmb{x})$  is given by
$$
\hat {s} = \frac {1}{N} \sum_ {n = 1} ^ {N} \frac {f \left(\boldsymbol {x} _ {n}\right) p \left(\boldsymbol {x} _ {n}\right)}{q \left(\boldsymbol {x} _ {n}\right)}. \tag {32}
$$
The asymptotic variance  $\sigma_s^2$  of importance sampling is given by (see e.g. Owen and Zhou [2000]):
$$
\begin{array}{l} \sigma_ {s} ^ {2} = \int_ {\mathcal {X}} \left(\frac {f (\boldsymbol {x}) p (\boldsymbol {x})}{q (\boldsymbol {x})} - s\right) ^ {2} q (\boldsymbol {x}) d \boldsymbol {x} \tag {33} \\ = \int_ {\mathcal {X}} \left(\frac {f (\boldsymbol {x}) p (\boldsymbol {x})}{q (\boldsymbol {x})}\right) ^ {2} q (\boldsymbol {x}) d \boldsymbol {x} - s ^ {2}, \\ \end{array}
$$
and its estimator when drawing  $\pmb{x}_n$  from  $q(\pmb{x})$  is given by
$$
\begin{array}{l} \hat {\sigma} _ {s} ^ {2} = \frac {1}{N} \sum_ {n = 1} ^ {N} \left(\frac {f \left(\boldsymbol {x} _ {n}\right) p \left(\boldsymbol {x} _ {n}\right)}{q \left(\boldsymbol {x} _ {n}\right)} - s\right) ^ {2} \tag {34} \\ = \frac {1}{N} \sum_ {n = 1} ^ {N} \left(\frac {f (\boldsymbol {x} _ {n}) p (\boldsymbol {x} _ {n})}{q (\boldsymbol {x} _ {n})}\right) ^ {2} - s ^ {2}. \\ \end{array}
$$
We observe, that the variance is determined by the term  $\frac{f(\boldsymbol{x})p(\boldsymbol{x})}{q(\boldsymbol{x})}$ , thus we want  $q(\boldsymbol{x})$  to be proportional to  $f(\boldsymbol{x})p(\boldsymbol{x})$ . Most importantly,  $q(\boldsymbol{x})$  should not be close to zero for large  $f(\boldsymbol{x})p(\boldsymbol{x})$ . To give an intuition about the severity of unmatched modes, we depict an educational example in Fig. B.1. Now we plug in the form of the integrand given by Eq. (30) into Eq. (31), to calculate the expected divergence  $\mathrm{D}(\cdot ,\cdot)$  under the model posterior  $p(\tilde{\boldsymbol{w}}\mid \mathcal{D})$ . This results in
$$
v = \int_ {\mathcal {W}} \frac {\mathrm {D} (p (\boldsymbol {y} \mid \boldsymbol {x} , \boldsymbol {w}) , p (\boldsymbol {y} \mid \boldsymbol {x} , \tilde {\boldsymbol {w}})) p (\tilde {\boldsymbol {w}} \mid \mathcal {D})}{q (\tilde {\boldsymbol {w}})} q (\tilde {\boldsymbol {w}}) \mathrm {d} \tilde {\boldsymbol {w}}, \tag {35}
$$
with estimate
$$
\hat {v} = \frac {1}{N} \sum_ {n = 1} ^ {N} \frac {\mathrm {D} (p (\boldsymbol {y} \mid \boldsymbol {x} , \boldsymbol {w}) , p (\boldsymbol {y} \mid \boldsymbol {x} , \tilde {\boldsymbol {w}} _ {n})) p (\tilde {\boldsymbol {w}} _ {n} \mid \mathcal {D})}{q (\tilde {\boldsymbol {w}} _ {n})}. \tag {36}
$$
The variance is given by
$$
\begin{array}{l} \sigma_ {v} ^ {2} = \int_ {\mathcal {W}} \left(\frac {\mathrm {D} (p (\boldsymbol {y} \mid \boldsymbol {x} , \boldsymbol {w}) , p (\boldsymbol {y} \mid \boldsymbol {x} , \tilde {\boldsymbol {w}})) p (\tilde {\boldsymbol {w}} \mid \mathcal {D})}{q (\tilde {\boldsymbol {w}})} - v\right) ^ {2} q (\tilde {\boldsymbol {w}}) \mathrm {d} \tilde {\boldsymbol {w}} \tag {37} \\ = \int_ {\mathcal {W}} \left(\frac {\mathrm {D} (p (\boldsymbol {y} \mid \boldsymbol {x} , \boldsymbol {w}) , p (\boldsymbol {y} \mid \boldsymbol {x} , \tilde {\boldsymbol {w}})) p (\tilde {\boldsymbol {w}} \mid \mathcal {D})}{q (\tilde {\boldsymbol {w}})}\right) ^ {2} q (\tilde {\boldsymbol {w}})   \mathrm {d} \tilde {\boldsymbol {w}} - v ^ {2}. \\ \end{array}
$$
The estimate for the variance is given by
$$
\begin{array}{l} \hat {\sigma} _ {v} ^ {2} = \frac {1}{N} \sum_ {n = 1} ^ {N} \left(\frac {\mathrm {D} (p (\boldsymbol {y} \mid \boldsymbol {x} , \boldsymbol {w}) , p (\boldsymbol {y} \mid \boldsymbol {x} , \tilde {\boldsymbol {w}} _ {n})) p (\tilde {\boldsymbol {w}} _ {n} \mid \mathcal {D})}{q (\tilde {\boldsymbol {w}} _ {n})} - v\right) ^ {2} \tag {38} \\ = \frac {1}{N} \sum_ {n = 1} ^ {N} \left(\frac {\mathrm {D} (p (\boldsymbol {y} \mid \boldsymbol {x} , \boldsymbol {w}) , p (\boldsymbol {y} \mid \boldsymbol {x} , \tilde {\boldsymbol {w}} _ {n})) p (\tilde {\boldsymbol {w}} _ {n} \mid \mathcal {D})}{q (\tilde {\boldsymbol {w}} _ {n})}\right) ^ {2} - v ^ {2}, \\ \end{array}
$$
where  $\tilde{\pmb{w}}_n$  is drawn according to  $q(\tilde{\pmb{w}})$ . The asymptotic  $(N\to \infty)$  confidence intervals are given by
$$
\lim  _ {N \rightarrow \infty} \Pr \left(- a \frac {\sigma_ {v}}{\sqrt {N}} \leqslant \hat {v} - v \leqslant b \frac {\sigma_ {v}}{\sqrt {N}}\right) = \frac {1}{\sqrt {2 \pi}} \int_ {- a} ^ {b} \exp (- 1 / 2 t ^ {2}) d t. \tag {39}
$$
Thus,  $\hat{v}$  converges with  $\frac{\sigma_v}{\sqrt{N}}$  to  $v$ . The asymptotic confidence interval is proofed in Weinzierl [2000] and Hesterberg [1996] using the Lindeberg-Lévy central limit theorem which ensures the asymptotic normality of the estimate  $\hat{v}$ . The  $q(\tilde{\boldsymbol{w}})$  that minimizes the variance is
$$
q (\tilde {\boldsymbol {w}}) = \frac {\mathrm {D} (p (\boldsymbol {y} \mid \boldsymbol {x} , \boldsymbol {w}) , p (\boldsymbol {y} \mid \boldsymbol {x} , \tilde {\boldsymbol {w}})) p (\tilde {\boldsymbol {w}} \mid \mathcal {D})}{v}. \tag {40}
$$
Thus we want to find a density  $q(\tilde{\boldsymbol{w}})$  that is proportional to  $\mathrm{D}(p(\boldsymbol{y} \mid \boldsymbol{x}, \boldsymbol{w}), p(\boldsymbol{y} \mid \boldsymbol{x}, \tilde{\boldsymbol{w}})) p(\tilde{\boldsymbol{w}} \mid \mathcal{D})$ . Only approximating the posterior  $p(\tilde{\boldsymbol{w}} \mid \mathcal{D})$  as Deep Ensembles or MC dropout is insufficient to guarantee a low expected error, since the sampling variance cannot be bounded, as  $\sigma_v^2$  could get arbitrarily big if the distance is large but the probability under the sampling distribution is very small. For  $q(\tilde{\boldsymbol{w}}) \propto p(\tilde{\boldsymbol{w}} \mid \mathcal{D})$  and non-negative, unbounded, but continuous  $\mathrm{D}(\cdot, \cdot)$ , the variance  $\sigma_v^2$  given by Eq. (37) cannot be bounded.
For example, if  $\mathrm{D}(\cdot ,\cdot)$  is the KL-divergence and both  $p(\boldsymbol {y}\mid \boldsymbol {x},\boldsymbol {w})$  and  $p(\boldsymbol {y}\mid \boldsymbol {x},\tilde{\boldsymbol{w}})$  are Gaussians where the means  $\mu (\pmb {x},\pmb {w}),\mu (\pmb {x},\tilde{\pmb{w}})$  and variances  $\sigma^2 (\pmb {x},\pmb {w}),\sigma^2 (\pmb {x},\tilde{\pmb{w}})$  are estimates provided by the models, the KL is unbounded. The KL divergence between two Gaussian distributions is given by
$$
\begin{array}{l} \mathrm {D} _ {\mathrm {K L}} (p (y \mid \boldsymbol {x}, \boldsymbol {w}) \| p (y \mid \boldsymbol {x}, \tilde {\boldsymbol {w}})) \tag {41} \\ = - \int_ {\mathcal {Y}} p (y \mid \boldsymbol {x}, \boldsymbol {w}) \log \left(\frac {p (y \mid \boldsymbol {x} , \boldsymbol {w})}{p (y \mid \boldsymbol {x} , \tilde {\boldsymbol {w}})}\right) d y \\ = \frac {1}{2} \log \left(\frac {\sigma^ {2} (\pmb {x} , \tilde {\pmb {w}})}{\sigma^ {2} (\pmb {x} , \pmb {w})}\right) + \frac {\sigma^ {2} (\pmb {x} , \pmb {w}) + (\mu (\pmb {x} , \pmb {w}) - \mu (\pmb {x} , \tilde {\pmb {w}})) ^ {2}}{2 \sigma^ {2} (\pmb {x} , \tilde {\pmb {w}})} - \frac {1}{2}. \\ \end{array}
$$
For  $\sigma^2 (\pmb {x},\tilde{\pmb{w}})$  going towards zero and a non-zero difference of the mean values, the KL-divergence can be arbitrarily large. Therefore, methods that only consider the posterior  $p(\tilde{\boldsymbol{w}}\mid \mathcal{D})$  cannot bound the variance  $\sigma_v^2$  if  $\mathrm{D}(\cdot ,\cdot)$  is unbounded and the parameters  $\tilde{\boldsymbol{w}}$  allow distributions which can make  $\mathrm{D}(\cdot ,\cdot)$  arbitrary large.
Figure B.1: Analysis of asymptotic variance of importance sampling for multimodal target distribution  $p(x)$  and a unimodal sampling distribution  $q(x)$ . The target distribution is a mixture of two Gaussian distributions with means  $\mu_{p,1}, \mu_{p,2}$  and variances  $\sigma_{p,1}^2, \sigma_{p,2}^2$ . The sampling distribution is a single Gaussian with mean  $\mu_q$  and variance  $\sigma_q^2$ .  $q(x)$  matches one of the modes of  $p(x)$ , but misses the other. Both distributions are visualized for their standard parameters  $\mu_{p,1} = \mu_q = 0$ ,  $\mu_{p,2} = 3$  and  $\sigma_{p,1}^2 = \sigma_{p,2}^2 = \sigma_q^2 = 1$ , where both mixture components of  $p(x)$  are equally weighted. We calculate the asymptotic variance (Eq. (33) with  $f(x) = 1$ ) for different values of  $\sigma_{p,2}^2$ ,  $\mu_{p,2}$  and  $\sigma_q^2$  and show the results in the top right, bottom left and bottom right plot respectively. The standard value for the varied parameter is indicated by the black dashed line. We observe, that slightly increasing the variance of the second mixture component of  $p(x)$ , which is not matched by the mode of  $q(x)$ , rapidly increases the asymptotic variance. Similarly, increasing the distance between the center of the unmatched mixture component of  $p(x)$  and  $q(x)$  strongly increases the asymptotic variance. On the contrary, increasing the variance of the sampling distribution  $q(x)$  does not lead to a strong increase, as the worse approximation of the matched mode of  $p(x)$  is counterbalanced by putting probability mass where the second mode of  $p(x)$  is located. Note, that this issue is even more exacerbated if  $f(x)$  is non-constant. Then,  $q(x)$  has to match the modes of  $f(x)$  as well.
C Experimental Details and Further Experiments
Our code is publicly available at https://github.com/ml-jku/quam.
C.1 Details on the Adversarial Model Search
During the adversarial model search, we seek to maximize the KL divergence between the prediction of the reference model and adversarial models. For an example, see Fig. C.1. We found that directly maximizing the KL divergence always leads to similar solutions to the optimization problem. Therefore, we maximized the likelihood of a new test point to be in each possible class. The optimization problem is very similar, considering the predictive distribution  $p(\boldsymbol{y} \mid \boldsymbol{x}, \boldsymbol{w})$  of a reference model and the predictive distribution  $p(\boldsymbol{y} \mid \boldsymbol{x}, \tilde{\boldsymbol{w}})$  of an adversarial model, the model that is updated. The KL divergence between those two is given by