Paper: Rethinking Out-of-Distribution Detection on Imbalanced Data Distribution (ICLR-2024)

Reviewer comment (Experiments):
What if the auxiliary OOD dataset used for training and/or the target OOD dataset exhibits class-imbalance as well? I think it is important to study various combinations of class-balanced and -imbalanced ID/auxiliary OOD/target OOD datasets. Does the analysis performed in the paper extend to and hold in such settings? Can ImOOD still outperform other baselines?

Author response:
> Q1: How to deal with the self-imbalanced OOD data?

The self-imbalanced OOD data is indeed a practical problem. 
As suggested, we now take CIFAR100 as the imbalanced auxiliary OOD data, and train models with CIFAR10 as ID.
Then models are evaluated on the remaining 5 subsets of the SCOOD benchmark (CIFAR100 was originally used as test OOD data but is now eliminated).
According to the results reported below, our ImOOD consistently outperforms the advanced PASCL method.

|  Method  |   AUROC↑  |    AUPR↑  |   FPR95↓  |
|:--------:|:---------:|:---------:|:---------:|
|   PASCL  |   88.05   |   86.63   |   38.69   |
| **Ours** | **89.14** | **87.30** | **35.48** |

Besides, we have also noticed a recent work by BalEnergy $^{[1]}$ that discussed this issue and added class-aware loss regularizations on OOD training data.
According to the experiments in Appendix B.3 (due to different experimental settings) of our submitted paper, we equipped our ImOOD with BalEnergy and achieved better OOD detection performance.
It indicates our method does not conflict with imbalanced OOD data optimization techniques.

|   ID Data   |   Method  |   AUROC↑  |   AUPR↑   |   FPR95↓  |
|:-----------:|:---------:|:---------:|:---------:|:---------:|
|  CIFAR10-LT | BalEnergy |   92.51   |   91.87   |   31.11   |
|             | **+Ours** | **92.80** | **92.26** | **30.29** |
| CIFAR100-LT | BalEnergy |   77.55   |   72.95   |   61.54   |
|             | **+Ours** | **77.85** | **73.96** |   61.82   |

Reviewer comment (Reproducibility):
More details on how the label distribution is learned (during test-time regularization) would be appreciated. Also, do you use the same learned label distribution when performing post-hoc normalization? Or is it used only for training-time regularization? If you discard it after training, one would have to know the label distribution anyways for post-hoc normalization, so do we really need to use the learned distribution in the first place?

Author response:
> Q3: Details about the label prior $P(y)$.

We are sorry to make you confused. During **training**, we make the initial statistic estimates $P(y) \coloneqq \pi_y$ as **learnable** $\pi_y(\theta)$, **merely** to better push $g(x)$ close to the ideal $g^{bal}(x)$.
During **testing**, the estimated $\pi_y(\theta)$ will be **discarded**, and we only adopt the already optimized $g(x)$ to perform OOD detection.
In this way, people do not need to know the learned $\pi_y(\theta)$, as no more post-hoc normalization is required.

We will better clarify the whole procedure of our method.

Reviewer comment (Experiments):
The empirical validation is limited to one target OOD dataset per InD dataset. Validation on more challenging OOD datasets (e.g., near OOD data, data with spurious correlation) would be helpful to gauge the effectiveness of the proposed method.

Author response:
> Q4: Evaluation on different OOD test sets.

In the paper we mainly compare different OOD detectors on the SCOOD benchmark $^{[2]}$, a composite evaluation dataset with 6 subsets covering different scenarios. 
Here we identify two representative subsets from SCOOD to further demonstrate our efficacy.
Specifically, SVHN can be viewed as far OOD, and CIFAR100 can be seen as near OOD (with CIFAR10-LT as ID), as suggested by Fort et al $^{[3]}$.
As we previously discussed, our ImOOD brings consistent enhancement against the strong baseline PASCL, especially on CIFAR100 (near OOD) test set with a decrease of 6.4% on FPR95.

In addition, we also report the spurious OOD detection evaluation as suggested by Ming et al $^{[4]}$. The WaterBird ID dataset also suffers from the imbalance problem (on water birds and land birds), and Ming et al specifically collected a subset of Places as the spurious OOD test set (with spurious correlation to background). The results below also demonstrate our method's robustness in dealing with spurious OOD problems.

|     Evaluation Dataset    |  Method  |   AUROC↑  |    AUPR↑  |   FPR95↓  |
|:-------------------------:|:--------:|:---------:|:---------:|:---------:|
|      SCOOD Benchmark      |   PASCL  |   90.99   |   89.24   |   33.36   |
|                           | **Ours** | **92.73** | **92.31** | **28.27** |
|       SVHN (Far OOD)      |   PASCL  |   96.63   |   98.06   |   12.18   |
|                           | **Ours** | **97.12** | **98.08** | **10.47** |
|    CIFAR100 (Near OOD)    |   PASCL  |   84.43   |   82.99   |   57.27   |
|                           | **Ours** | **86.03** | **85.67** | **50.84** |
| WaterBird (Spurious OOD)  |   PASCL  |   89.59   |   91.05   |   33.73   |
|                           | **Ours** | **90.63** | **92.49** | **30.11** |

Reviewer comment (Experiments):
I am curious about the possibility of this method being extended to distance-based OOD detection methods, such as Mahalanobios distance, etc. How well does the current method compare to the state-of-the-art distance-based methods?

Author response:
Thanks for the thoughtful suggestion. Due to the time limitation, here we mainly compare our method with Mahalanobios distance $^{[1]}$ (denoted as "Maha") on the CIFAR10-LT benchmark. The results show that our post-hoc normalization (denoted as "Maha + infer") brings slight improvements (e.g., 0.3% increase on AUROC), while our training-time regularization (denoted as "Maha + train") significantly boosts the imbalanced OOD detection (e.g., 1.2% increase on AUROC and 3.4% decrease on FPR95).

|    Method    |   AUROC↑  |   AUPR↑   |   FPR95↓  |
|:------------:|:---------:|:---------:|:---------:|
|     Maha     |   88.26   |   87.94   |   42.74   |
| Maha + infer |   88.58   |   87.98   |   42.47   |
| Maha + train | **89.43** | **88.31** | **39.37** |

However, the final results are still worse than advanced models (with 92%+ on AUROC for example). A possible reason might be that the feature-level distance estimation is basically inaccurate, especially for the tail classes with rare data samples to statistic (e.g., computing the mean and variance). On the other hand, our method takes the imbalance problem into consideration, which helps balance the feature space by using the training-time regularization.

Reviewer comment (Experiments):
I am curious about how well the current method performs on synthesized outliers (Tao et.al. 2023).

Author response:
Thanks for the insightful suggestion. Here we equip with the novel VOS $^{[2]}$ and NPOS $^{[3]}$ to synthesize virtual OOD data in the feature space for training.
According to the results shown below, synthesized outliers can also improve the OOD detection performance (e.g., 72% v.s. 75% on AUROC), and our method brings further advance regarding the vanilla VOS and NPOS methods (e.g., 75% v.s. 78% on AUROC).


| Training OOD |  Method  |   AUROC↑  |    AUPR↑  |   FPR95↓  |
|:------------:|:--------:|:---------:|:---------:|:---------:|
|     None     |    MSP   |   72.09   |   70.40   |   68.79   |
|    VOS-Syn   |    VOS   |   75.44   |   73.86   |   65.04   |
|              | **Ours** | **78.61** | **76.97** | **64.65** |
|   NPOS-Syn   |   NPOS   |   74.83   |   74.02   |   69.67   |
|              | **Ours** | **77.05** | **76.52** |   70.85   |

However, compared to the real OOD training data (e.g., the TinyImages80M used in our original setting), the synthesized outliers seem to be unsatisfactory to help train a SOTA OOD detector. It indicates that the density-based VOS and the distance-based NPOS also suffer from inaccurate feature-level statistics on imbalanced data distribution, and are unable to generate qualified virtual outliers.
This is more severe for models training from scratch, as NPOS also discussed, and image-level OOD sample synthesis may help alleviate this problem.

We will add those experiments and discussions.

Reviewer comment (Novelty):
Could you elaborate more on a closely related baseline, Jiang et al. 2023, and discuss the similarities and differences w.r.t your work?

Author response:
Thanks for pointing out this. Here we summarize the main similarity and differences regarding ClassPrior in detail.

The major **similarity**, as discussed in the submitted manuscript, is that both ClassPrior and our method incorporate ID class prior to boosting imbalanced OOD detection. On the other hand, the **differences** mainly lie in three aspects:

1. The **motivation** between our ImOOD and ClassPrior is different. ClassPrior assumes a different posterior distribution $P(y|x)$ on ID data and OOD data, and manually develops two ad-hoc distance-measures regarding $P(y|x)$ and $P(y)$ to adjust existing OOD scorers without **theoretical support**. Instead, our method theoretically analyzes the bias between imbalanced OOD detector $g(x)$ and ideal (balanced) $g^{bal}(x)$, based on which we further provide a unified view of post-hoc normalization and training-time regularization techniques to push $g(x)$ towards $g^{bal}(x)$.
2. ClassPrior makes a **strong assumption** that the posterior probability of OOD data equals the prior ID probability, that is, $P(y|x \in \mathcal{D}^{out}) = P(y)$ (see its Theorem 3.2). The question is this assumption does not always hold. In our Table 2, we report its "RP+MSP" (RePlacing) strategy on models trained with CIFAR10-LT (with ID data only), which leads to negligible improvements (e.g., 0.3% increase of AUROC). We further test its "RW+Energy" (ReWeighting) strategy on the same model, as shown in the table below, which even causes performance degradation. In contrast, our method does not make any assumption on $P(y|x \in \mathcal{D}^{out})$, and shows strong robustness to the practical scenarios (e.g., 4.3% increase of AUROC). 

|  Post-hoc  | AUROC↑ |  AUPR↑ | FPR95↓ |
|:----------:|:-----:|:-----:|:-----:|
|    Energy  | 73.16 | 71.73 | 69.19 |
| ClassPrior | 72.22 | 70.88 | 70.75 |
|    **Ours**    | **77.48** | **76.29** | **66.47** |

3. Our ImOOD provides **training-time regularization** to further boost the imbalanced OOD detection, where ClassPrior is **inapplicable** since its assumption $P(y|x \in \mathcal{D}^{out}) = P(y)$ does not necessarily hold during training (e.g., OE assumes $P(y|x \in \mathcal{D}^{out}) = \frac{1}{N_c} \neq P(y)$).

We will supplement those discussions to clarify our novelty and contribution.

Reviewer comment (Evaluation):
The performance gain using the post hoc normalization seems to be marginal on OE and BinDisc, especially in terms of AUROC and AUPR. Having a more detailed explanation for this would be useful.

Author response:
> Q3: About the effectiveness of post-hoc normalization.

Thanks for pointing out this. In the manuscript, we only provide the performance gain brought by our post-hoc normalization on CIFAR10-LT benchmark. Here we supplement the results on CIFAR100-LT and ImageNet-LT benchmarks, which shows applying our method leads to consistent improvements on various datasets. The general validation of our post-hoc normalization is verified.

|  Benchmark  |   Method  |   AUROC↑  |   AUPR↑   |   FPR95↓  |
|:-----------:|:---------:|:---------:|:---------:|:---------:|
|  CIFAR10-LT |  BinDisc  |   87.37   |   81.05   |   33.66   |
|             | **+Ours** | **87.64** | **81.61** | **31.31** |
| CIFAR100-LT |  BinDisc  |   72.09   |   67.63   |   68.70   |
|             | **+Ours** | **72.33** | **67.96** | **67.54** |
| ImageNet-LT |  BinDisc  |   70.12   |   69.64   |   78.13   |
|             | **+Ours** | **70.74** | **70.28** | **76.83** |

However, as our experiments suggest, the enhancement by post-hoc normalization is relatively limited, while our training-time regularization seems to bring more significant advances.
The main reason may be that the estimates of probability distributions are not well-calibrated, especially for the class prior $P(y) \coloneqq \pi_y$ whose numerical instability may severely affect the OOD detection process, as discussed in Appendix 2.3 in the submitted paper.
We thus further develop the training-time regularization technique to automatically adjust the estimates, in order to ultimately learn a better OOD detector $g(x)$ close to the ideally balanced $g^{bal}(x)$.
Once $g(x)$ is optimized, no estimate is used for detecting OOD samples, and the output of scorer $g(x)$ is more stable and effective in performing OOD detection.

We will add the experiments and discussions.