Density-driven Regularization for Out-of-distribution Detection
Authors: Wenjian Huang
Hao Wang
Jiahao Xia
Chengyan Wang
Jianguo Zhang
Venue: NeurIPS 2022 Accept (2022)

Abstract: Detecting out-of-distribution (OOD) samples is essential for reliably deploying deep learning classifiers in open-world applications. However, existing detectors relying on discriminative probability suffer from the overconfident posterior estimate for OOD data. Other reported approaches either impose strong unproven parametric assumptions to estimate OOD sample density or develop empirical detectors lacking clear theoretical motivations. To address these issues, we propose a theoretical probabilistic framework for OOD detection in deep classification networks, in which two regularization constraints are constructed to reliably calibrate and estimate sample density to identify OOD. Specifically, the density consistency regularization enforces the agreement between analytical and empirical densities of observable low-dimensional categorical labels. The contrastive distribution regularization separates the densities between in distribution (ID) and distribution-deviated samples. A simple and robust implementation algorithm is also provided, which can be used for any pre-trained neural network classifiers. To the best of our knowledge, we have conducted the most extensive evaluations and comparisons on computer vision benchmarks. The results show that our method significantly outperforms state-of-the-art detectors, and even achieves comparable or better performance than methods utilizing additional large-scale outlier exposure datasets.

Density-driven Regularization for Out-of-distribution Detection
Wenjian Huang" | Hao Wang" Jiahao Xia?, Chengyan Wang", Jianguo Zhang
Dept. of Computer Science and Engineering, Southern University of Science and Technology Faculty of Engineering and IT,, University of Technology Sydney "Human Phenome Institute, Fudan University "Reeearch Institute of Trustworthy Autonomous Systems and Dept. of Computer Science and Engineering, Southern University Science and Technology *Png Cheng Lab, Shenzhen, China
juangyj@sustech edu. cn, 11812301 @mail susllchssthh..hee wwwssttec.edu..... cn
jiahao xia@student uts. edu. wangcyōfudan. edu. cn, zhangjgösustech. edu, cn
Abstract
Detecting outtof-distribution (OOD) samples is essential for reliably deploying deep learning classifiers in open-world world applications. However, existing detectors relying on discriminative probability suffer from the overconfident posterior es- timate for OOD data. Other reported approaches either impose strong unproven parametric assumptions to estimate OOD sample density or develop empirical detectors lacking clear theoretical motivations. To address these issues, we propose a theoretical probabilistic framework for OOD detection in deep classification net- works, which two regularization constraints are constructed to reliably calibrate and estimate sample density to identify OOD. Specifically, the density consistency regularization enforces the agreement between analytical and empirical densities of observable oww-imensional categorical labels. The contrastive distribution regular- ization separates the densities between in distribution (ID) and distribution-deviatee samples. A simple and robust implementation algorithm is also provided, which can used for any pre-trained neural network classifiers. To the best of our knowledge we have conducted the most extensive evaluations and comparisons on computer vision benchmarks. The results show that our method significantly outperforms state-of-thee tiie-of-theeart art detectors, and even achieves comparable better performance than methods utilizing additional large-scale outlier exposure datasets.
Introduction
Deep networks have achieved impressive accuracy on many classification tasks when evaluated in static and closed environment, where the test samples are sampled from the same distribution as the training data. However, when deployed in real- world applications, deep learning (DL) models often encounter anomalous samples different from the training data. Detecting such unexplored samples is referred to nut-of-distributio (OOD) detection [113], which is crucial for reliable decision making, especially safety-critical applications such as autonomous driving, medical diagnosis and secure authentication[1] 3 This topic is particularly important for deep classifiers because it has been well documented that it can be easily fooled by OOD samples to produce high confidence 4 In recent years, most reported and favored strategies for based OOD detection are to design the detectors by inspecting the distribution of high-level features extracted by the relevant target task network. The studies are briefly reviewed below.
predictions 14 15
'Equal contribution.
1 CCoresponding author.
36th Conference on Neural Information Processing Systems (NcurIPS 2022).

---

As a pilot study, Hendrycks et al. proposed to detect OOD samples based on maximal softmax probability (Msp)
[6] i.e., max, p(y] which has become a common baseline for OOD detection 13 18]. Subsequently, Liang et al. proposed the Odin method, which provided temperature scaling and input perturbation strategies, to push the Msp score further apart for ID and OOD data [77.. Hsu et al. generalized the Odin method to avoid access to OOD samples for parameter tuning [5]. Another similar technique, which uses softmax probability for OOD detection, is PNML [3. In pNML, Bibas et al. detected OOD samples using their proposed regret score log F(yla),, where F(ylæ:) denotes online fine-tuned softmax probability by adding the test sample ar to the training set with an arbitrary label y. However, these methods relying on softmax probability score pzy(zz) can suffer from overconfidence problem since many studies have shown that neural
[10 4 12
17
networks can produce arbitrarily high softmax probability for OOD inputs 4 19 IO
8 I2 20].
Another line of research utilizes the distribution of extracted high-level features f(z) to estimate ID data density p(x)) for OOD detection as modeling p(æ)) directly with high-dimensional input is prohibitive in most cases. For example, Lee et al. [9] proposed using the Mahalanobis distance between the test sample's feature representations and the clasiccon gaussian distributions in the intermediate layers to train a logistic regression OOD detector. Essentially, this Mah method constructed the OOD score using maxy ([](x]ly) in which p( ly) was assumed to obey Gaussian distribution for the ID training data. Afterward, Sehwag et al. [21] and Zhou et al. [19 further extended the Mah model for unsupervised learning (no training labels available) and semi-supervised learning settings (small set of training labels available). respectively. However, the strong parametric assumption for these studies that class-conditional feature representation follows Gaussian distribution often fails in practical applications. Liu et al. [4] interpreted the softmax function from an energy perspective which assumed that log(p(z)) o 1og(E, (x)(() where T was temperature coefficient and f (x) denoted the classification logit for input x and class y. The energy method proposed to use Helmholtz free energy -T Togg(,, (xp(f"(x:)/T)
as the OOD score. Nevertheless, we will explain in the method section that the underlying assumption of the energy model does not necessarily hold, which can lead to poor estimation of p(æ) for OOD detection.
Some other studies reported different empirical methods for OOD detection. For example, Sastry et al. 8 detected OOD samples by defining the deviation of test samples from training data based on a layer-wise Gram matrix that encoded pairwise feature correlations between channels. Inspired by the contrastive learning strategy, Tack et al. [22] contrasted different types of augmented training samples and proposed empirical OOD score by mcasuring the distance between the test sample and nearest training samples in contrastive representation. Additionally, Sun et al. M observed that OOD data tend to trigger unit activation with larger variations and positive skewness. In light of this, the proposed ReAct model I directly truncated high activations in the penultimate layer, which was experimentally confirmed to be helpful in improving the performance of common OOD scores.
In summary, the existing methods have one or more of the following limitations: (1) Due to lack of clear probabilistic definition of OOD detection, some studies identify OOD samples using estimated discrininative probability p(y(ar) instead of data distribution p(x)), which can be susceptible to the influence of overconfident posterior; (2) Some researchers estimate p(x) by imposing strong explicit parametric or implicit assumptions of high-level extracted features f f(z). which however are not necessarily justified and can impair the OOD detection performance; (3) Several empirical methods lack a clear thcoretical motivation.
To overcome these limitations, we will explore how to reliably estimate ID data distribution p(z) for OOD detection using the high-level representation features. First, we consider it is inappropriate to estimate the sample distribution p(x) directly from the distribution of latent feature representation learned by the discriminative network since it only concerns the conditional probability p(y(=) without any constraints to guarantee the reliability of the estimated p(r).. To address this issue, we propose a novel density-consistenge regularization strategy: given that the distribution of low dimensional variable Y can be estimated with high accuracy, this study enforces the consistency between empirical density P(y) and the estimated density p(y)=f p(z, y)dz= f p(x)
())(((())))))))))))))))))))))) z) derived from latent feature representation in deep layers, e.g., the last logit layer, on batch-by-bateh basis. Theoretically, with sufficient training samples (batch numbers), combining this consistency regularization with common supervised loss can reliably calibrate and estimate both p(y]z) and p(x), thus enabling effective OOD detection. Secondly, to ensure OOD samples highly deviated from the ID distribution can also be identified, we further propose contrastive distribution regularization to produce low-density estimates
2

---

for the distribution deviated samples. These two regularizations are properly combined to further improve the detection accuracy.
The following methods section will investigate how to achieve the above density regularizations.
includes building the consistency criterion with the law of large numbers, analyzing asymptotic prop- erties for the deviation from consistency with the central limit theorem, developing asymptotic-test based regularization for the consistency hypothesis, and finally incorporating density regularization
with contrastive distributions. Our contribution can be summarized as follows: (1) We propose unified probabilistic framework for OOD detection in discriminative networks, which reveals that direct estimation of ID data distribution p(x) via latent feature representations can be biased and and contrastive criteria to address this issue. Unlike previous studies, our method does not rely on any unproven assumptions. (2) We derive analytical regularization terms by analyzing the asymptotic properties of the density-consister and contrastive criteria, and provide simple yet surprisingly effective computational algorithm for OOD detection applicable to any deep networks with a softmax classifier. (3) Extensive experiments on various standard OOD detection benchmarks demonstrate that the proposed density-driven OOD detector achieves state-of-the-art performance compared with many other existing methods.
introduces density-consisterd
2
Related work
In general, OOD detectors can be broadly categorized into generative and discriminative approaches.
OOD detection with generative models Deep generative models have been explored for OOD detection 66 23 II 24 2 25 28 as an intuitive strategy since they enable modeling likelihoods (1)) for high dimensional input. One contributing aspect of this approach is that it directly models the input distribution without using labeled data [1]. However, it requires additional generative networks for classification tasks, which can be prohibitively challenging
optimize [4 29 [].
Moreover, significant issues have been highlighted that deep generative models can frequently assign
spuriously higher likelihoods to OOD than ID samples 2 7 4 25 24 30
T0 23
g 31 27),
and the performance can often lag behind the discriminative approaches 7 29 Recent studies
revealed that it might be because deep generative models can be confounded by background statisties or because of the discordance between the model's 's typical set and high-density region [23
Discriminative model-based OOD detection The discriminative model-based approach, which derives OOD score by using representations from a predefined cl classification task, has advantages over generative-base approaches by circumventing the difficult optimization process and obtaining better detection performance [1] 9 6). especially for complex datasets (22). This can be because super- vised learning effectively learns discriminative representations useful in identifying in-distribution samples by exploiting label information
& 6 19 A brief overview of the baseline Msp model [16]
and state-of of-the-ar discriminative OOD detection methods, including Odin (17), Mah 99, Gram 3 and ReAct [1] is presented in the introduction section.
Energy 4. pNML
Discriminative model-based OOD detection with outlier exposure Some researchers have explored using auxiliary datasets of outliers, which allow the model to be explicitly regularized through fine-tuning, to increase the margin between the OOD scores of the ID and OOD data. Such an outlier exposure strategy has been reported by Oe [O) Oece (32 and Energy 4 to be helpful in OOD detection. However, OOD samples are different and infinite. To avoid specific exposure OODs inducing biases, researchers typically used large-scale diverse dataset as the outlier exposure dataset 10 32 4. e.g., 80 Million Tiny Images. Yet it is often not possible to have such large amount of external data in many real-world tasks, especially those with large ID datasets.
3 Methods
3.1
Probabilistic framework for OOD detection
The goal of a machine learning classifier is to learn the mapping from X to Y, where input X is usually a high-dimensional random vector and Y a discrete random variable. Let g y) be the probability density function (p.d.f)) of Y) with respect to measure vx X TTY. where Px is Lebesgue measure
3

---

in Euclidean space R" and Ty is discrete measure with (Y = y) 1 L. L is the number classification categories. The classification probabilities for discriminant model P(Y can be represented
(X.9) P(Y - - [ (X,Y) dry
(I)
For deep learning models, researchers generally considered the following softmax values PXY
exp (h (X))
P(Y = y = - Eiswei exp (h (X))
(2)
where (X) is the classification logits produced by the deep neural networks. By connecting [ and E2. (2) (x)(h"(x)) can be considered as the Boltzmann-Gibbe form for g y) from an ie.,
energy-based perspective B3 34
(z. y) exp (h (x)).
(3)
Alternativlly, g (z. y) = 1/2
2 exp (h" (z)) and denominator & Eisyel exp (h" (X)) dvx.
For OOD detection, we first argue that OOD score can more appropriately constructed from P(X) rather than P(Y ()). where the latter is commonly used in previous studies 17 3 since the
estimated P P(Y = x|X = z) can create over-confidence probability [ 4 even when P(X = x)
is relatively small. In terms of P(X), can obtain the following estimated p.d.f. k(x) based on 33:
k (x)
f (2, day Z
Σ exp (h" (x)).
ISVIL
k(x) appears to be reasonable OOD detection score. Similarly, Liu al. proposed to use Helmholtz free energy 7 log(_ exp(h" (x)/T)) as OOD score with temperature T 4.. which is similar
to & (x:) from a computational perspective, and demonstrated its advantage over OOD scores based on discriminative probability P(Y(X) [16
However, directly calculating k (x) as the OOD score can lead to poor density estimation since the prerequisite Eq.(3) is not clearly satisfied, which has been overlooked in previous studies. Particularly, classification models generally focus on improving the accuracy of P(Y by classification loss Leie without explicitly enforcing the validity Eq. Therefore, this study firstly aims to develop an explicit regularization for density calibration to satisfy the constraint in Eq. based on the empirical density estimation of the ID training data. Specifically, since the empirical density function (EDF) of a low-dimensional random variable (r.v.) can be estimated with high accuracy, we start with estimating the EDF of discrete r.v. Y and enforce the consistency between EDF and its analytical parametric p.d.f. of the following form based on E3.
a (v) = / (X, (X.8) dux
1 f exp (h" (X)) dux Z
(5)
In the following sections, will construct the analytical consistency regularization and implementa- tion algorithm for ensuring the constraints of (3) thereby improving OOD detection performance, using the law of large numbers (LLN), central limit theorem (CLT) and asymptotic test statistics.
3.2 Consistency criterion for low-dimensional density estimation
As noted above, density function k(x),, estimated by high layer features, can be useful OOD score if the underlying assumption B3. holds. To realize this assumption, we now enforce the consistency between analytical p.d.f (1)) derived by (3) and the empirical density function (EDF) for low- dimensional variable Y. which can reliably estimated by 7 (リ) = ny/N. ny = Eisisn ((x==)) represents the number of samples in class y and N = -t ny the sample size. Namely, with E3, we derive the following property:
(y) ( Z
1 eepp (h" (X)) dux
1
exp (X)(
dux: S SASL
(6)
T (v)
7
T (v)

---

By the law of large numbers, 0 (у) converges to u (b) almost surely (a.s.) and in probability as N + co. Thus, the pivotal variable (xI( dvx converges a.s. and in probability, By the 8(3)
Monte Carlo method, Z can be approximated by:
exp h (X))) (Vy)
dux Eisien exp (h" (XI))N
7 ~z
1A S y T.
ny/N
Obviously, the right-hand side (RHS) of 7 also converges to Z a.s. and in probability as N co. Thus, we arrive at the proposition that for each class 1 S y S L, the exponential of classification logit has mean value proportional to the class ratio.
Since deep learning models are trained in a batch mode, in which random batch sampling with replacement allows bootstrap estimates, we now proceed to construct batch-win wise statistics and analytical regularization for [ We first give the following lemma. The proof Appendix A.1 of the supplementary material.
Lemma 1. If Eq. 3 holds, then
Eisien exp (h" (X.))
Ny N
ta.s. 0, S S L
(8)
Eisign Eigiet exp (h' (X,))
Lemma[ggen gives theoretical batch- wise constraint for the classification logit. However, the conver- gence rate is not specified here, making it challenging to design an adaptive regularization subjected varying class sample ny and batch size N. To address this issue, in the section, will specify the convergence rate O(1/VN) for Eq. using the central limit theorem and accordingly propose the adaptive consistency regularization by asymptotic test statistics.
3.3 Adaptive density-consistency regularization by asymptotic test
To construct the
regularization adaptive to different class size ny and batch size N, consider the convergence rate with respect sample size for Eq. (8) by the following lemma The proof is provided Appendix A.2.
Lemma 2. If Eq.
holds, then
Eisien exp (12 (h" (Xi))
r = VN
Ry N
a N (0, A0)
EISIeN Eisist exp (hl (X;))
where A = (n²)) ER [V (1²) and g( v, x) =yx - z. n and Σ" represent the mean
and covariance matrix random vector u Eisier exp (h' (X)) exp (h" (X)) L(Y=v)
Lemma and lemma) in fact, show that if implicit assumption Eq. holds, i.c., 1 exp(h²(( (z)) can accurately approximate density g(x, y), we can then construct batch-wise statistics T in which
1 r% converges to zero at the rate of ONN-1/2) by analyzing the distribution of low-dimensional VN
Y. More specifically, T% converges a particular Gaussian distribution whose parameter can be reliably estimated.
Thus to satisfy assumption (3. which is deemed to provide more accurate estimation of P(x) for OOD detection, we propose to construct the asymptotic-test statistics using TV from the perspective of hypothesis testing, and creatively transform the hypothesis reject criteria into penalty term to support the assumption Eq. can be accepted at any specific level of significance.
Specifically, we consider the following hypotheses:
Ho 0V = 0 versus H1 0" #0
(10)
where
E Texp (A (X))
00
El(y=))
(11)
E Eisiso exp (/' (X))
5

---

First, assumption Eq. implies null hypothesis Ho, and accordingly leads to the following conver- gence in distribution by lemma 2
A rg -a (0,1) and AA [x + (1)
|
(12)
where AV - VV (mx) ]] EN V (1%) approximates and converges A in probability. 14y and yy denote sample mean and sample covariance for μº and Σ", respectively. From the perspective of asymptotic test theory [35], we can construct a x²-test with the following reject region which has asymptotic significance level a.
[ [T xi.a
(13)
where xi.a is the (1 ahtth quantile of chi-squared distribution x² (1). When Eq. 13 is observed, the asymptotic test rejects Ho, as well as assumption Eq. Hence, to ensure the assumption E3. is rightly accepted, we propose to transform the hypothesis test rejection criteria into the following regularization term:
Σ max (log (IAN) [&] ( /x).))
(14)
L
ISUSL
The regularization term À will be added to the classification loss Teess where hyperparameter a E [0, controls the significance level and y the loss weight balancing the regularization term and classification loss Lets.
3.4 Density regularization with contrastive distribution
The above
regularization (DCR) can calibrate classification logit based on observable low-dimensional density P(Y), which offers a more reliable P(X, Y) estimate for ID- like samples. Nevertheless, the real test OOD samples come from distribution deviating far from the II) distribution. To ensure these samples with large distribution deviations can also be accurately identified, further propose the density-contrasting scheme, which enforces that random distribution-deviated (DD) samples produce low-density estimates.
We first define the distribution-deviatte operator S, which can be applied to ID data X to generate DD samples X = (X)). An ideal density estimator should yield the likelihood ratio
P(X)
< 1 and
P P(X)
Rs 0 for large constant v, i.e.,
P(X)
EisIsl exp (ll (8 (x))) =r.log llog Eisiso exp (h' (X))
ths (X) A log
DC.
(15)
P(X)
We incorporate this constraint into the above DCR by defining Ty:
T%
T + exp
NIS Σ
ESe.15ISN the (X,) +
(16)
where & denotes the distribution-deviatee operator set. Here constant y is added to ensure numerical stability. Since the second term in RHS is considered close to zero, we can obtain that - 12 also converges x1) approximately. Thus, our final generalized density regularization with contrastive distribution can be defined:
Σ 1SUSL
max (Iog (Tx)/
(17)
Figure I shows the overview of the proposed density driven regularization (DDR) for OOD detection and Algorithm presents the pseudo-code for the training of our DDR method") It is worth noting that to increase numerical stability, we normalize the classification logit by subtracting the maximal logit before calculating in Algorithm This normalization procedure is also widely used to avoid overflow when calculating softmax probability (36). We will show. in Appendix A.3, that the normalized logit essentially yields the same results as the original logit. Finally, after fine-tuning, (xp(h((x)) of the sample density k((x) is used as the OOD score in this study for any testing sample æ, which is theoretically equivalent to directly adopting k(xx) the OOD score.
monotonic transformation log(2 Z k(x)) = log(En
Coode for the proposed DDR is available http://Weeiiaatuuugggggggiibbiid 2DR

---

(a)
(b)
P
P(V)
P(X)
x
distribution- deviating
deep classifier
operators
P(X))))
CDR loss
Pic ((R)
Normalized histgraam
(e)
Normalized
P( P(
(a) Illustration of the proposed method. (b-c) The analytical class distributions p(y)) computed from classification logits for the overall test set (CIFAR-10, WideResNet) w/o and w/ density consistency regularization (DCR) loss, respectively. The summarized mean absolute error of the analytical class distribution w.r.t the actual empirical class distribution (red dotted lines) is reduced from 0.50 to 0.24 by DCR loss. (d-e) The normalized histograms for the sample density (test set CIFAR-10 10, WideResNet) w/o and w/ contrastive distribution regularization (CDR) loss, respectively. The distributions of in-distribution (ID) sample density and distribution-deviatee sample density can be well separated by the CDR loss.
Figure 1:
Experiments
We demonstrate the effectiveness of the proposed method using diverse deep convolutional neural network architectures on multiple OOD detection benchmark datasets, and compare it against various state-of-the-art methods.
Datasets and experimental setup Following existing literature [ 19 32
17 16
we train OOD models on the training set of CIFAR-10 10 (37], CIFAR- 100 [37 and ImageNet [38], respectively. and evaluate OOD detectors in identifying OOD test samples from other datasets, including iSUN (39, iNtturalist 40)] LSUN(R) 17,. LSUN(C) [17], Gaussian [77. Places365 4
Textures 42 and SVHN 45). ImageNet(R) 3 and Imagenet(C) S are also used as OOD sets for
the CIFAR experiment. For the ImageNet experiment, CIFAR datasets are considered as OOD sets.
These datasets are described and provided in previous studies 4
For fair comparison and aid reproducibility, we the pretrained model for standard ResNet-34 44], WideResNer-40 (45 and DenseNer-BCC10 46 as the backbone network for the CIFAR
experiment since they are widely used in previous OOD detection studies 3 32
I0 9
17 Following [I], we adopt the lightweight MobileNet-v2 (47) for the ImageNet experiment. It
noteworthy that since some of the following compared models, c.g., Gram g and Mah [9]. require prohibitively large memory for large networks with high input dimensions, we only conduct experiments on lightweight MobileNet-v2 for the ImageNet dataset. The pretrained weights for the
above ResNet, WideResNet, NenseNet and MobileNet are provided by [17 9 [. When training our OOD detector, we use the same normalization, augmentation and training setting as in [10, 4]. where the learning rate was adjusted by cosine decay schedule (48) and the fine-tuning epoch is 10. The initial learning rates are set 10-3 and 10-4 for CIFAR and ImageNet experiments. Other hyperparameters are set as follows: batch size of 256, regularization weight 1=10- constan r=10, and fixed statistical sigmificance level a=0.05. Constant q is a detached tensor dynamically determined to lincarly map the exponent from [-200r, 0) to 5. 5) for ensuring numerical stability. It is worth noting that unlike many previous studies 4 g
S 32). which adjusted hyperparameters for different datasets or networks, our method can achieve fate-off-hhearr performance across various experiments with fixed values of introduced hyperparameters. Moreover, we will also demonstrate the robustness of our approach to hyperparameter changes in ablation studies. Our distribution-deviainng operators S include random resized crop and random affine transforms realized by Torch Vision library [49]. and uniform noise generator (see Appendix A.4 for details).
The proposed approach compared to the state-of-the-an methods, including Msp 16.. Odin 177, Mah 9 Energy (4) Gram (8), ReAct [ and pNML [3] for OOD detection without outlier exposure,
7

---

Algorithm 1: Training density-driven regularization (DDR) model for OOD detection Input: ID training set Din, batch size N, initialized/pre-trainnn network feg- significance level o, loss weight ", constant r, deviating operator set S, learning rate 1) and training/line-tnninn
iteration T. Output: classification network før for & 0, ...,, 7' 1 do
sample a batch of N training samples {X,,, Y from Din generate distribution-deviace samples X = S (X;) for S S initialize regularized loss =
calculate logit vector h (X;) == fo. (X+) and ((x)) = fo, (X:))
h (X,) f h (X,) - C and h( h(x;)) t h (x;5 C' where C' is the maximal value all logit
vectors // ensuring numerical stability
define Ω {y/ EisigN (X=E) > 0, S 0
for y E Ω2 do
define ny
Σ (X==)) and uz = Σ exp (X)( exp , [xx=w)]
ISIS
1SISL
Σ exp(h' (X?))
define
3
log 18K
N
(X,))
SEB.ISiSN
18152
calculate detached tensor y by which v + q linearly map the original exponent value e in [-200r, 0J to [-5, 5] // ensuring numerical stability
(x.()
calculate
N = VN
ISEN
* + exp (v 4) // Eq. (16)
ISISNASISL exp(P
calculate Ag Vg (4&- EN [Vg (g(2)) 1 and ΣN are the sample mean and covariance matrix for nd and E" computed by u. (1emma
- + 7 max (log [A (T"] /x2.a) // asymptotic test based
regularization by Eq. (17)
calculate supervised classification loss Lets using (softmax (fo, (X))),())
combine loss value Tatts + X
update network parameter 0c+1 + 0, Va, (Lods + X) by SGD based optimizer return for
well Energy and Oеce
32 for OOD detection with outlier exposure. 300K Random
Images [0] is used as the outlier exposure dataset to reproduce the Energy method. All compared methods are evaluated with their open-source codes and trained weights. Following existing studies
32 4 g 10 9 [7 [6], commonly used metrics including AUROC, AURP and FPR (at 95% TPR) are used evaluate different OOD detectors. The evaluation code is adopted from 4 All experiments run on the PyTorch framework [50] with Nvidia A100 and GeForce RTX 3090 GPUs, with maximum RAM of 512GB.
Experimental results The experimental results on CIFAR-100 in terms of FPR95% are shown in Table [] See Appendix A.S for the variance of the results over ten runs with different subsets of OOD data. Compared to other state-of-the-an detectors without outlier exposure, our method achieves the best detection accuracy for diverse OOD datasets under different network architectures. The averaged FPR95% of the proposed method is significantly lower than that of other detectors without outlier exposure, and even lower than the four satie--f-th-attt detectors that use an external large-scale outlier exposure dataset with 80 million images. Other evaluation results in terms of AUROC and AUPR also reveal consistent performance trend, which can be found in Appendix A.5. worth noting that the proposed method only utilizes classification logits for OOD detection. In contrast, the best-performed existing method, i.e., Gram, uses features across all layers detect OODs and requires calculating huge gram matrices dynamically using all latent features of training samples, preventing end-to-end real-time prediction and becoming intractable for deep networks

---

Table 1: Performance comparison (in terms of FPR95%) of various methods in CIFAR-100 (ID dataset) under three commonly-used networks. The best and second-best models without accessing external outlier datasets are coloured red and blue, respectively.
w/o outlier exposure (FPR95% U)
w/ outlier expesure (FPR95% J)
OOD datasel
MinrOdtin/Maah/eeergygoe
Occe/Energy/ Occc+pNML
ISUN
83.10/ 55.05/5.65//// / 67 / 80,91 5.01 / 80.00 7 55.10/ 4.93
/4,76/ 2.14
LSUN(R)
80.75/ 68. 15 / 2.92/ / 7 70.75 /4.90/
3.19
1.72 /4,07/ / 1.01
CIFAR-10N 100100 (ResNet34)
LSUN(C)
81.30/ 55.35 / 47 21 82.93 / 33.76/ 80.25/ / 70.60
/47.5//
7.99
39.46/37.20/ 10.36
CIFAR-10
80,95 85.685.6/5 /1 81.50/ 88.12/ 83.05/ 80.00/
81.15/85.08
85.06
83.31 / 79.05
ImageNNer()
79.00/ 52.55 63.96/ 7 5.17 75.995 67.95/ / / 4.47
4.60/ 62.30/ 4.12
Ima
77.40/ 57.90 90 / 58.55 55/ 73.43
16.8 72
53.15/
4.07
0.32/59.27, / 8,53
Gaussian
100.0/ 95.35 / 27 / /00.0/ 0.00
100.0/000///// 85.25 32.50/ 0.00
0.00/ 0.01 / 0.00
Places365
84.55 84, 10/ 59.75 85.68 46.89
00.0///000100000 71..25 61. /21.12
31.76/ 41.05 19.74
Textures
80,80/ 80. 15 56
79,96/
/3 50/
61.
53.80/ 18.50
24.66 43,64 16.38
iNaturalist
73.00/ 50/50/ 58 36 /
71.75
85
46.22/ 68. 47.49
SVHN
79,70/ / 31 42 13
19.99
78.
75/ 40/
26.30/
1.61
13.09 40.57 10.23
average
81.87 36.36 56.45 81,
26.51
80.
68.55
52.55
16.60
21.69 49.52/ / 18.10
iSUN
86.75 60/ 36.73 /
5.23
70
43.45
73.45/
2.34
7.93 55.97 / 3.01
CIFAR 100 (WideRRsNeel
LSUN(R)
85.75 60.500000/// 34.66 66
40
2.97
82
77 55
7
1.08
53.28 1.90
LSUN(C)
80.85/ 52. 10/ 45,
85
37,
29
57 85 86,
65
5.67
18.20/ 29.25 / 6.70
CIFAR-10
81.85 85.885990 90 95.45 85
40
90 98.45 97.699988...//
88.52/ 84.75 90.36
ImageNet(R)
84,90/ 63. 95 34.06 98.95
6.01
83 60 71.55 7 3.34
12.04 66.33 7.72
ImageNer(())
82.55 65.30/ 46.77 71.05
98 76. 80/ 79.40/ 79.90 3.48
15.84/ 56.36/ 7.81
Gaussian
99.60 0.05/ 0.00/ 65
0.00/
0.00/ 0.00
0.00/ 0.00/ 0.00
Places365
83.80/ 70 52.73 81 05
46
27
82,
45 62.60 / 11.27
23.26 36.49/ 9.68
Textures
81.60/74.05 39.05 78
45
35
98
66
00
75
40/ 58.75 12.40
19.62 38.03/ / 8.10
iNaturalist
76.15 70.35 / 59. 72 40
86
70.
75
85 40
73, 40 17.10
38.38
62. 70 24.92
SVHN
77.30 42.4424444 45/25///255 33.27
40/
19
26
76
74.
85
05
1.68
9,43 37.50/ 3.64
average
83.74/ 01999.3//42.27
76.50
64.88
13.35
21.69 47.33/ / 14.89
ISUN
83.85/ 62.5/62.10// 16.48 82.45
3.99
40.35
40
/
5.66
3.21 76609 0.92
CIFAR- 100 (DenseNet)
LSUN(R)
82.75/ 58.55 13.48 77, 45/
2.38
35 16. 60/0//
/
4.20
1.98 73.39/ 0.57
LSUN(C)
73.40/42.25 77.
47.05
30
45.80/
/0 10/
8.35
26.35/ 33.94/ 16.89
CIFAR-10
80.90 84.20/ / 98 86 02.05
87 81 90/ 97. 70/
/92.46
89.58 86,30 /91.2
ImageNet(R)
81,90 56.95 16. / 76.85/
4.15 39,70 70 13.55
/ 2.83
3.85/75.50/ 1.19
ImageNet(C)
75.45 46.75/ 35.92 58.65
10 /0 22.75 /1.90/ 3.53
8.09 60.05 3.40
Gaussian
100.0/ / 0.00/ / 0.00/ / / 0.00/
0.00/ 0.00
0.00/ 100.0/ 0.00
Places365
76.15 51 80 /2/ 58
45 56 /3 36.35
/6.35/ 15.18
41.32/ 46.77 32.74
Textures
75.15 56.50 / /9.34/ 34/ 58.85 38 47. 25 90 / 14.07
31.87 48.95 23.20
iNaturalist
70.30 80/ 79.96 98 48 61
45.
22.50
48.27 64.23 44.94
SVHN
73.75 44. / 49.71 95 52
55 20.50/
50 3,16
11.63/
69.06/ 9.72
average
79.42/ 59.56 / 47.88 68.76 25.90 / 51.58/ 17 29.52/ 15.63
24.20/ 66.75/ 20.49
trained on large datasets (See Appendix A. for computational cost comparision with our approach). Due to the page limit, the reader is referred Appendix A.6 for detailed results of the CIFAR-10 experiment, in which our method also achieves the best detection accuracy in both FPR95%, AUROC and AUPR compared other existing methods without outlier exposure. The performance of the proposed method is also comparable to the state-of-the-wee OOD detectors that require large-scale additional outlier exposure datasets. Tables in Appendix A.7 also provide the experimental results of FPR95% AUROC and AUPR values on ImageNet. Due to the lack of large-scale high-resolution outlier exposure datasets, which should theoretically be much larger than the ID dataset, none of the outlier-exposure OOD detectors had been evaluated on the ImageNet benchmark in literature. Therefore, only OOD detectors without requiring outlier exposure datasets are evaluated. It can be observed that the proposed method also achieves the highest averaged detection accuracy on the ImageNet benchmark. is noteworthy that our method performs relatively poorly on the iNaturalists and Places365 compared to other OOD datasets, as is also the case for other traditional methods. can be because the ImageNet includes semantically overlapping objects as the iNaturalists and Places365, as is shown in Appendix A.9, even though we have used the conceptually disjoint subsets of Textures and iNaturalists provided by the previous study [1] for model evaluation.
Ablation studies We conduct ablation experiments on CIFAR-100 using the WideResNet network. Table 2 verifies the effectiveness of each component, i.e., density consistency regularization and contrastive distribution regularization. We remark that the baseline model without regularization
9

---

Table 2: Contribution of the proposed regularization terms to OOD detection performance. DCR: density consistency regularization. CDR: contrastive distribution regularization. The result the average value across all OOD datasets.
in-dist
DCR
CDR
mean
mean
mcan
(model)
AUROC (T)
AUPR (?)
FPR95% (1)
80.05
95.11
77.04
CIFAR-100
90.84
97.88
41.59
(WidcResNet)
96.09
98.94
13.35
Table Ablation studies on CIFAR-100 (ID dataset) with WideResNet demonstrating the proposed
method's robustness to hyperparameters. The result is the average value across all OOD datasets.
ablation studies
parameters
mean AUROC (1)
mean AUPR (1)
mean FPR95% (T)
T28
96.
98.94
13.43
batch size
256
96.09
98.94
13.35
512
96.08
98.93
13.63
0.005
96.02
98,94
14.08
regularization weight y
0.01
96.09
98.94
13.35
0.02
96.15
98.91
12.92
96.02
98.94
14.03
constant
10
96.09
98.94
13.29
20
96.12
98.91
12.87
corresponds theoretically to the Energy model with no outlier exposure and temperature coefficient of TT= Table 3 verifies the robustness of the proposed method to hyperparameters, including batch size, regularization weight y and constant r. The model performance quite consistent when increasing decreasing the default values by 100% and 50%, respectively. More detailed results on different OOD datasets and more hyperparamter choices can be found Appendix A.8. Please note that unlike many previous approaches involving hyperparameter tuning 4 method uses fixed hyperparameters for OOD detection across different ID datasets, OOD datasets and networks. It further confirms the robustness of the proposed method.
g 10
17 g B2,
Conclusion
In this paper, propose theoretical probabilistic framework for OOD detection, which derives analytical density regularization by investigating the inherent consistent and contrastive characteristics of the ID sample density to calibrate and build accurate sample density estimator. Unlike many previous studies, our method neither relies on unproven assumptions about the latent feature distribution nor requires additional outlier exposure datasets to calibrate ID density estimates tune hyperparameters. A simple yet effective computational algorithm also developed, which can be used for any pretrained classification network. Extensive evaluations benchmark datasets show that the proposed approach significantly outperforms existing state-of-the-art OOD detectors. Furthermore, our method even achieves comparable better performance than the approaches requiring external large-scale outlier exposure datasets. A limitation of our approach is that the fixed hyperparameters may be optimal for specific task, although it enables our fairly robust model to achieve
performances across benchmarks. We leave it for future work to investigate adaptively setting hyperparameters with the dataset. Additionally, since our approach requires fine-tuning, this can lead to the problem that there exists a discrepancy in classification probabilities between the original network and the fine-tuned network. This problem can be avoided using the original and the fine-tuned networks for the classification and OOD detection tasks, respectively. However, can double the inference time and computation load. Finally, we believe our accurate sample density estimator can also guide future studies in related machine learning fields, such as active learning, open-world classification, semi-supervised learning, etc.
Acknowledgments and Disclosure of Funding
This work supported in part by National Key Research and Development Program of China (2021 0021YFF1200000
10

---

References
[1] Yiyou Sun, Chuan Guo, and Yixuan Li. React: Out-of-distribution detection with rectified activations. In Advances in Neural Information Processing Systems, pages 144-157, 2021.
[2] Keunseo Kim, JunCheol Shin, and Heeyoung Kim. Locally most powerful bayesian test for out-of- distribution detection using deep generative models. In Advances in Neural Information Processing Systems, pages 14913-14924, 2021.
[3] Koby Bibas, Meir Feder, and Tal Hassner. Single layer predictive normalized maximum likelihood for out distribiittiittionn detection. In Advances in Neural Information Processing Systems, pages 1179-1192 2021.
[4] Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. Energy-based -ft-t--dittiibttion detection. In Advances in Neural Information Processing Systems, pages 21464-21475, 2020.
[5] Yen-Chang Hsu, Yilin Shen, Hongxia Jin, and Zsolt Kira. Generalized odin: Detecting image without learning from out-of-distribution data. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). pages 10948-10957, 2020.
[6] Joan Serrà, David Álvarez. Vicenç Gómez, Olga Slizovskaia, José F. Núñeez, and Jordi Luque. Input complexity and ofi-t---isttibuttinn detection with likelihood based generative models. In 8th International Conference on Learning Representations, 2020.
Zhisheng Xiao, Qing Yan, and Yali Amit. Likelihood regret: An out-of-distribution detection score for variational auto-encoder. In Advances in Neural Information Processing Syxtems, pages 20685-20696, 2020.
[8]
Chandramouli Shama Sastry and Sageev Oore. Detecting -uito--distribution examples with gram matrices. In Proceedings of the 37th International Conference on Machine Learning, pages 8491-8501, 2020.
[9] Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of- distribution samples and adversarial attacks. In Advances in Neural Information Processing Systems, pages 7167-7177, 2018.
[10] Dan Hendrycks, Mantas Mazeika, and Thomas G. Dietterich. Deep anomaly detection with outlier exposure. In 7th International Conference on Learning Representations. 2019.
[11] Jie Ren, Peter J. Liu, Emily Fertig, Jasper Snoek, Ryan Poplin, Mark Depristo, Joshua Dillon, and Balaji Lakshminarayanan. Likelihood ratios for out-of-distribution detection. In Advances in Neural Information Processing Systems, pages 14680-14691, 2019.
[12] Qing Yu and Kiyoharu Aizawa. Unsupervised out-of-distribution detection by maximum classifier dis- crepancy. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pages 9517-9525, 2019.
[13] Kimin Lee, Honglak Lec, Kibok Lee, and Jinwoo Shin. Training confidence-calibrated classifiers for detecting out-of-disttibution samples. In 6th International Conference on Learning Representations, 2018.
[14] lan J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In Yoshua Bengio and Yann LeCun, editors, 3rd International Conference on Learning Representations, 2015.
[15] Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In 2015 IEEE Conference Computer Vision and Pattern Recognition (CVPR), pages 427-436, 2015.
[16] Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and -ut-of-distribution examples in neural networks. In 5th International Conference on Learning Representations, 2017.
[17] Shiyu Liang, Yixuan Li, and R. Srikant. Enhancing the reliability of out-of-distribbatio image detection in neural networks. In 6th International Conference on Learning Representations, 2018
[18] Apoory Vyas, Nataraj Jammalamadaka, Xia Zhu, Dipankar Das, Bharat Kaul, and Theodore L. Willke. Out-of-distribution detection using an ensemble of self supervised leave-out classifiers. In Proceedings of the European Conference Computer Vision (ECCV), pages 560-574, 2018
[19] Zhi Zhou, Lan-Zhe Guo, Zhanzhan Cheng, Yu-Feng Li, and Shiliang Pu. Step: distrributn detection in the presence of limited in in-distribution labeled data. In Advances in Neural Information Processing Systems, pages 29168-29180, 2021.

---

[20] Matthias Hein, Maksym Andriushchenko, and Julian Bitterwolf. Why relu networks yield high-confidence predictions far away from the training data and how mitigate the problem. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 41-50, 2019.
[21] Vikash Sehwag, Mung Chiang, and Prateek Mittal. SSD: A unitied framework for self- self-supervised outlier detection. 9th International Conference on Learning Representations. 2021.
[22] Jihoon Tack, Sangwoo Mo, Jongheon Jeong, and Jinwoo Shin. Csi: Novelty detection via contrastive learning on distributionally shifted instances. Advances in Neural Information Processing Systems, pages 11839 11852, 2020.
[23] Ziyu Wang, Bin Dai, David Wipf, and Jun Zhu. Further analysis of outlier detection with deep generative models. In Advances in Neural Information Processing Systems, pages 8982-8992, 2020.
[24] Hyunsun Choi, Eric Jang, and Alexander Alemi, Waic, but why? generative ensembles for robust anomaly detection. arXiv preprint 1rx1v:1810001192, 2018.
[25] Eric T. Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Görür, and Balaji Lakshminarayanan. Do deep generative models know what they don't know? In 7th International Conference on Learning Representations, 2019.
[26] Jinwon An and Sungzoon Cho. Variational autoencoder based anomaly detection using reconstruction probability. Special Lecture on IE, 2(1):1-18, 2015.
[27] Robin Schirreeister, Yuxuan Zhou, Tonio Ball, and Dan Zhang. Understanding anomaly detection with deep invertible networks through hierarchies of distributions and features. In Advances in Neural Information Processing Systems, pages 21038 21049, 2020.
[28] Davide Abati, Angelo Porrello, Simone Calderara, and Rita Cucchiara. Latent space autoregression for novelty detection. In 2019 IEEE/CVF Conference on Computer Vision and Puttern Recognition (CVPR), pages 481-490, 2019.
[29] Jingkang Yang. Kaiyang Zhou, Yixuan Li, and Ziwei Liu. Generalized out-of-distribution detection: survey. arXiv preprint arXiv:2 11334, 2021.
[30] Alireza Shafaei, Mark Schmidt, and James J. Litle. A less biased evaluation of out-of-distribution sample detectors. In 30th British Machine Vision Conference, 2019.
[31] Polina Kirichenko, Pavel Izmailov, and Andrew G Wilson. Why normalizing flows fail to detect out-of- distribution data. In Advances in Neural Information Processing Systems, pages 20578-20589, 2020.
[32] Aristos Papadopoulos, Mohammad Reza Rajati, Nazim Shaikh, and Jiamian Wang. Outlier exposure with confidence control for out-of-distribution detection. Neurocompuriing 441:138-150, 2021.
[33] Will Grathwohl, Kuan-Chier Wang. Jörn- Henrik Jacobsen, David Duvenaud, Mohammad Norouzi, and Kevin Swersky. Your classifier is secretly an energy based model and you should treat it like one, In 8th International Conference on Learning Representations, 2020.
[34] Yann LeCun, Sumit Chopra, Raia Hadsell, Fu Jie Huang, and et al. A tutorial on energy-based learning. In Predicting structured data. MIT Press, 2006.
[35] Jun Shao. Mathematical statistics. Springer Science Business Media, 2003.
[36] François Chollet et al. Keras. https://keras: 1o 2015.
[37] Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, University of Toronto, Toronto, Ontario, 2009.
[38] Jia Deng, Wei Dong. Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pages 248 255, 2009.
[39] Pingmei Xu, Krista A Ehinger, Yinda Zhang, Adam Finkelstein, Sanjeev Kulkarni, and Jianxiong Xiao. Turkergaze: Crowdsourcing saliency with webcam based eye tracking. arXiv preprint 2015.
[40] Grant Van Horn, Oisin Mac Aodha, Yang Song. Yin Cui, Chen Sun, Alex Shepard, Hartwig Adam, Pietro Perona, and Serge Belongie. The inaturalist species classification and detection dataset. In 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages
2018
12

---

[41] Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. IEEE Transactions Pattern Analysis and Machine Intelligence 40(6):1452-1464) 2017.
[42] Mircea Cimpoi, Subhransu Maji. lasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing textures the wild. 2014 IEEE Conference on Computer Vision and Pattern Recognition, pages 3606-3613, 2014.
[43] Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, Andrew Y. Ng. Reading digits natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2011.
[44] Kaiming He, Xiangyu Zhang, Shaoqing Rea, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770-778, 2016.
[45] Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146. 2016.
[46] Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q. Weinberger. Densely connected convolutional networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages -2669, 2017.
[47] Mark Sandler. Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In 2018 IEEE/CVF Conference Computer Vision and Pattern Recognition, pages 4510-4520, 2018.
[48] Ilya Loshchilov and Hutter Frank. Sgdr: Stochastic gradient descent with warm restarts, In 5th International Conference on Learning Representations. 2017.
[49] Sébastien Marcel and Yann Rodriguez. Torchvision the machine-vision package of torch. In Proceedings of the 18th ACM international conference on Multimedia, pages 1485 1488, 2010.
[50] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf. Edward Yang. Zachary Vito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang. Junjic Bai, and Soumith Chintala. Pytorch: An imperative style, high-performanc deep learning library. In Advances in Neural Information Processing Systems, pages 2024-8033 2019.
13

---

Checklist
1. For all authors...
(a) Do the main claims made in the abstract and introduction accurately reflect the paper's
contributions and scope? [Yes]
(b) Did you describe the limitations of your work? [Yes]
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
2. If you are including theoretical results...
(a) Did you state the full set of assumptions of all theoretical results? [Yes]
(b) Did you include complete proofs of all theoretical results? [Yes]
3. If you experiments..
(a) Did you include the code, data, and instructions needed to reproduce the main experi- mental results (either the supplemental material or as URL)? [Yes]
(b) Did you specify all the training details (e.g., data splits. hyperparameters, how they were chosen)? [Yes]
(c) Did you report error bars (e.g.. with respect the random seed after running experi- ments multiple times)? [Yes]
(d) Did you include the total amount of compute and the type of resources used (c.g., type of GPUs, internal cluster, or cloud provider)? [Yes]
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
(a) If your work uses existing assets, did you cite the creators? [Yes]
(b) Did you mention the license of the assets? [No] We use standard datasets freely available for academic research. They are well-known so we did not mention their licenses.
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A]
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
5. If you used crowdsourcing or conducted research with human subjects...
(a) Did you include the full text of instructions given to participants and screenshots, applicable? [N/A]
(b) Did you describe any potential participant risks, with links Institutional Review Board (IRB) approvals, if applicable? [N/A]
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
14


Reviews:
[{"review_id": "srCYtYZHsjU", "reviewer": "Reviewer_gXcr", "summary": "The paper proposes to improve OOD detection with energy score [1] by incorporating a density-based regularizer during training that promotes better estimate of P(Y). In particular, the regularizer is derived based on the rejection criteria of a hypothesis test to ensure the consistency of Monte Carlo mean of P(y) (estimated per batch) and the empirical mean in the training set (n_y/N). \n\n\n\n\n[1] Liu et al., Energy-based out-of-distribution detection, NIPS 2020. ", "questions": "It would be great if the authors can provide further clarifications on the above Weaknesses points and the following two points:\n\n- It is unclear why ImageNet(R)  and ImageNet(C) can be used as OOD sets for CIFAR (ID). If OOD is defined based on the label, ImageNet contains categories with overlapping semantics with CIFAR and therefore may not serve as valid OOD test sets.\n\n- The reported results for energy score seem much worse than the numbers in the original paper [1] under the same architecture (WideResNet). Are there any potential reasons for the discrepancy? \n\n\n[1] Liu et al., Energy-based out-of-distribution detection, NIPS 2020. ", "limitations": "The paper included discussions on limitations. ", "rating": 4, "confidence": 5, "soundness": 2, "presentation": 2, "contribution": 2, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "Strengths\n- The motivation that existing OOD detection scores suffer from poor density estimation is clear and the task is important. \n- The proposed method based on law of large numbers and central limit theorem is simple. \n\nWeaknesses\n- The rationale behind the proposed method is unclear to me. Currently the works promotes Monte Carlo estimate of P(Y=y) to be closer to n_y/N in the training set. However, during test time, this assumption may not hold: OOD detection concerns with label shift and it is unclear why one wants to overfit the density of label distribution in the training set.\n- While both Lemma 1 and Lemma 2 hold when N goes to infinity,  the batch size used in practice is 256, where Monte Carlo estimate can result in large variance and unreliable estimation. Therefore, there exists significant gaps between the proposed theoretical insights and practical implementation.\n- While y is in low dimensional space, obtaining P(Y) requires integrating over x, which are high dimensional vectors and therefore the effects of dimensionality on the accuracy of estimation is non-negligible. \n", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"ethics_review_area": ""}, "extra_text": {}}, {"review_id": "eMp9hw6fqDr", "reviewer": "Reviewer_9BXS", "summary": "A method is presented to fine-tune pretrained networks by introducing regularization terms such that the marginal density $p(y)$ estimated from logits matches the empirical density $n_y/N$. The claim is that this method allows the sum of logit-exponentials $\\log(\\sum_y \\exp(h_y(x)))$ to be used as a score for OOD detection. Effectiveness on various datasets is examined with good results.", "questions": "1) In lines 243-245, the OOD score is specified as $\\log(\\sum_y \\exp(h_y(x)))$. Since log is a monotonic function, we can focus instead on the term inside the logarithm i.e. $\\sum_y \\exp(h_y(x))$, which is basically the sum (or average) of logit exponentials (which is the same as the denominator of the softmax function). Can the authors motivate this intuitively? How and why is it better than using the softmax score, itself? Specifically, how does introducing the regularization terms during training impact the characteristics of the logit such that this term $\\log(\\sum_y \\exp(h_y(x)))$ can serve as an effective OOD score?\n\n2) A related question: it is stated that \"existing detectors relying on discriminative probability suffer from the overconfident posterior estimate for OOD data.\" This is true, particularly for Softmax based OOD scores. This is closely related to the problem of uncertainty calibration and plenty of research has been done on softmax calibration. Can the authors comment if their OOD score, which is also closely derived from logit-exponentials, is better calibrated? \n\n3) Can the authors please clarify how the numbers reported in Table 1 were obtained? Assuming FPR95% means FPR when TPR=95%, then the benchmarks would seem to be performing remarkably poorly, getting false positive rates of well over 70-80% ? If so, these do not seem to agree with what is widely reported in literature for these methods. For example, TNR rates of well over 80% are reported in reference [9] (Mahalanobis), which would imply FPRs of under 20%. The authors should clarify any differences in settings that were used to obtain their results on benchmarks.\n\n4) The distribution deviating operator $\\mathcal{S}$ comprises fairly standard transformations such as rotations, crops, etc. Typically these are used to generate positive or similar samples in contrastive learning, but here they are being used to synthetically generate out-of-distribution samples. Wouldn't this result in such inputs (from the in-distribution dataset that have been rotated, cropped, etc.) being classified as OOD? \n\n5) It is claimed that the computational algorithm that is developed, \"can be used for any pretrained classification network.\" Hence, the proposed approach is akin to fine-tuning it's parameters with additional regularization terms. Can the authors comment if they tried training a network from scratch (ie with randomly initialized weights), with their combined loss function?", "limitations": "No concerns with potential negative societal impact.", "rating": 5, "confidence": 3, "soundness": 2, "presentation": 2, "contribution": 2, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "\n\nThe exposition is heavy on mathematical proofs at the cost of conceptual clarity and readability. A lot of emphasis is placed on various proofs, but the intuition and concept do not come across as clearly. For instance, in a paper on OOD detection, what is used as the OOD score should be clearly emphasized. However, here the fact that $\\log(\\sum_y \\exp(h_y(x)))$ is used as the eventual OOD score is mentioned only fleetingly, and is easy to miss on the first reading. \nSome recommendations for improvement:\n1) I feel that the training algorithm should be included in the main manuscript instead of the appendix since it clarifies how the various regularization terms are calculated and gives a clearer picture of the overall flow. Some of the details of the lemmas and proofs can be moved to the Appendix.\n2) Mathematical notation should be simplified and made consistent to improve readability. For instance, $y$ is used both as the dependent variable in Eq. (2) and also as the index of summation in the denominator. The term $\\Upsilon^y_n$ in Eq. (9) seems to be a scalar. However, in Eqs. (12) and (13), the matrix transposition operator is applied to it. Can the authors please clarify how to interpret $\\Upsilon^y_n$? Also, notation should be explained where it is introduced. For instance $\\mathbb{S}$ is introduced in Eq. (16), but is explained almost a page later on line 274. \n\nThe paper is well motivated, though, and the results seem good, but there is a question about benchmarks (explained in the next question before). \n\n", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"ethics_review_area": ""}, "extra_text": {}}, {"review_id": "4asAkpY2vTo", "reviewer": "Reviewer_fnQU", "summary": "This paper highlights the drawbacks of current OOD detection methods that most of them try to model ID p(x) using the features that are intially trained to fit p(y|x).\nTo solve the distribution misalignment, a novel density-consistency regularizaiton is proposed.\nA contrastive criterion is also used to flatten p(x) so that OOD samples can locate in low-density area to be identified easily.\nThe proposed method is evaluated upon both OE and non-OE settings, and the performance exceeds the previous methods in a large margin.", "questions": "- How is Mah implemented? Only use the last layer feature to compute mah dist or use features from multiple layers and use validation set to learn optimal weight combination of different feature layers, as the original paper suggest?", "limitations": "The authors do not include the discussion on the limitation of the method.\nWe hope the authors can provide more analysis on its weakness in discusssion.", "rating": 7, "confidence": 5, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "Pro:\n- The paper is well-motivated, and the methods can address the problem intuitively.\n- The method rely on proven assumptions with theoretical proof.\n- The paper obtains significant great results across various experiments with fixed hyperparameters.\n\n\nCon:\n- The results in Table 1 are super charming. However, for CIFAR-100 experiments, I am more interested in the results when CIFAR-10 is OOD, as CIFAR-10 and CIFAR-100 are generally looks alike, but they are from different label distribution. This result usually clearly show how the method capture clues to distinguish ID/OOD. \nIn CV, OOD samples are usually considered as semantic anomalies to ID datasets. However, a common shortcoming of current OOD detection evaluation protocols use different datasets as OOD, so that some methods can use low-level superficial shortcut to make good results (e.g., a simple low/high-resolution image classifier might do extra well on some OOD datasets). But actually, we hope the model uses semantic difference to distinguish ID/OOD. I hope the proposed method gets the better result not by superficial shortcut. The easiest way to proof is to show (ID: CIFAR-10, OOD: CIFAR-100) and (ID: CIFAR-100, OOD: CIFAR-10) cases.\n- The paper points out the semantically overlapping objects between ImageNet and iNaturalist. In some other works such as `ViM: Out-Of-Distribution with Virtual-logit Matching`, `https://github.com/hendrycks/natural-adv-examples`, `Scaling Out-of-Distribution Detection for Real-World Settings`, some cleaner OOD datasets for ImageNet are provided. Authors are suggested to do experiments on these clean ood data. Or to support the reason that the proposed method does not do well on Texture / iNaturalist due to the label noise, the author shall show the appropriated sampled semantically-overlapping objects get high confidence.\n- It would be great if the authors provide more visualization or deeper analysis on what DCR and CDR impact (maybe on the feature space) to help readers better understand the method.", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"ethics_review_area": ""}, "extra_text": {}}, {"review_id": "4MqtkzdxVwf", "reviewer": "Reviewer_QcD7", "summary": "The authors tackle the issue of out-of-distribution detection for deep learning classifiers by proposing two regularization terms that can be added to a loss-function to fine-tune a pretrained network in order to ensure a calibrated probability output of P(X) that can be used to detect OOD samples. \n\nExisting approaches rely on either using a function of the logits P(Y|X) or directly estimating P(X) based on high-level features of the deep learning classifier. However, the logits of a deep network can be overconfident (mis-calibrated) [1] and are often not linearly correlated with P(X) for OOD samples [2]. Furthermore, density estimation on a biased low-dimensional projection of X might not produce an unbiased estimate of P(X). \n\nInstead, the authors propose to compute P(X) based on the softmax logits (P(Y|X)) after first (re)-calibrating the joint distribution P(X,Y) (g(x,y) in Eq. 3). Towards this goal, they derive a density-consistency regularization (DCR) term  based on the asymptotic testing of the consistency of P(Y) (based on logits) and its empirical density function, in a batch-wise fashion. \nThis regularization term effectively (although asymptotically) re-calibrates v(Y) and thus, according to the author’s derivations, re-calibrates the joint distribution h(X,Y). Since a discriminative model already optimizes for the accuracy of P(Y|X), calibrating P(X,Y) = P(Y|X) P(X) should ensure a calibrated P(X) which can be used as a reliable OOD score.\n\nAs a second contribution, this paper introduces a contrastive distribution regularization (CDR) term that incentivizes a high likelihood ratio between augmented samples (assumed to be distribution-deviating) and in-distribution samples. \n\n\n[1] Matthias Hein, Maksym Andriushchenko, and Julian Bitterwolf. Why relu networks yield high-confidence predictions far away from the training data and how to mitigate the problem. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 41–50, 2019\n\n[2] Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. Energy-based out-of-distribution detection. In Advances in Neural Information Processing Systems, pages 21464–21475, 2020.\n", "questions": "1. It is unclear to me why the OOD performance degrades with a larger batch size (Table 3) as it should ensure a tighter CLT bound thus a more accurate analytical approximation in the density-consistency regularization (DCR) term. Do the authors have any intuition regarding this?\n2. To establish the utility of density-consistency regularization, could the authors compare and report the CDFs of the joint (X,Y) or marginals between the networks fine-tuned by the baselines and that using the DCR loss?\n3. The aggregation of the results across different metrics for the ablation study somewhat defies the purpose of disentangling which features matter for which datasets, especially when there is a high variance of difficulty across the datasets (20% FPR vs. ~0). Would it be possible to de-aggregate these results in the appendix?\n4. This approach does indeed seem simple and, based on the reported results, effective. However, could the authors provide some information on the inference time/memory requirements of this approach (as compared to some memory-intensive approaches such as Gram, for example) ?\n5. Could you report the performance of adding CDR alone in Table 2? While the paper is anchored on the novelty of the density consistency regularization term, it seems that the most empirical gain might be from the contrastive distribution regularization term.\n6. What do you mean by \"q is a detached tensor dynamically determined to lienarly map the exponent...\" shouldn't this just be a constant for numerical stability rather than being an adaptive tensor?", "limitations": "1. The performance on ImageNet is not as impressive as that on CIFAR-10/100 which brings up the question of whether this approaches scales with the number of classes or size of dataset. Furthermore, larger networks that are becoming more commonplace for ImageNet-derived tasks might be better calibrated [3]. It would be interesting to verify that this approach can be as effective on these modern architectures. \n2. While the authors claim robustness to hyper parameter choices, the FPR metric does seem to change significantly (on the average benchmark) with different choices of “r” and batch size. It would be interesting to see if that's on a subset of the dataset or a common theme.\n", "rating": 7, "confidence": 5, "soundness": 4, "presentation": 3, "contribution": 3, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "Strengths:\n* The proposed approach is simple and the derivation is straightforward. \n* The idea of converting the asymptotic consistency test into a regularization term for fine-tuning seems novel to me. The idea of calibrating P(Y) to ensure the calibration of P(X) also seems new.\n* The authors present an extensive empirical study in which their approach outperforms most state of the art benchmarks. \n\nWeaknesses:\n* The writing could be clearer. For example, the authors claim to propose a new approach for estimating P(X) when they are actually re-calibrating the logits-based estimation of P(X). “Calibration” was not once mentioned in the paper even though it is equivalent to the assumption of Eq. 3 (that the learned model is faithful to the joint distribution).\n* The authors emphasize on the novelty of the density-consistency regularization term. However, from the empirical study as well as previous literature, it is highly likely that the contrastive-loss term is the main driver of the improved performance. Ablation studies do not disentangle the contribution of this term from that of the density-consistency one (Table 2 is lacking a row for enabling CDR alone).\n* It is difficult to assess the significance of these contributions due to the lack of a detailed (rather than aggregated) ablation study and the use of smaller networks than commonly deployed for the ImageNet results (which I believe are more interesting than those of CIFAR-10/100). \n\n[3] Minderer, Matthias, Josip Djolonga, Rob Romijnders, Frances Hubis, Xiaohua Zhai, Neil Houlsby, Dustin Tran, and Mario Lucic. \"Revisiting the calibration of modern neural networks.\" Advances in Neural Information Processing Systems 34 (2021): 15682-15694.\n", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"ethics_review_area": ""}, "extra_text": {}}]

Author rebuttal:

Decision: Accept