Does In-Distribution Temperature Scaling Stay Calibrated Under Shift? A Small Study on Digits Antares-32C Stemma seed corpus https://github.com/mihir-chauhan/research-harness-papers/tree/main/papers/calibration-under-shift-digits Abstract—We ask whether temperature scaling (TS) fitted I. Introduction on in-distribution validation data stays calibrated under dis- tribution shift, on scikit-learn digits with rotation (0–60◦ ) and Gaussian-noise shift of increasing intensity, and, in a revision, A classifier deployed in practice sees inputs that differ on MNIST-C with a small CNN. We reimplement and compare from its training data, and the usefulness of its prob- a single MLP, TS, MC dropout and a 5-member deep ensemble abilities then depends on whether they remain honest. over 11 shift conditions and 5 seeds, reporting accuracy, ECE, NLL and Brier score. In distribution all systems are well Post-hoc temperature scaling is the cheapest calibration calibrated and the TS gain is not statistically supported with fix [1], but it is fitted on data that look like the training 5 seeds. Under shift, ID-fitted TS does not remain calibrated: distribution. Whether the fitted temperature transfers its mean ECE rises from 0.016 in distribution to 0.803 at 60◦ to shifted inputs is an empirical question that large- rotation and 0.618 at noise σ = 1, although it still lowers NLL scale benchmarks have studied on image corruptions [2] relative to the uncalibrated MLP at every shifted condition. An oracle ablation fitting the temperature on shift-matched (building on the corruption benchmark of Hendrycks validation data brings ECE to at most 0.092, but at strong shift and Dietterich [3]), with the conclusion that in-domain only with predictions close to uniform (NLL close to ln 10 at calibration does not carry over reliably [2], [4]. 60◦ ); a uniform predictor has lower ECE (0.002) than the oracle in all 11 conditions, so we claim an informative improvement We ask the same question at a scale where every only where the oracle’s NLL is clearly below that of the uniform cell of the experiment can be run in seconds on a predictor, not a temperature-mismatch mechanism. TS fitted CPU and repeated over five seeds: scikit-learn digits on randomly perturbed validation data reaches an ECE close (8×8 images), an MLP, and two shift families with a to the oracle’s at 30◦ and noise σ = 0.5 (differences from the graded intensity, rotation and additive Gaussian noise. oracle not significant) and lies between ID-fitted TS and the oracle at stronger shifts, but is much worse than ID-fitted TS We compare a single MLP, TS fitted on in-distribution in distribution and at mild shift. Against our pre-registered validation data, MC dropout [5] and a five-member deep expectation, in the untuned main comparison MC dropout had ensemble [6], measured by accuracy, expected calibration lower mean ECE, NLL and Brier than the deep ensemble in error (ECE), negative log-likelihood (NLL) and Brier all 11 conditions (paired differences significant at α = 0.05, score. The question that motivated the study is: does uncorrected, for NLL in all 11 conditions, ECE in 9 and Brier in 7); but in that comparison the MC-dropout network is the only temperature scaling fitted in-distribution stay calibrated regularised model, and when each system selects its dropout under shift? We register five hypotheses in advance (Sec- rate and weight decay from the same grid on validation NLL tion IV), and add an oracle-temperature ablation and two the differences are not significant in MC dropout’s favour for sensitivity sweeps to probe the mechanism. In a revision NLL or Brier in any condition (for ECE in 2 of 11 against the we added input-independent controls for the oracle, TS on tuned ensemble), and on a CNN on MNIST-C the untuned ensemble has the lower mean NLL in 13 of 16 conditions. An perturbed validation data, ensemble and MC dropout plus exploratory decomposition gives clearer support for test-time TS, a regularisation-matched comparison of MC dropout MC averaging than for dropout regularisation during training: and ensembles, an ensemble-size sweep at the severe the deterministic dropout-trained network differs significantly conditions, and a replication with a CNN on MNIST-C. from the MLP in ECE only at noise σ = 1. The study is small (digits, one MLP and one small CNN, 5 seeds, mostly untuned Contributions are modest by design: (i) a small-scale reimplemented baselines) and the conclusions are limited to reproduction of the shift-calibration comparison on a dif- that scale. ferent data modality and two shift families; (ii) an oracle- Index Terms—calibration, distribution shift, temperature temperature ablation with input-independent controls, scaling, deep ensembles, MC dropout which shows what a shift-matched temperature does to ECE, NLL and Brier and where its low ECE coincides with near-uniform predictions; (iii) all code, run logs and tables Antares-32C is the codename of an autonomous study, not a in the repository. Everything is reimplemented here, noth- person. Produced by the Stemma autonomous AI research pipeline; ing is tuned except in the regularisation-matched com- the topic was chosen to cover the field. Every reported number comes from logged runs in the linked repository and every reference was parison, and the conclusions are limited to the datasets, checked against arXiv, Crossref, DataCite or OpenAlex. architectures and shift constructions studied. 1 P II. Related Work p̂(y|x) = M m pθm (y|x). We use no adversarial training Guo et al. [1] showed that modern networks are over- and no proper-scoring-rule variants beyond cross-entropy. confident and introduced temperature scaling (TS), a one- Metrics. With confidence ci = maxk p̂(k|xi ), prediction parameter post-hoc rescaling of the logits fitted on held- ŷi and bins Bb (15 equal-width bins on (0, 1]), out in-distribution data, together with the ECE/NLL X |B | evaluation protocol we use. Ovadia et al. [2] then asked ECE = n b acc(Bb ) − conf(Bb ) , (1) b how predictive uncertainty behaves under dataset shift, X comparing a plain network, TS, MC dropout, deep en- NLL = − n1 log p̂(yi |xi ), (2) sembles and other methods over graded shift intensities XX i 2 on image corruptions and other data; their headline finding Brier = n1 p̂(k|xi ) − ⊮[k = yi ] . (3) was that quality degrades with shift and that ensembles i k were the most robust of the methods they compared. We also report accuracy and the mean confidence c̄. Our setup is a small-scale analogue of that protocol, NLL and Brier are proper scoring rules; ECE depends with corruption-style shift intensities in the spirit of [3]. on binning and is reported alongside them, not instead of Tomani et al. [4] argue that post-hoc calibration fitted them. in-domain breaks under domain drift and propose to fit Shift. For a test image x ∈ [0, 1]64 , rotation by α degrees it on perturbed calibration data; our oracle-temperature (bilinear interpolation, zero fill, no resize) gives Rα x, and ablation is a cheap version of that idea, using validation noise gives clip(x+σε, 0, 1) with ε ∼ N (0, I); the combined data transformed exactly like the test condition. condition applies rotation, then noise. Rotation by α = 0 Deep ensembles [6] average independently trained net- with no noise is the in-distribution condition. works; MC dropout [5] keeps dropout active at test time and averages stochastic passes as an approximation to Shift-aware calibration baselines (added in revision). Bayesian inference, a reading that Le Folgoc et al. [7] TS on perturbed validation data (TS-pert). T is fitted question. Uncertainty Baselines [8] provides tuned large- as above, but on a pool made of the clean validation scale implementations of these and related methods; images and four randomly perturbed copies of them: each Laplace approximations [9], SWAG [10] and architecture- perturbed image is, with probability one half, rotated by diverse ensembles [11] are further approaches that we an angle drawn uniformly from [−60◦ , 60◦ ] and otherwise do not evaluate. We do not propose a new method; corrupted by Gaussian noise whose σ is drawn uniformly the contribution is a controlled, fully reproducible CPU- from [0, 1] (then clipped). The pool does not depend on scale comparison with a mechanism ablation, and its the test condition and the same T is used for every conclusions should be read at that scale. condition, as for ID-fitted TS, but it does use the two shift families and their largest intensities, so it is a III. Method favourable instance of a shift-agnostic procedure in the Let fθ (x) ∈ R be the logits of an MLP (K = 10) and K spirit of [4]. Ensemble+TS and MCD+TS. Ensembles and pθ (y|x) = softmax(fθ (x)). P All networks are trained with MC dropout have no single logit vector, so T is fitted on cross-entropy, L(θ) = − N1 i log pθ (yi |xi ). log p̂(y|x) of the averaged predictive distribution, on ID Single MLP. Prediction p̂(y|x) = pθ (y|x) with a single validation data (“+TS”) or on the perturbed pool (“+TS- trained network. pert”), and applied to the same log p̂ at test time. Temperature scaling (reimplemented from [1]). Controls for the oracle (added in revision). The uniform A scalar T > 0 rescales logits, p̂T (y|x) = predictor p̂(y|x) = 1/K and the class-prior predictor softmax(fθ (x)/T ). P With the network frozen, p̂(y|x) = πy (training class frequencies) ignore x; they T = arg minT − N1v j∈V log p̂T (yj |xj ), optimised over are scored with the same metrics on the same test log T by L-BFGS on an in-distribution validation split images. Beyond the 15-bin equal-width top-label ECE V. The argmax, and hence accuracy, is unchanged. The we report two further diagnostics: ECE-eq, the top-label same T is applied to every shifted test condition. ECE with 15 equal-mass bins (each bin holds the same Oracle TS (ablation). Identical, but V is replaced by the number of test images), and ECE-cw, the classwise ECE P P |Bkb | b n |⊮[y = k]Bkb − p̂(k|x)Bkb | with 15 equal- 1 validation images transformed by the same shift s as the K k test condition, Ts = arg minT NLL(p̂T ; s(V)). This uses width bins per class on the probability of class k. information (the shift) that is unavailable in deployment Regularisation-matched systems (added in revision). and serves only to isolate the mechanism. Each of MLP, MC dropout, ensemble and MC-dropout MC dropout (reimplemented from [5]). The network ensemble picks its regularisation, a dropout rate and is trained with dropout (rate p) after each hidden an L2 weight decay, from one shared grid by NLL on layer; PS at test time dropout stays active and p̂(y|x) = the unshifted validation split (Section IV). A dropout- 1 S s=1 pθ,ϵs (y|x) with S = 20 masks ϵs . regularised ensemble has members trained with dropout Deep ensemble (reimplemented from [6]). M = 5 p and is evaluated either deterministically (dropout off, networks differing in initialisation and minibatch order, members averaged) or with MC dropout (each member averaged over S = 20 stochastic passes, then members runs exactly); the revision adds shift-aware baselines 660, averaged). oracle controls 275, regularisation-matched comparison 385, ensemble size at r60 and n1.0 50 and MNIST-C IV. Experimental Setup 1040 runs (the MNIST-C group also holds 6 failed rows, Data and splits. scikit-learn digits (1797 images, 8×8, from a bug in the MC-dropout path that was fixed before pixel values divided by 16). For each seed s ∈ {0, 1, 2, 3, 4} those runs were repeated; failed rows are excluded from a stratified split gives 1078 training, 269 validation and every aggregate). The registry holds 3122 rows, because 450 test images; the seed also determines network initiali- the main-group runs of the MLP and of TS are listed a sation, minibatch order, dropout masks and noise. Shift is second time in the oracle group, and those of the MLP applied to test images only (and, for the oracle ablation, and of MC dropout in the decomposition group (rh log to the validation images), never to training data. --from-run: copies of logged rows, no new computation), Shift conditions (“tasks”). Eleven conditions: in- so that systems of different groups can be paired by seed; distribution (r0); rotations of 10, 20, 30, 45, 60 degrees in the revision groups the systems needed for pairing were (r10–r60); Gaussian noise with σ ∈ {0.25, 0.5, 0.75, 1.0} instead run again, and their metrics reproduce the main- (n0.25–n1.0); and rotation 30 plus noise σ = 0.5 group runs). Every mean in the text and tables is an (r30+n0.5). The strongest conditions are not mild: on 8×8 aggregate recomputed from the registry when the paper images accuracy falls to chance level for r45/r60 (Table II), is built, and every difference, relative change and paired where ECE is therefore essentially the mean confidence. t-test p-value is a statistic of rh compare; none is typed Systems. All reimplemented in PyTorch in by hand. method/run.py: MLP 64–128–128–10 with ReLU; Revision experiments. (a) Controls and shift-aware Adam, learning rate 1 × 10−3 , batch 64, 100 epochs, baselines (digits, main configuration, 5 seeds, 11 condi- no weight decay, no early stopping. MLP+TS uses tions): the uniform and class-prior predictors, TS-pert, the MLP with T fitted on unshifted validation data; and ensemble/MC-dropout plus TS (Section III); they MC dropout trains the same architecture with dropout reuse the main-configuration networks (same seeds) and p = 0.2 after each hidden layer and averages S = 20 add the diagnostics ECE-eq and ECE-cw. The MLP, stochastic passes; the ensemble has M = 5 MLPs. TS, oracle, MC dropout and ensemble are run again The single MLP is ensemble member 0. All systems inside these groups so that rh compare can pair them share data, splits, optimiser and epochs, and are scored by seed; their metrics reproduce the main-group runs. with the same metric code (15-bin ECE, NLL, Brier, (b) Regularisation-matched comparison (digits, 5 seeds, accuracy, mean confidence). Network weights are cached 11 conditions): the grid is dropout p ∈ {0, 0.2, 0.5} times per (architecture, seed) so that the rows of a seed share L2 weight decay (Adam weight_decay) in {0, 1×10−3 }, six one trained network; training is deterministic. configurations. Every system, MLP, MC dropout, ensem- Tuning budget and tests. None in the main experiments: ble and MC-dropout ensemble, selects one configuration every hyperparameter was fixed before the runs and not per seed with the same criterion (NLL of its own predictor selected on test data (validation data are used only to on the unshifted validation split, the only data used, no fit T ). The sweeps in Section VI are reported, not used shifted data) from the same six configurations, trained for to choose settings. Hypotheses H1–H5 were registered the same epochs (equal tuning budget); ensemble mem- in proposal.md before the main runs. H1, H4 and H5 bers share the selected configuration. The deterministic are tested with paired t-tests over the five seeds at dropout-trained network is the MLP row of this exper- α = 0.05 (no correction for multiple comparisons, so they iment, because the MLP may select a dropout-trained are descriptive); H2 and H3 are comparisons of means over network; the two rows are identical by construction. Two seeds. The dropout decomposition (Section VI) was added untuned control ensembles use dropout p = 0.2 members after seeing the main results and is exploratory. (deterministic and MC). (c) Ensemble size at the severe Compute and provenance of the numbers. Apple-silicon conditions: M ∈ {1, 2, 3, 5, 10} at r60 and n1.0 with the CPU (shared machine), 2 threads, torch CPU. One run five main seeds. (d) MNIST-C with a CNN (below). The takes a few seconds, and the study stayed within the tuning-budget statement above (“None”) applies to every 45-minute compute budget fixed in research.yaml. The other experiment; selection is used only in (b). logged runs are: main 55 runs for each of the four MNIST-C. The first non-toy setting is MNIST-C [12]: systems on digits, oracle 55, dropout decomposition 55, 60000 training and 10000 test images per condition for ensemble-size sweep 45 and dropout-rate sweep 36 (three the plain digits (identity) and 15 corruptions (brightness, conditions, seeds 0–2), and one sanity run (the main canny edges, dotted line, fog, glass blur, impulse noise, group also holds 135 rows for TS, of which those of the motion blur, rotate, scale, shear, shot noise, spatter, stripe, 16 MNIST-C conditions and 5 seeds are the MNIST-C translate, zigzag), 16 conditions in all. Per seed a random temperature-scaling runs registered a second time because split of the training images gives 50000 training and 10000 rh check requires the method’s rows in the main group validation images (the identity ones train the networks; for every task; they repeat the mnistc group’s CNN+TS corrupted versions of the validation images are used only MLP H1 (TS helps in distribution): not supported by the 0.8 TS 0.6 MCD registered test. At r0, TS lowers mean NLL from 0.117 0.6 Ens 0.4 to 0.104 and ECE from 0.018 to 0.016, but the paired ECE 0.4 ECE 0.2 tests give p = 0.094 and p = 0.268 (Table III, Table IV). 0.2 The direction agrees with the hypothesis; five seeds on 0.0 0.0 a 450-image test set cannot show that the in-distribution 0 20 40 60 0.0 0.2 0.4 0.6 0.8 1.0 rotation (degrees) noise sigma gain is real, which is plausible because the MLP is already 10 calibrated here (the fitted T averages 1.522, Table VI). 15 H2 (ID-fitted TS does not stay calibrated): supported 10 for ECE; the NLL clause is refuted. TS ECE is 0.803 at r60 NLL NLL 5 5 and 0.618 at n1.0, versus 0.016 at r0: both exceed twice 0 0 the r0 value, the registered criterion, by a wide margin 0 20 40 60 0.0 0.2 0.4 0.6 0.8 1.0 (Table IV). Even at mild shift ECE rises from 0.016 to rotation (degrees) noise sigma 0.070 at r10 and 0.067 at n0.25 (Table III). The relative ECE change from the MLP to TS shrinks with rotation, Fig. 1. ECE (top) and NLL (bottom) against shift intensity for rotation (left) and noise (right); mean ± SD over 5 seeds. The r0 from −33% at r10 to −3% at r60 (p = 0.099); that point is shared by both families. difference is not significant, but a non-significant paired test on five seeds does not show that TS is equivalent to no calibration at r60, only that these data do not separate by the oracle and perturbed-pool temperatures); the test them; for noise it is −36% at n0.25 and −8% at n1.0. set of each condition is used only for scoring. The CNN The second part of H2 as registered (NLL gain over the has two 3×3 convolutions (16 and 32 channels) with ReLU MLP shrinks with intensity) is wrong: TS lowers NLL and max pooling, a hidden layer of 128 units with ReLU at every shifted condition (the largest paired p is 0.020, and a 10-way output; dropout (for MC dropout, rate at n0.25, Table III) and the absolute gain grows (0.117 0.2, 20 passes) sits after the hidden layer only. Adam, to 0.104 at r0, 15.27 to 11.10 at r60 as in Table I). TS learning rate 1 × 10−3 , batch 128, 4 epochs, no weight therefore reduces the damage under shift, but does not decay or tuning. Systems mirror the digits study: CNN, restore calibration; the reduction is largely a better NLL, TS (ID-fitted on identity validation images), TS-oracle not a calibrated one. (fitted on validation images under the test corruption), H3 (ensemble best on NLL and Brier at severe shift): TS-pert (a pool of clean validation images and four copies refuted. At r60 and n1.0 MC dropout has the lowest NLL with each image carrying a corruption drawn uniformly (10.442 and 5.993) and Brier score (1.616 and 1.246) of from the 15), MC dropout, the dropout-trained CNN the four systems, while the ensemble has NLL 13.874 and evaluated deterministically, 5-member ensembles of plain 8.689 (Tables I, II, and rows H3 of Table IV). The ensemble CNNs and of dropout CNNs (deterministic and MC), and improves on the single MLP in NLL and Brier at every MC dropout/ensemble plus TS (ID and perturbed). Seeds shift, but its NLL is higher than that of TS at every 0–4. The TS-pert pool contains the test corruptions as a condition (r60: 13.874 vs 11.101). family, so it is shift-agnostic only in not knowing which H4 (ensemble ECE below MC dropout at severe shift): corruption is present. not supported at r60, contradicted at n1.0. The observed direction is the opposite at both conditions, but only one V. Results difference is significant. At r60 MCD ECE is lower (0.792 vs 0.820) with p = 0.071, which is not significant, so no We go hypothesis by hypothesis. Per-seed reversal of H4 is established there; at n1.0 (0.555 vs 0.593, standard deviations are in the generated tables paired p = 6.4 × 10−5 ; Table IV) the opposite direction (results/tables/main.md); with five seeds, all verdicts are is significant. MC dropout has the lowest mean ECE and descriptive. NLL in all eleven conditions (paired differences from the Overall picture. Every system is accurate and well ensemble, listed in Table V, are significant at α = 0.05, calibrated in distribution (the largest mean ECE of the uncorrected, for NLL in all 11, ECE in 9 and Brier in 7; four is 0.018, for the MLP, in Table I) and becomes the non-significant ECE cases are r0 and r60), although severely over-confident under shift: for the MLP at r60, at r0 its ECE ties with TS to three decimals (Table I). accuracy is 0.139 (Table II) while mean confidence remains This contradicts the common finding that ensembles are close to 1 (Fig. 2). ECE, NLL and Brier all increase the stronger uncertainty method [2], [6] only for this monotonically with intensity for each family (Fig. 1). untuned comparison, in which the MC-dropout network Accuracy is nearly identical across systems (differences is the only regularised model; the regularisation-matched of at most a few points, e.g. MCD 0.839 vs MLP 0.812 at comparison of Section VI does not reproduce the ordering r10), so the differences below are mainly calibration, not with significance, so we do not offer it as evidence against accuracy. ensembles. TABLE I ECE and NLL (mean over 5 seeds; lower is better, bold marks the lowest mean only, not a significant difference) per shift condition. rα: rotation by α◦ ; nσ: Gaussian noise; MCD: MC dropout; Ens: 5-member ensemble; TS: MLP with ID-fitted temperature. Shift ECE MLP ECE TS ECE MCD ECE Ens NLL MLP NLL TS NLL MCD NLL Ens r0 0.018 0.016 0.016 0.017 0.117 0.104 0.083 0.111 r10 0.104 0.070 0.042 0.078 0.745 0.614 0.491 0.645 r20 0.226 0.161 0.149 0.208 1.954 1.450 1.370 1.687 r30 0.457 0.388 0.361 0.415 4.747 3.365 3.098 3.987 r45 0.816 0.785 0.752 0.803 13.431 9.490 8.639 12.257 r60 0.827 0.803 0.792 0.820 15.266 11.101 10.442 13.874 n0.25 0.105 0.067 0.043 0.083 0.763 0.587 0.479 0.667 n0.5 0.392 0.335 0.280 0.343 4.109 2.903 2.402 3.467 n0.75 0.584 0.524 0.474 0.522 7.746 5.468 4.525 6.597 n1.0 0.674 0.618 0.555 0.593 10.145 7.230 5.993 8.689 r30+n0.5 0.674 0.612 0.579 0.616 9.953 7.048 6.156 8.673 TABLE II Accuracy (higher is better) and Brier score (lower is better), mean over 5 seeds. TS has the same accuracy as MLP by construction. Shift Acc MLP Acc TS Acc MCD Acc Ens BRIER MLP BRIER TS BRIER MCD BRIER Ens r0 0.972 0.972 0.977 0.973 0.047 0.047 0.037 0.045 r10 0.812 0.812 0.839 0.825 0.287 0.271 0.227 0.257 r20 0.650 0.650 0.657 0.653 0.562 0.520 0.502 0.527 r30 0.400 0.400 0.412 0.412 1.012 0.935 0.899 0.949 r45 0.132 0.132 0.139 0.128 1.657 1.606 1.559 1.636 r60 0.139 0.139 0.136 0.131 1.674 1.636 1.616 1.660 n0.25 0.839 0.839 0.861 0.852 0.258 0.241 0.205 0.236 n0.5 0.496 0.496 0.516 0.500 0.867 0.812 0.749 0.813 n0.75 0.301 0.301 0.303 0.301 1.244 1.171 1.097 1.163 n1.0 0.217 0.217 0.225 0.226 1.407 1.331 1.246 1.307 r30+n0.5 0.200 0.200 0.196 0.203 1.425 1.345 1.303 1.354 1.00 102 1.0 ID-fit T oracle T 2 × 101 0.4 4 0.8 mean confidence accuracy 0.75 101 rot0 temperature temperature ECE rot30 NLL 0.6 0.50 101 6 × 100 0.2 noise0.5 2 4 × 1000 0.4 0.25 MLP 3 × 10 0.0 0 TS MCD 2 × 100 5 10 5 10 5 10 0.00 Ens 100 ensemble size M ensemble size M ensemble size M 0.0 0.5 1.0 0 25 50 0.0 0.5 1.0 4 1.0 accuracy rotation (degrees) noise sigma 0.4 0.8 accuracy ECE 0.2 NLL 2 0.6 Fig. 2. Left: mean confidence against accuracy for each system and each of the 11 conditions (points on the dashed line are calibrated 0.4 0.0 0 on average). Middle, right: ID-fitted and oracle temperature (mean 0.2 0.4 0.2 0.4 0.2 0.4 ± SD over 5 seeds) for rotation and noise. dropout rate p dropout rate p dropout rate p Fig. 3. Sweeps over ensemble size (top) and dropout rate (bottom); Where the method fails. (i) At r45 and r60 all four mean ± SD over seeds 0–2. systems are at chance accuracy and mean ECE lies between 0.75 and 0.83: no system is usable and scalar rescaling cannot help (Table I). (ii) The combined shift ECE relative to the ID-fitted T at every severe condition r30+n0.5 gives ECE of 0.612 for TS, higher than either tested (r45, r60, n0.75, n1.0), e.g. r60 0.029 versus 0.803 r30 (0.388) or n0.5 (0.335) alone. (iii) ID-fitted TS is never (the largest paired p of the four is 7.0 × 10−5 , at n0.75, the best system on ECE or NLL outside r0 and is never Table IV), and over all eleven conditions the oracle ECE well calibrated outside r0. stays at or below 0.092 (Table VI). The fitted oracle temperature grows with intensity, from 1.522 at r0 to VI. Ablations and Analysis 57.595 at r60 (Fig. 2, Table VI), whereas the ID-fitted T Oracle temperature (tests H5): supported, with a stays at 1.522. Low ECE with a shift-matched temperature caveat. Fitting T on shift-matched validation data lowers is, however, not enough to call the failure a temperature TABLE III Temperature scaling versus the uncalibrated MLP per shift. ∆ECE% is the change of mean ECE from the MLP to TS relative to the MLP; p is a paired t-test over 5 seeds. Shift ECE MLP ECE TS ∆ECE% p NLL MLP NLL TS p r0 0.018 0.016 −12 0.268 0.117 0.104 0.094 r10 0.104 0.070 −33 0.018 0.745 0.614 0.009 r20 0.226 0.161 −28 0.017 1.954 1.450 0.012 r30 0.457 0.388 −15 0.016 4.747 3.365 0.009 r45 0.816 0.785 −4 0.038 13.431 9.490 0.011 r60 0.827 0.803 −3 0.099 15.266 11.101 0.012 n0.25 0.105 0.067 −36 0.016 0.763 0.587 0.020 n0.5 0.392 0.335 −14 0.017 4.109 2.903 0.016 n0.75 0.584 0.524 −10 0.012 7.746 5.468 0.011 n1.0 0.674 0.618 −8 0.017 10.145 7.230 0.010 r30+n0.5 0.674 0.612 −9 0.020 9.953 7.048 0.010 TABLE IV on only 269 validation images. Whether a practical shift- Registered hypothesis tests. A and B are means over 5 seeds; A−B agnostic procedure, such as perturbing the calibration and the paired t-test p over the 5 seeds are statistics of rh compare. H2 compares the two means with the registered factor of set [4], finds comparable temperatures is tested in the two and H3 compares means only; in H3, A is MC dropout, the paragraph on TS-pert below. best system other than the ensemble (B). A p that would print as Controls for the oracle: input-independent predictors zero is given in scientific notation. and further ECE variants (added in revision). Two predic- Hyp. Quantity (A − B) Shift A B A−B p tors that ignore the image, the uniform predictor and the H1 NLL: TS − MLP r0 0.104 0.117 −0.013 0.094 class-prior predictor, are scored on the same test images H1 ECE: TS − MLP r0 0.016 0.018 −0.002 0.268 H2 TS ECE: shifted (A), r0 (B) r60 0.803 0.016 – – (Tables IX and X). Their 15-bin ECE is 0.002 (uniform) H2 TS ECE: shifted (A), r0 (B) n1.0 0.618 0.016 – – H3 NLL: MCD − Ens r60 10.442 13.874 −3.432 – and 0.000 (class prior) in every condition, because they do H3 H3 Brier: MCD − Ens NLL: MCD − Ens r60 n1.0 1.616 5.993 1.660 8.689 −0.044 −2.696 – – not depend on the shift, whereas the oracle’s ECE is higher H3 Brier: MCD − Ens n1.0 1.246 1.307 −0.061 – than the uniform predictor’s in all eleven conditions (e.g. H4 ECE: MCD − Ens r60 0.792 0.820 −0.028 0.071 H4 ECE: MCD − Ens n1.0 0.555 0.593 −0.039 6.4 × 10−5 0.029 at r60 and 0.092 at r30; paired difference significant H5 ECE: TS − Oracle r45 0.785 0.053 0.732 3.6 × 10−6 at α = 0.05, uncorrected, in all eleven, the largest p being H5 ECE: TS − Oracle r60 0.803 0.029 0.773 1.8 × 10−5 H5 ECE: TS − Oracle n0.75 0.524 0.067 0.457 7.0 × 10−5 0.043 at r30+n0.5). A low binned ECE therefore does H5 ECE: TS − Oracle n1.0 0.618 0.045 0.573 9.5 × 10−6 not separate the oracle from a constant predictor. On the proper scoring rules the oracle is better than the uniform TABLE V predictor in all eleven conditions (largest paired p at r60: MC dropout versus the 5-member ensemble per shift: difference of the means over 5 seeds (∆, MC dropout minus ensemble; negative 0.005 for NLL and 0.009 for Brier), but by little at the favours MC dropout) and paired t-test p, uncorrected (scientific strongest shifts: oracle NLL is 2.249 at r45 and 2.279 at notation where four decimals would print as zero). r60 against 2.303 for the uniform predictor, whereas at r30 it is 1.765. The further ECE variants depend on the Shift ∆ECE p ∆NLL p ∆Brier p binning (Table X): at r60 the oracle’s equal-mass ECE r0 −0.002 0.3438 −0.028 0.0064 −0.008 0.0067 is 0.090, against 0.029 with equal-width bins and 0.039 r10 −0.036 0.0088 −0.153 0.0055 −0.031 0.0629 r20 −0.059 0.0139 −0.316 0.0006 −0.025 0.2020 for the uniform predictor. Its classwise ECE is lower than r30 −0.055 0.0149 −0.889 0.0001 −0.051 0.0546 that of ID-fitted TS at r30, r45, r60, n0.5, n0.75, n1.0 r45 −0.051 0.0496 −3.618 0.0001 −0.077 0.0533 r60 −0.028 0.0711 −3.432 0.0001 −0.044 0.0419 and r30+n0.5 but higher at r10, r20 and n0.25 (r10: 0.038 n0.25 −0.040 0.0009 −0.188 0.0011 −0.031 0.0072 versus 0.034), and above the uniform predictor’s in all n0.5 −0.063 0.0010 −1.065 0.0007 −0.064 0.0017 eleven. What the evidence supports is therefore narrower n0.75 −0.048 0.0026 −2.072 0.0002 −0.066 0.0011 n1.0 −0.039 0.0001 −2.696 0.0001 −0.061 0.0003 than a temperature-mismatch account: a temperature r30+n0.5 −0.037 0.0054 −2.517 0.0001 −0.051 0.0016 fitted on shift-matched validation data lowers NLL, Brier and 15-bin ECE relative to the ID-fitted temperature at every shifted condition, and where its predictions remain mismatch, as the controls below show. The caveat is in the clearly better than uniform (r10–r30, n0.25–n0.5) this is NLL columns: the oracle NLL at r60 is 2.279, close to the an improvement of an informative predictor; at r45 and ln 10 of a uniform prediction over ten classes, i.e. the oracle r60 its small ECE comes with predictions that are close to “calibrates” by making predictions nearly uniform. That is uniform, and we do not call them calibrated. We did not calibrated but uninformative; accuracy is unchanged. The test whether the remaining error at moderate shift is due oracle also needs to know the shift, which is not available to the form of the correction (for example a classwise in deployment, and the very large temperatures are fitted temperature vector), so we make no claim about the TABLE VI Oracle ablation: temperature fitted on in-distribution validation data (TS) versus on validation data shifted like the test condition (Orc). The ID-fitted T is constant across shifts by construction. Shift ECE TS ECE Orc NLL TS NLL Orc T TS T Orc r0 0.016 0.016 0.104 0.104 1.522 1.522 r10 0.070 0.056 0.614 0.561 1.522 2.197 r20 0.161 0.076 1.450 1.103 1.522 3.438 r30 0.388 0.092 3.365 1.765 1.522 6.737 r45 0.785 0.053 9.490 2.249 1.522 33.365 r60 0.803 0.029 11.101 2.279 1.522 57.595 n0.25 0.067 0.043 0.587 0.504 1.522 2.520 n0.5 0.335 0.067 2.903 1.511 1.522 5.692 n0.75 0.524 0.067 5.468 1.974 1.522 10.676 n1.0 0.618 0.045 7.230 2.136 1.522 16.211 r30+n0.5 0.612 0.033 7.048 2.189 1.522 18.446 TABLE VII Dropout decomposition (exploratory): MLP, the dropout-trained network evaluated deterministically with dropout off (Det), and MC dropout with 20 passes (MCD). Means over 5 seeds. Shift Acc MLP Acc Det Acc MCD ECE MLP ECE Det ECE MCD NLL Det NLL MCD r0 0.972 0.976 0.977 0.018 0.018 0.016 0.084 0.083 r10 0.812 0.840 0.839 0.104 0.070 0.042 0.538 0.491 r20 0.650 0.653 0.657 0.226 0.203 0.149 1.594 1.370 r30 0.400 0.412 0.412 0.457 0.427 0.361 3.732 3.098 r45 0.132 0.139 0.139 0.816 0.787 0.752 10.575 8.639 r60 0.139 0.135 0.136 0.827 0.820 0.792 12.702 10.442 n0.25 0.839 0.858 0.861 0.105 0.080 0.043 0.556 0.479 n0.5 0.496 0.512 0.516 0.392 0.360 0.280 3.059 2.402 n0.75 0.301 0.310 0.303 0.584 0.553 0.474 5.869 4.525 n1.0 0.217 0.227 0.225 0.674 0.643 0.555 7.791 5.993 r30+n0.5 0.200 0.198 0.196 0.674 0.654 0.579 7.707 6.156 TABLE VIII at r0 (p = 0.000), 0.388 versus 0.070 at r10 and 0.339 Sensitivity sweeps (mean over seeds 0–2, conditions r0, r30, n0.5): versus 0.067 at n0.25, with NLL 0.535 versus 0.104 at r0. ensemble size M and dropout rate p. The M = 5 and p = 0.2 rows are deliberate re-runs of the main configuration on 3 of the 5 seeds. The crossover lies between r20 and r30 and between n0.25 and n0.5: at r20 TS-pert has the higher ECE (p = 0.044) Sweep Value ECE r0 NLL r0 ECE r30 NLL r30 ECE n0.5 NLL n0.5 and the lower NLL, though not significantly (p = 0.211). M M 1 2 0.016 0.017 0.098 0.095 0.452 0.452 4.560 4.401 0.404 0.370 4.367 3.984 Its fitted temperature, 6.48 against 1.52 for the ID fit, M 3 0.015 0.094 0.424 3.978 0.354 3.715 is that of a pool in which most images are strongly M 5 0.015 0.092 0.419 3.853 0.353 3.589 M 10 0.014 0.091 0.401 3.726 0.345 3.449 perturbed. TS-pert therefore has an ECE not significantly p 0.1 0.014 0.078 0.417 3.524 0.343 3.088 different from the oracle’s at r30 and n0.5 (which does not p 0.2 0.015 0.071 0.364 3.045 0.295 2.515 p 0.3 0.021 0.073 0.336 2.721 0.260 2.218 show equivalence) and lies between ID-fitted TS and the p 0.5 0.038 0.095 0.245 2.178 0.194 1.760 oracle at the stronger conditions, but is worse than ID- fitted TS at the mild conditions (r10, r20, n0.25) where predictions are most informative, and it costs calibration mechanism. in distribution; the pool uses the two shift families of the Shift-agnostic temperature scaling and post-hoc calibra- test conditions and their largest intensities, so this is a tion of ensembles and MC dropout (added in revision). TS- favourable instance of a shift-agnostic procedure. ID-fitted pert fits T on the clean validation images plus randomly TS on the other systems does not change the conclusion perturbed copies (Section III); Tables XI–XIII give ECE, that an ID-fitted temperature does not stay calibrated: NLL and paired differences. At r30 and n0.5, TS-pert at r60 the ECE is 0.798 for ensemble+TS and 0.797 for reaches ECE 0.092 and 0.079, against 0.092 and 0.067 MCD+TS, and at r30 ensemble+TS lowers ECE from for the oracle (paired p = 0.97 and 0.27) and 0.388 and 0.415 to 0.355 while MCD+TS leaves MC dropout’s 0.361 0.335 for ID-fitted TS; at the severe conditions it is far at 0.375. With the perturbed pool, MCD and ensemble below ID-fitted TS but still above the oracle (r60: 0.432, land close to TS-pert on the single MLP at r30 (ECE 0.029 and 0.803). At mild shift and in distribution it is 0.090, 0.097 and 0.092; NLL 1.746, 1.718 and 1.767), which much worse than ID-fitted TS: ECE 0.354 versus 0.016 TABLE IX Oracle controls (5 seeds). Orc: oracle TS; Unif: uniform predictor; Prior: class-prior predictor. ∆ is oracle minus uniform (negative: the oracle is better) and p the paired t-test over 5 seeds, uncorrected. Shift ECE Orc ECE Unif ECE Prior NLL Orc NLL Unif NLL Prior Brier Orc Brier Unif Brier Prior ∆NLL p ∆Brier p r0 0.016 0.002 0.000 0.104 2.303 2.302 0.047 0.900 0.900 −2.199 3.4 × 10−10 −0.853 4.9 × 10−10 r10 0.056 0.002 0.000 0.561 2.303 2.302 0.265 0.900 0.900 −1.742 1.7 × 10−7 −0.635 9.7 × 10−7 r20 0.076 0.002 0.000 1.103 2.303 2.302 0.482 0.900 0.900 −1.200 9.7 × 10−6 −0.418 9.1 × 10−6 r30 0.092 0.002 0.000 1.765 2.303 2.302 0.735 0.900 0.900 −0.538 0.0004 −0.165 0.0021 r45 0.053 0.002 0.000 2.249 2.303 2.302 0.887 0.900 0.900 −0.053 0.0025 −0.013 0.0068 r60 0.029 0.002 0.000 2.279 2.303 2.302 0.894 0.900 0.900 −0.024 0.0049 −0.006 0.0093 n0.25 0.043 0.002 0.000 0.504 2.303 2.302 0.234 0.900 0.900 −1.798 1.3 × 10−6 −0.666 2.3 × 10−6 n0.5 0.067 0.002 0.000 1.511 2.303 2.302 0.667 0.900 0.900 −0.792 0.0001 −0.233 0.0002 n0.75 0.067 0.002 0.000 1.974 2.303 2.302 0.823 0.900 0.900 −0.328 0.0003 −0.077 0.0003 n1.0 0.045 0.002 0.000 2.136 2.303 2.302 0.865 0.900 0.900 −0.167 0.0006 −0.035 0.0004 r30+n0.5 0.033 0.002 0.000 2.189 2.303 2.302 0.876 0.900 0.900 −0.114 0.0018 −0.024 0.0023 TABLE X Oracle analysis with ECE variants other than the 15-bin equal-width top-label ECE (mean over 5 seeds): ECE-eq is the top-label ECE with 15 equal-mass bins and ECE-cw the classwise ECE (Section III). TS: ID-fitted TS. Shift ECE-eq TS ECE-eq Orc ECE-eq Unif ECE-eq Prior ECE-cw TS ECE-cw Orc ECE-cw Unif ECE-cw Prior r0 0.011 0.011 0.039 0.047 0.008 0.008 0.001 0.001 r10 0.070 0.057 0.039 0.047 0.034 0.038 0.001 0.001 r20 0.162 0.080 0.039 0.047 0.056 0.058 0.001 0.001 r30 0.388 0.109 0.039 0.047 0.098 0.071 0.001 0.001 r45 0.784 0.102 0.039 0.047 0.167 0.033 0.001 0.001 r60 0.801 0.090 0.039 0.047 0.169 0.020 0.001 0.001 n0.25 0.065 0.046 0.039 0.047 0.025 0.026 0.001 0.001 n0.5 0.333 0.079 0.039 0.047 0.081 0.051 0.001 0.001 n0.75 0.522 0.067 0.039 0.047 0.119 0.048 0.001 0.001 n1.0 0.617 0.066 0.039 0.047 0.137 0.039 0.001 0.001 r30+n0.5 0.611 0.058 0.039 0.047 0.140 0.040 0.001 0.001 TABLE XI ECE of the shift-aware calibration baselines (mean over 5 seeds). TSp: TS fitted on perturbed validation data; Orc: oracle TS; MCD, Ens: MC dropout and 5-member ensemble; “+TS”: ID-fitted T on log p̂; “+TSp”: perturbed-pool T . Shift MLP TS TSp Orc MCD MCD+TS MCD+TSp Ens Ens+TS Ens+TSp r0 0.018 0.016 0.354 0.016 0.016 0.021 0.305 0.017 0.019 0.320 r10 0.104 0.070 0.388 0.056 0.042 0.059 0.382 0.078 0.055 0.378 r20 0.226 0.161 0.263 0.076 0.149 0.157 0.252 0.208 0.154 0.251 r30 0.457 0.388 0.092 0.092 0.361 0.375 0.090 0.415 0.355 0.097 r45 0.816 0.785 0.392 0.053 0.752 0.761 0.387 0.803 0.776 0.397 r60 0.827 0.803 0.432 0.029 0.792 0.797 0.453 0.820 0.798 0.433 n0.25 0.105 0.067 0.339 0.043 0.043 0.049 0.332 0.083 0.060 0.332 n0.5 0.392 0.335 0.079 0.067 0.280 0.290 0.101 0.343 0.293 0.083 n0.75 0.584 0.524 0.144 0.067 0.474 0.488 0.118 0.522 0.471 0.127 n1.0 0.674 0.618 0.241 0.045 0.555 0.567 0.199 0.593 0.542 0.201 r30+n0.5 0.674 0.612 0.217 0.033 0.579 0.593 0.209 0.616 0.561 0.199 are means without a paired test between these systems. untuned one of the main comparison under shift (r60 Regularisation-matched comparison of MC dropout and NLL 9.752 against 13.874). MC dropout (tuned) has ensembles (added in revision). In Tables XIV–XVI every the lower mean ECE than the tuned ensemble in 9 of system picks its regularisation from the same six config- 11 conditions and the lower mean NLL and Brier in urations by validation NLL (Section IV). The selected 7 of 11, and lower mean ECE than the ensemble of dropout rate averages 0.32 for MC dropout, 0.38 for dropout-trained members with MC dropout in 9 of 11 the MLP (the same network, evaluated deterministically, conditions and lower mean NLL and Brier in 10 of 11 is the dropout-trained deterministic baseline) and 0.50 (Table XVI). The paired differences are mostly within for the ensemble, so tuning moves the single MLP and seed noise: against the tuned ensemble MC dropout is the ensemble members towards the dropout-regularised significantly better at α = 0.05 (uncorrected) only for regime. The tuned ensemble is much better than the ECE at n0.25 (p = 0.040) and r20 (p = 0.032) and TABLE XII NLL of the shift-aware calibration baselines (mean over 5 seeds); abbreviations as in Table XI. Shift MLP TS TSp Orc MCD MCD+TS MCD+TSp Ens Ens+TS Ens+TSp r0 0.117 0.104 0.535 0.104 0.083 0.095 0.445 0.111 0.103 0.474 r10 0.745 0.614 1.020 0.561 0.491 0.532 0.926 0.645 0.566 0.958 r20 1.954 1.450 1.298 1.103 1.370 1.507 1.251 1.687 1.358 1.239 r30 4.747 3.365 1.767 1.765 3.098 3.490 1.746 3.987 3.090 1.718 r45 13.431 9.490 2.869 2.249 8.639 9.742 2.864 12.257 9.115 2.834 r60 15.266 11.101 3.155 2.279 10.442 11.539 3.206 13.874 10.315 3.037 n0.25 0.763 0.587 0.855 0.504 0.479 0.524 0.785 0.667 0.562 0.811 n0.5 4.109 2.903 1.514 1.511 2.402 2.687 1.464 3.467 2.693 1.495 n0.75 7.746 5.468 2.084 1.974 4.525 5.107 2.015 6.597 5.030 2.054 n1.0 10.145 7.230 2.458 2.136 5.993 6.773 2.372 8.689 6.592 2.404 r30+n0.5 9.953 7.048 2.492 2.189 6.156 6.980 2.456 8.673 6.576 2.459 TABLE XIII TS on perturbed validation data (TSp) minus ID-fitted TS (columns 2–5) and minus oracle TS (columns 6–9): difference of means over 5 seeds and paired t-test p, uncorrected; positive means TSp is higher (worse). Shift ∆ECE p ∆NLL p ∆ECE p ∆NLL p −4 −4 r0 0.338 3.7 × 10 0.431 0.001 0.338 3.7 × 10 0.431 0.001 r10 0.318 0.002 0.407 0.006 0.332 3.9 × 10−4 0.459 0.001 r20 0.101 0.044 −0.152 0.211 0.187 0.001 0.195 0.006 r30 −0.296 0.004 −1.598 0.006 0.000 0.967 0.002 0.274 r45 −0.393 4.3 × 10−5 −6.621 0.002 0.339 5.6 × 10−5 0.620 0.001 r60 −0.371 1.7 × 10−5 −7.946 0.002 0.403 2.7 × 10−4 0.876 5.7 × 10−5 n0.25 0.272 1.2 × 10−4 0.269 0.002 0.296 1.4 × 10−5 0.351 8.2 × 10−5 n0.5 −0.256 4.5 × 10−4 −1.389 0.005 0.012 0.273 0.003 0.415 n0.75 −0.380 1.7 × 10−5 −3.384 0.002 0.078 0.010 0.110 0.001 n1.0 −0.377 1.5 × 10−5 −4.772 0.002 0.196 4.2 × 10−5 0.322 6.2 × 10−5 r30+n0.5 −0.395 1.3 × 10−5 −4.557 0.003 0.184 3.8 × 10−4 0.303 3.9 × 10−4 TABLE XIV than the tuned ensemble in distribution. What we can say Regularisation-matched comparison: mean selected dropout rate is that the main-comparison advantage is consistent with and weight decay over 5 seeds (selection by validation NLL from the same six configurations). MLP: single network (also the a difference in regularisation and tuning; we cannot say deterministic dropout-trained network); Ens-MC: ensemble that MC dropout is better or worse than a regularisation- evaluated with MC dropout. matched ensemble. The selection used six configurations and the unshifted validation split only; a larger grid, early System mean selected p mean selected weight decay stopping or selection on perturbed validation data might MLP/Det 0.38 6.0 × 10−4 change the ordering. MCD 0.32 2.0 × 10−4 Why does MC dropout win? A decomposition (ex- Ens 0.50 2.0 × 10−4 ploratory). The dropout-trained network evaluated deter- Ens-MC 0.16 0.0 ministically (Det) is not identical to the MLP: its ECE is between MLP and MCD at most conditions (e.g. r30 0.457, 0.427, 0.361; n1.0 0.674, 0.643, 0.555; Table VII), never for NLL or Brier, and it is significantly worse for while at r0 the three are close (0.018, 0.018 and 0.016). NLL and Brier at r0 (p = 0.018 and 0.011); against Accuracy of Det is higher than the MLP at r10 (0.840 vs the dropout-trained ensemble with MC dropout it is 0.812) and n0.25 (0.858 vs 0.839). The paired Det-versus- significantly better in no condition and significantly worse MLP ECE differences are not significant at r0 (p = 0.95), for NLL and Brier at r0 (p = 0.004 and 0.019). So the r30 (p = 0.086) or r60 (p = 0.37) and only at n1.0 main comparison’s result, MC dropout best on NLL in (p = 0.004), whereas Det versus MCD is significant at all 11 conditions with significant differences, does not r30, r60 and n1.0 (the largest p is 0.023, at r60) but survive matching the regularisation: with five seeds the not at r0 (p = 0.47). So the evidence that MC averaging regularisation-matched differences are not distinguishable at test time contributes is clearer than that for dropout from zero under shift, although the means mostly still regularisation, which may also contribute, and a part of favour MC dropout, and the tuned MC dropout is worse MC dropout’s advantage over the ensemble is a property TABLE XV Regularisation-matched comparison (mean over 5 seeds). MLP/Det, MCD, Ens, Ens-MC: single network, MC dropout, 5-member ensemble and ensemble with MC dropout, each with its own validation-selected regularisation; EnsD and EnsD-MC: ensembles of dropout-trained members (dropout p = 0.2, untuned), evaluated deterministically and with MC dropout. Shift ECE MLP/Det ECE MCD ECE Ens ECE Ens-MC ECE EnsD ECE EnsD-MC NLL MLP/Det NLL MCD NLL Ens NLL Ens-MC NLL EnsD NLL EnsD-MC r0 0.018 0.027 0.015 0.019 0.015 0.020 0.083 0.092 0.075 0.084 0.080 0.079 r10 0.051 0.051 0.044 0.047 0.051 0.039 0.458 0.457 0.416 0.494 0.493 0.460 r20 0.157 0.096 0.145 0.150 0.184 0.132 1.279 1.168 1.156 1.279 1.376 1.195 r30 0.363 0.281 0.347 0.352 0.392 0.338 2.833 2.502 2.573 2.912 3.235 2.708 r45 0.696 0.686 0.734 0.767 0.782 0.753 7.648 6.832 8.098 8.501 9.749 7.839 r60 0.745 0.732 0.776 0.801 0.818 0.795 9.158 8.260 9.752 10.116 11.719 9.432 n0.25 0.047 0.035 0.045 0.049 0.067 0.039 0.377 0.409 0.357 0.479 0.501 0.438 n0.5 0.242 0.204 0.233 0.272 0.318 0.260 1.942 1.855 1.905 2.367 2.737 2.157 n0.75 0.432 0.392 0.426 0.457 0.507 0.441 3.820 3.466 3.760 4.438 5.206 4.000 n1.0 0.539 0.490 0.522 0.533 0.583 0.517 5.197 4.613 5.099 5.866 6.895 5.279 r30+n0.5 0.558 0.510 0.534 0.557 0.604 0.546 5.368 4.816 5.180 5.998 6.858 5.464 TABLE XVI Regularisation-matched comparison: tuned MC dropout minus the tuned ensemble (columns 2–7) and minus the dropout-trained ensemble with MC dropout (columns 8–13); difference of means over 5 seeds (∆, negative favours MC dropout) and paired t-test p, uncorrected (scientific notation where four decimals would print as zero). Shift ∆ECE p ∆NLL p ∆Brier p ∆ECE p ∆NLL p ∆Brier p r0 0.012 0.0792 0.017 0.0184 0.005 0.0107 0.007 0.1761 0.014 0.0039 0.004 0.0193 r10 0.007 0.4412 0.040 0.0936 0.016 0.1067 0.012 0.0745 −0.003 0.8348 −0.001 0.8066 r20 −0.050 0.0320 0.012 0.9006 −0.008 0.6517 −0.036 0.0634 −0.027 0.7307 −0.013 0.1777 r30 −0.066 0.1051 −0.071 0.7884 −0.035 0.4399 −0.057 0.1026 −0.206 0.3974 −0.054 0.1655 r45 −0.048 0.3238 −1.267 0.2279 −0.065 0.3928 −0.067 0.0718 −1.007 0.2255 −0.098 0.0840 r60 −0.044 0.4216 −1.492 0.2866 −0.072 0.3806 −0.062 0.1584 −1.172 0.2980 −0.095 0.1532 n0.25 −0.010 0.0403 0.052 0.2771 0.021 0.2532 −0.004 0.6641 −0.029 0.3546 −0.011 0.2981 n0.5 −0.030 0.5044 −0.051 0.8656 0.016 0.8223 −0.056 0.1479 −0.302 0.2389 −0.059 0.1713 n0.75 −0.034 0.4836 −0.294 0.6101 −0.018 0.8142 −0.049 0.1730 −0.535 0.2825 −0.063 0.1952 n1.0 −0.032 0.4851 −0.485 0.5202 −0.035 0.6084 −0.027 0.4244 −0.666 0.3046 −0.050 0.2759 r30+n0.5 −0.024 0.6385 −0.365 0.6174 −0.022 0.7433 −0.037 0.2622 −0.649 0.3179 −0.048 0.2932 TABLE XVII stripe 0.039, fog 0.057), with NLL (translate 1.504) below Ensemble size at the severe conditions, five seeds (0–4): mean ECE, the ln 10 of a uniform prediction, so predictions are not NLL and Brier of the M -member ensemble at r60 and n1.0, and the main-run MC dropout for reference. near-uniform here. TS on the corrupted validation pool is mixed: it is better than ID-fitted TS at translate (0.237), M ECE r60 NLL r60 Brier r60 ECE n1.0 NLL n1.0 Brier n1.0 stripe (0.130) and canny edges (0.084), and worse in 1 0.827 15.266 1.674 0.674 10.145 1.407 2 0.825 15.010 1.673 0.624 9.404 1.349 distribution (0.014) and at fog (0.221); this pool contains 3 0.814 14.149 1.657 0.602 8.984 1.318 each test corruption as one of its 15 families. ID-fitted TS 5 0.820 13.874 1.660 0.593 8.689 1.307 10 0.817 13.725 1.655 0.584 8.305 1.288 on the ensemble lowers ECE at fog (0.242 to 0.162) and MC dropout 0.792 10.442 1.616 0.555 5.993 1.246 raises it at translate (0.206 to 0.253); for MC dropout the changes are also mixed (Table XX). The MC-dropout- versus-ensemble ordering of the digits study does not of the differently trained network rather than of its test- replicate: the untuned 5-CNN ensemble has the lower time Bayesian approximation (cf. [7]). We did not test a mean NLL in 13 of 16 conditions and the lower mean Brier dropout-regularised ensemble, which would be the natural score in 14 of 16, significantly so (uncorrected, α = 0.05) controlled comparison. for NLL in 3 and Brier in 4 conditions and never in MC MNIST-C with a small CNN (added in revision). The dropout’s favour, while MC dropout has the lower mean corruptions of MNIST-C are far less destructive than ECE in 13 of 16 conditions (significantly in its favour in 1 rotating 8×8 digits (Tables XVIII–XXI): the CNN’s ac- and in the ensemble’s favour in 1). The ensemble is also the curacy is 0.986 in distribution and ranges from 0.492 more accurate system in most conditions (e.g. brightness (translate) to 0.972 (spatter). ID-fitted TS changes little: 0.847 against 0.783), which ECE ignores. Against the the fitted T is 1.02, and its ECE is 0.003 in distribution, ensemble of dropout-trained CNNs with MC dropout, MC small for several corruptions (spatter 0.006, shot noise dropout has the lower mean ECE in 12 of 16 conditions 0.014) and large for translate (0.301), stripe (0.177), canny (significantly in 10, and in the ensemble’s favour in 1) but edges (0.124) and fog (0.130). So the finding that an ID- the higher NLL in 14 of 16 and the higher Brier score in fitted temperature does not stay calibrated replicates for all 16 (significantly in 2 and 6 conditions). The dropout- those corruptions but not as a uniform collapse. The oracle trained CNN evaluated deterministically has ECE close temperature lowers ECE strongly there (translate 0.025, to the plain CNN at translate (0.310 against 0.306) and TABLE XVIII MNIST-C, small CNN (mean over 5 seeds; test sets of 10000 images per condition): ECE and NLL of the CNN, ID-fitted TS, MC dropout and the 5-CNN ensemble, and accuracy of the CNN and of MC dropout. Shift ECE CNN ECE TS ECE MCD ECE Ens NLL CNN NLL TS NLL MCD NLL Ens Acc CNN Acc MCD identity 0.003 0.003 0.008 0.009 0.041 0.041 0.042 0.036 0.986 0.987 brightness 0.075 0.077 0.063 0.090 0.572 0.573 0.602 0.453 0.799 0.783 canny_edges 0.128 0.124 0.088 0.063 0.993 0.980 0.897 0.806 0.710 0.718 dotted_line 0.006 0.005 0.014 0.020 0.137 0.136 0.129 0.123 0.955 0.958 fog 0.123 0.130 0.177 0.242 1.048 1.058 1.178 0.915 0.698 0.672 glass_blur 0.052 0.056 0.077 0.084 0.214 0.218 0.229 0.204 0.939 0.942 impulse_noise 0.027 0.024 0.028 0.039 0.419 0.416 0.317 0.344 0.862 0.894 motion_blur 0.048 0.052 0.071 0.081 0.221 0.224 0.220 0.212 0.936 0.944 rotate 0.030 0.028 0.008 0.008 0.329 0.326 0.293 0.269 0.896 0.903 scale 0.035 0.039 0.060 0.081 0.297 0.300 0.286 0.289 0.902 0.913 shear 0.005 0.006 0.016 0.020 0.139 0.139 0.131 0.115 0.955 0.960 shot_noise 0.012 0.014 0.023 0.030 0.103 0.104 0.098 0.091 0.968 0.972 spatter 0.006 0.006 0.014 0.019 0.088 0.088 0.085 0.077 0.972 0.974 stripe 0.180 0.177 0.112 0.059 1.212 1.179 0.956 0.790 0.680 0.697 translate 0.306 0.301 0.264 0.206 2.363 2.323 2.080 1.889 0.492 0.478 zigzag 0.060 0.058 0.027 0.027 0.458 0.449 0.356 0.408 0.862 0.880 TABLE XIX MNIST-C, additional systems (mean over 5 seeds): oracle TS (TS-orc), TS on a pool of randomly corrupted validation images (TS-pert), the dropout-trained CNN evaluated deterministically (Det), and ensembles of 5 dropout-trained CNNs, deterministic (EnsD) and with MC dropout (EnsD-MC). Shift ECE TS-orc ECE TS-pert ECE Det ECE EnsD ECE EnsD-MC NLL TS-orc NLL TS-pert NLL Det NLL EnsD NLL EnsD-MC identity 0.003 0.014 0.003 0.008 0.014 0.041 0.049 0.039 0.034 0.039 brightness 0.038 0.089 0.061 0.112 0.133 0.534 0.571 0.592 0.469 0.492 canny_edges 0.051 0.084 0.110 0.053 0.041 0.824 0.868 0.935 0.779 0.770 dotted_line 0.006 0.022 0.008 0.020 0.034 0.136 0.144 0.125 0.112 0.122 fog 0.057 0.221 0.166 0.293 0.304 0.986 1.143 1.166 0.989 1.007 glass_blur 0.006 0.119 0.061 0.088 0.104 0.185 0.286 0.213 0.201 0.220 impulse_noise 0.015 0.028 0.014 0.057 0.075 0.407 0.412 0.309 0.275 0.292 motion_blur 0.008 0.113 0.054 0.081 0.099 0.197 0.287 0.203 0.203 0.222 rotate 0.007 0.009 0.021 0.008 0.024 0.314 0.315 0.297 0.256 0.261 scale 0.008 0.102 0.036 0.077 0.102 0.283 0.357 0.266 0.271 0.297 shear 0.007 0.028 0.005 0.020 0.032 0.139 0.151 0.126 0.105 0.115 shot_noise 0.004 0.045 0.012 0.026 0.037 0.100 0.129 0.090 0.080 0.091 spatter 0.004 0.026 0.006 0.017 0.027 0.088 0.101 0.080 0.071 0.080 stripe 0.039 0.130 0.157 0.037 0.035 0.877 1.008 1.067 0.668 0.663 translate 0.025 0.237 0.310 0.217 0.183 1.504 1.918 2.333 1.890 1.731 zigzag 0.016 0.029 0.044 0.018 0.010 0.394 0.403 0.375 0.348 0.344 MC averaging lowers it (0.264), but at fog MC averaging H3 (NLL, Brier) and the direction of the means in H4 are raises it (0.166 to 0.177). In this setting dropout acts only not an artefact of M = 5 at r60 and n1.0 for ensembles of on the hidden layer of the CNN, one network family and up to ten unregularised members; these are comparisons of one dataset, so this is a second data point on the same means (the sweep and the main runs are different groups), kind of digits, not a general result. and the regularisation confound above applies to them. Sensitivity to ensemble size and dropout rate. In Ta- Larger dropout rates reduce shifted ECE and NLL further ble VIII the ensemble’s NLL under r30 falls monotonically (p = 0.5: r30 ECE 0.245, n0.5 ECE 0.194) but worsen from 4.560 (M = 1) to 3.726 (M = 10), and under n0.5 in-distribution calibration (r0 ECE 0.038 versus 0.015 at from 4.367 to 3.449; ECE falls from 0.452 to 0.401 (r30) p = 0.2), a trade-off that the main comparison at p = 0.2 and 0.404 to 0.345 (n0.5). Even M = 10 stays above MC does not reveal. The sweeps use seeds 0–2 only; they are dropout at p = 0.2 on r30 (NLL 3.045, ECE 0.364) and not used to choose p or M , and a rate chosen on shifted n0.5 (NLL 2.515, ECE 0.295). These sweep conditions data would be tuning on the shift. are not the H3/H4 conditions (r60 and n1.0), which the VII. Limitations first sweep did not cover; they are covered by a second sweep with the five main seeds (Table XVII). There the This is a small CPU study and its scope is narrow. ensemble’s NLL falls from 15.266 (M = 1) to 13.725 (i) The main study uses one dataset (8×8 digits), one (M = 10) at r60 and from 10.145 to 8.305 at n1.0, and architecture (a two-hidden-layer MLP) and two synthetic stays above MC dropout’s 10.442 and 5.993; the same shift families; rotation of 8×8 images is destructive, so holds for Brier (M=10: 1.655 and 1.288, MC dropout 1.616 accuracy drops to chance at r45 and r60. The MNIST- and 1.246) and for ECE (M = 10: 0.817 and 0.584, MC C replication adds a small CNN and 15 corruptions of dropout 0.792 and 0.555). So the ordering of the means in 28×28 digits, but it is still handwritten digits, one CNN TABLE XX MNIST-C, MC dropout and ensemble plus TS (mean over 5 seeds): ID-fitted (+TS) and perturbed-pool (+TSp) temperature on log p̂. Shift ECE MCD+TS ECE MCD+TSp ECE Ens+TS ECE Ens+TSp NLL MCD+TS NLL MCD+TSp NLL Ens+TS NLL Ens+TSp identity 0.003 0.012 0.004 0.009 0.039 0.045 0.032 0.036 brightness 0.060 0.074 0.045 0.088 0.608 0.614 0.414 0.450 canny_edges 0.117 0.074 0.102 0.061 0.967 0.866 0.872 0.802 dotted_line 0.006 0.023 0.007 0.021 0.126 0.135 0.117 0.123 fog 0.141 0.205 0.162 0.242 1.160 1.207 0.811 0.914 glass_blur 0.046 0.103 0.047 0.085 0.200 0.257 0.165 0.204 impulse_noise 0.011 0.045 0.012 0.039 0.311 0.327 0.335 0.343 motion_blur 0.042 0.095 0.043 0.081 0.193 0.245 0.176 0.213 rotate 0.021 0.013 0.019 0.009 0.301 0.294 0.280 0.270 scale 0.031 0.085 0.040 0.081 0.265 0.308 0.255 0.289 shear 0.006 0.026 0.007 0.020 0.128 0.138 0.109 0.115 shot_noise 0.011 0.035 0.013 0.030 0.089 0.109 0.077 0.091 spatter 0.005 0.022 0.008 0.019 0.081 0.091 0.069 0.077 stripe 0.140 0.091 0.075 0.056 1.038 0.915 0.844 0.783 translate 0.301 0.237 0.253 0.205 2.333 1.938 2.196 1.889 zigzag 0.042 0.019 0.049 0.027 0.374 0.347 0.447 0.409 TABLE XXI MNIST-C: MC dropout minus the plain ensemble (columns 2–7) and minus the ensemble of dropout-trained CNNs with MC dropout (columns 8–13); difference of means over 5 seeds (negative favours MC dropout) and paired t-test p, uncorrected. Shift ∆ECE p ∆NLL p ∆Brier p ∆ECE p ∆NLL p ∆Brier p identity −0.001 0.2809 0.006 0.0143 0.003 0.0038 −0.006 0.0008 0.002 0.1119 0.003 0.0036 brightness −0.027 0.3770 0.150 0.2163 0.062 0.2907 −0.070 0.0608 0.111 0.3757 0.057 0.3568 canny_edges 0.025 0.2301 0.091 0.3796 0.023 0.4865 0.048 0.0653 0.126 0.1981 0.035 0.2929 dotted_line −0.006 0.1449 0.007 0.3804 0.004 0.3554 −0.019 0.0006 0.007 0.4525 0.007 0.2148 fog −0.065 0.1906 0.263 0.1146 0.077 0.1304 −0.127 0.0512 0.170 0.2460 0.041 0.3195 glass_blur −0.008 0.3677 0.025 0.1102 0.013 0.0565 −0.028 0.0049 0.010 0.3616 0.011 0.0464 impulse_noise −0.012 0.1767 −0.027 0.4586 −0.013 0.4531 −0.047 0.0005 0.025 0.4510 0.018 0.2743 motion_blur −0.009 0.3155 0.007 0.6621 0.004 0.5843 −0.027 0.0095 −0.003 0.7924 0.004 0.4164 rotate 0.000 0.6890 0.024 0.0516 0.011 0.0216 −0.016 5.4 × 10−6 0.032 0.0121 0.015 0.0024 scale −0.020 0.0249 −0.003 0.8421 0.000 0.9666 −0.041 0.0005 −0.011 0.2287 0.001 0.8626 shear −0.004 0.0983 0.016 0.0989 0.007 0.1029 −0.016 2.6 × 10−5 0.016 0.0739 0.010 0.0341 shot_noise −0.007 0.0513 0.007 0.4505 0.004 0.3203 −0.014 1.5 × 10−5 0.007 0.4091 0.007 0.1263 spatter −0.006 0.1244 0.008 0.0032 0.005 0.0039 −0.013 0.0012 0.005 0.0531 0.006 0.0085 stripe 0.053 0.1457 0.166 0.2548 0.064 0.2468 0.077 0.0662 0.293 0.0675 0.111 0.0703 translate 0.059 0.0032 0.191 0.0072 0.076 0.0011 0.082 0.0001 0.349 0.0004 0.078 0.0003 zigzag 0.000 0.9900 −0.053 0.0693 −0.020 0.1158 0.017 0.0930 0.012 0.5907 0.001 0.9302 trained for 4 epochs without tuning, and no natural-image and 269 validation images, and achieves low ECE with benchmark (e.g. CIFAR-10-C) was run, so the conclusions predictions close to uniform at the strongest shifts, where may not transfer to natural images or larger models. (ii) input-independent predictors have lower ECE than it; we Five seeds (three for the sweeps), a 450-image test set make no claim about the mechanism, and it is not a per seed and paired t-tests without multiple-comparison practical method. (vi) Models are cached per seed so rows correction; p-values are descriptive, and the H1 non-result across shifts are not independent trainings; shift noise is a may be a lack of power. (iii) In the main comparison single draw per seed. A fuller study would add corrupted the baselines are reimplemented, not tuned, and the MC- natural-image benchmarks, larger tuning budgets with dropout network differs from the other systems in training early stopping, more seeds, and a proper OOD-detection regularisation, which confounds that comparison (Sec- evaluation. tion VI). The regularisation-matched comparison selects among six configurations (dropout rate and L2 weight VIII. Conclusion decay) on the unshifted validation split only, with no On digits with rotation and noise shift, a temperature early stopping and no larger search; its outcome may fitted on in-distribution validation data did not stay depend on that grid. The MNIST-C runs are untuned. calibrated: TS ECE rose from 0.016 in distribution to The dropout decomposition was exploratory and added 0.803 at r60 and 0.618 at n1.0, although TS still lowered after seeing results. (iv) ECE is a binned estimator that NLL relative to the uncalibrated MLP at all shifted is easily dominated by the mean confidence when accuracy conditions; its relative ECE change against the MLP is near chance; NLL and Brier are shown alongside but shrank to −3% at r60, a difference that is not significant the three metrics are strongly correlated across conditions and does not show equivalence to no calibration. On here. (v) The oracle temperature uses the shift itself MNIST-C with a CNN the ID-fitted temperature left ECE large for some corruptions (translate, stripe, canny edges, [7] L. L. Folgoc, V. Baltatzis, S. Desai, A. Devaraj, S. Ellis, O. E. M. fog) and small for others. A temperature fitted on shift- Manzanera, A. Nair, H. Qiu, J. Schnabel, and B. Glocker, “Is MC Dropout Bayesian?” arXiv preprint arXiv:2110.04286, matched validation data brought ECE to at most 0.092 in 2021. [Online]. Available: https://arxiv.org/abs/2110.04286 all conditions, but the uniform and class-prior predictors [8] Z. Nado, N. Band, M. Collier, J. Djolonga, M. W. have lower ECE than the oracle in every condition and Dusenberry, S. Farquhar, Q. Feng, A. Filos, M. Havasi, R. Jenatton, G. Jerfel, J. Liu, Z. Mariet, J. Nixon, the oracle’s NLL is close to that of the uniform predictor S. Padhy, J. Ren, T. G. J. Rudner, F. Sbahi, Y. Wen, at r45 and r60, so we do not conclude that the failure F. Wenzel, K. Murphy, D. Sculley, B. Lakshminarayanan, is a temperature mismatch; the supported statement is J. Snoek, Y. Gal, and D. Tran, “Uncertainty Baselines: Benchmarks for Uncertainty & Robustness in Deep Learning,” that the shift-matched temperature lowers ECE, NLL arXiv preprint arXiv:2106.04015, 2021. [Online]. Available: and Brier relative to the ID-fitted one and, where its https://arxiv.org/abs/2106.04015 predictions remain clearly better than uniform (r10–r30, [9] E. Daxberger, A. Kristiadi, A. Immer, R. Eschenhagen, M. Bauer, and P. Hennig, “Laplace Redux – Effortless n0.25–n0.5), does so for an informative predictor. TS on Bayesian Deep Learning,” arXiv preprint arXiv:2106.14806, randomly perturbed validation data has an ECE close to 2021. [Online]. Available: https://arxiv.org/abs/2106.14806 the oracle’s at r30 and n0.5 (differences not significant, [10] W. Maddox, T. Garipov, P. Izmailov, D. Vetrov, and A. G. Wilson, “A Simple Baseline for Bayesian Uncertainty in Deep which does not show equivalence) but is worse than Learning,” arXiv preprint arXiv:1902.02476, 2019. [Online]. ID-fitted TS in distribution and at mild shift. In the Available: https://arxiv.org/abs/1902.02476 untuned main comparison MC dropout had the lowest [11] S. Zaidi, A. Zela, T. Elsken, C. Holmes, F. Hutter, and Y. W. Teh, “Neural Ensemble Search for Uncertainty Estimation ECE, NLL and Brier in all 11 conditions, contrary to our and Dataset Shift,” arXiv preprint arXiv:2006.08573, 2020. pre-registered expectation, but that comparison pits the [Online]. Available: https://arxiv.org/abs/2006.08573 one regularised model against unregularised ones: with the [12] N. Mu and J. Gilmer, “MNIST-C: A Robustness Benchmark for Computer Vision,” arXiv preprint arXiv:1906.02337, 2019. regularisation of every system chosen from the same grid [Online]. Available: https://arxiv.org/abs/1906.02337 on validation NLL, MC dropout is not significantly better than the ensemble on NLL or Brier in any condition, and on MNIST-C the ensemble has the lower mean NLL in most conditions. We therefore make no claim that MC dropout is better or worse than a regularisation-matched ensemble. The exploratory decomposition gives clearer support for test-time MC averaging than for dropout regularisation during training (Det versus MLP ECE is significant only at n1.0). The in-distribution benefit of TS was not statistically supported at 5 seeds. These findings are limited to a small MLP on a small dataset, one small CNN on MNIST-C, and a handful of seeds. References [1] C. Guo, G. Pleiss, Y. Sun, and K. Q. Weinberger, “On Calibration of Modern Neural Networks,” arXiv preprint arXiv:1706.04599, 2017. [Online]. Available: https://arxiv.org/ abs/1706.04599 [2] Y. Ovadia, E. Fertig, J. Ren, Z. Nado, D. Sculley, S. Nowozin, J. V. Dillon, B. Lakshminarayanan, and J. Snoek, “Can You Trust Your Model’s Uncertainty? Evaluating Predictive Uncertainty Under Dataset Shift,” arXiv preprint arXiv:1906.02530, 2019. [Online]. Available: https://arxiv.org/abs/1906.02530 [3] D. Hendrycks and T. Dietterich, “Benchmarking Neural Network Robustness to Common Corruptions and Perturbations,” arXiv preprint arXiv:1903.12261, 2019. [Online]. Available: https://arxiv.org/abs/1903.12261 [4] C. Tomani, S. Gruber, M. E. Erdem, D. Cremers, and F. Buettner, “Post-hoc Uncertainty Calibration for Domain Drift Scenarios,” arXiv preprint arXiv:2012.10988, 2020. [Online]. Available: https://arxiv.org/abs/2012.10988 [5] Y. Gal and Z. Ghahramani, “Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning,” arXiv preprint arXiv:1506.02142, 2015. [Online]. Available: https://arxiv.org/abs/1506.02142 [6] B. Lakshminarayanan, A. Pritzel, and C. Blundell, “Simple and Scalable Predictive Uncertainty Estimation using Deep Ensembles,” arXiv preprint arXiv:1612.01474, 2016. [Online]. Available: https://arxiv.org/abs/1612.01474