HyperMix: Out-of-Distribution Detection and Classification in Few-Shot Settings

Nikhil Mehta, Kevin J. Liang, Jing Huang, Fu-Jen Chu, Li Yin, Tal Hassner

Abstract

Out-of-distribution (OOD) detection is an important topic for real-world machine learning systems, but settings with limited in-distribution samples have been underexplored. Such few-shot OOD settings are challenging, as models have scarce opportunities to learn the data distribution before being tasked with identifying OOD samples. Indeed, we demonstrate that recent state-of-the-art OOD methods fail to outperform simple baselines in the few-shot setting. We thus propose a hypernetwork framework called HyperMix, using Mixup on the generated classifier parameters, as well as a natural out-of-episode outlier exposure technique that does not require an additional outlier dataset. We conduct experiments on CIFAR-FS and MiniImageNet, significantly outperforming other OOD methods in the few-shot regime.

Introduction

Most Out-of-Distribution (OOD) detection systems are "data-hungry," typically relying on thousands of samples to define sharp boundaries for In-Distribution (IND) data. However, many real-world applications—such as personalizing a device or identifying rare medical conditions—provide only a handful of examples, known as the "few-shot" setting. In these scenarios, Few-Shot Learning (FSL) models are prone to over-generalization and overconfidence when encountering novel inputs. Research indicates that many current state-of-the-art OOD methods actually perform worse than simple baselines, like Maximum Softmax Probability, when restricted to few-shot episodes.

The HyperMix Framework

To address the limitations of existing methods, we introduce HyperMix, a framework based on a hypernetwork—a secondary model that generates the weights for a primary classifier based on the provided support samples. HyperMix incorporates two primary innovations to enhance OOD detection:

  1. ParamMix (Parameter Mixup): While standard Mixup blends images or features, ParamMix performs Mixup in the parameter space of the generated classifier weights. This regularizes the hypernetwork, helping it produce classifiers that generalize more effectively across decision boundaries.
  2. OOE-Mix (Out-of-Episode Mixup): Outlier Exposure (OE) usually requires massive auxiliary datasets. HyperMix instead utilizes "leftover" classes within the same dataset that were not selected for the current few-shot task. By treating these as "near-OOD" samples and mixing them with IND samples during training, the model learns to be intentionally uncertain when encountering inputs that look similar to training data but do not belong to the target classes.
The HyperMix architecture utilizes a hypernetwork to generate classifier weights, incorporating parameter-space Mixup (ParamMix) for regularization.

Our analysis also revealed that popular methods like Deep Mahalanobis fail in few-shot settings because they rely on covariance matrices that become "degenerate" (rank-deficient) with only 5 or 10 samples, leading to poor statistical estimates.

Experimental Results

We evaluated HyperMix on two standard benchmarks: CIFAR-FS and MiniImageNet. In our protocol, half of the query images were from the classes in the support set (IND), and the other half were from unseen classes (OOD).

HyperMix consistently outperformed baselines across both datasets in 5-shot and 10-shot settings:

  • AUROC Improvements: On CIFAR-FS, HyperMix achieved an AUROC of 82.43%, compared to 75.42% for the standard ProtoNet baseline.
  • FPR Reduction: It significantly reduced the False Positive Rate at 90% recall (FPR@90). On MiniImageNet 5-shot, it dropped the FPR to 65.57%, whereas other hypernetwork-based OOD methods hovered between 70-85%.
HyperMix demonstrates superior robustness to label noise compared to standard hypernetworks and other OOD methods on CIFAR-FS and MiniImageNet.

Furthermore, HyperMix demonstrated significant robustness to noise. Even when the support set contained mislabeled samples, the framework maintained a performance lead, suggesting that parameter-space regularization provides a critical buffer against low-quality data.

Conclusion

HyperMix effectively addresses the "few-shot" OOD dilemma by combining hypernetwork weight generation with novel Mixup strategies. While the current framework excels at "near-OOD" detection within specific domains, future work will explore cross-domain OOD scenarios and methods to reduce the computational complexity of the hypernetwork architecture.

Summary updated

Abstract

Out-of-distribution (OOD) detection is an important topic for real-world machine learning systems, but settings with limited in-distribution samples have been underexplored. Such few-shot OOD settings are challenging, as models have scarce opportunities to learn the data distribution before being tasked with identifying OOD samples. Indeed, we demonstrate that recent state-of-the-art OOD methods fail to outperform simple baselines in the few-shot setting. We thus propose a hypernetwork framework called HyperMix, using Mixup on the generated classifier parameters, as well as a natural out-of-episode outlier exposure technique that does not require an additional outlier dataset. We conduct experiments on CIFAR-FS and MiniImageNet, significantly outperforming other OOD methods in the few-shot regime.
BibTeX
@inproceedings{mehta2024hypermix,
  author = {Nikhil Mehta and Kevin J. Liang and Jing Huang and Fu-Jen Chu and Li Yin and Tal Hassner},
  title = {{HyperMix: Out-of-Distribution Detection and Classification in Few-Shot Settings}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
  url = {https://openreview.net/forum?id=UyPBOth2X3},
}
Figure