STEP: Out-of-Distribution Detection in the Presence of Limited In-Distribution Labeled Data

Abstract: Existing semi-supervised learning (SSL) studies typically assume that unlabeled and test data are drawn from the same distribution as labeled data. However, in many real-world applications, it is desirable to have SSL algorithms that not only classify the samples drawn from the same distribution of labeled data but also detect out-of-distribution (OOD) samples drawn from an unknown distribution. In this paper, we study a setting called semi-supervised OOD detection. Two main challenges compared with previous OOD detection settings are i) the lack of labeled data and in-distribution data; ii) OOD samples could be unseen during training. Efforts on this direction remain limited. In this paper, we present an approach STEP significantly improving OOD detection performance by introducing a new technique: Structure-Keep Unzipping. It learns a new representation space in which OOD samples could be separated well. An efficient optimization algorithm is derived to solve the objective. Comprehensive experiments across various OOD detection benchmarks clearly show that our STEP approach outperforms other methods by a large margin and achieves remarkable detection performance on several benchmarks. 


Reviews and author responses:

 Thank you for the updated results. I raised my score since the authors have addressed the major concerns. In the final version, I strongly recommend the authors include the complete results on broader OOD datasets (including some of the more challenging ones such as Textures and CIFAR-10 vs. CIFAR-100), together with self-supervised baselines.

**Summary**
This paper proposes a new OOD detection method in a semi-supervised OOD detection setting. The problem formulation is based on two characteristics: (1) labeled ID data is limited and (2) unlabeled data can contain a mixture of ID and OOD data. The setting is interesting and more practical in real-world applications. The proposed method STEP is based on the projected space where local topological structures are maintained for the semi-supervised setting.  **Strengths**
- The paper is thoughtfully written and easy to follow.
- The proposed method and the setting of semi-supervised OOD detection is novel
- The reported experimental results seem quite promising (with a few caveats, as described below).

**Weaknesses**
- [validity of OOD during training] The training setup is not completely OOD agnostic, as acknowledged by the authors. In real applications, one can not assume the availability of test OOD during training. The proposed setting had been studied in [1], where a similar assumption is made that unlabeled data is a mixture of ID and OOD. The reviewer thinks a more novel setting is OOD-agnostic, which makes the generalization to unseen OOD critical. Recent works [2][3] also leverage a large pool of unlabeled data for model regularization, which can be relevant. The subtle differences being that [2][3] do not consider limited ID data, and the unlabeled data does not assume the mixture of ID and OOD (which seems more realistic and less restrictive than the proposed setting).
- [Validity of Generalization of OOD Detection] The review is glad that the authors made an effort to address the concern above by testing the OOD detecting performance on an unseen set. However, the experiments are very limited because (TINc, TINr) and (LSUNr, LSUNc) are semantically similar. It would be more convincing if the authors can report the performance on a broader range of OOD test sets. 
- [high time complexity] Training with SimCLR for 500 epochs itself is super expensive. To ensure a fair comparison, can the authors provide the training and evaluation time for each method and start from a representation not obtained by SimCLR?
- [Need for labeled data] From L239 - L246, the detection performance is largely unaffected even if the size of the labeled data is only 10. It seems that the label information is redundant. Perhaps this makes the method in spirit closer to the self-supervised setting, and may deem a careful comparison with recent methods such as CSI [4]and SSD [5]. In comparison with UOOD* (with OOD validation data), the performance gain seems quite marginal.
- [Visualization] Besides the illustration in Figure 1, it might be helpful to provide the visualization of the representation space, especially when the training OOD and test OOD are semantically different? In which case, by viewing the decision boundary, it may be more convincing to see that the proposed method can indeed generalize to unseen OOD distribution.

----
Post rebuttal:
I raised my score since the authors have addressed the major concerns. In the final version, I recommend the authors include the complete results on broader OOD datasets (including some of the more challenging ones such as Textures and CIFAR-10 vs. CIFAR-100), together with self-supervised baselines. 

**References**
[1] Blanchard, Gilles, Gyemin Lee, and Clayton Scott. "Semi-supervised novelty detection." The Journal of Machine Learning Research 11 (2010): 2973-3009.

[2]Hendrycks, Dan, Mantas Mazeika, and Thomas Dietterich. Deep Anomaly Detection with Outlier Exposure. International Conference on Learning Representations. 2018.

[3] Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. Energy-based Out-of-distribution Detection. In Advances in Neural Information Processing Systems, 2020

[4] Jihoon Tack, Sangwoo Mo, Jongheon Jeong, and Jinwoo Shin. CSI: Novelty detection via contrastive learning on distributionally shifted instances. In Advances in Neural Information Processing Systems, 2020

[5] Vikash Sehwag, Mung Chiang, and Prateek Mittal. SSD: A unified framework for self-supervised outlier detection. In Proceedings of the 9th International Conference on Learning Representations.
 The authors have provided a broader impact statement, which seems sufficient. 

 Thank you for your follow-up feedback.

We evaluate our approach and SSD on 5 different OOD data sets in the semi-supervised OOD detection setting (Using CIFAR-10 as ID data set and using samples drawn from TINr as OOD samples mixed in unlabeled data). 

|          | TINr             | TINc             | LSUNr            | LSUNc            | iSUN             |
| :------: | ---------------- | ---------------- | ---------------- | ---------------- | ---------------- |
| STEP | 95.62 $\pm$ 0.37 | 93.19 $\pm$ 1.43 | 98.29 $\pm$ 0.21 | 91.67 $\pm$ 1.91 | 97.42 $\pm$ 0.36 |
|   SSD    | 68.34 $\pm$ 1.12 | 83.85 $\pm$ 1.93 | 67.92 $\pm$ 1.62 | 94.62 $\pm$ 0.66 | 70.00 $\pm$ 1.40 |

The distinction between our work and SSD is that we considered the novel setting where OOD samples are mixed in unlabeled data. In this case of insufficient ID data directly available, it's difficult to consistently obtain satisfactory results using SSD. Compared to SSD, our work focuses on using local structures and original Mahalanobis distance to further enhance OOD detection capabilities instead of directly using Mahalanobis distance as the metric.

 Thanks for the response! I have some standing concerns in the experimental evaluation. I believe addressing these are important for the research community and will strengthen the contributions. 

There have been many great recent works on self-supervised OOD detection. Among those, [1][2] are highly relevant to this work yet uncompared with for no good reason. In particular, the recent training framework in SSD is very similar to the proposed work: a backbone using SimCLR loss is trained for 500 epochs on in-distribution data (which can be unlabeled or labeled). Both methods use Mahalanobis distance as the detection score. The proposed method differs by taking into account OOD data during unsupervised training. In this regard, the reviewer sees SSD as a necessary baseline, as it can be viewed as a lower bound to the proposed method (which has the additional advantage of using OOD data in training). _"Compared to the unsupervised OOD detection methods, they do not require labeled data_" -- note that this argument is not accurate, as SSD has the SupCon variant, which allows training with supervised contrastive loss by leveraging the labeled ID data (see Algorithm 1 in the paper).

Moreover, OOD detection literature commonly evaluates on a larger collection of OOD datasets. This is important because the OOD uncertainty space, especially in high-dimensional space, is exponentially large. Models (and their decision boundary) trained on one dataset are prone to overfit to one particular region of uncertainty space. Therefore, to measure the generalization performance, it's more rigorous to report results across common test sets, such as SVHN, iSUN, LSUN-c, LSUN-r, Textures, etc. In the case of CIFAR-10, you could also evaluate on CIFAR-100 as near ID. The reviewer does not yet see how the paper can claim "generalization" with 1-2 OOD test datasets.

Given the effectiveness of unsupervised pre-training (for both your method and SSD), it'd be also valuable to show how the generalization performance (on various OOD test datasets above) differs for these two methods. This seems like a key to distinguish the contribution of the proposed work from SSD. 

I'd appreciate it if the authors can provide further results on the points raised above. Thanks!

[1] Jihoon Tack, Sangwoo Mo, Jongheon Jeong, and Jinwoo Shin. CSI: Novelty detection via contrastive learning on distributionally shifted instances. In Advances in Neural Information Processing Systems, 2020

[2] Vikash Sehwag, Mung Chiang, and Prateek Mittal. SSD: A unified framework for self-supervised outlier detection. In Proceedings of the 9th International Conference on Learning Representations.


 Thank you for the valuable feedback. Please refer to our reply below.

> Q: [validity of OOD during training] The training setup is not completely OOD agnostic, as acknowledged by the authors. In real applications, one can not assume the availability of test OOD during training. The proposed setting had been studied in [1], where a similar assumption is made that unlabeled data is a mixture of ID and OOD. The reviewer thinks a more novel setting is OOD-agnostic, which makes the generalization to unseen OOD critical. Recent works [2][3] also leverage a large pool of unlabeled data for model regularization, which can be relevant. The subtle differences being that [2][3] do not consider limited ID data, and the unlabeled data does not assume the mixture of ID and OOD (which seems more realistic and less restrictive than the proposed setting).

OOD detection in semi-supervised scenarios is meaningful. Firstly, it is very expensive to collect a large amount of labeled data. Secondly, as discussed in DS3L [13] and Unsupervised OOD Detection [43], many OOD samples are collected at a low cost in the unlabeled data. It is necessary to handle the situation where the labeled data is limited and the unlabeled data is mixed with ID and OOD samples. Recent unsupervised OOD detection algorithms require that unlabeled data must be drawn from in-distribution. This limits the application of these algorithms in real scenarios.

> Q: [Validity of Generalization of OOD Detection] The review is glad that the authors made an effort to address the concern above by testing the OOD detecting performance on an unseen set. However, the experiments are very limited because (TINc, TINr) and (LSUNr, LSUNc) are semantically similar. It would be more convincing if the authors can report the performance on a broader range of OOD test sets.

From the performance in previous studies [36] on the same data sets, the similarity between TINc and TINr (LSUNr and LSUNc) is not that high in terms of OOD detection. We further justify it on one more test case and get similar results. Specifically, we use Cifar10 as ID data set and TINr, LSUNr as two different OOD data sets, and get similar results.

| Train OOD - Test OOD | TINr-TINr    | TINr-LSUNr    | Deterioration |
| -------------------- | ---------------- | ---------------- | ---------------- |
| AUROC         | 95.61 $\pm$ 0.36 | 93.55 $\pm$ 2.75 | -2.15% |



> Q: [high time complexity] Training with SimCLR for 500 epochs itself is super expensive. To ensure a fair comparison, can the authors provide the training and evaluation time for each method and start from a representation not obtained by SimCLR?

All comparison methods require a well-trained model. We tried to train the model from scratch using the Fixmatch, which took us almost 24 hours. This takes longer compared to using SimCLR to get effective feature representations. We use the pre-trained network obtained by SimCLR as initialization for all the comparison methods to conduct a fair comparison. A more efficient pre-training network in the future could be applied to accelerate the training time.

> Q: [Need for labeled data] From L239 - L246, the detection performance is largely unaffected even if the size of the labeled data is only 10. It seems that the label information is redundant. Perhaps this makes the method in spirit closer to the self-supervised setting, and may deem a careful comparison with recent methods such as CSI and SSD. In comparison with UOOD* (with OOD validation data), the performance gain seems quite marginal.

Labeled data is needed. We need to use a small amount of labeled data to estimate the Mahalanobis distance and use Structure-Keep Unzipping to achieve a better OOD detection performance.
Compared to the unsupervised OOD detection methods, they do not require labeled data, but the unlabeled samples must be drawn from the in-distribution.
Compared with UOOD*, the performance gain does seem quite marginal. However, it has been proved in Figure 2 that the detection performance of UOOD* for the unseen OOD samples is seriously degraded, which has great damage to its practicality.

> Q: [Visualization] Besides the illustration in Figure 1, it might be helpful to provide the visualization of the representation space, especially when the training OOD and test OOD are semantically different? In which case, by viewing the decision boundary, it may be more convincing to see that the proposed method can indeed generalize to unseen OOD distribution.

We carried out relevant visualization in A.4, where the accuracy of covariance matrix in Mahalanobis distance does affect the OOD detection ability. Moreover, our projected representation has a better OOD detection ability.


 Thank you for the valuable feedback. Please refer to our reply below.

> Q: Varying the amount of out-of-distribution or in-distribution data

We believe it is meaningful that how varying the amount of out-of-distribution or in-distribution data affects the OOD detection methods. We will further investigate this problem in our work and include this part in our final version.

> Q: It is a bit vague in the Introduction whether the setting is of“limited in-distribution unlabeled data” or “abundant in-distribution unlabeled data”.

It should be limited in-distribution labeled data and abundant in-distribution unlabeled data. We will revise it throughout the paper.

 Thank you for the valuable feedback. Please refer to our reply below.

> Q: The quality of the features obtained by unsupervised training seems to have a quiet impact on the success of the algorithm. Does it infer that the features obtained by unsupervised learning already have a certain OOD detection ability?

Our proposed approach does assume that the representations obtained by unsupervised learning have certain OOD detection capability, which is also verified by the experiments in our paper and previous work [36]. 

> Q: Although the experimental part of the comparison method is relatively sufficient, does the proposal outperforms unsupervised OOD detection methods?

In our setting, unlabeled data is mixed with both ID samples and OOD samples that brings difficulties to the application of such methods. Taking CSI as an example, although there is no need for the labels, the unlabeled data used must be drawn from in-distribution. This provides the possibility to estimate in-distribution from all unlabeled data.

> Q: The histogram of Figure.2 does not intuitively show extract change of performance changes. It's better to add the percentage of performance change.

We will revise it throughout the paper.


 Thank you for the valuable suggestions. Please refer to our reply below. 

> Q: The entire training process is to maintain the distance between connected pairs of samples, and at the same time to extend the distance between unrelated samples. How is the training stability of the algorithm, and whether the final performance is seriously affected by the training epochs? 

As shown in Figure 3, our STEP algorithm is robust and stable to hyper-parameters. Meanwhile, when the loss converges, increasing the number of training epochs will not affect the final performance. We showed it in A.3.  

> Q: The paper written needs to be further improved. For example, there are some overlaps between the content of the related work and the comparison method. Moreover, the font in Figure 2 is too small.


We will improve the writing quality throughout the paper.

> Q: The whole algorithm is based on the features obtained by unsupervised learning. Therefore, it is better to discuss how the quality of the representation learning affects the final performance.

Using advanced unsupervised learning techniques to get better discriminative features can enhance the performance of this algorithm. 


This paper studies a novel setting called semi-supervised out-of-distribution detection. Focusing on the inaccurate estimation problem in this setting, the author proposes a STEP approach to learning an OOD detection-specific space where the model can better separate the in-distribution samples and OOD samples. The comprehensive experiments prove the effectiveness of the proposed approach in this paper.  Pros:
1. This paper analyzes the problem that the OOD detection algorithm potentially encounters in the semi-supervised out-of-distribution detection setting, that is the inaccurate estimation of in-distribution samples. The solution using unlabeled data to compensate for missing in-distribution data seems reasonable and insightful.
2. The experiment part includes comparisons with the SOTA methods, ablation experiments, and hyper-parameter experiments. The experimental content is relatively substantial and basically demonstrates the viewpoints put forward in the paper.
 1. The quality of the features obtained by unsupervised training seems to have a quiet impact on the success of the algorithm. Does it infer that the features obtained by unsupervised learning already have a certain OOD detection ability?
2. Although the experimental part of the comparison method is relatively sufficient, does the proposal outperforms unsupervised OOD detection methods?
3. The histogram of Figure.2 does not intuitively shows extract change of performance changes. It's better to add the percentage of performance change.


This paper introduces a novel out-of-distribution detection setting, where only a tiny subset of labeled ID data is observed. The others remain unlabeled and may belong to ID or OOD. A novel approach is proposed to address the lack of labeled in-distribution data by performing a structure-keep unzipping procedure. The main contribution of the paper is to discuss the new OOD detection setting caused by lacking in-distribution data and propose a new learnable metric to improve the original Mahalanobis distance in this case.   Overall, the proposed setting is novel and the proposed approach reasonable, and the experiments are also convincing. 1. The entire training process is to maintain the distance between connected pairs of samples, and at the same time to extend the distance between unrelated samples. How is the training stability of the algorithm, and whether the final performance is seriously affected by the training epochs?

2. The paper written needs to be further improved. For example, there are some overlaps between the content of the related work and the comparison method. Moreover, the font in Figure 2 is too small.

3.  The whole algorithm is based on the features obtained by unsupervised learning. Therefore, it is better to discuss how the quality of the representation learning affects the final performance.

This paper proposes a novel setting for semi-supervised learning (SSL): SSL with out-of-distribution unlabeled data. In this setting, a limited amount of labelled in-distribution data and a large amount of unlabeled data, a mixture of both in-distribution and out-of-distribution data, are given.  For the labelled in-distribution data is limited, existing methods cannot work well. The paper proposes a method based on self-supervised learned features to project the data into a new space, where the nearest neighbours' distance is preserved but the non-nearest neighbours' distance is maximized. An efficient optimization problem is proposed and the distance in the new space is then used as a criterion to differentiate out-of-distribution data from in-distribution one. Experimental results are shown to verify the effectiveness of the proposed method compared to baselines.   Both the problem setting and the technologies proposed are novel. The problem setting is a combination of semi-supervised learning and out-of-distribution detection. The combination of the two settings has practical consideration, as many real-world problems listed in the paper encounter such kind of problem. It is non-trivial to be solved by existing methods since the labelled data is limited. In such a setting, how to make the best use of these limited labelled data becomes a challenge. The paper proposes a new method to tackle the challenge from the way of topological preserving. An efficient optimization is also proposed and can be combined easily with deep neural networks. 

The paper uses abundant experimental results to support the effectiveness of the proposed method. With four different combinations of data, the proposal achieves the best performance in almost all settings.  Its performance is significantly better than other baselines with or without known that the out-of-distribution data exist. The ablation study shows the key components of the proposed method are necessary. The paper also shows that the proposal is less sensitive to hyperparameters. 

Overall, the paper proposes a novel learning setting with a novel solution. The novel learning setting is of practical value. The methods are appropriately used, and the experimental results have demonstrated the effectiveness of the proposed method from various aspects. 

I appreciate that the paper has honestly admitted in the conclusion that a theoretical study is lacking for the current paper and promise to explore further in this direction. It is quite valuable if some theoretical results can be given, showing how the amount of out-of-distribution data will impact the performance of the proposal compared to baselines, as well as how the amount of in-distribution labelled data will impact the performance. Before further exploring this direction in future work, I suggest the paper show some empirical studies by varying the amount of out-of-distribution or in-distribution data and plotting out how the proposal’s and baselines' performance change with that. 

Another thing is the clarity may need further improvement in some parts of the paper. It is a bit vague in the Introduction whether the setting is of “limited in-distribution unlabeled data”, or “abundant in-distribution unlabeled data”. I suggest the paper clarifies this point. Other parts of the paper are well-written and easy to follow. Lacking theoretical studies is one limitation. The paper has also pointed it out in the conclusion. 

Meta-review: The paper studied out-of-distribution detection problem and proposed semi-supervised OOD detection setting with a new technique called structure-keep unzipping to solve the new setting. The writing is clear, the motivation is strong, the idea is novel, and the results are significant. Thus, I think it should be accepted for publication.

A reviewer had three concerns but the authors wrote a nice rebuttal which addressed two concerns. I think the third concern, which was discussed internally, is also sensible. The problem setting is closely related to positive-unlabeled learning; see [1]. If PU learning can be used to detect in-distribution data, it can of course be used to detect out-of-distribution data. Please add PU learning into the section 4 related work.

A minor comment is that OOD in the title should be given the full term instead of the abbreviation --- first, OOD is not as well known as SVM and it may hurt the understanding (the title should be understandable to every NeurIPS participant), and second, in-distribution is not abbreviated.

[1] Yixing Xu, Yunhe Wang, Hanting Chen, Kai Han, Chunjing Xu, Dacheng Tao, and Chang Xu. Positive-Unlabeled Compression on the Cloud. NeurIPS 2019.


Decision: accept