Paper: DOS: Diverse Outlier Sampling for Out-of-Distribution Detection (ICLR-2024)

Reviewer comment (Novelty):
Diverse sampling is a well-known method in active learning [1,2]. Diverse sampling leading to superior performance is not surprising. It indeed improves the performance of OOD models. Critically speaking, the novelty in terms of the method is limited. If the authors could provide some deeper theoretical analysis, e.g., how diverse sampling improves the generalization bound, it would make the paper more solid.

Author response:
Yes, the factor of diversity has been explored in the context of active learning, where the goal is to select **in-distribution data** for better generalization. In this work, we select **outlier examples** as auxiliary data to improve OOD detection, which is different from active learning. In other words, the problem setting of this work is different from those methods for active learning.

To the best of our knowledge, this work is **the first to investigate the benefits of diversity in outlier sampling for OOD detection**, as recognized by Reviewer HJAj. In the literature, previous works proposed random selection [1,4,5,6] and greedy sampling [2,3] strategies to build the auxiliary OOD dataset. As shown in Section 5, our proposed method achieves substantial improvements over previous methods and enjoys fast convergence.

This work also provides unique insights compared to the diverse sampling of active learning. In active learning, diverse sampling aims to find a collection of samples that can approximate the entire data distribution (ID). In this work, we propose the importance of diversity in alleviating the sampling bias of greedy sampling (See Subsection 2.2). As suggested by reviewer HJAj, we provide a formal definition of diversity (see response to reviewer HJAj), which is different from that of active learning.

Lastly, we would like to clarify that outlier exposure is not directly linked to the generalization bound, which is usually analyzed in active learning. The goal of outlier exposure is to increase the differentiation between ID and OOD inputs, while we only have access to a finite OOD dataset from the infinite OOD feature space. As far as we know, there is no general theoretical framework in existing works to analyze outlier exposure. Instead, **we provide in-depth analysis to show the advantages of DOS from various perspectives**, as appreciated by all reviewers.

Reviewer comment (Theory):
There are typos in equation 2. I understand that the authors use a cross-entropy loss. However, equation 2 is just the entropy. $p(y)$ or $y$ is missing inside the expectation.

Author response:
Thank you for pointing it out. We have fixed it in the updated version.

Reviewer comment (Theory):
Technically, the proposed method (DOS) is based on an empirical demonstration of "diversity" with the OOD detection performance. However, the detailed definition of diversity is under-defined and the underlying mechanism of the clustering-based sampling scheme is not clearly explained.

Author response:
Thank you for pointing out the ambiguous description. Here, we provide a rigorous definition of diversity and show how clustering-based sampling promotes diversity.

Given a set of all OOD examples $\mathcal{D} = { \lbrace \mathbf{x}\_i \rbrace}^{N}\_{i=1}$, our goal is to select a subset of $K$ examples $\mathcal{S} \subseteq \mathcal{D}$ with $|\mathcal{S}| = K$. We define that the selected subset is diverse, if $\mathcal{S}$ satisfies the condition: $$\delta(\mathcal{S}) = \frac{1}{K}\sum\_{x\_{i} \in \mathcal{S}} \min _{j \neq i} d\left(x\_{i}, x\_{j}\right) \geq C,$$ where $d$ denotes a distance function in the space and $C$ is a constant that controls the degree of diversity. A larger value of $C$ reflects a stronger diversity of the subset. A greedy method to promote diversity is directly maximizing the left term $\delta(\mathcal{S})$ among all possible solutions. However, finding the optimal solution requires high computational complexity. And, it will be challenging to maintain the informativeness of selected examples, as you are concerned in W3.

Therefore, we adopt the K-means clustering algorithm to keep the diversity of the selected subset. Intuitively, the clustering algorithm avoids repeatedly selecting examples in the same cluster, i.e., similar examples [1,2]. In particular, the distance between two examples from different clusters is lower bounded by the minimum distance between the boundary of the two clusters. By enlarging the separability of clusters (the goal of clustering), we can then increase the lower bound of $\delta(S)$, i.e., $\mathcal{C}$. In this way, we show the relationship between clustering and diversity.

In addition, we adopt the Calinski-Harabasz (CH) index as a proxy to measure the diversity of the subset (see Figure 3). In particular, the CH index is the ratio of the between-cluster sum of squares (BCSS) and the within-cluster sum of squares (WCSS). A higher value of the CH index reflects a larger between-cluster distance and smaller within-cluster distance, leading to a higher value of $\mathcal{C}$.

Reviewer comment (Experiments):
Since the previous greedy strategy will continually sample those outliers that are easy to be recognized as ID data, why do we need to utilize the diverse sampling method if the newly proposed method will sample some outliers that are already recognized as OOD data by the model?

Author response:
Yes, promoting diversity in sampling would include some outliers that are easier than those selected by greedy sampling. As shown in Subsection 2.2, the hardest examples selected by the greedy sampling might be similar (See Figure 2a), leading to suboptimal performance in OOD detection (See Figure 2b). Therefore, we propose to sample **the hardest examples from different clusters**, which introduces diversity among the selected examples. Despite the fact that those diverse examples might not be the hardest globally, they are sufficiently informative to support the OOD detection task, as verified in Tables 1 and 2.

Reviewer comment (Experiments):
The experimental part can include more results conducted in other ID datasets, as well as the large benchmark dataset (like ImageNet) to demonstrate the effectiveness and efficiency of the proposed DOS.

Author response:
In addition to CIFAR100, we also conduct experiments on ImageNet-10 as the large-scale benchmark, following recent work on OOD detection [3]. The details of the experimental setting are introduced in Appendix C and the corresponding results are presented in Table 2. Our method achieves the best performance, surpassing the competitive OE by 3.07% in average FPR95. To avoid any confusion, we add a sentence in Subsection 4.1 to list all datasets we used in experiments.

Reviewer comment (Experiments):
As for the critical motivation ("However, the OOD samples selected solely based on uncertainty can be biased towards certain classes or domains, which may fail to capture the full distribution of the auxiliary OOD dataset."), the intuitive illustration is based on a toy example in 2D space, it could be better to refer to some convincing results which also show the same problem with Figure 1c.

Author response:
To support Figure 1c, we design an empirical analysis (see Subsection 2.2) to show the biased distribution caused by greedy sampling. As shown in Figure 2a, the greedy strategy leads to biased sampling, which exhibits an imbalanced distribution of outliers over the six clusters. To make it clearer, we add a note in the caption of Figure 1c.

Reviewer comment (Experiments):
For the "imbalanced performance of OOD detection" pointed out in the same sentence, could the authors provide some empirical evidence?

Author response:
Thank you for pointing out the ambiguous word. For clarification, we refer to "imbalanced" as "suboptimal" performance of OOD detection in the sentence. As shown in Figure 2b, the biased sampling leaves a large portion of OOD samples overconfident, which is suboptimal compared to the uniform sampling. In the revised version, we replace the "imbalanced" with "suboptimal" in Section 1.

Reviewer comment (Evaluation):
The critical observation shows that "outlier subset comprising data from more clusters results in better OOD detection", but what is the relationship between the cluster with diversity?

Author response:
We guess your concern is about how diverse clusters affect OOD detection. In Figure 2b, we provide an empirical analysis to show the advantage of uniform sampling, compared to biased sampling. The results show that the uniform strategy with max diversity achieves a much lower FPR95 than the biased strategy, which demonstrates the critical role of diversity in sampling.

Reviewer comment (Experiments):
It seems that the current version of the work does not provide the corresponding experimental part for supporting the claimed "efficient" of the proposed DOS, like the sampling efficiency if I understand it correctly.

Author response:
Thank you for pointing out the potential for misunderstanding. The efficiency of DOS refers to the efficient training from fast convergence, instead of sampling efficiency. In particular, models trained with DOS converge to the optimal performance in much fewer epochs. As shown in Figure 5, our method achieves impressive performance at the 70th epoch, while the performances of random sampling and NTOM are not converged at the 100th epoch, with a significant gap to our method. More details can be found in Section 5 of the manuscript.

Reviewer comment (Experiments):
In addition to using the CIFAR-100 as the ID dataset, it could be better to use the ImageNet dataset as ID dataset and use a large-scale ImageNet 21k as auxiliary outliers to verify the scalability of the proposed DOS.

Author response:
In addition to CIFAR100, we also conduct experiments on ImageNet-10 as the large-scale benchmark, following recent work on OOD detection [3]. The details of the experimental setting are introduced in Appendix C and the corresponding results are presented in Table 2. Our method achieves the best performance, surpassing the competitive OE by 3.07% in average FPR95. To avoid any confusion, we add a sentence in Subsection 4.1 to list all datasets we used in experiments.

Reviewer comment (Experiments):
By normalizing the feature vectors, if I understand correctly, Euclidean norm is used so that the normalized vector resides on the unit hypersphere. Is there any benefit to using specialized versions of k-means (and k-means related) algorithms for the hypersphere? For reference, there are versions of k-means and the Gaussian mixture model that are restricted to the hypersphere (technically, mixtures of von Mises-Fisher distributions). See, for instance, the papers by Banerjee et al (2005) and Kim (2021). More generally, some sort of sensitivity analysis with respect to using different clustering algorithms could be helpful.

Author response:
Thank you for the great suggestion. Here, we conduct sensitivity analysis to compare the performance of various clustering algorithms, including Agglomerative [1], K-Means++ seeding [2,3], Spherical K-Means, moVMF soft, and moVMF hard [4,5]. The experiments are conducted with the large benchmark (IN10-IN990). We keep the same training setting as in the manuscript. In addition to the OOD detection performance, we also present clustering time in each iteration, which is also a key factor of choosing clustering algorithm.

As shown in the Table below, K-means (our choice) achieves the best performance among the compared algorithms. In addition, the two algorithms based on moVMF require too much time in each iteration, making it non-trivial to implement in this case. The resting algorithms cannot achieve comparable performance to ours, while they three obtains a little higher efficiency. We add the empirical results into Appendix D of the manuscript.


|         Metric         | Agglomerative | K-Means++ seeding | Spherical K-Means | moVMF soft | moVMF hard | K-Means (Ours) |
|:----------------------:|:-------------:|:-----------------:|:-----------------:|:----------:|:----------:|:--------------:|
|   FPR95 $\downarrow$   |     38.39     |       48.19       |       24.11       |     -      |     -      |   **20.71**    |
| Time Cost $\downarrow$ |   **0.05s**   |       2.0s        |       3.1s        |   242.1s   |   243.0s   |      4.5s      |

Reviewer comment (Experiments):
Figuring out how to set up experiments so that you could report error bars would be very helpful.

Author response:
Thank you for pointing this out. We add the error bars in the revised version.