Manuscript Offprint
arXiv:2611.07206TrustMix: Graceful Degradation for Pretrained Models under Distribution Shift
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Juliusz Ziomek
Machine Learning Research Group University of Oxford Oxford OX1 2JD, United Kingdom
juliusz [at] robots (dot) ac.uk
Maike Osborne
Machine Learning Research Group University of Oxford Oxford OX1 2JD, United Kingdom
maike.osborne [at] eng (dot) ox.ac.uk
Yee Whye Teh
Department of Statistics University of Oxford Oxford OX1 2JD, United Kingdom
yee.teh [at] stats (dot) ox.ac.uk
Abstract
Predicting beyond the training domain necessarily requires assumptions about how the ground truth extrapolates, yet in most neural networks these assumptions are made only implicit through the architecture. We propose TrustMix, a lightweight post-hoc method that makes a pretrained model's extrapolative behaviour explicit and controllable. TrustMix combines the predictive distribution produced by a pretrained model with a user-specified fallback distribution , such that as the out-of-distribution (OOD) deviation statistic grows, we collapse towards . TrustMix provides graceful degradation: the predictive distribution converges toward the fallback distribution as the OOD signal grows. The fallback distribution can reflect domain knowledge, if available, or rely on a domain-agnostic stationarity assumption. TrustMix does not require retraining of the base model and can be applied to both regression and classification problems. We evaluated TrustMix on several synthetic and real-world distribution shifts, including tabular, image, and natural language processing tasks. We tested TrustMix on datasets such as CIFAR-10/100 and ImageNet and on numerous architectures including Convolutional Neural Networks (CNNs) and Transformers. TrustMix remains competitive in-distribution while improving predictive uncertainty under distribution shift, with gains in predictive likelihood for regression and calibration for classification. Finally, we showed that TrustMix can provide useful predictive distributions for decision-making applications by utilizing it as a surrogate for Bayesian Optimisation.
Keywords: deep learning; distribution shift; uncertainty quantification
1 Introduction
Nothing is more dangerous than a failure that is silent. Neural networks today are capable of achieving excellent performance within training distribution. However, their behaviour outside of this training domain is less understood. A network can be confident even when it is completely wrong and far from the domain it was trained upon. In general, making predictions under distribution shift requires assumptions about how patterns observed in the training data transfer beyond the training domain. Standard neural networks make such assumptions implicitly through their architecture; however, they lack a mechanism directly identifying the transitions from interpolation to extrapolation. To address this, Out-Of-Distribution (OOD) Detection methods have been developed.
Although OOD detection signals can identify inputs that appear to be unusual or atypical, they do not resolve the fundamental problem of prediction. An OOD score can indicate that the relationship between inputs and outputs that a model has learned may no longer apply; however it does not specify what the model should predict instead. While the optimal predictive distribution in those regions necessarily depends on domain assumptions, we believe that these assumptions can be made explicit. We present TRUSTMIX, a simple post-hoc framework for enabling graceful degradation of pretrained models during distribution shift. TrustMix separates the predictive behaviour that a model learns from data and the assumed fallback distribution to which the model collapses in OOD regimes. TrustMix gradually transitions from the base model's predictive distribution to the fallback distribution, as a scalar deviation signal grows. We specifically enforce the monotonicity of this transition architecturally, which guarantees that reliance on the base model is non-increasing as a function of and disappears entirely as . TrustMix does not eliminate model assumptions, but makes them controllable and explicit through the choice of fallback distribution .
-
We enforce that reliance on the base model decreases monotonically with deviation and vanishes asymptotically (Proposition 1), for any parameter values.
-
We demonstrate TrustMix across regression and classification tasks, multiple model architectures, and both synthetic and real-world distribution shifts. We further show that its predictive distributions are useful for downstream decision-making by applying TrustMix as a scalable neural surrogate for Bayesian optimisation.
2 Problem Statement and Preliminaries
We assume access to a pretrained base model consisting of a feature extractor and a task-specific prediction head , where denotes the set of distributions over . The resulting predictive distribution is obtained as . We assume the model is trained on a dataset and we have access to some validation set , unseen by the model during training. Throughout, and are fixed and our goal is to endow the model with graceful degradation under distribution shifts, without modifying the base model itself. Given a proper scoring rule measuring quality of predictive distribution when the outcome is , the risk under the true distribution at point is given by . We thus wish to produce an output distribution with the lowest expected score. Throughout, we rely on log-likelihood as the scoring rule, but note that other scoring rules can also be used.
We assume we have access to some OOD deviation signal produced by the model, which quantifies how far the input is from the training distribution. However, even a perfect OOD signal does not directly specify how predictions should be adjusted: it is a single scalar and does not directly map to a predictive distribution. A plethora of OOD signals have been proposed in past literature, which we describe in detail in Section 4. Throughout the paper we rely on Mahalanobis distance as a robust default, as it is known for strong OOD detection performance (Mukhoti et al., 2023), and importantly can be both applied to both regression and classification. In Appendix C we detail how the Mahalanobis distance can be efficiently computed. Alternative signals such as the energy score (Liu et al., 2020b) are also applicable, which we investigate in Section 5.5.
Crucially, even a perfect deviation signal does not resolve the problem of making predictions under distribution shift. The signal can provide evidence about whether the relationship learned by the base model remains applicable at , but it does not specify what the predictive distribution should be when that relationship is no longer trusted. We therefore separate two questions: when should the base model be trusted, and what should we predict when it is not? TrustMix uses to address the former and an explicit fallback distribution to encode the modelling assumption required for the latter. The usefulness of ultimately depends on whether it is informative about predictive failure. In Section 5.5, we empirically investigate this assumption and show that larger representation-space deviations are associated with deteriorating base-model predictive performance across the considered tasks.
3 Methodology
When a model's inputs diverge from the training distribution, its predictions need not become visibly unreliable - there is no guarantee their uncertainty will increase. Previous literature shows that a fully connected network with ReLU non-linearities tend to simply continue the linear trend, eventually exploding to (Ziomek et al., 2025), thus making very extreme predictions in regions where we should rather be cautious. As established in Section 2, an OOD deviation signal on its own only quantifies how atypical an input is; it does not prescribe how a model's prediction should change in response. Our goal is therefore to equip a fixed, pretrained model with the capacity to gracefully reduce its reliance on its own prediction as the input moves away from the training distribution, without retraining or . Since predictive behaviour far from the training distribution cannot in general be determined from training data alone, we explicitly specify the predictive behaviour we wish the model to approach when its own prediction is no longer trusted. We propose to smoothly interpolate between two distributions: the model distribution and a fallback distribution , that is:
where is the weight in given by some gating mechanism, parametrised by . We would like to have the property that as , the gating weight and the predictive distribution collapses to the fallback . As such, we use:
where is a small, monotonic neural network parametrised with , which is guaranteed to be monotonically non-decreasing in its input. This can be easily achieved by ensuring all its weights are positive and using non-decreasing activations, as stated by the next proposition.
Proposition 1 (Architectural monotonicity). Let , where every has positive entries and is non-decreasing and unbounded. Then is non-decreasing in , and hence is non-increasing in and as , we get .
Proof. Appendix A.
The conditions of the proposition above hold if we use the reparametrisation for some small and optimise parameters instead. Across all experiments we use the same architecture with two hidden layers, each with 16 neurons and batch normalisation between the hidden layers. For batch normalisation, we turn off the learnable affine parameters, so that it only centres and rescales its input by a positive standard deviation, thus preserving non-decreasing and limiting properties of . This guarantees collapse to the fallback distribution for extreme . We now discuss how this fallback can be chosen.
Fallback Distribution The fallback distribution represents the predictive behaviour we wish to adopt when we completely stop trusting the base model. Importantly, TrustMix does not assume that this distribution can be inferred from the training data: sufficiently far from the observed domain, predictive behaviour necessarily depends on additional modelling assumptions. The fallback makes these assumptions explicit. The behaviour of TrustMix under extreme distribution shifts thus depends on the choice of ;

Trust Mix Predictions

Resulting Trust
Figure 1: Illustration of TrustMix on a toy regression problem. Top-left: predictions of a base MLP with a variance head, showing overconfident extrapolation outside the training region. Top-right: Mahalanobis deviation score , which increases sharply away from the training distribution. Bottom-right: resulting mixture weight , which decreases with deviation. Bottom-left: TrustMix predictions obtained by mixing the base predictor with the fallback distribution, producing increased uncertainty under distribution shift.
TrustMix governs the transition behaviour, but does not guarantee that arbitrarily chosen is well specified. When relevant domain knowledge is available, it can be incorporated directly into . In the absence of such information, we use a simple domain-agnostic assumption that the global moments of the predictive distribution remain stationary throughout the domain. Let us define:
to be the first and second central moments of model predictions at training points. In the regression setting, we propose to simply use:
as the default, input-independent fallback distribution. In Section 5.5, we investigate how accurate the fallback models observation under extreme deviation relatively to the base model. Note that such an assumption is common in regression models. For example, Gaussian Process (GP) regressors typically collapse to the normal prior with fitted mean and scale as the input deviates from training data (Rasmussen & Williams, 2006). In classification, we put the same Gaussian fallback, except on the model logits, as we explain later in this section. We now proceed to discuss details of applying TrustMix in regression and classification settings.
TrustMix for Regression If the model is equipped with a variance head , we simply set for some learnable . Otherwise we use a constant variance . We include a variance scaling parameter to correct systematic over- or under-confidence in the base predictive uncertainty estimates.
The overall predictive distribution from Equation 1 has the following mean and variance:
For computational convenience in regression, we approximate this mixture by a Gaussian whose first two moments match those of the mixture:
TrustMix for Classification. For classification, we apply TrustMix in logit space rather than directly to class probabilities. We first transform the base model logits using an affine transformation , where and are learnable calibration parameters. This allows us to adjust the scale and offset of the logits before applying TrustMix.
We then model the logits using a diagonal Gaussian distribution, with mean and variance , where . The fallback distribution is also defined as a diagonal Gaussian in logit space, with its mean and variance estimated from the base model's predictions on the training data. TrustMix interpolates between the transformed base logits and this fallback distribution, with the interpolation controlled by the learned trust function.
To obtain class probabilities, we use the analytical approximation of Mucsányi et al. (2025):
where division and the square root are applied element-wise. Under this approximation, the variance of each logit attenuates its contribution to the softmax independently. Consequently, changes in logit uncertainty can affect both the sharpness of the predictive distribution and the relative probabilities of different classes.
An alternative would be to interpolate directly between the base model's class probabilities and a fallback categorical distribution. Such an approach restricts the resulting predictions to convex combinations of these two probability vectors. In contrast, TrustMix performs the interpolation in logit space and incorporates the resulting uncertainty before applying the nonlinear softmax transformation. This allows the predictive distribution to change in ways that are not restricted to linear interpolation between two fixed categorical distributions. Further details of the classification formulation are provided in Appendix D.
Training TrustMix We optimise the following set of parameters . To do so, we optimise the negative log-likelihood over the validation dataset that the base model did not see during training. We thus solve the following:
This objective calibrates the trust weight, encouraging lower reliance on the base model in regions where its predictions are less reliable. TrustMix can increase the predictive variance by increasing the rate at which collapses to zero, but doing so will necessarily increase predictive variance for all points where is large. As such, the only way for TrustMix to decrease the loss above is by appropriately calibrating the relationship between and the mixing weight . Importantly, this calibration requires no out-of-distribution examples: TrustMix learns when to distrust the base model solely from in-distribution validation data. This raises a natural question: can the parameters be identified from in-distribution data alone? Even within the in-distribution validation dataset, datapoints can exhibit different levels of deviations, allowing TrustMix to leverage the difference in to calibrate its collapse mechanism. We investigated this mechanism further in Section 5.5.
4 Related Work
Uncertainty estimation. A large body of work aims to quantify predictive uncertainty in deep models, including Bayesian neural networks (Neal, 2012; Blundell et al., 2015), MC dropout (Gal & Ghahramani, 2016), deep ensembles (Lakshminarayanan et al., 2017), and kernel-based approaches such as DUE, DUQ, and SNGP (Van Amersfoort et al., 2021; 2020; Liu et al., 2020a). These methods typically require modifying or retraining the base model. In contrast, TrustMix is a post-hoc approach that operates on a fixed pretrained model. These directions are complementary: improved uncertainty estimates from such models can be further calibrated using TrustMix.
Post-hoc calibration. Post-hoc calibration methods align predicted probabilities with empirical accuracy without retraining. Temperature scaling (Guo et al., 2017) and its variants adjust prediction sharpness, while isotonic regression (Zadrozny & Elkan, 2002) and order-preserving transformations (Rahimi et al., 2020) learn more flexible mappings. However, these methods are primarily designed for in-distribution calibration and do not explicitly account for distributional shift.
Density-aware calibration (DAC) (Tomani et al., 2023) extends this setting by incorporating representation-space density and inflating temperature as we move to regions with lower estimated density. In contrast, TrustMix learns a simple monotone mapping from a deviation signal to predictive trust.
Regression calibration. Calibration for regression is less studied. Laves et al. (2020) propose variance scaling, which rescales predictive uncertainty by a global factor. While effective, such methods are input-independent, as they globally scale variance by the same scalar across the domain. TrustMix instead introduces an input-dependent mechanism, allowing predictive uncertainty to adapt to distributional deviation.
Out-of-distribution detection. OOD detection methods (Hendrycks & Gimpel, 2016; Lee et al., 2018; Nalisnick et al., 2019; Liu et al., 2020b) assign scores that measure how atypical an input is relative to the training distribution. These methods focus on ranking inputs rather than producing calibrated predictions. TrustMix complements OOD detection by mapping deviation scores to predictive distributions, enabling evaluation under proper scoring rules.
Conformal prediction. Conformal prediction (Vovk et al., 2005; Angelopoulos & Bates, 2021) provides distribution-free uncertainty quantification via set-valued predictions with coverage guarantees. Unlike Trust-Mix, it does not produce full predictive distributions and typically assumes exchangeability, which may not hold under distribution shift. The two approaches are orthogonal: conformal methods provide coverage guarantees, while TrustMix enables calibrated probabilistic predictions under shift.
5 Experiments
We evaluate TrustMix on regression and classification tasks across diverse datasets and architectures. In all settings, we first train a base model and then apply post-hoc calibration on a held-out validation set. For regression, we use a standard base model that predicts a mean and variance (“VarHead”), trained by maximising Gaussian likelihood, as well as a version with MC Dropout. We compare TrustMix against -scaling (Laves et al., 2020) calibration applied on top of both the base model and MC Dropout. Additionally, since none of the other baselines relies on the deviation signal, we also compare against a modified version of -scaling, which we call Distance Aware -scaling, where we scale the base-model predictive standard deviation as:
where and are scalars learnt on calibration data and is the exact same deviation signal used by TrustMix. Note that recovers standard -scaling. For classification, we calibrate pretrained models using TrustMix and standard baselines including temperature scaling (TS) (Guo et al., 2017), its entropy variant (HTS) (Balanya et al., 2024), isotonic regression (Zhang et al., 2020), and intra order-preserving networks (IOP-IO) (Rahimi et al., 2020), as well as density-aware calibration (DAC)(Tomani et al., 2023).

Figure 2: Predictive fit on the 1-D synthetic GP (non-stationary kernel, prior variance shrinking out-of-distribution). Base and -scaling extrapolate a confident trend and diverge; MC-Dropout is erratic; TrustMix reverts the mean to its fitted fallback with a flat uncertainty band; TrustMix + oracle reverts to the true prior.
Further details are provided in Appendix B. Throughout these experiments, we use the Mahalanobis distance as the base OOD deviation signal ; details of its computation are provided in Appendix C.
5.1 Synthetic Experiments
We start by applying TrustMix to a synthetic dataset where the function is sampled from a noisy (with noise std. deviation ) GP prior over a ten-dimensional () space. 1000 training and 200 validation points are drawn uniformly from ; whereas evaluation is done on 2000 points drawn from an extended domain of . We use an isotropic RBF kernel (Rasmussen & Williams, 2006) with lengthscale (i.e. for ) and an input-dependent scale, that is:
We consider two cases: stationary where and non-stationary where . Intuitively, in the second case, the average function magnitude we expect to see far from training data is actually lower than in-distribution. Importantly, note that before any data is observed, at any point the distribution of observations is . We thus consider two variants: Trust-Mix using the default fallback distribution from Equation 4 and a TrustMix with an oracle fallback using . We present results in Table 1. In Figure 2, we show example model fits for different methods in the one dimensional case with the non-stationary kernel. In the table, we also include the NLL under the true GP posterior fitted on training data, as the theoretical lower bound. Unsurprisingly, TrustMix with the oracle fallback distribution performs best, followed by the TrustMix with the default fallback given by Equation 4. The remaining methods exhibit substantially higher NLL. The gap between using the oracle and default fallback is particularly pronounced in the non-stationary case, which is expected as in the stationary case, the marginal target distribution far from training data is the same as on the training data. As such, the default fallback, which simply estimates the first and second moments of model predictions on training data, can accurately estimate it, which is not the case with non-stationarity. This experiment illustrates the role of the fallback as an explicit extrapolation assumption. TrustMix does not remove the need for such an assumption: when the fallback is misspecified, performance under sufficiently extreme shift is necessarily limited by this choice. Conversely, when relevant knowledge about extrapolative behaviour is available, it can be incorporated directly through , as demonstrated by the oracle fallback.
Table 1: Synthetic GP experiments on 10D space, models are given data from and tested on . Displayed values are predictive NLL (), median [Q1, Q3] over 10 seeds. Best method (except for oracle) in bold.
| 10D, stationary RBFNLL () | 10D, non-stationaryNLL () | |
|---|---|---|
| Base | 18.99 [17.20, 37.15] | 11.29 [5.61, 16.23] |
| -scaling | 12.07 [9.76, 15.65] | 11.94 [9.56, 15.83] |
| Dropout | 2.22 [2.07, 2.59] | 1.34 [1.25, 1.54] |
| -scaling + Dropout | 2.45 [2.22, 2.68] | 1.38 [1.28, 1.57] |
| Dist.-Aware -scaling | 2.18 [2.11, 2.41] | 1.72 [1.52, 1.87] |
| TrustMix | 1.44 [1.42, 1.46] | 0.71 [0.69, 0.73] |
| TrustMix + oracle prior | 1.41 [1.41, 1.42] | 0.66 [0.65, 0.66] |
| GP oracle | 1.39 [1.39, 1.40] | 0.64 [0.63, 0.64] |
Table 2: Median NLL values () with first and third quartiles in brackets for different methods on datasets over 10 seeds. Values in bold correspond to best method and ties w.r.t. Wilcoxon test.
| DatasetMetric | VPowers | Weather | ||
|---|---|---|---|---|
| NLL () | OOD NLL () | NLL () | OOD NLL () | |
| Base | -0.35 [-0.58, -0.33] | -0.28 [-0.29, -0.20] | -0.09 [-0.15, -0.07] | 1.64 [0.69, 2.50] |
| -scaling | -0.37 [-0.59, -0.34] | -0.28 [-0.30, -0.11] | -0.11 [-0.16, -0.09] | 2.25 [0.92, 3.44] |
| Dropout | 0.08 [0.07, 0.10] | 0.12 [0.09, 0.15] | 0.42 [0.40, 0.49] | 0.60 [0.52, 0.65] |
| -scaling + Dropout | -0.28 [-0.30, -0.27] | -0.36 [-0.36, -0.34] | -0.01 [-0.03, 0.02] | 0.26 [0.24, 0.30] |
| Dist.-Aware -scaling | -0.37 [-0.59, -0.34] | -0.28 [-0.30, -0.12] | -0.11 [-0.16, -0.09] | 2.25 [0.93, 3.45] |
| TrustMix (ours) | -0.58 [-0.64, -0.57] | -0.44 [-0.46, -0.35] | -0.29 [-0.30, -0.28] | 0.24 [0.10, 0.30] |
5.2 Regression
We consider tabular (Weather(Malinin et al., 2021) and VPower (Malinin et al., 2022) datasets), vision (UTK-Face), and NLP tasks. For tabular datasets, we simply train a MLP; for the weather dataset, in-distribution data is drawn from Shifts' canonical training/development split of weather station measurements from a fixed set of times and locations, while out-of-distribution data comes from held-out stations and time periods exhibiting genuine seasonal and geographic shift; for VPower - where the task is predicting the power output of a marine cargo vessel's engine from operating and environmental sensor readings — in-distribution data corresponds to normal, expected vessel operating conditions, while out-of-distribution data corresponds to Shifts' synthetically perturbed operating regimes designed to emulate atypical vessel behaviour. On UTK-Face, we train a ResNet-18 and introduce distribution shift via ImageNet-C style corruptions (Hendrycks & Dietterich, 2019). For NLP, we train a DistilBERT model to regress review scores from text; scores are normalised to and mapped to via a logit transform. We treat Amazon reviews (Keung et al., 2020) as in-distribution and evaluate on other domains (TripAdvisor (Junichiro, 2024), Yelp (Zhang et al., 2015), Google Play) as OOD. Calibration is performed by minimising negative log-likelihood (NLL) on validation data. We report median NLL in Tables 2,3 and 4 with quartiles over multiple seeds and assess significance using the Wilcoxon test. We bold best method and ties w.r.t. the test. We also present coverage and interval width results in E. Across all benchmarks, TrustMix consistently improves OOD NLL while remaining competitive in-distribution, with particularly large gains on UTK-Face. The closest runner-ups are -scaling in combination with MC dropout and the Distance Aware -scaling. However, TrustMix, which relies on the same deviation signal as Distance Aware -scaling, consistently matches or improves upon its NLL. When it comes to coverage results, TrustMix obtains comparable coverage both in and out-of-distribution with other methods on UTK and NLP tasks, while slightly underperforming on Weather and
https://huggingface.co/datasets/Gopalatius/google-play-review
Table 3: Median NLL values (↓) with first and third quartiles in brackets for different methods on review score prediction over 10 seeds. Bold values are best method and ties w.r.t. Wilcoxon test. Base model here is DistilBERT.
| DatasetMetric | AmazonNLL (↓) | Google PlayOOD NLL (↓) | Trip AdvisorOOD NLL (↓) | YelpOOD NLL (↓) |
|---|---|---|---|---|
| Base | 0.66 [0.64, 0.69] | 1.54 [1.50, 1.64] | 1.57 [1.42, 1.70] | 1.72 [1.59, 1.82] |
| σ-scaling | 0.63 [0.62, 0.65] | 1.42 [1.40, 1.46] | 1.38 [1.31, 1.45] | 1.53 [1.44, 1.56] |
| Dropout | 0.65 [0.64, 0.66] | 1.47 [1.44, 1.56] | 1.54 [1.37, 1.58] | 1.62 [1.50, 1.63] |
| σ-scaling + Dropout | 0.64 [0.62, 0.65] | 1.41 [1.38, 1.45] | 1.40 [1.30, 1.43] | 1.47 [1.41, 1.53] |
| Dist.-Aware σ-scaling | 0.63 [0.62, 0.65] | 1.40 [1.38, 1.44] | 1.36 [1.29, 1.42] | 1.50 [1.41, 1.53] |
| TrustMix (ours) | 0.63 [0.62, 0.65] | 1.40 [1.38, 1.44] | 1.35 [1.28, 1.41] | 1.47 [1.41, 1.50] |
Table 4: Median NLL values (↓) with first and third quartiles in brackets for different methods on UTK-Face datasets over 10 seeds. Bold values are best method and ties w.r.t. Wilcoxon test. Base model here is ResNet-18.
| DatasetMetric | UTK-Face | |
|---|---|---|
| NLL (↓) | OOD NLL (↓) | |
| Base | 0.39 [0.33, 0.46] | 8.36 [3.94, 12.75] |
| Dropout | 0.38 [0.32, 0.44] | 7.22 [3.60, 10.13] |
| σ-scaling | 0.36 [0.32, 0.44] | 7.63 [5.26, 12.16] |
| σ-scaling + Dropout | 0.34 [0.30, 0.41] | 7.29 [4.85, 11.12] |
| Dist.-Aware σ-scaling | 0.34 [0.31, 0.43] | 2.12 [1.96, 2.40] |
| TrustMix (ours) | 0.34 [0.30, 0.38] | 1.57 [1.43, 1.96] |
VPower_s. All methods (including TrustMix) are calibrated with NLL as the target metric, not coverage or interval width, so these results should be regarded as secondary.
5.3 Bayesian Optimisation
To assess TrustMix in downstream decision-making under uncertainty, we compare it with other regression methods when used as a surrogate model for Bayesian optimisation (BO). BO is a natural testbed for uncertainty under distribution shift, as effective optimisation often requires exploring regions far from the observations used to fit the surrogate model. In the problem setting of BO we wish to maximise an unknown black-box function, without access to its derivatives. At each timestep , we can simply query the function at a selected point and observe the function value . We then fit a regression model to all datapoints gathered so far and based on it construct an acquisition function that tells us how promising each point is to query next. In our experiments we use Expected Improvement, defined as:
where is the best function value so far and and are Gaussian CDF and PDF respectively and and are predicted mean and standard deviation at a given point by the fitted regression model. At each timestep we select the point where expected improvement is greatest, that is . We test two settings: small-scale, where we start with 20 initial datapoints and operate on a 2-dimensional space and large-scale, where we start with 5000 initial points and operate on a 10-dimensional space. In each setting, we evaluate on seven commonly used benchmark functions: Levy, Michalewicz, Rastrigin, StyblinskiTang, Ackley, Griewank and Rosenbrock. We compare all previously tested regression methods as well as a Gaussian Process regressor in small-scale setting and a Sparse Gaussian Process in large-scale setting. We record the best function value found so far by each method before or on each timestep. In Figure 3, we show the average rank of best values found by each method (lower the better) across all benchmark functions in each setting. We show detailed results in Appendix G.

Figure 3: Results on BO experiments. Plots show average rank (lower is better) across all 7 tested functions and all 25 seeds. The plots show how each method's rank, based on the best value found by each iteration, evolves over time. Best method on last step and ties according to two-sided z-test are in bold.
In a BO problem, there is no clear in-distribution/OOD split, in many cases, we wish to explore points very far from the ones we tested so far, in others, we focus on a promising region close to previous queries. As such, we need a method that exhibits strong OOD performance while being competitive in-distribution. This is reflected in BO results, where TrustMix achieves a lower average rank than the other neural methods early in optimisation and largely maintains this advantage thereafter. In the small-scale setting, TrustMix closely matches the performance of the gold standard GP model. This model, however, in its standard version is computationally expensive to scale to large datasets in its standard form, hence we rely on SparseGP in the large-scale setting. Note, however, that SparseGP is an approximation to full GP and TrustMix outperforms in terms of average rank across the functions we tested.
5.4 Classification
We evaluate TrustMix on three widely used image-classification benchmarks: CIFAR10, CIFAR100 and ImageNet. As the OOD set we use the CIFAR-C and ImageNet-C datasets proposed by (Hendrycks & Dietterich, 2019) at the highest corruption severity (corruption level 5). On each dataset, we calibrate two different architectures trained on the corresponding training sets as base models. On CIFAR10/100 we use the canonical WideResNet 28-10 (Zagoruyko & Komodakis, 2016) and VGG16BN (Simonyan & Zisserman, 2014). On ImageNet we use ResNet152 (He et al., 2016) and Vision Transformer ViT-B/16 (Dosovitskiy et al., 2020). We report the NLL and Expected Calibration Error (ECE) in Tables 5 and 6 as well as in Appendix F.
The classification results show that TrustMix is particularly effective at maintaining calibration under distribution shifts, while remaining competitive in-distribution. Across CIFAR10, CIFAR100, and ImageNet, all methods are calibrated using ID validation data only, making OOD performance a direct test of robustness. Across all datasets and architectures, TrustMix obtains the lowest (or statistically tied with best) OOD ECE, while remaining competitive in-distribution. Improvements in OOD NLL are less consistent: TrustMix is competitive in several settings but is outperformed by other calibration methods on some dataset-architecture combinations. The ImageNet results demonstrate applicability of TrustMix to large datasets and modern architectures.
5.5 Understanding TrustMix
Is deviation informative about model reliability? TrustMix separates the question of what to predict under extreme extrapolation, encoded by , from the question of when the base model should be trusted, informed by . The latter requires the deviation signal to be informative about predictive failure. To investigate this assumption, in Table 7, we show Spearman rank correlation between the NLL of the base distribution used by TrustMix and the used Mahalanobis deviation signal . We measure this on both in-distribution and out-of-distribution data. We repeat the procedure across all seeds and report the mean correlation, the number of runs with positive correlation, and with statistically significant correlation.
Table 5: ECE (↓) and NLL (↓) on ID and OOD (corruption severity 5) datasets on CIFAR100 with the WideResNet 28-10 architecture. Reported values are means over 3 seeds, with values after ± being 1.96 times the standard error (half-width of the 95% confidence interval). Best values and ties w.r.t. two-sided z-test are in bold, second best underlined.
| Method | 10×ECE | NLL | ||
|---|---|---|---|---|
| ID | OOD | ID | OOD | |
| Base | ||||
| DAC | ||||
| HTS | ||||
| IOP-IO | ||||
| IROVA | ||||
| TS | ||||
| TrustMix (ours) | ||||
Table 6: ECE (↓) and NLL (↓) on ID and OOD (corruption severity 5) datasets on ImageNet with the ViT-B/16 architecture. Reported values are means over 3 seeds, with values after ± being 1.96 times the standard error (half-width of the 95% confidence interval). Best values and ties w.r.t. two-sided z-test are in bold, second best underlined.
| Method | 10×ECE | NLL | ||
|---|---|---|---|---|
| ID | OOD | ID | OOD | |
| Base | ||||
| DAC | ||||
| HTS | ||||
| IOP-IO-Clip | ||||
| IROVA | ||||
| TS | ||||
| TrustMix (ours) | ||||
While the strength of the association varies across tasks, all measured rank correlations are positive and statistically significant, supporting the use of Mahalanobis distance as a deviation signal in the considered settings.
Table 7: Spearman rank correlation between TrustMix's OOD deviation and NLL for the base model distribution used by TrustMix. Middle column: how many of the evaluations had a positive correlation; right column: how many were significant.
| Problem | Mean Spearman | # positive | # significant () |
|---|---|---|---|
| CIFAR10 (WideResNet 28-10) | 0.40 | 3/3 | 3/3 |
| CIFAR100 (WideResNet 28-10) | 0.32 | 3/3 | 3/3 |
| ImageNet (ViT-B/16) | 0.39 | 3/3 | 3/3 |
| UTK | 0.49 | 20/20 | 20/20 |
| Vpower | 0.08 | 10/10 | 10/10 |
| Weather | 0.22 | 10/10 | 10/10 |
| NLP – Amazon + Google Play | 0.22 | 10/10 | 10/10 |
| NLP – Amazon + Trip Advisor | 0.27 | 10/10 | 10/10 |
| NLP – Amazon + Yelp | 0.09 | 10/10 | 10/10 |
How can trust be learned from ID data alone? TrustMix is fitted to the in-distribution validation data only. However, the deviation signal varies significantly within the in-distribution validation data, allowing TrustMix to learn how trust in the base model should vary with deviation. We examine the effect of variation within the calibration data in greater detail in Fig. 4. We reduced the size of the validation sets in two ways: either by randomly eliminating data points or by eliminating the data points with the largest deviations. We evaluated these reductions on two representative problems: regression on vPower and classification on ImageNet. Eliminating validation data with large deviations typically produces substantially

Figure 4: Plots showing the effect of removing validation datapoints on TrustMix. Blue curve shows random removal, where we randomly drop a given fraction of datapoints, whereas the red curve shows the effects of removing a fraction of points with highest OOD signal.
greater degradation in OOD performance compared to eliminating the same proportion of validation data at random. These results suggest that TrustMix utilizes the variability of deviation among in-distribution calibration examples (particularly those with large deviations) to determine the rate at which trust in the base model should be reduced.
How good is the default fallback? In Figure 5 we show how NLL changes of TrustMix's predictive distribution changes on various OOD datasets as the input deviates from training distribution. We bin the datapoints from OOD datasets into 5 bins depending on their deviation signal and display summary values for each bin. Alongside, we plot the NLL of the base distribution and that of the fallback . We also show the average trust gate value assigned at each deviation level in the middle plots and distribution of OOD and validation datapoints in the bottom plots.
We see that the base model gets worse on large deviation examples, while fallback is roughly flat. As such, on multiple datasets, the base model eventually becomes worse than the fallback. This shows that reverting to a simple, input-independent fallback can meaningfully improve on base model in far OOD scenarios. In particular on the UTK dataset, fallback is substantially better than base model and TrustMix leverages that by quickly collapsing to it. However, on ImageNet, the NLL of base model gets closer to the one of fallback, but is never worse. Even then, by mixing the two distribution, TrustMix achieves better NLL than either of them. This reveals one important property of the fallback: on its own it does not necessarily needs to be better than the base model to allow TrustMix to make meaningful improvements via mixing.
TrustMix with a different deviation signal Throughout the paper, we use Mahalanobis distance as our default deviation signal. However, TrustMix can in principle be used with alternative signals, such as logit energy (Liu et al., 2020b). We conducted an experiment on ImageNet, where we replaced the deviation signal in TrustMix and used Logit Energy, normalised by smallest training set energy so that the signal lies in . We compare the Mahalanobis distance-based deviation signal defined in Appendix C with an energy-based deviation signal proposed by (Liu et al., 2020b): , where are the logits for the th class for a given input as given by the base model and is the number of classes. As can be both negative and positive, to convert it into a non-negative deviation signal that can be used by TrustMix we transform it as:

Figure 5: Behaviour of TrustMix on various OOD dataset. Top row: predictive NLL of the base model , fallback , and resulting TrustMix mixture . Middle row: learned trust . Bottom row: distribution of over validation and OOD evaluation datasets. Lines and shaded areas in middle plot correspond to mean and standard errors over seeds. Top and Middle plots are made by binning the deviation signal on OOD datasets into 5 bins, plots show respective summary values over each bin.
with and . We instantiate TrustMix with instead of Mahalanobis and show the result in Table 8. We see that this makes little change with ViT-B/16 as a base model, yet meaningfully impacts OOD performance with ResNet 152 used as base. This is consistent with earlier literature reporting Mahalanobis to be generally stronger OOD detector than Energy (Mukhoti et al., 2023).
TrustMix operating in probability space Earlier we explained that operating in logits space should give TrustMix more flexibility than operating in pure probability space. We now verify this claim experimentally; in Table 9 we show a comparison of performance on ImageNet of standard TrustMix with a TrustMix operating in probability space, where denotes the class probabilities produced by the base model (with learnable temperature) and is a uniform categorical distribution over classes. Note that when , both models have the same flexibility. As such, the only difference is how the mixing is conducted. We see that, as predicted, mixing in probability space achieves much worse in-distribution performance. out-of-distribution, it achieves slightly better NLL on ResNet 152 at the cost of substantially worse ECE.
Table 8: ECE () and NLL () on ID and OOD (corruption severity 5) datasets on ImageNet with the ViT-B/16 and ResNet152 architectures, comparing TrustMix's default Mahalanobis OOD deviation signal against an Energy signal. Reported values are means over 3 seeds, with values after being 1.96 times the standard error (half-width of the 95% confidence interval). Best values and ties w.r.t. two-sided z-test are in bold.
| ViT-B/16 | ||||
|---|---|---|---|---|
| Method | 10×ECE | NLL | ||
| ID | OOD | ID | OOD | |
| TrustMix (ours) | ||||
| TrustMix (Energy) | ||||
| ResNet 152 | ||||
| Method | 10×ECE | NLL | ||
| ID | OOD | ID | OOD | |
| TrustMix (ours) | ||||
| TrustMix (Energy) | ||||
Table 9: ECE (↓) and NLL (↓) on ID and OOD (corruption severity 5) datasets on ImageNet with the ViT-B/16 and ResNet152 architectures, comparing TrustMix's logit-space fallback (default) against probability-space mixing. Reported values are means over 3 seeds, with values after ± being 1.96 times the standard error (half-width of the 95% confidence interval). Best values and ties w.r.t. two-sided z-test are in bold.
| ViT-B/16 | ||||
|---|---|---|---|---|
| Method | 10×ECE | NLL | ||
| ID | OOD | ID | OOD | |
| TrustMix (Logit Space) | 0.18 ± 0.04 | 0.21 ± 0.07 | 0.74 ± 0.01 | 3.28 ± 0.03 |
| TrustMix (Prob. Space) | 0.35 ± 0.02 | 1.04 ± 0.06 | 0.79 ± 0.01 | 3.27 ± 0.02 |
| ResNet 152 | ||||
| Method | 10×ECE | NLL | ||
| ID | OOD | ID | OOD | |
| TrustMix (Logit Space) | 0.17 ± 0.03 | 0.69 ± 0.23 | 0.68 ± 0.01 | 3.67 ± 0.01 |
| TrustMix (Prob. Space) | 0.34 ± 0.02 | 1.84 ± 0.01 | 0.74 ± 0.01 | 3.62 ± 0.02 |
6 Conclusions
In this work, we explicitly separated two questions that are often conflated: when should a model be trusted, and what should we predict when trust in the model is low? TrustMix addresses the first question by learning a monotonic mapping from a deviation signal to model trust. It addresses the second through a user-specified fallback distribution, which defines the predictive behaviour as trust in the base model vanishes. Importantly, TrustMix does not make a binary choice between trusting the base model and deferring to the fallback. Instead, it smoothly interpolates between their predictive distributions, allowing predictions to rely partially on the base model and partially on the fallback.
Across regression benchmarks, TrustMix achieved strong OOD predictive likelihood while remaining competitive in-distribution. In classification, its most consistent advantage was OOD calibration, achieving the lowest or statistically tied ECE across the evaluated settings, although improvements in OOD NLL were task-dependent. TrustMix also performed competitively as a neural surrogate for Bayesian optimisation.
The main limitation of TrustMix is its dependence on the choice of fallback distribution. If the fallback is poorly specified for a given task, collapsing towards it under large distribution shifts can degrade predictive performance. TrustMix therefore does not eliminate assumptions about extrapolation; rather, it makes them explicit and controllable. A promising direction for future work is to design task-specific fallback distributions for applications in which extrapolation beyond the training domain is particularly important.
References
Anastasios N Angelopoulos and Stephen Bates. A gentle introduction to conformal prediction and distribution-free uncertainty quantification. arXiv preprint arXiv:2107.07511, 2021.
Sergio A Balanya, Juan Maronas, and Daniel Ramos. Adaptive temperature scaling for robust calibration of deep neural networks. Neural Computing and Applications, 36(14):8073–8095, 2024.
Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural network. In International conference on machine learning, pp. 1613–1622. PMLR, 2015.
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pp. 1050–1059. PMLR, 2016.
Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In International conference on machine learning, pp. 1321–1330. PMLR, 2017.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. arXiv preprint arXiv:1903.12261, 2019.
Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. arXiv preprint arXiv:1610.02136, 2016.
Niimi Junichiro. Hotel review dataset (english). https://github.com/jniimi/tripadvisor_dataset, 2024.
Phillip Keung, Yichao Lu, György Szarvas, and Noah A. Smith. The multilingual amazon reviews corpus. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, 2020.
Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. Advances in neural information processing systems, 30, 2017.
Cornelius Lanczos. An iteration method for the solution of the eigenvalue problem of linear differential and integral operators. Journal of research of the National Bureau of Standards, 45(4):255–282, 1950.
Max-Heinrich Laves, Sontje Ihler, Jacob F Fast, Lüder A Kahrs, and Tobias Ortmaier. Well-calibrated regression uncertainty in medical imaging with deep learning. In Medical imaging with deep learning, pp. 393–412. PMLR, 2020.
Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. Advances in neural information processing systems, 31, 2018.
Jeremiah Liu, Zi Lin, Shreyas Padhy, Dustin Tran, Tania Bedrax Weiss, and Balaji Lakshminarayanan. Simple and principled uncertainty estimation with deterministic deep learning via distance awareness. Advances in neural information processing systems, 33:7498–7512, 2020a.
Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. Energy-based out-of-distribution detection. Advances in neural information processing systems, 33:21464–21475, 2020b.
Andrey Malinin, Neil Band, German Chesnokov, Yarin Gal, Mark JF Gales, Alexey Noskov, Andrey Ploskonosov, Liudmila Prokhorenkova, Ivan Provilkov, Vatsal Raina, et al. Shifts: A dataset of real distributional shift across multiple large-scale tasks. arXiv preprint arXiv:2107.07455, 2021.
Andrey Malinin, Andreas Athanasopoulos, Mohamed Barakovic, Meritxell Bach Cuadra, Mark JF Gales, Cristina Granziera, Mara Graziani, Nikolay Kartashev, Konstantinos Kyriakopoulos, Po-Jui Lu, et al. Shifts 2.0: Extending the dataset of real distributional shifts. arXiv preprint arXiv:2206.15407, 2022.
Bálint Mucsányi, Nathaël Da Costa, and Philipp Hennig. Rethinking approximate gaussian inference in classification. arXiv preprint arXiv:2502.03366, 2025.
Jishnu Mukhoti, Andreas Kirsch, Joost Van Amersfoort, Philip HS Torr, and Yarin Gal. Deep deterministic uncertainty: A new simple baseline. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 24384–24394, 2023.
Eric Nalisnick, Akihiro Matsukawa, Yee Whye Teh, and Balaji Lakshminarayanan. Detecting out-of-distribution inputs to deep generative models using typicality. arXiv preprint arXiv:1906.02994, 2019.
Radford M Neal. Bayesian learning for neural networks, volume 118. Springer Science & Business Media, 2012.
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. PyTorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32, 2019.
Amir Rahimi, Amirreza Shaban, Ching-An Cheng, Richard Hartley, and Byron Boots. Intra order-preserving functions for calibration of multi-class neural networks. Advances in neural information processing systems, 33:13456–13467, 2020.
Carl Edward Rasmussen and Christopher K. I. Williams. Gaussian Processes for Machine Learning. MIT Press, Cambridge, MA, USA, 2006.
Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108, 2019.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
Christian Toman, Futa Kai Waseda, Yuesong Shen, and Daniel Cremers. Beyond in-domain scenarios: Robust density-aware calibration. In International Conference on Machine Learning, pp. 34344–34368. PMLR, 2023.
Joost Van Amersfoort, Lewis Smith, Yee Whye Teh, and Yarin Gal. Uncertainty estimation using a single deep deterministic neural network. In International conference on machine learning, pp. 9690–9700. PMLR, 2020.
Joost Van Amersfoort, Lewis Smith, Andrew Jesson, Oscar Key, and Yarin Gal. On feature collapse and deep kernel learning for single forward pass uncertainty. arXiv preprint arXiv:2102.11409, 2021.
Vladimir Vovk, Alexander Gammerman, and Glenn Shafer. Algorithmic learning in a random world. Springer, 2005.
Bianca Zadrozny and Charles Elkan. Transforming classifier scores into accurate multiclass probability estimates. In Proceedings of the eighth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 694–699, 2002.
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
Jize Zhang, Bhavya Kailkhura, and T Yong-Jin Han. Mix-n-match: Ensemble and compositional methods for uncertainty calibration in deep learning. In International conference on machine learning, pp. 11117–11128. PMLR, 2020.
Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. Advances in neural information processing systems, 28, 2015.
Juliusz Ziomek, George Whittle, and M A Osborne. Just one layer norm guarantees stable extrapolation. arXiv preprint arXiv:2505.14512, 2025.
A Proof of Proposition 1
Proposition 1 (Architectural monotonicity). Let , where every has positive entries and is non-decreasing and unbounded. Then is non-decreasing in , and hence sigmoid is non-increasing in and as , we get .
Proof. We prove the claim by induction over the layers. Define
and, for ,
Let . Since every entry of is positive, we have that coordinatewise:
so
Thus is coordinatewise non-decreasing in . Now suppose, inductively, that is coordinatewise non-decreasing. Then for ,
Because is non-decreasing,
Multiplying by , whose entries are positive, preserves the coordinatewise inequality, and hence
Therefore is also coordinatewise non-decreasing. By induction, is non-decreasing in . It remains to prove the limit. Since every entry of is positive,
Because is non-decreasing and unbounded, this implies
Since every entry of is positive,
Repeating this argument layer by layer gives
Finally, sigmoid is increasing and sigmoid as . Hence
as . Moreover since sigmoid is increasing and is non-decreasing, we have that is non-increasing in .
B Experimental Details
All experiments were executed on compute nodes equipped with NVIDIA A40 GPUs, each providing 48 GB of GPU memory.
We adopt a unified experimental protocol across methods whenever feasible in order to isolate methodological differences. Stochastic Dropout inference relies on five Monte Carlo forward passes, with the dropout rate fixed to 0.3 throughout. Aside from the final prediction layer—which is method-dependent — all approaches share an identical backbone architecture. We use Adam for optimisation unless stated otherwise.
For regression tasks, we first train the model's mean head by MSE. After this training is completed, we freeze all the layers except for the weights of uncertainty head and train it to maximise Gaussian likelihood. The uncertainty head predicts the log of standard deviation. When combining with dropout, we take the output mean to be average mean head output, and variance is the sum of mean's head variance and average variance given by uncertainty head. For classification tasks, we simply train the model to output logits for each class with standard cross entropy loss.
When calibrating all models with all methods, we first precompute base model outputs and then calibrate them. This allows us to save time and memory and thus when calibrating we always use full batch gradient descent. When calibrating, we optimise log likelihood until the change over 10 steps is less than 0.0001.
For all datasets and methods, training is governed by a patience-based early-stopping criterion: if the final epoch yields the lowest validation loss observed so far, training is continued until no additional improvement is detected.
B.1 Regression – Weather and VPower_s
For regression on Weather and VPower_s datasets, we use a fully connected MLP backbone with two hidden layers of 256 units. Model is trained with a learning rate of 10⁻³ for the mean head and variance head. Mean head is trained for one full epoch with batch size 512 and variance head is trained for 10 epochs with full batch of precomputed embeddings. Validation MSE for main model and NLL for variance head are computed every epoch, and the model parameters corresponding to the lowest validation loss are selected for evaluation. Training takes up to 10 minutes.
B.2 Regression – UTK
For regression on UTK-Face, we use a ResNet-18 backbone (He et al., 2016) initialised from random weights, followed by a single linear output layer. Model is trained for 50 epochs with a batch size of 64 using Adam at a learning rate of 10⁻³ for both mean and uncertainty heads. We use data augmentation introduced by (Zagoruyko & Komodakis, 2016). Validation MSE for main model and NLL for variance head is computed every epoch, and the model parameters corresponding to the lowest validation loss are selected for evaluation. Training takes up to 20 minutes.
B.3 Regression – NLP tasks
For regression on NLP tasks, we use DistilBERT (Sanh et al., 2019), where we add a linear layer on top. The review scores for each dataset are first normalised to [0, 1] range and then transformed via a logit transform. Before transformation, the scores are clipped to [0.01, 0.99] to avoid infinite scores. Model is trained for 50 epochs with a batch size of 128 using Adam at a learning rate of 10⁻⁵ for both mean and uncertainty heads. Training can take up to 4 hours.
B.4 Classification – CIFAR-10/100
For classification experiments on CIFAR-10 and CIFAR-100 we train all base models from scratch. We use data augmentation following the standard procedure introduced by (Zagoruyko & Komodakis, 2016). For WideResNet 28-10, optimisation is performed using stochastic gradient descent with momentum 0.9 and weight decay over 200 epochs. The learning rate is initialised to 0.1 and reduced by a factor of 5 after epochs 60, 120, and 180. For VGG16BN, we train with momentum 0.9 and weight decay for 100 epochs, initialise the learning rate to 0.03 and divide by 5 at epochs 60 and 80. All experiments use a batch size of 128. Training can take up to 3 hours.
B.5 Classification – ImageNet
On ImageNet, we use pretrained models provided by torchvision (Paszke et al., 2019) that were trained on the ImageNet trainset. We then take the original ImageNet validation set consisting of 50,000 examples and split it randomly (seeded with a given random seed) in half to create a calibration set and evaluation set. For OOD, for each evaluation image, we randomly select one type of corruption proposed by (Hendrycks & Dietterich, 2019) and apply it at the highest severity.
B.6 Bayesian Optimisation
In Bayesian Optimisation, we need to remain particularly sample efficient, so we adopt a slightly different approach compared to supervised learning. We keep two models; one trained on a fraction of available data with the rest set aside for validation and the other trained on full dataset. As validation we randomly select 25% of points excluding the initial design, together with 5 points from random design in small-scale setting and 20 points in large-scale setting. This is because the initial design is likely to have a completely different distribution from that of points gathered during BO. By restricting the number of data points from the initial design entering the validation we effectively focus more on the BO region. Before fitting the model, we apply the Yeo-Johnson transform for normality to the observed values. We record the average loss achieved by the first model on the training set when the validation set loss is best. Then when training the second model, without the validation set, we simply stop whenever we achieve an average loss that is better or equal. For -scaling or TrustMix, all calibration parameters are selected using the first model, using the validation set for calibration and then simply copied over to the full model. We train both models with a learning rate of for 1500 epochs at first and then we reuse them at further iterations while only training them for a further 100 epochs. We do a full model reset every 10 iterations. One run takes up to 12 minutes.
C Details of Mahalanobis Computations
Given a pretrained feature extractor , Mahalanobis distance quantifies the representation space deviation as:
where
denote the empirical mean and covariance of the training embeddings with . Both quantities can be computed efficiently using a single forward pass over the training set. Computing Mahalanobis distance requires inverting the covariance , which is performed once per trained model and incurs negligible overhead relative to training. Importantly, is defined over the feature dimension rather than the dataset size, so its size does not scale with the number of training examples. In practice, covariance inversion can be efficiently handled using standard techniques such as Lanczos method (Lanczos, 1950). Also, in practice, we find that there is no need to compute and over the entire training set. For larger training sets, we find it sufficient to compute this only on small fraction of training set. Throughout our experiments we use 1% of all training data on ImageNet and the Amazon data in NLP task. For remaining tasks, we use the entire training set.
In deeper architectures, we find that computing Mahalanobis distance with intermediate features instead of only the last layer features, improves the quality of the OOD signal. Assuming the architectures consists of blocks after which we extract intermediate representation and the full feature extractor can be rewritten as , we define the per-block Mahalanobis distance as:
where analogously:
The final deviation signal is the average per-block distance:
In Table 10 below we detail which intermediate layers we use for Mahalanobis distance computations for each architecture among the experiments. Whenever we compare with DAC in classification, we use the same intermediate layer for Mahalanobis computation as for density estimation in DAC for fair comparison.
Table 10: Intermediate representations used for Mahalanobis distance computations across architectures and experimental settings. For convolutional networks, we extract features after major stages or blocks of the network. For transformer-based models, we use the hidden representations after each transformer block together with the final normalization layer.
| Experiment | Architecture | Feature representations used |
|---|---|---|
| CIFAR10/100 | WRN-28-10 | Outputs after the three residual groups |
| ResNet-110 | Outputs after the three residual groups | |
| VGG16BN | Outputs after convolutional blocks 2, 3, 4, and 5, together with the final convolutional feature map | |
| ImageNet | ResNet-152 | Outputs after residual stages 1–4 |
| ViT-B/16 | Representations after all 12 transformer encoder blocks and the final layer normalization | |
| DenseNet-169 | Outputs after transition layers 1–3 and the final pooled representation before classification | |
| UTK | ResNet-18 | Outputs after residual stages 1–4 |
| NLP | DistilBERT | Final embeddings only |
| UCI | MLP | Final embeddings only |
D Details on TrustMix in classification
In classification with classes, we treat the logits space as the output space of base model as . As such, the fallback parameters are now vectors, that is and and the fallback distribution is a diagonal Gaussian over logits space . We also apply an affine transformation to the logits first, that is we take as base logits. and are then set relatively to base model, by the elementwise vector equations below:
Denoting , the predictive distribution over logits is also defined by element-wise vector equations:
where and , but is a scalar. Since the base model outputs logits but not variance over logits, we just set . Finally, the equation for predictive distribution over classes:
means we apply softmax to the vector of logits. In other words, if we let denote the th entry of vector , then the th element of logits vector is:
and the th entry after softmax is applied is:
E Coverage and Interval Width Results
Table 11: 95% predictive interval coverage and width for all methods on VPowerₛ and Weather datasets. Displayed values are averages over 10 seeds with standard errors after ± sign. Best values and ties according to z-test in bold, second best are underlined.
| DatasetMetric | VPowerₛ | Weather | ||
|---|---|---|---|---|
| Coverage | OOD Coverage | Coverage | OOD Coverage | |
| Base | 0.96 ± 0.01 | 0.93 ± 0.02 | 0.97 ± 0.00 | 0.89 ± 0.02 |
| σ-scaling | 0.95 ± 0.00 | 0.91 ± 0.02 | 0.95 ± 0.00 | 0.87 ± 0.02 |
| Dropout | 0.99 ± 0.00 | 1.00 ± 0.00 | 1.00 ± 0.00 | 0.99 ± 0.00 |
| σ-scaling + Dropout | 0.95 ± 0.00 | 0.97 ± 0.00 | 0.95 ± 0.00 | 0.93 ± 0.01 |
| Dist.-Aware σ-scaling | 0.95 ± 0.00 | 0.91 ± 0.02 | 0.95 ± 0.00 | 0.87 ± 0.02 |
| TrustMix (ours) | 0.94 ± 0.00 | 0.91 ± 0.02 | 0.94 ± 0.00 | 0.85 ± 0.01 |
| Metric | Width (↓) | OOD Width (↓) | Width (↓) | OOD Width (↓) |
|---|---|---|---|---|
| Base | 0.75 ± 0.10 | 0.67 ± 0.09 | 1.04 ± 0.05 | 1.12 ± 0.10 |
| σ-scaling | 0.67 ± 0.07 | 0.60 ± 0.06 | 0.91 ± 0.03 | 0.98 ± 0.08 |
| Dropout | 1.69 ± 0.03 | 1.75 ± 0.05 | 2.41 ± 0.13 | 2.77 ± 0.33 |
| σ-scaling + Dropout | 0.80 ± 0.02 | 0.83 ± 0.02 | 1.05 ± 0.04 | 1.21 ± 0.12 |
| Dist.-Aware σ-scaling | 0.67 ± 0.07 | 0.60 ± 0.06 | 0.91 ± 0.03 | 0.98 ± 0.08 |
| TrustMix (ours) | 0.53 ± 0.01 | 0.54 ± 0.04 | 0.72 ± 0.00 | 0.71 ± 0.04 |
Table 12: 95% predictive interval coverage and width for all methods on NLP tasks. Displayed values are averages over 10 seeds with standard errors after ± sign. Best values and ties according to z-test in bold, second best are underlined.
| DatasetMetric | AmazonCoverage | Google PlayOOD Coverage | Trip AdvisorOOD Coverage | YelpOOD Coverage |
|---|---|---|---|---|
| Base | 0.93 ± 0.00 | 0.86 ± 0.02 | 0.77 ± 0.03 | 0.79 ± 0.02 |
| σ-scaling | 0.95 ± 0.00 | 0.90 ± 0.01 | 0.85 ± 0.02 | 0.85 ± 0.01 |
| Dropout | 0.94 ± 0.00 | 0.88 ± 0.01 | 0.80 ± 0.03 | 0.82 ± 0.02 |
| σ-scaling + Dropout | 0.95 ± 0.00 | 0.90 ± 0.01 | 0.84 ± 0.02 | 0.85 ± 0.01 |
| Dist.-Aware σ-scaling | 0.95 ± 0.00 | 0.91 ± 0.01 | 0.86 ± 0.01 | 0.86 ± 0.01 |
| TrustMix (ours) | 0.95 ± 0.00 | 0.91 ± 0.01 | 0.86 ± 0.01 | 0.87 ± 0.01 |
| DatasetMetric | AmazonWidth | Google PlayOOD Width | Trip AdvisorOOD Width | YelpOOD Width |
|---|---|---|---|---|
| Base | 1.81 ± 0.03 | 2.39 ± 0.06 | 1.93 ± 0.06 | 2.11 ± 0.06 |
| σ-scaling | 2.04 ± 0.02 | 2.69 ± 0.04 | 2.17 ± 0.04 | 2.37 ± 0.04 |
| Dropout | 1.90 ± 0.03 | 2.48 ± 0.06 | 2.01 ± 0.06 | 2.20 ± 0.06 |
| σ-scaling + Dropout | 2.03 ± 0.02 | 2.66 ± 0.03 | 2.15 ± 0.04 | 2.36 ± 0.04 |
| Dist.-Aware σ-scaling | 2.07 ± 0.02 | 2.74 ± 0.04 | 2.21 ± 0.04 | 2.41 ± 0.04 |
| TrustMix (ours) | 2.07 ± 0.02 | 2.72 ± 0.04 | 2.21 ± 0.04 | 2.42 ± 0.05 |
Table 13: 95% predictive interval coverage and width for all methods on UTK-Face. Displayed values are averages over 20 seeds with standard errors after ± sign. Best values and ties according to z-test in bold, second best are underlined.
| DatasetMetric | UTK | |||
|---|---|---|---|---|
| ID Coverage | OOD Coverage | ID Width (↓) | OOD Width (↓) | |
| Base | ||||
| σ-scaling | ||||
| Dropout | ||||
| σ-scaling + Dropout | ||||
| Dist.-Aware σ-scaling | ||||
| TrustMix (ours) | ||||
F Further Results on Classification
Table 14: ECE (↓) and NLL (↓) on ID and OOD (corruption severity 5) datasets on CIFAR10 with the WideResNet 28-10 architecture. Reported values are means over 3 seeds, with values after ± being 1.96 times the standard error (half-width of the 95% confidence interval). Best values and ties w.r.t. two-sided z-test are in bold, second best underlined.
| Method | ECE | NLL | ||
|---|---|---|---|---|
| ID | OOD | ID | OOD | |
| Base | ||||
| DAC | ||||
| HTS | ||||
| IOP-IO | ||||
| IROVA | ||||
| TS | ||||
| TrustMix (ours) | ||||
Table 15: ECE (↓) and NLL (↓) on ID and OOD (corruption severity 5) datasets on CIFAR10 with the VGG16BN architecture. Reported values are means over 3 seeds, with values after ± being 1.96 times the standard error (half-width of the 95% confidence interval). Best values and ties w.r.t. two-sided z-test are in bold, second best underlined.
| Method | ECE | NLL | ||
|---|---|---|---|---|
| ID | OOD | ID | OOD | |
| Base | ||||
| DAC | ||||
| HTS | ||||
| IOP-IO | ||||
| IROVA | ||||
| TS | ||||
| TrustMix (ours) | ||||
Table 16: ECE (↓) and NLL (↓) on ID and OOD (corruption severity 5) datasets on CIFAR100 with the VGG16BN architecture. Reported values are means over 3 seeds, with values after ± being 1.96 times the standard error (half-width of the 95% confidence interval). Best values and ties w.r.t. two-sided z-test are in bold, second best underlined.
| Method | 10×ECE | NLL | ||
|---|---|---|---|---|
| ID | OOD | ID | OOD | |
| Base | ||||
| DAC | ||||
| HTS | ||||
| IOP-IO | ||||
| IROVA | ||||
| TS | ||||
| TrustMix (ours) | ||||
Table 17: ECE (↓) and NLL (↓) on ID and OOD (corruption severity 5) datasets on ImageNet with the ResNet152 architecture. Reported values are means over 3 seeds, with values after ± being 1.96 times the standard error (half-width of the 95% confidence interval). Best values and ties w.r.t. two-sided z-test are in bold, second best underlined.
| Method | 10×ECE | NLL | ||
|---|---|---|---|---|
| ID | OOD | ID | OOD | |
| Base | ||||
| DAC | ||||
| HTS | ||||
| IOP-IO-Clip | ||||
| IROVA | ||||
| TS | ||||
| TrustMix (ours) | ||||
G Detailed BO results

BO Best Value on Ackley (2-dim, 20 init. points)
BO Best Value on Michalewicz (2-dim, 20 init. points)

BO Best Value on Michalewicz (10-dim, 5000 init. points)
BO Best Value on Levy (2-dim, 20 init. points)
BO Best Value on Levy (10-dim, 5000 init. points)
BO Best Value on Rastrigin (2-dim, 20 init. points)
BO Best Value on Rastrigin (10-dim, 5000 init. points)
Figure 6: Detailed plots showing the average best value, with confidence intervals, achieved by each algorithm at each iteration (lower is better). Where a method performs substantially differently from the others, an arrow indicates that it lies outside the y-axis limits

BO Best Value on StyblinskiTang (10-dim, 5000 init. points)
BO Best Value on Rosenbrock (2-dim, 20 init. points)
BO Best Value on Rosenbrock (10-dim, 5000 init. points)
BO Best Value on Griewank (2-dim, 20 init. points)
BO Best Value on Griewank (10-dim, 5000 init. points)
Figure 7: Detailed plots showing average based value with confidence intervals achieved by each algorithm by each iteration for each algorithm (lower the better). Where a method has vastly different performance to others, the arrow indicates that it lies outside of the y-axis limits.