A Geometric Perspective towards Neural Calibration via Sensitivity Decomposition
Year: 2022

Abstract:
It is well known that vision classification models suffer from poor calibration in the face of data distribution shifts. In this paper, we take a geometric approach to this problem. We propose Geometric Sensitivity Decomposition (GSD) which decomposes the norm of a sample feature embedding and the angular similarity to a target classifier into an instance-dependent and an instance-independent component. The instance-dependent component captures the sensitive information about changes in the input while the instance-independent component represents the insensitive information serving solely to minimize the loss on the training dataset. Inspired by the decomposition, we analytically derive a simple extension to current softmax-linear models, which learns to disentangle the two components during training. On several common vision models, the disentangled model outperforms other calibration methods on standard calibration metrics in the face of out-of-distribution (OOD) data and corruption with significantly less complexity. Specifically, we surpass the current state of the art by 30.8% relative improvement on corrupted CIFAR100 in Expected Calibration Error. Code available at https: //github.com/GT-RIPL/Geometric-Sensitivity-Decomposition.git.

text: It is well known that vision classification models suffer from poor calibration in the face of data distribution shifts. In this paper, we take a geometric approach to this problem. We propose Geometric Sensitivity Decomposition (GSD) which decomposes the norm of a sample feature embedding and the angular similarity to a target classifier into an instance-dependent and an instance-independent component. The instance-dependent component captures the sensitive information about changes in the input while the instance-independent component represents the insensitive information serving solely to minimize the loss on the training dataset. Inspired by the decomposition, we analytically derive a simple extension to current softmax-linear models, which learns to disentangle the two components during training. On several common vision models, the disentangled model outperforms other calibration methods on standard calibration metrics in the face of out-of-distribution (OOD) data and corruption with significantly less complexity. Specifically, we surpass the current state of the art by 30.8% relative improvement on corrupted CIFAR100 in Expected Calibration Error. Code available at https: //github.com/GT-RIPL/Geometric-Sensitivity-Decomposition.git.

heading: 1 Introduction
text: During development, deep learning models are trained and validated on data from the same distribution. However, in the real world sensors degrade and weather conditions change. Similarly, subtle changes in image acquisition and processing can also lead to distribution shift of the input data. This is often known as covariate shift, and will typically decrease the performance (e.g. classification accuracy). However, it has been empirically found that the model’s confidence remains high even when accuracy has degraded [1]. The process of aligning confidence to empirical accuracy is called model calibration. Calibrated probability provides valuable uncertainty information for decision making. For example, knowing when a decision cannot be trusted and more data is needed is important for safety and efficiency in real world applications such as self-driving [2] and active learning [3].
A comprehensive comparison of calibration methods has been studied for in-distribution (IND) data [4], However, these methods lead to unsatisfactory performance under distribution shift [5]. To resolve the problem, high-quality uncertainty estimation [6, 5] is required. Principled Bayesian methods [7] model uncertainty directly but are computationally heavy. Recent deterministic methods [8, 9] propose to improve a model’s sensitivity to input changes by regularizing the model’s intermediate layers. In this context, sensitivity is defined as preserving distance between two different input samples through layers of the model. We would like to utlize the improved sensitivity to better detect
35th Conference on Neural Information Processing Systems (NeurIPS 2021).
Out-of-Distribution (OOD) data. However, these methods introduce added architecture changes and large combinatorics of hyperparameters.
Unlike existing works, we propose to study sensitivity from a geometric perspective. The last linear layer in a softmax-linear model can be decomposed into the multiplication of a norm and a cosine similarity term [10, 11, 12, 13]. Geometrically, the angular similarity dictates the membership of an input and the norm only affects the confidence in a softmax-linear model. Counter-intuitively, the norm of a sample’s feature embedding exhibits little correlation to the hardness of the input [11]. Based on this observation, we explore two questions: 1) why is a model’s confidence insensitive to distribution shift? 2) how do we improve model sensitivity and calibration?
We hypothesize that in part an insensitive norm is responsible for bad calibration especially on shifted data. We observe that the sensitivity of the angular similarity increases with training whereas the sensitivity of the norm remains low. More importantly, calibration worsens during the period when the norm increases while the angular similarity changes slowly. This shows a concrete example of the inability of the norm to adapt when accuracy has dropped. Intuitively, training on clean datasets encourages neural networks to always output increasingly large feature norm to continuously minimize the training loss. Because the probability of the prevalent class of an input is proportional to its norm, larger norms lead to smaller training loss when most training data have been classified correctly (See Sec. 3.1). This renders the norm insensitive to input differences because the model is trained to always output features with large norm on clean data. While we have put forth that the norm is poorly calibrated, we must emphasize that it can still play an important role in model calibration (See Sec. 4.1).
To encourage sensitivity, we propose to decompose the norm of a sample’s feature embedding and the angular similarity into two components: instance-dependent and instance-independent. The instance-dependent component captures the sensitive information about the input while the instanceindependent component represents the insensitive information serving solely to minimize the loss on the training dataset. Inspired by the decomposition, we analytically derive a simple extension to the current softmax-linear model, which learns to disentangle the two components during training. We show that our model outperforms other deterministic methods (despite their significant complexity) and is comparable to multi-pass methods with fewer training hyperparameters in Sec. 4.1.
In summary, our contributions are four fold:
• We study the problem of calibration geometrically and identify that the insensitive norm is responsible for bad calibration under distribution shift.
• We derive a principled but simple geometric decomposition that decomposes the norm into an instance-dependent and instance-independent component.
• Based on the decomposition, we propose a simple training and inference scheme to encourage the norm to reflect distribution changes.
• We achieve state of the art results in calibration metrics in the face of corruptions while having arguably the simplest calibration method to implement.

heading: 2 Related Work
text: Methods dedicated to strengthening calibration can be divided into two camps: multi-pass models and single-pass deterministic models. The current state-of-the-art multi-pass models are: Bayesian Monte Carlo Drop Out (MCDO) [7] and Deep Ensembles [14]. Bayesian methods are the most principled way to model uncertainty. Instead of optimizing max likelihood for a single set of parameters, Bayesian methods obtain a posterior distribution over possible parameters given a prior distribution over parameters and calculated data likelihood assuming some process noise. The posterior distribution over parameters captures epistemic uncertainty or uncertainty due to the limits of what the model knows . The final predictive distribution is obtained by marginalizing out model parameters. While Bayesian methods are theoretically sound, they are intractable in practice. Deep Ensembles averages multiple models trained using different random initialization so they learn different classification functions.
A recent trend is to use a single-pass deterministic non-Bayesian model to improve uncertainty estimation. Two recent works DUQ [8] and SNGP [9] propose to improve uncertainty-awarenesss of
deterministic networks by improving the networks’ sensitivity to input changes. Intuitively, a sensitive model should map samples further from the training data as they become more out-of-distribution. This can be achieved at two levels: feature level and output level. At the feature level, both methods require the feature extractors (CNNs) to be regularized to prevent feature collapse, which is the mapping of two different data points to the same embedded vector. This is ensured by having input distance awareness, which is equivalent to ensuring bi-Lipschitz continuity [15].
In order to achieve this, DUQ [8] uses a two-sided gradient penalty [16] and SNGP [9] uses bounded spectral normalization [15]. The output level needs to reflect the changes in feature space. This can be done by adopting distance-aware classifiers. DUQ [8] uses a RBF networks with learned centroids for each class and SNGP [9] uses an approximate Gaussian Process layer. We were inspired by temperature scaling [4], which is another method for bettering calibration, but fails under distribution shift [5]. Our method does not require input distance awareness and instead leverages the geometric intuitions about the output layer, specifically properties of the norm of the input embedding.

heading: 3 Method
text: Following our hypothesise that the insensitivity of the norm is responsible for bad calibration on distribution shifted data, we propose geometric sensitivity decomposition (GSD) for the norm. We first introduce the geometric perspective of the last linear layer in Sec. 3.1 and then derive GSD in Sec. 3.2. To improve sensitivity of the norm and model calibration on shifted data, we propose a GSD-inspired training and inference procedure in Sec. 3.3 and Sec. 3.4.

heading: 3.1 Norm and Similarity
text: The output layer of a neural network can be written as a dot-product < x,wy >, where x is the embedded input and wy is the weight vector associated with class y. Though seemingly simple there are strong geometric and calibration related intuitions drawn from this. Several prior works [10, 12, 11] have studied the effects decomposition of the last linear layer in a softmax model can have on classification. The output layer can be decomposed into angular similarity cosφy and norm ‖x‖2.
P (y|x) = exp ly∑c j=1 exp lj = exp (‖wy‖2‖x‖2 cosφy)∑c j=1 exp (‖wj‖2‖x‖2 cosφj)
(1)
where ‖wy‖2 is the norm of a specific classifier in the linear layer. We’ll use this geometric view of the linear layer instead of the dot-product representation.
Based on this perspective, we base the foundation of our work on the following observations from prior works [10, 12, 11]: 1) The probability/confidence of the prevalent class of an input is proportional to its norm [12]. 2) While the norm of a feature strongly scales the predictive probability, due to it’s unregularized nature the norm is not sensitive to the hardness of the input [11]. In other words, the norm could be the reason for bad sensitivity of the confidence to input distribution shift. Consequently, the insensitive norm can be causally related to bad calibration. We will examine a strong correlation between the quality of calibration and the magnitude of norm in Sec. 4.2.

heading: 3.2 Geometric Sensitivity Decomposition of Norm and Angular Similarity
text: To motivate the subsequent geometric decomposition, we can revisit the softmax model, P (y|x) ∝ exp (‖wy‖2‖x‖2 cosφy). There are three terms contributing to the magnitude of the exponential function, ‖wy‖2, ‖x‖2 and cosφy. Due to weight regularizations, ‖wy‖2 is most likely very small, while cosφy ∈ [−1, 1]. Therefore, the only way to obtain a high probability/confidence on training data and minimize cross-entropy loss is to 1) push the norm ‖x‖2 to a large value and 2) keep cos |φy| of the ground truth class close to one, i.e., |φy| close to zero. This is further supported by [17], where it was shown that logits of the ground truth class must diverge to infinity in order to minimize cross-entropy loss under gradient descent. In this process, models tend towards large norms and small angles for all training samples.
Therefore, we propose to decompose the norms of features into two components: an instanceindependent scalar offset and an instance-dependent variance factor, which we define in Eq. 2. The role of the instance-independent offset Cx is to minimize the loss on the entire training set and
the instance-dependent component ∆x accounts for differences in samples. Therefore, if we can disentangle the instance-independent component from the instance-dependent component, we can obtain a norm that is sensitive to the hardness of data. Following this logic, we decompose the norm into two components.
‖x‖2 = ‖∆x‖2 + Cx (2)
Similarly, we relax the angles such that the predicted angular similarity does not need to be close to one on the training data, i.e., making the angles larger. To achieve this, we introduce an instanceindependent relaxation angle Cφ and an instance-dependent angle ∆φy. Analogous to the norm decomposition, the scalar Cφ serves solely to minimize the training loss while the instance-dependent ∆φy accounts for differences in samples. Because we need to account for the sign of the angle, we put an absolute value on it.
|φy| = |∆φy| − |Cφ| (3)
The ‖∆x‖2, |∆φy| are the instance-dependent components and Cx, |Cφ| are the instance-independent components. We can rewrite the pre-softmax logits in Eq. 1 with the decomposed norm and angular similarity. (Detailed derivation in Sec. A.1 in the Appendix.)
‖x‖2 cosφy = ‖x‖2 cos |φy| = (‖∆x‖2 + Cx) cos (|∆φy| − |Cφ|) (4)
= (‖∆x‖2 + Cx) 1
cos |Cφ| cos |∆φy|
( 1− sin |Cφ|2 ( 1− cos |Cφ| sin |∆φy|
sin |Cφ| cos |∆φy|
))
We can simplify the equation by assuming cos |φy| is close to one, which means |φy| is small. This is due to the fact that |φy| is the angle between the correct class weight and x, which means as training ensues, the angle converges to 0 and thus the cosine similarity converges to 1. (Please see Sec. A.2 for empirical support.)
cos |Cφ| sin |∆φy| sin |Cφ| cos |∆φy| = sin (|∆φy|+ |Cφ|) + sin |φy| sin (|∆φy|+ |Cφ|)− sin |φy| ≈ 1 (5)
Therefore, Eq. 4, omitting the absolute value on angles because cos is an even function, simplifies:
‖x‖2 cosφy ≈ (‖∆x‖2 + Cx) 1
cos Cφ cos ∆φy (6)
=
( 1
cos Cφ ‖∆x‖2 +
1 cos Cφ Cx ) cos ∆φy
=
( 1
α ‖∆x‖2 +
β
α
) cos ∆φy
Because cos Cφ and Cx are instance-independent, we denote them as α and β respectively. This geometric decomposition of norm and cosine similarity inspires us to include α and β as free trainable parameters in a new network and the network can learn to predict the more inputsensitive ‖∆x‖2 and ∆φy instead of the original ‖x‖2 and φy . While both the angle and norm can be decomposed we direct the focus to the norm as the angle is already calibrated to accuracy [11]. In other words, angles have been shown to be sensitive to input changes in [11].

heading: 3.3 Disentangled Training
text: Following the derivation in Eq 6, we replace the norm, ‖x‖2, in Eq. 1 by ( 1 α‖∆x‖2 + β α ) and φy by ∆φy . ‖∆x‖2 and ∆φy are now learned outputs from a new network instead as shown in Eq. 6:
P (y|x) = exp ly∑c j=1 exp lj = exp (‖wy‖2
( 1 α‖∆x‖2 + β α ) cos ∆φy)∑c
j=1 exp (‖wj‖2 ( 1 α‖∆x‖2 + β α ) cos ∆φj)
(7)
The new model can be trained using the same training procedures as the vanilla network without additional hyperparameter tuning, changing the architecture or extended training time. Even though the outputs of the new network, ‖∆x‖2 and ∆φy , only approximate the original geometric relationships with Eq. 6, the effect of α and β reflects the decomposition in Eq. 3 and Eq. 2.
• β encodes an instance-independent scalar Cx of the norm. A larger β corresponds to a smaller instance-dependent component ‖∆x‖2.
• α encodes the cosine of a relaxation angle Cφ. A larger arccosα corresponds to a larger Cφ and therefore a larger ∆φj .
Because β encodes the independent component, the new feature norm ‖∆x‖2 becomes sensitive to input changes and maps OOD data to lower norms than IND data as we can see in Fig. 3a, 3b. We regularize α such that the instance-independent component Cφ is small. Specifically, we penalize ‖α− 1‖22 because α = cos Cφ, i.e., if α ≈ 1, Cφ ≈ 0. We empirically found that a larger relaxation angle Cφ deteriorates performance because the angular similarity already correlates well with difficulty of data [11] and we do not need to encourage a large relaxation. Sec. 4.3 will empirically verify this.

heading: 3.4 Disentangled Inference
text: The decomposition theory in Sec. 3.2 provides a geometric perspective on the sensitivity of the norm and the angular similarity to input changes and inspires a disentangled model in Sec. 3.3. The new model uses a learnable affine transformation on the norm ‖∆x‖2. Let’s denote the affine transformed norm as the effective norm N (∆x) .= 1α‖∆x‖2 + β α . However, the training only separates the sensitive components of the norm and angular similarity, the model can still be overconfident due to the existence of insensitive components. Therefore, we can improve calibration by modifying insensitive components, e.g., β in our case. We propose a two-step calibration procedure that combines in-distribution calibration (Fig. 1b) and out-of-distribution detection (Fig. 1c) based on two observations: 1) overconfident IND data can be easily calibrated on a validation set, similar to temperature scaling [4]. 2) for OOD data, without access to a calibration set for OOD data, the best strategy is to map them far away from the IND data given that the model clearly distinguishes them.
The first step is calibrating the model on IND validation set (note our method does not rely on OOD validation data), similar to temperature calibration [4]. However, instead of tuning a temperature parameter as shown in Fig. 1a, we simply tune the offset parameter β on the validation set in one of two ways: 1) grid-search based on minimizing Expected Calibration Error (see Sec. 4) 2) SGD optimization based on Negative Log Likelihood [4]. Because these are post-training procedure, both methods are very efficient. We denote the new parameter as β′. As shown in Fig. 1b, by changing the offset, we decrease the magnitude of the norms after the affine transformation. Formally,
N (∆x) = 1 α ‖∆x‖2 + β α → N (∆x) = 1 α ‖∆x‖2 +
β′ α (8)
The second step approximates the calibrated affine mapping in Eq. 8 by a non-linear function which covers a wider range of the effective norm as shown in Eq. 9 and maps OOD data further away from IND data. Intuitively, when a sample is more likely IND, the non-linear function maps it closer to the
calibrated transformation. When a sample is OOD, the non-linear function maps it more aggressively to a smaller magnitude, exponentially away from the IND samples.
N (∆x) = 1 α ‖∆x‖2 +
β′ α (1− e−c‖∆x‖2) (9)
where c is a hyperparameter which can be calculated as in Eq. 10. The non-linear function grows exponentially close to the calibrated affine mapping in Eq. 8 dictated by 1− e−c‖∆x‖2 as shown in 1c. Therefore, e−c‖∆x‖2 can be viewed as an error term that quantifies how close the non-linear function is to the calibrated affine function in Eq. 8. Let µx and σx denote the mean and standard deviation of the distribution of the norm of IND sample embedding calculated on the validation set. We use the heuristic that when evaluated at one standard deviation below the mean, ‖∆x‖2 = µx − σx, the approximation error e−c(µx−σx) = 0.1. Even though the error threshold is a hyperparameter, using an error of 0.1 lead to state-of-the-art results across all models applied.
c = −ln(1− error) µx − σx = −ln(0.9) µx − σx
(10)
In summary, the sensitive norm ‖∆x‖2 is used both as a soft threshold for OOD detection and as a criterion for calibration. While similar post-processing calibration procedure exists, such as temperature scaling [4] (illustrated in Fig. 1a and further introduced in A.9) it only provides good calibration on IND data and does not provide any mechanism to improve calibration on shifted data [5]. Our calibration procedure can improve calibration on both IND and OOD data, without access to OOD data, because the training method extracts the sensitive component in a principled manner. Just as temperature scaling, the non-linear mapping needs only to be calculated once and adds no computation at inference.

heading: 4 Experiments

heading: 4.1 Experiments on Calibration
text: The ultimate goal of the paper is to improve model calibration under distribution shift by improving sensitivity. Popular metrics for measuring calibration include: Negative Log-Likelihood (NLL [18]),
Brier [19] and Expected Calibration Error (ECE [20]). Our goal is for our model is to produce values close to 0 in these metrics, which maximizes calibration. Please refer to Sec. A.3 (Appendix) for more detailed discussion on these metrics. Following prior works [9, 8, 5], we will use CIFAR10 and CIFAR100 as the in-distribution training and testing dataset, and apply the image corruption library provided by [1] to benchmark calibration performance under distribution shift. The library provides 16 types of noises with 5 severity scales. In this section, we show that our model outperforms other deterministic methods (despite their significant complexity
Compared Methods We compare to several popular state-of-the-art models including stochastic Bayesian methods (multi-pass): Deep Ensemble [14] and MC dropout [7], and recent deterministic methods (single pass): SNGP [9] and DUQ [8].
Results In Tab. 1 and 2, we compare our model to the most recent state of art deterministic methods SNGP and DUQ using Wide ResNet 28-10 [21] as the model backbone and each model evaluated using the average of 10 seeds. We report accuracy, ECE and NLL on clean and corrupted CIFAR10/100 datasets [1]. Our method outperforms all single-pass methods on calibration when data is corrupted, and even surpass ensembles on error metrics for corrupted data. We had 2 versions of our model: Grid Searched: grid search β′ on the validation set to minimize ECE and Optimized: optimize β′ on the validation set via gradient decent to minimize NLL for 10 epochs, similar to temperature scaling. We report additional results with ResNet18 in Sec. A.4 and Sec. A.5 (Appendix) with image noise and rotation respectively.
Generalizability We explored how generalizable our method (Grid Searched) is by applying it to 12 different models and 4 different datasets in Tab. 3. We can see consistently that our model had stronger calibration across all models and metrics, including models known to be well calibrated like LeNet [22]. All models were tested on CIFAR10C and CIFAR100C datasets offered by [1] where the original CIFAR10 and CIFAR100 were pre-corrupted; these were used for consistent corruption benchmarking across all models. All non-CIFAR datasets were corrupted via rotation from angles [0,350] with 10 step angles in between and the average calibration and accuracy was taken across all
degrees of rotation. Our models included: DenseNet [23], LeNet [22] and 6 varying sizes of ResNet, which are described in [24]. The datasets we experimented on CIFAR10 [25], CIFAR100 [25], MNIST [26] and SVHN [27], CIFAR10C [1], CIFAR100C [1]. We report Optimized results in Tab. 14 in A.7 (Appendix). Both tuning methods yield similar performance.
Qualitative Comparison The current state-of-the-art single pass models for inference on OOD data, without training on OOD data, are SNGP [9] and DUQ [8]. The primary disadvantages of these models are: 1) Hyperparameter Combinatorics: Both DUQ and SNGP require many hyperparameters as shown in Tab. 13 in A.6 (Appendix). Our model only has one hyperparameter that is tuned post-training, which is quicker and less costly than the other methods that require pre-training tuning. 2) Extended Training Time: DUQ requires a centroid embedding update every epoch, while SNGP requires sampling potentially high dimensional embeddings of training points, thus increasing training time while our model trains in the same amount of time as the model it is applied to. Bayesian MCDO [7] and Deep Ensemble [14] are considered the current state-of-the-art methods for multi-pass calibration. Bayesian MCDO requires multiple passes with dropout during inference. Deep Ensembles requires N times the number of parameters as the single model it is ensembling where N is the number of models ensembled. The main disadvantage of multi-pass models is high inference complexity while our model adds no overhead computation at inference.
Importance of the Norm While we have shown and conjectured that the norm of x is uncalibrated to OOD data and not always well calibrated to IND data, one might suggest to simply remove the norm. We show in Tab. 4 though the norm is uncalibrated it is still important for inference. We trained ResNet18 on CIFAR10 and then ran inference with ResNet18 modified in the following: dividing out the norms of the weights for each class, dividing out the norm of the input and then dividing out both. As we can see the weight norm contributes minimally to inference as accuracy decreased by 0.03% without it and as previous work has shown the angle dominates classification. We can see with ||x|| removed the entropy is at it’s highest while calibration is very poor, implying the distribution is much more uniform when it should be peaked, as a larger entropy implies a more uniform distribution. Thus the root of the issue does not lie in the existence of the norm, but it’s lack of sensitivity.

heading: 4.2 Reasons for Bad Calibration under Distribution Shift
text: To identify the cause of bad calibration, we record the accuracy, ECE, norm and cosine similarity of a model during training of a vanilla ResNet model. Specifically, we record the evaluation statistics on clean data and also on data corrupted with Gaussian noise on CIFAR100. Fig. 2a and 2b show the accuracy and ECE respectively. We observe that evaluation on Gaussian noise corrupted data yields lower accuracy and higher ECE compared to evaluation on clean data. This demonstrates that
the model’s confidence fails to adapt to the decreasing accuracy. Fig. 2c and 2d show the change of average norm and average cosine similarity throughout training. The difference between Gaussian noised data and clean data is also reported. We observe that the norm of clean data and the norm of Gaussian noised data are close and the difference remains constantly low whereas the cosine similarity of the two diverges with training. This indicates that sensitivity of cosine similarity increases whereas sensitivity of the norm remains low with training. In the shaded region of Fig. 2b-2d where ECE increases the most, we observe that the norm also increases but the cosine similarity only increases slowly. The observation also holds for other noises and architectures. We further present Pearson correlation between ECE and cosine similarity or norm on 4 models and 3 noises in Tab. 5. A large correlation coefficient indicates a higher positive correlation. Norm is consistently positively correlated with ECE whereas the similarity is either negatively or not correlated with ECE. This shows that the worsening of ECE (large ECE) is correlated with the increasing norm. Based on supporting literature [12], [11] and this correlation, the observation supports the conjecture that the insensitivity of the norm is responsible for bad calibration.

heading: 4.3 Empirical Support for the Disentangled Training
text: In the first set of experiments, we show that α and β reflect the effects of the geometric decomposition as claimed in Sec. 3.2 with different α− β configurations. From Fig. 4a - 4d, we observe that the norm decreases linearly with β for fixed α. From Fig. 4e - 4h, we observe that the angle increases linearly with arccos(α). The observations are consistent with the original geometric motivation. β encodes an instance-independent portion, Cx, of the norm. As β increases, Cx increases and therefore the magnitude of the dependent component, ‖∆x‖2 decreases linearly. α encodes the inverse of the cosine of a relaxation angle, Cφ. As arccos(α) increases, the resulting angle, ∆φ increases linearly due to the increased relaxation angle encoded by α.
In the second set of experiments, we show that the new model effectively increases the sensitivity of both the norm and the angle to input distribution shift as claimed in Sec. 3.3. Specifically, we measure OOD detection performance of the models using both the norm and the cosine similarity with the Area Under the Receiver Operating Characteristic (AUROC) curve metric. We use CIFAR10/100 as
the IND data and SVHN [27] as the OOD data. In Tab. 6a and 6b we show two configurations of models in addition to vanilla ResNet18: (α-regularized) we regularize α such that it stays close to one as described in Sec. 3.3; (α-unregularzed) we optimize both α and β freely without constraints. Compared to vanilla ResNet, the norms predicted by our models achieve significant improvement in separating IND data from OOD data. Additionally, we visualize the distribution of norms in Fig. 3a and 3b. The separation between IND and OOD data increases significantly compared to vanilla ResNet18. However, a large α (see α-unregularzed in Tab. 6a and 6b) leads to marginal cosine similarity sensitivity improvement on CIFAR10 and CIFAR100. This indirectly confirms our observations in Sec. 4.2 and in prior works [11] that cosine similarity correlates well with distribution shift. Introducing further angle relaxation might not be always beneficial. While we mainly focus on calibration, our method also strengthens its base model’s ability for OOD detection.
The assumption that OOD data have smaller norms is based on the expectation that a model should be less confident on OOD data. Practically, the norm acts as a temperature in softmax as shown in Eq. 1. Intuitively, larger always yields more peaked/confident predictions, and smaller always yields flatter predictive distributions. Therefore, we expect less confident data such as OOD data to have smaller because we expect the output distribution to be flatter. The assumption is supported by the following empirical evidence. In Tab. 7 we show the norm of in-distribution and out-of-distribution data on CIFAR10 using ResNet50-GSD (ours). The OOD data is produced by the 15 corruptions used in the paper. OOD data have consistently smaller norms and the accuracy decreases with decreasing norm with a Pearson correlation of 0.9 as an indicator of more out-of-distribution.

heading: 5 Conclusion
text: In this paper, we studied the geometry of the last linear decision layer and identified the insensitivity of the norm as the culprit of bad calibration under distribution shift. To encourage sensitivity, we derived a general theory to decompose the norm and angular similarity. Inspired by the theory, we proposed a simple yet very effective training and inference scheme that encourages the norm to reflect distribution changes. The model outperforms other deterministic single pass-methods in calibration metrics with much fewer hyperparameters. We also demonstrated its superior generalizability on a variety of popular neural networks. Note that our problem and method have positive societal impact, as calibration under shift improves overall confidence and robustness of these models.

heading: 6 Acknowledgements
text: This work was partially supported by ONR grant N00014-18-1-2829.

Review summaries:
The paper presents an approach for calibration of neural networks. The proposed approach is based on the analysis of the softmax logits and decomposing it into two components that depends on the norm of the feature vector (norm component), and the other that depends on the similarity (similarity component) with the weight vector corresponding to a class. The paper then derives learnable parameters that could control each of the components and thus can be used for calibration of the predicted probabilities. The paper claims that for out-of-distribution (OOD) scenarios, this calibration scheme outperforms previously proposed approaches. The empirical results are reported for in-distribution (IND) on CIFAR-10 and CIFAR-100 and their corrupted versions of these for OOD, for various different models. 

This paper studies the problem of model calibration in the presence of distribution shifts for vision classification tasks. The authors propose a sensitivity decomposition on the last softmax layer of the model. The resulting calibration approach demonstrates improved performance compared to existing calibration methods under distribution shifts.

The paper proposes Geometric Sensitivity Decomposition (GSD) as the new calibration method in the face of out-of-distribution (OOD) data. The paper identifies that the insensitive norm is responsible for bad calibration under distribution shift. Based on GSD, the paper proposes a simple and quick training and inference scheme. The paper achieves SOTA in calibration metrics in the face of corruptions while having arguably the simplest calibration method to implement.

This paper studies the problem of neural calibration from a novel geometric perspective and finds that the insensitive norm is responsible for bad calibration under distribution shift. Based on this insight, this paper proposes Geometric Sensitivity Decomposition (GSD), which decomposes the norm and angular similarity into an instance-dependent and instance-independent component. Subsequently, this paper proposes a training and inference scheme, to encourage the norm to reflect distribution changes. The proposed method is easy to implement and achieves SOTA results in calibration metrics in the face of corruptions.