VRA: Variational Rectified Activation for Out-of-distribution Detection

Out-of-distribution (OOD) detection is critical to building reliable machine learning systems in the open world. Researchers have proposed various strategies to reduce model overconfidence on OOD data. Among them, ReAct is a typical and effective technique to deal with model overconfidence, which truncates high activations to increase the gap between in-distribution and OOD. Despite its promising results, is this technique the best choice for widening the gap? To answer this question, we leverage the variational method to find the optimal operation and verify the necessity of suppressing abnormally low and high activations and amplifying intermediate activations in OOD detection, rather than focusing only on high activations like ReAct. This motivates us to propose a novel technique called ``Variational Rectified Activation (VRA)'', which simulates these suppression and amplification operations using piecewise functions. Experimental results on multiple benchmark datasets demonstrate that our method outperforms existing post-hoc strategies. Meanwhile, VRA is compatible with different scoring functions and network architectures. \textcolor[rgb]{0.93,0.0,0.47}{Our code can be found in Supplementary Material}.

Paper

References (52)

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer JjUp6/10 · confidence 5/52023-06-17

Summary

This paper conducts a fine-grained analysis of ReAct, a simple but effective OOD method by rectifying high activation. The authors perform a variational method to analyze the optimal activation function by clipping and amplifying features. Strong empirical results are presented to support the effectiveness of the proposed methods.

Strengths

1. The proposed method is well-motivated both intuitively and theoretically. ReAct presented a promising solution to distinguish OOD samples by clipping activation. So it is natural to perform a fine-grained analysis of how to better clip activations. Actually, ASH [1] has a similar idea but this paper takes a step further to find the optimal solution of clipping from a theoretical point of view. The variational method seems valid and the assumption of Hilbert space is mostly valid for activations of deep neural networks. The theoretical analysis well motivates the methodology and shaping. 2. The authors propose two different variants of the method: one by simply clipping as React, and the other with middle activation amplification. This allows more possibilities to perform OOD detection. 3. The empirical results are very strong. In the ImageNet benchmark, it even outperforms MOS which is a training-needed approach. >[1] Extremely Simple Activation Shaping for Out-of-Distribution Detection. ICLR 23.

Weaknesses

1. My main concern is that the methodology seems to need to calculate $\rho_{out}$ in advance. However, the statistics of OOD data are usually unknown to the model. So having access to the density might reveal some information about OOD data, which might be unfair to the baselines. This might limit the real-world usage of the method. 2. There are some very relevant OOD papers missing in the reference [1,2,3,4]. As stated before, ASH[1] actually has done the similar fine-grained analysis of ReAct. Furthermore, the concept of shaping in ASH covers more operations such as pruning, binary, and scale. RankFeat [2] is also motivated by ReAct and removes the dominant single value of the last feature map. Moreover, it analyzes the lower bound of their method and ReAct. The bound analysis seems to apply to the method of this paper. The comparison and discussion with [1,2] are thus needed in the paper. 3. Some more operations such as binary and scaling can be explored. Currently, only amplification and pruning are supported. >[1] Extremely Simple Activation Shaping for Out-of-Distribution Detection. ICLR 23. > >[2] RankFeat: Rank-1 Feature Removal for Out-of-distribution Detection

Questions

Please see weakness and limitations.

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

5: You are absolutely certain about your assessment. You are very familiar with the related work and checked the math/other details carefully.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

My primary concern is the availability of OOD statistics required by this method. I suggest the authors at least explicitly mention it in the limitation section.

Reviewer J9PQ4/10 · confidence 5/52023-07-06

Summary

The authors propose a technique called "Variational Rectified Activation (VRA)", which simulates these suppression and amplification operations using piecewise functions. Theoretical analysis is provided to illustrated VRA. Extensive experiments demonstrate the effectiveness and generalization for the proposed method.

Strengths

1. It is technically sound to use variational methods to find the optimal function that maximizes the gap between ID and OOD. 2. The whole method is simple and effective, and performs well in different datasets and models. The proposal is also compatible with different scoring functions. 3. The paper is well written, well-structured and easy to understand.

Weaknesses

1. The proposed method of simultaneously truncating high and low activations is very similar to the existing method in [1], which also corrects features by suppressing high and low activations, thus limiting the novelty of this proposal. 2. The formula in Eq.3 confuses me a bit. Why maximizing Ein(z) - Eout(z) maximizes the gap between ID and OOD. Why not maximize the squared difference? What happens if you maximize Eout(z) - Ein(z)? 3. The VRA piecewise function is designed based on the feature histograms in one model and one ID dataset, which may not hold for other datasets and model architectures. For example,for a Transformer-based model, the features in the penultimate layer contains many negative values,how the piecewise function should be in Transformer-based function.   [1] Boosting Out-of-distribution Detection with Typical Features. NeurIPS 2022.

Questions

1. Please compare the VRA framework with [1] and discuss the similarities and differences between the two. 2. In Fig.1, I'm curious about how the optimal function is look like if you use ViT as the classification model, and CIFAR as ID dataset. Could you provide more visualizations in the appendix.   [1] Boosting Out-of-distribution Detection with Typical Features. NeurIPS 2022.

Rating

4: Borderline reject: Technically solid paper where reasons to reject, e.g., limited evaluation, outweigh reasons to accept, e.g., good evaluation. Please use sparingly.

Confidence

5: You are absolutely certain about your assessment. You are very familiar with the related work and checked the math/other details carefully.

Soundness

3 good

Presentation

2 fair

Contribution

2 fair

Limitations

Please see the comments above.

Reviewer Tdya5/10 · confidence 4/52023-07-06

Summary

This work leverages the variational method to find optimal operation and proposes a new technique variational rectified activation (VRA) for out-of-distribution (OOD) detection. This paper finds the best operation for OOD detection and verifies the necessity of suppressing abnormally low and high activations and amplifying intermediate activations. The proposed VRA method is compatible with different network architectures and scoring functions. Extensive experiments on a number of benchmark datasets show the effectiveness of the proposed method.

Strengths

1. This work tackles out-of-distribution (OOD) detection tasks, which is important for building reliable machine learning models in the real world. 2. The key idea of variational rectified activation that mimics suppression and amplification operations using piecewise functions is simple and flexible to compatible with different scoring functions and network architectures. This work also provides a theoretical understanding of the VRA method for OOD detection from the perspective of the variational method. 3. This paper conducts extensive experiments on several benchmark datasets to validate the effectiveness of the proposed VRA method.

Weaknesses

1. Can the authors report the mean and std for the main results in the experiment section? 2. It would be interesting if the authors can compare the visualization of the distribution of ID and OOD uncertainty scores before and after variational rectification.

Questions

Refer to the detailed comments on weaknesses.

Rating

5: Borderline accept: Technically solid paper where reasons to accept outweigh reasons to reject, e.g., limited evaluation. Please use sparingly.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

This work does not present any potential negative societal impact.

Reviewer GN4S4/10 · confidence 3/52023-07-10

Summary

In this paper, the authors explore the out-of-distribution detection ability. They propose Variational Rectified Activation based on ReAct. Specifically, they suppress both the high and low values of the penultimate layer rather than only focusing on high values. Their performance on several benchmark dataset surpasses existing post-hoc strategies.

Strengths

1. They give a theoretical analysis to the proposed method. 2. They compare VRA-based methods with competitive post-hoc strategies, and performs the best.

Weaknesses

1. The theory part should be more clear about the relationship between the objective you minimize and the final score. 2. Please add more baselines to demonstrate the effectiveness of VRA, comparing your method with contrastive learning trained backbones (SSD+[1], CSI[2], CIDER[3]), and other state-of-the-art post-hoc methods (maxlogit[4] and HEAT[5]). [1] https://openreview.net/forum?id=v5gjXpmR8J [2] https://openreview.net/forum?id=o5RKoLQlK4olF [3] https://openreview.net/forum?id=aEFaE0W5pAd [4] https://arxiv.org/abs/1911.11132 [5] https://openreview.net/forum?id=tpCynHFviX

Questions

1. In equation 3, why it is needed to maximally preserve the input? And with this term, why the optimal operation maximize the gap between ID and OOD? 2. In figure 1, your optimal g function does not seem to agree with VRA function. Have you ever try to adjust the gradient when z is between alpha and beta?

Rating

4: Borderline reject: Technically solid paper where reasons to reject, e.g., limited evaluation, outweigh reasons to accept, e.g., good evaluation. Please use sparingly.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

It seems that the paper did not include a limitation section or paragraph explicitly.

Reviewer JjUp2023-08-13

Thanks for the response

Thanks for the response! The reply addresses most of my concerns, but I have one final question: >A3: Thanks for your valuable comments. We have followed a similar method for analysis, but the space here is too small to write, and we will show it in our subsequent discussion and appendix. Can the authors give the results of the analysis here? There is no need to write the full derivations but I am just interested in the final results of the analysis.

Authorsrebuttal2023-08-13

Thanks for the response!

Thank you for taking your precious time to read our rebuttal and give us a response. Based on your valuable suggestions, we provide theoretical proof from the perspective of boundary analysis to answer your final question. Consider output logits $f(\mathbf{z})=\mathbf{W}\mathbf{z}+\mathbf{b}$, where $\mathbf{z}$ is the feature vector of the penultimate layer. We denote the $i^{th}$ element in $f(\mathbf{z})$ as $f_i$, and $c$ is the number of categories. We compute the energy score of the output logits $f(\mathbf{z})$ as the OOD score, consistent with RankFeat: \begin{align} S(\mathbf{z}) = \log \sum_{i=1}^c e^{f_i} = \log \sum_{i=1}^c e^{f_i - \max_{i=1}^c{f_i}} + \max_{i=1}^c f_i \le \log c + \lVert f(\mathbf{z}) \rVert_{\infty}, \nonumber \end{align} For any norm $\lVert \cdot \rVert_{p} (p > 0)$, there exist $k_1>0$ and $k_2>0$ satisfying: \begin{align} k_1 \lVert f(\mathbf{z}) \rVert_p \le \lVert f(\mathbf{z}) \rVert_{\infty} \le k_2 \lVert f(\mathbf{z}) \rVert_p. \end{align} Then, we get: \begin{align} S(\mathbf{z}) \le k_2 \lVert \mathbf{W}\mathbf{z}+\mathbf{b} \rVert_{p} + \log c. \nonumber \end{align} According to the triangle inequality $\lVert \mathbf{W}\mathbf{z}+\mathbf{b} \rVert _p \leq \lVert \mathbf{W}\mathbf{z}\rVert _p + \lVert \mathbf{b} \rVert_p $ and consistence of matrix norms $\lVert \mathbf{W}\mathbf{z}\rVert _p \leq \lVert \mathbf{W}\rVert _p \lVert \mathbf{z} \rVert_p$, and set $p = 1$, we can get: \begin{align} S(\mathbf{z}) \le k_2 \lVert \mathbf{W} \rVert _1 \lVert \mathbf{z} \rVert _1 + k_2 \lVert \mathbf{b} \rVert_1 + \log c. \end{align} According to the above inequality, maximizing $E_{in}[z] - E_{out}[z]$ in VRA means increasing the upper bound gap between ID and OOD. For a clear comparison we write the results in RankFeat: \begin{align} S(\mathbf{z}) \le K\lVert \mathbf{W}\rVert_{\infty} (\sum_{i=1}^N s_i) + \lVert \mathbf{b} \rVert_{\infty} + \log c, \end{align} where $K>0$ and $s_i$ is the singular value of high-level feature map. Specifically, RankFeat "removes the rank-1 matrix from the high-level feature", which means replace $\sum_{i=1}^Ns_i$ with $\sum_{i=1}^N s_i - s_1$, where $s_1$ is the largest singular value. Then RankFeat think "OOD feature usually has a much larger $s_1$", so the operation "removes the rank-1 matrix" in RankFeat can increases the upper bound gap between ID and OOD; VRA maximizes $E_{in}[z] - E_{out}[z]$ to also increase the upper bound gap between ID and OOD. But the upper bound is different between VRA and RankFeat. Above is the analysis of VRA from the similar perspective of RankFeat.

Reviewer JjUp2023-08-13

Thanks for the response! This analysis is very interesting, and further unifies previous works (RankFeat and ReAct). My concerns have been addressed. I would increase the score by one level.

Reviewer J9PQ2023-08-19

Response to Rebuttal

I would like to thank the authors for their rebuttal. But my main concerns have not been addressed. 1. The VRA optimal operation is more like a simple variant of existing feature clipping methods, such as ReAct[1], BAST[2], ASH[3]. ReAct clips high activations, BAST clips both low activations and high activations and ASH-B clips low activations. Although the author emphasizes the difference from BAST, in fact VRA only add three hyper-parameters, while BAST utilized mean and variance to get the min and max thresholds. 2. There are still some problems in the interpretation of formula 3. ReAct clips the high activations and proves that the average activation reduction of OOD is larger than the reduction of ID, which is reasonable. Eq.3 is lack of insight, the author may provide more explanations about why the objective function (Eq.3 ) benefits OOD performance. 3. The optimal operation is based on feature histograms of ID set and OOD set. For different models and OOD datasets, the estimated optimal operation functions might be different, which makes it difficult to obtain the optimal function. For example, the activation functions on iNaturalist, SUN and CIFAR-100 are quite different. Besides, it seems that the optimal function is estimated based on the test ID/OOD set, rather than a validation set. In general,It is interesting and novel to utilize variational method to estimate the optimal activation function. But there are some significant shortcomings, making it hard to be accepted by NeurIPS. I believe the paper can be significantly improved if the author could provide a more reasonable and insightful objective function, and estimate a robust operation function. - [1] ReAct: Out-of-distribution Detection with Rectified Activations. - [2] Boosting Out-of-distribution Detection with Typical Features - [3] Extremely Simple Activation Shaping for Out-of-Distribution Detection.

Authorsrebuttal2023-08-19

Thanks for your response.

We greatly appreciate your reply and want to address your concern as much as possible. **Q1**: The VRA optimal operation is more like a simple variant of existing feature clipping methods, such as ReAct, BAST, ASH. ReAct clips high activations, BAST clips both low activations and high activations and ASH-B clips low activations. Although the author emphasizes the difference from BAST, in fact VRA only add three hyper-parameters, while BAST utilized mean and variance to get the min and max thresholds. **A1**: Thank you very much for your valuable comments. In addition to our responses to Reviewer J9PQ (see A1) and Reviewer JjUp (see A2), we also try to restate the difference between VRA-based methods with existing approaches. In this paper, we extend ReAct and propose new activation functions in OOD detection. VRA-based approaches are not simple variants of existing approaches but have strong motivations and theoretical guarantees. Compared with ReAct, BAST, and ASH which merely truncate low and high activations, we further prove the necessity of amplifying intermediate activations. Such a simple modification can achieve state-of-the-art OOD detection performance, which fully validates its effectiveness. As Reviewer JjUp comments, our VRA-based methods "allow more possibilities to perform OOD detection". **Q2**: There are still some problems in the interpretation of formula 3. ReAct clips the high activations and proves that the average activation reduction of OOD is larger than the reduction of ID, which is reasonable. Eq.3 is lack of insight, the author may provide more explanations about why the objective function (Eq.3 ) benefits OOD performance. **A2**: Thanks for your comments and we apologize for our unclear description. First, let's review the theoretical analysis in ReAct (see Section 5 of ReAct ). It proves that the rectification operation affects OOD activations more severely compared to ID activations and results in a large $ E_{out} ( z_i - \bar{z_i} ) - E_{in} ( z_i - \bar{z_i} ) $ (see Remark 1 of ReAct). The increased separation between OOD and ID activations can transfer to the output space as well (see Remark 2 of ReAct), thus enlarging the gap between OOD and ID score. Rather than just increasing separation like ReAct, this paper attempts to maximize the separation. Based on this motivation, we propose the objective function in Eq. 3. Experimental results on benchmark datasets also demonstrate the effectiveness of our method. **Q3**: The optimal operation is based on feature histograms of ID set and OOD set. For different models and OOD datasets, the estimated optimal operation functions might be different, which makes it difficult to obtain the optimal function. For example, the activation functions on iNaturalist, SUN and CIFAR-100 are quite different. **A3**: Thanks for your valuable comments. In Figure 2 (see attached PDF in Global Response) and Figure 1 (see the main text), we provide visualization results on multiple datasets and obverse the same phenomenon. From this phenomenon, we verify the necessity of suppressing abnormally low and high activations and amplifying intermediate activations. Although different models and OOD datasets might have different optimal operation functions, we can adjust the hyper-parameters in activation functions to approximate the optimal operation function. **Q4**: Besides, it seems that the optimal function is estimated based on the test ID/OOD set, rather than a validation set. **A4**: In fact, we use Gaussian noise images as the validation set for hyper-parameter tuning (see Implementation Details in the main text). If we choose the best hyper-parameter according to the test ID/OOD set, we can achieve even higher OOD detection performance. For example, we set $\eta_{\alpha} = 0.6$, $\eta_{\beta} = 0.95$ and report "17.74/96.47(FPR95/AUROC)'' in Table 1 of our main text. If we choose the best hyper-parameter based on the test ID/OOD set, we can get "16.78/96.63 (FPR95/AUROC)''.

Reviewer GN4S2023-08-21

Thanks for the response. I appreciate the author(s)' effort in this work, but I also realize that the paper has some weaknesses, e.g., in the aspect of novelty, contribution, related work, and technology as other reviewers and I raised in the comments. So, I am inclined to maintain my initial rating.

Authorsrebuttal2023-08-21

Response to Reviewer GN4S

**Q1:** I appreciate the author(s)' effort in this work, but I also realize that the paper has some weaknesses, e.g., in the aspect of novelty, contribution, related work, and technology as other reviewers and I raised in the comments. So, I am inclined to maintain my initial rating. **A1:** Thank you for your valuable comments. To address your concerns, we decide to present our novelty, contribution, related work, and technology more clearly. We kindly ask the reviewer to reconsider the rating. *Novelty and Contribution:* To the best of our knowledge, this is the first work that exploits the variational approach to find the optimal operation and validates the necessity of amplifying intermediate activations in OOD detection. VRA-based approaches are not simple variants of existing works but have strong motivations and theoretical guarantees. As Reviewer JjUp comments, our VRA-based methods "allow more possibilities to perform OOD detection". Experimental results on multiple benchmark datasets demonstrate that our method outperforms existing post-hoc strategies. Therefore, this paper is novel and points out a new direction for OOD detection. *Related Works:* In this paper, we have taken the reviewers' suggestions and compared our VRA-based methods with more related works, including SSD+, CSI, CIDER, MaxLogit, HEAT, BATS, ASH, and RankFeat. Compared with existing works, our method is different in motivation and practical form (see our previous response). Such a simple strategy can achieve state-of-the-art OOD detection performance, which fully validates the effectiveness of our method. Please specify which relevant works we are missing. We can add more discussions and comparisons. *Technology:* We have taken the reviews' suggestions and proposed more variants for VRA, including VRA-G (see the response to Reviewer GN4S), VRA-ViT (see the response to Reviewer J9PQ), and VRA-B (see the response for Reviewer JjUp). Our method allows more possibilities for OOD detection.

Reviewer Tdya2023-08-21

Response to Rebuttal

Thanks for the authors' rebuttal. I read the response and other reviewers' comments. After consideration, I decided to keep my original score.

Authorsrebuttal2023-08-22

Response to Reviewer Tdya

Thank you for your valuable comments. We decide to present our novelty, contribution, related work, and technology more clearly. We kindly ask the reviewer to reconsider the rating. Novelty and Contribution: To the best of our knowledge, this is the first work that exploits the variational approach to find the optimal operation and validates the necessity of amplifying intermediate activations in OOD detection. VRA-based approaches are not simple variants of existing works but have strong motivations and theoretical guarantees. As Reviewer JjUp comments, our VRA-based methods "allow more possibilities to perform OOD detection". Experimental results on multiple benchmark datasets demonstrate that our method outperforms existing post-hoc strategies. Therefore, this paper is novel and points out a new direction for OOD detection. Related Works: In this paper, we have taken the reviewers' suggestions and compared our VRA-based methods with more related works, including SSD+, CSI, CIDER, MaxLogit, HEAT, BATS, ASH, and RankFeat. Compared with existing works, our method is different in motivation and practical form (see our previous response). Such a simple strategy can achieve state-of-the-art OOD detection performance, which fully validates the effectiveness of our method. Please specify which relevant works we are missing. We can add more discussions and comparisons. Technology: We have taken the reviews' suggestions and proposed more variants for VRA, including VRA-G (see the response to Reviewer GN4S), VRA-ViT (see the response to Reviewer J9PQ), and VRA-B (see the response for Reviewer JjUp). Our method allows more possibilities for OOD detection.

Program Chairsdecision2023-09-21

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC