Paper: Out-of-Distribution Detection with Hyperspherical Energy (ICLR-2024)

Reviewer comment (Writing):
The paper lacks a basic specification for random variable z.

Author response:
Please specify $\mathbf{z}$ before use in the introduction section.

Thank you for pointing that out! We have carefully reviewed the paper again to ensure that we introduce and describe the notations before using them.

Reviewer comment (Experiments):
The reviewer is skeptical of hyperspherical embedding as a training strategy that learns better representation in general. A recently proposed benchmark of [7] compares CIDER [2] (which originates from the same training framework as this paper) to other strategies and shows its deficit in Near-OODs (e.g. SSB-Hard, NINCO) even compared to a simple rotation prediction strategy [8], and it scores the worst among all pretraining strategies. The reviewer thinks the bold assumption of this paper of showcasing hyperspherical embedding as an effective training loss should be verified by comparing to other strategies (e.g. AugMix, RandAugment, RegMixup) on challenging OOD, instead of comparing against only easy ones.

Author response:
> Near-OOD datasets 

Thank you for the valuable suggestions regarding the evaluation of Near-OOD benchmarks. The table below presents a performance comparison of various methods on the suggested dataset NINCO (w.r.t. ImageNet-1k). This comparison highlights the efficacy of the Hyperspherical Energy method, which shows an overall improvement in performance compared to the Energy and CIDER methods. 

|                        | NINCO   |           | 
|:--------------------- |:------- | --------- |
| **Method**            |  **FPR** | **AUROC** | 
| MSP                   | 76.37   | 79.94     | 
| Energy                |  77.63   | 79.69     | 
| CIDER                 |  72.63   | 78.17     | 
| Hyperspherical Energy |  **64.66**   | **84.68**     | 

> How does the proposed method perform against the common corruption?

Thank you for your suggestion on testing against corrupted OOD data. In response to this, we've conducted extensive evaluations on CIFAR-10 and CIFAR-100 under AugMix and RandAugment augmentation scenarios on OOD datasets, as detailed in the tables below. These results clearly demonstrate the effectiveness of the Hyperspherical Energy method in dealing with harder OOD datasets (from common corruptions) by consistently achieving top performance compared to traditional Energy score and CIDER in various scenarios and datasets.

**Under AugMix Augmentation**

|                       | SVHN    |           | Places365 |           | LSUN    |           | iSUN    |           | Texture |           | Average |           |
|:--------------------- | ------- |:--------- |:--------- | --------- | ------- | --------- | ------- | --------- |:------- |:--------- |:------- | --------- |
| **Method**            | **FPR** | **AUROC** | **FPR**   | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** |
| **CIFAR-100** |
| Energy                | 72.33   | 86.38     | 81.85     | 76.97     | 70.17   | 84.59     | 76.01   | 81.16     | 87.93   | 74.18     | 77.66   | 80.66     |
| CIDER                 | 25.03   | 94.90     | 77.88     | 74.62     | 16.65   | 96.29     | 68.27   | 81.59     | 43.90   | 90.41     | 46.35   | 87.56     |
| Hyperspherical energy | 19.69   | 96.08     | 74.81     | 77.34     | 8.35    | 98.28     | 55.09   | 86.71     | 31.51   | 93.48     | 37.89   | 90.38     |
| **CIFAR-10** |
| Energy                | 68.44   | 86.20     | 78.97     | 79.60     | 65.64   | 86.13     | 70.53   | 83.12     | 83.92   | 76.91     | 73.50   | 82.39     |
| CIDER                 | 24.11   | 95.08     | 71.73     | 78.55     | 22.31   | 94.83     | 64.50   | 82.30     | 42.04   | 91.14     | 44.94   | 88.38     |
| Hyperspherical energy | 18.26   | 96.46     | 68.40     | 81.20     | 14.24   | 97.08     | 51.05   | 87.80     | 29.77   | 94.06     | 36.34   | 91.32     |

**Under RandAugment Augmentation**

|                       | SVHN    |           | Places365 |           | LSUN    |           | iSUN    |           | Texture |           | Average |           |
|:--------------------- | ------- |:--------- |:--------- | --------- | ------- | --------- | ------- | --------- |:------- |:--------- |:------- | --------- |
| **Method**            | **FPR** | **AUROC** | **FPR**   | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** |
| **CIFAR-100** |
| Energy                | 53.89   | 91.05     | 43.25     | 91.38     | 13.08   | 97.60     | 29.19   | 95.27     | 56.74   | 89.31     | 39.23   | 92.92     |
| CIDER                 | 4.49    | 99.20     | 28.64     | 95.07     | 2.73    | 99.33     | 15.81   | 97.30     | 14.93   | 97.66     | 13.32   | 97.71     |
| Hyperspherical energy | 5.16    | 99.07     | 29.82     | 94.70     | 3.31    | 99.26     | 16.24   | 97.19     | 14.80   | 97.68     | 13.87   | 97.58     |
| **CIFAR-10** |
| Energy                | 44.48   | 92.65     | 38.75     | 92.60     | 12.50   | 97.73     | 24.07   | 96.14     | 48.72   | 91.16     | 33.70   | 94.06     |
| CIDER                 | 4.40    | 99.23     | 25.88     | 95.51     | 3.97    | 99.16     | 11.89   | 97.78     | 12.91   | 97.92     | 11.81   | 97.92     |
| Hyperspherical energy | 5.16    | 99.10     | 27.43     | 95.13     | 4.67    | 99.06     | 12.94   | 97.69     | 13.58   | 97.87     | 12.76   | 97.77     |

Reviewer comment (Evaluation):
The reasoning and criticisms focused on ImageNet-1k also apply to CIFAR-100 given the low scores in Table 1 of [7].

Author response:
> Near-OOD datasets 

Thank you for the valuable suggestions regarding the evaluation of Near-OOD benchmarks. The table below presents a performance comparison of various methods on the suggested dataset NINCO (w.r.t. ImageNet-1k). This comparison highlights the efficacy of the Hyperspherical Energy method, which shows an overall improvement in performance compared to the Energy and CIDER methods. 

|                        | NINCO   |           | 
|:--------------------- |:------- | --------- |
| **Method**            |  **FPR** | **AUROC** | 
| MSP                   | 76.37   | 79.94     | 
| Energy                |  77.63   | 79.69     | 
| CIDER                 |  72.63   | 78.17     | 
| Hyperspherical Energy |  **64.66**   | **84.68**     | 

> How does the proposed method perform against the common corruption?

Thank you for your suggestion on testing against corrupted OOD data. In response to this, we've conducted extensive evaluations on CIFAR-10 and CIFAR-100 under AugMix and RandAugment augmentation scenarios on OOD datasets, as detailed in the tables below. These results clearly demonstrate the effectiveness of the Hyperspherical Energy method in dealing with harder OOD datasets (from common corruptions) by consistently achieving top performance compared to traditional Energy score and CIDER in various scenarios and datasets.

**Under AugMix Augmentation**

|                       | SVHN    |           | Places365 |           | LSUN    |           | iSUN    |           | Texture |           | Average |           |
|:--------------------- | ------- |:--------- |:--------- | --------- | ------- | --------- | ------- | --------- |:------- |:--------- |:------- | --------- |
| **Method**            | **FPR** | **AUROC** | **FPR**   | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** |
| **CIFAR-100** |
| Energy                | 72.33   | 86.38     | 81.85     | 76.97     | 70.17   | 84.59     | 76.01   | 81.16     | 87.93   | 74.18     | 77.66   | 80.66     |
| CIDER                 | 25.03   | 94.90     | 77.88     | 74.62     | 16.65   | 96.29     | 68.27   | 81.59     | 43.90   | 90.41     | 46.35   | 87.56     |
| Hyperspherical energy | 19.69   | 96.08     | 74.81     | 77.34     | 8.35    | 98.28     | 55.09   | 86.71     | 31.51   | 93.48     | 37.89   | 90.38     |
| **CIFAR-10** |
| Energy                | 68.44   | 86.20     | 78.97     | 79.60     | 65.64   | 86.13     | 70.53   | 83.12     | 83.92   | 76.91     | 73.50   | 82.39     |
| CIDER                 | 24.11   | 95.08     | 71.73     | 78.55     | 22.31   | 94.83     | 64.50   | 82.30     | 42.04   | 91.14     | 44.94   | 88.38     |
| Hyperspherical energy | 18.26   | 96.46     | 68.40     | 81.20     | 14.24   | 97.08     | 51.05   | 87.80     | 29.77   | 94.06     | 36.34   | 91.32     |

**Under RandAugment Augmentation**

|                       | SVHN    |           | Places365 |           | LSUN    |           | iSUN    |           | Texture |           | Average |           |
|:--------------------- | ------- |:--------- |:--------- | --------- | ------- | --------- | ------- | --------- |:------- |:--------- |:------- | --------- |
| **Method**            | **FPR** | **AUROC** | **FPR**   | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** | **FPR** | **AUROC** |
| **CIFAR-100** |
| Energy                | 53.89   | 91.05     | 43.25     | 91.38     | 13.08   | 97.60     | 29.19   | 95.27     | 56.74   | 89.31     | 39.23   | 92.92     |
| CIDER                 | 4.49    | 99.20     | 28.64     | 95.07     | 2.73    | 99.33     | 15.81   | 97.30     | 14.93   | 97.66     | 13.32   | 97.71     |
| Hyperspherical energy | 5.16    | 99.07     | 29.82     | 94.70     | 3.31    | 99.26     | 16.24   | 97.19     | 14.80   | 97.68     | 13.87   | 97.58     |
| **CIFAR-10** |
| Energy                | 44.48   | 92.65     | 38.75   | 92.60     | 12.50   | 97.73     | 24.07   | 96.14     | 48.72   | 91.16     | 33.70   | 94.06     |
| CIDER                 | 4.40    | 99.23     | 25.88     | 95.51     | 3.97    | 99.16     | 11.89   | 97.78     | 12.91   | 97.92     | 11.81   | 97.92     |
| Hyperspherical energy | 5.16    | 99.10     | 27.43     | 95.13     | 4.67    | 99.06     | 12.94   | 97.69     | 13.58   | 97.87     | 12.76   | 97.77     |

Reviewer comment (Experiments):
On the ImageNet dataset, they are obliged to fine-tune only the last residual block of a pre-trained ResNet to achieve good results. I wonder if there are instabilities on the training of the entire network or if the generalization error is elevated.

Author response:
> Q1. Why fine-tune the last residual block only?

That's a great question. We performed fine-tuning on the last residual blocks, mostly to lower computational cost due to limited GPU resources. One can easily use our method and fine-tune on the entire backbone, without stability issues. On small-scale datasets such as CIFAR-10 and CIFAR-100, our training is indeed performed from scratch, on the entire network backbone.

Reviewer comment (Experiments):
Sufficient empirical investigation is lacking to justify some claims of the paper. How does the model perform on vision transformers for instance? Are the learned representations still useful for OOD detection?

Author response:
> Q3. Performance on vision transformers

Thanks for the suggestion - these new experiments are underway and will be added to our updated manuscript.

Reviewer comment (Evaluation):
Discussion on the limitations of the method is missing.

Author response:
> Q6. Limitations

A key strength of our method is its grounded interpretation from a likelihood perspective, as outlined in Lemma 3. This approach, however, necessitates training the model under the von Mises-Fisher (vMF) distribution. While our method achieves accuracy comparable to state-of-the-art models in certain scenarios, it's important to note that it is less common than models trained using traditional cross-entropy loss. This may limit its immediate applicability in environments where standard cross-entropy loss models are the norm. However, we believe that the trustworthiness of the models is worth an effort to train them in a certain way.

Reviewer comment (Novelty):
I suggest the authors better discuss the differences of their method w.r.t SIREN.

Author response:
> Q2. Difference w.r.t. SIREN

We highlight the major differences below:

- SIREN uses maximum class-conditional likelihood (see **Table 1**), which is mathematically different from the hyperspherical energy score. Unlike SIREN, hyperspherical energy is theoretically sound for OOD detection, due to its log-likelihood interpretation (see Section 3.1 for details). Our OOD scoring function enjoys rigorous theoretical interpretation from a log-likelihood perspective, while SIREN's does not. Our derivation and interpretation of hyperspherical energy provided in Section 3.1 is an entirely new contribution, relative to SIREN.
- SIREN primarily focuses on representation shaping loss during training time. In contrast, we focus on a novel test-time OOD detection scoring function. Our method is the first to establish the connection between the hyperspherical representations and Helmholtz free energy for OOD detection. From a training-time perspective, we also derive new insight into how the learning objective induces lower hyperspherical energy (Section 3.2), which directly connects to our proposed OOD scoring function.

Reviewer comment (Experiments):
I suggest running experiments with vision transformers to strengthen your empirical contributions and the relevance of the proposed method. Or adjusting the claims accordingly.

Author response:
> Q3. Performance on vision transformers

Thanks for the suggestion - these new experiments are underway and will be added to our updated manuscript.

Reviewer comment (Reproducibility):
Could the authors provide experimental details to obtain the results in Table 2? Additionally, error bars and the number of tries on the results would be appreciated.

Author response:
> Q4. Could the authors provide experimental details to obtain the results in Table 2? Additionally, error bars and the number of tries on the results would be appreciated.

To provide clarity on the results in Table 2, we focused on measuring the time required to calculate the score for each sample. We obtained these results by averaging the time taken to calculate scores for samples in the ID dataset across each column. **The updated Table 2 now includes error bars**, indicating the variability in results across samples in the dataset.

Reviewer comment (Evaluation):
Could the authors provide error bars for their results by training on multiple random seeds? I believe this would strengthen their empirical contributions.

Author response:
> Q5. Could the authors provide error bars for their results by training on multiple random seeds? I believe this would strengthen their empirical contributions.

Excellent point. Indeed, we have provided error bars in **Figure 3**, where the results are based on multiple training over 3 random seeds.

Reviewer comment (Writing):
The paper could be a bit more well-written overall (see "Minor things" in Questions below).

Author response:
> **Minor suggestions on writing**

We have fixed those writing glitches - thank you for the careful read!

Reviewer comment (Evaluation):
The experimental results are not analyzed in much detail. The OOD detection performance (FPR95/AUROC) is evaluated _relative_ to other methods, but nothing is said about the performance in _absolute_ terms. For example in Table 3, is an average FPR95 of 38.5 actually good? Why is there such a big performance difference between Places365 and LSUN? In which cases does the model fail to distinguish between ID and OOD examples? Why?

Author response:
> Q1. What can be said of the absolute OOD detection performance of the proposed method?

Thanks for the insightful question. We believe it's meaingful to look at both the absolute and relative performance. In particular, Table 3 is based on a challenging setting of CIFAR-100 as ID. As you can see, early method such as MSP can have average FPR95 as high as 83.90%. This signifies the non-trivialness of the task itself. This can be attributed to two factors. First, the ID accuracy on CIFAR-100 is suboptimal (75.03\% as we report in Appendix Table 5), which means the model does not have a strong inherent characterization of the ID data within its representation. Secondly, the ID data and some OOD data can share spurious correlation (e.g., blue sky background), which further exacerbate the detection difficulty. 

Noticeably, in this challenging setting, our method can reduce the FPR95 from the earliest 83.9% to now 38.55% on this challenging task, which we believe is significant progress already. Admittedly, there is still large room for improvement in future research. From a practical point of view, we do desire as low absolute FPR95 as possible. That would be the dream of all researchers in this field, as make more progress :)

Reviewer comment (Evaluation):
What can be said of the _absolute_ OOD detection performance of the proposed method? For example in Table 3, is an average FPR95 of 38.5 good? Does the method actually perform well? In the Introduction you write _"The ability to detect OOD samples is crucial for ensuring the reliability and safety of machine learning models, especially in real-world applications where the consequences of misidentifying OOD samples can be severe"_, does the method perform well enough for this important task?

Author response:
> Q1. What can be said of the absolute OOD detection performance of the proposed method?

Thanks for the insightful question. We believe it's meaingful to look at both the absolute and relative performance. In particular, Table 3 is based on a challenging setting of CIFAR-100 as ID. As you can see, early method such as MSP can have average FPR95 as high as 83.90%. This signifies the non-trivialness of the task itself. This can be attributed to two factors. First, the ID accuracy on CIFAR-100 is suboptimal (75.03\% as we report in Appendix Table 5), which means the model does not have a strong inherent characterization of the ID data within its representation. Secondly, the ID data and some OOD data can share spurious correlation (e.g., blue sky background), which further exacerbate the detection difficulty. 

Noticeably, in this challenging setting, our method can reduce the FPR95 from the earliest 83.9% to now 38.55% on this challenging task, which we believe is significant progress already. Admittedly, there is still large room for improvement in future research. From a practical point of view, we do desire as low absolute FPR95 as possible. That would be the dream of all researchers in this field, as make more progress :)

Reviewer comment (Evaluation):
Can anything be said about common failure cases? For example, why is there such a big performance difference between Places365 and LSUN?

Author response:
> Q2. Common failure cases

The high FPR95 for places365 might be due to the artifact in the dataset itself, rather than the methodology. Despite its common use in literature, the test dataset can be flawed since many images can be distributionally close to ID data. For example, recent work [1] pointed out that Places have some overlapping classes with the ImageNet-1k data, which may lead to high FPR95 in evaluation.

To investigate this hypothesis for CIFAR-100, we analyze the FPR95 for each category in the places365 dataset. We found that more than half of the 365 types of images have FPR95 of at least 79%. This suggests that there’s a lot of overlap between ID and OOD data, which leads to high rates of false positives. On closer inspection, we saw that certain types of images, like natural landscapes and room scenes, are more likely to have this problem. For example, in the places365 dataset, images in the "television_room" category often get mixed up with "television", "couch", or "table" classes from CIFAR-100 because those objects are in the pictures. This confusion leads to FPR95 to be as high as 97%. Another example is the "storage_room" images in places365. They get classified as "table" or "wardrobe" if those items are in the picture, resulting in an FPR95 of 79%.