Skip to main content
QUICK REVIEW

[Paper Review] ViM: Out-Of-Distribution with Virtual-logit Matching

Haoqi Wang, Zhizhong Li|arXiv (Cornell University)|Mar 21, 2022
Advanced Neural Network ApplicationsComputer Science7 citations
TL;DR

This paper proposes Virtual-logit Matching (ViM), a novel out-of-distribution (OOD) detection method that combines feature-level residuals and class-dependent logits by generating a virtual OOD logit from the feature residual and matching it to average maximum logits via scaling. ViM achieves state-of-the-art performance with a 90.91% average AUROC on four challenging OOD benchmarks using the BiT-S model, outperforming prior methods by 4%.

ABSTRACT

Most of the existing Out-Of-Distribution (OOD) detection algorithms depend on single input source: the feature, the logit, or the softmax probability. However, the immense diversity of the OOD examples makes such methods fragile. There are OOD samples that are easy to identify in the feature space while hard to distinguish in the logit space and vice versa. Motivated by this observation, we propose a novel OOD scoring method named Virtual-logit Matching (ViM), which combines the class-agnostic score from feature space and the In-Distribution (ID) class-dependent logits. Specifically, an additional logit representing the virtual OOD class is generated from the residual of the feature against the principal space, and then matched with the original logits by a constant scaling. The probability of this virtual logit after softmax is the indicator of OOD-ness. To facilitate the evaluation of large-scale OOD detection in academia, we create a new OOD dataset for ImageNet-1K, which is human-annotated and is 8.8x the size of existing datasets. We conducted extensive experiments, including CNNs and vision transformers, to demonstrate the effectiveness of the proposed ViM score. In particular, using the BiT-S model, our method gets an average AUROC 90.91% on four difficult OOD benchmarks, which is 4% ahead of the best baseline. Code and dataset are available at https://github.com/haoqiwang/vim.

Motivation & Objective

  • To address the limitations of existing OOD detection methods that rely on a single source of information—such as features, logits, or softmax probabilities—by combining multiple information sources.
  • To improve robustness against the immense diversity of OOD samples that may be easily detectable in one space (e.g., feature) but not in another (e.g., logit).
  • To develop a fast, inference-efficient OOD scoring function that requires no retraining and can be applied to pre-trained models.
  • To create a large-scale, human-annotated, realistic OOD benchmark for ImageNet-1K to enable fair and meaningful evaluation of OOD detection methods.

Proposed method

  • ViM constructs a virtual OOD class by computing the residual of the input feature against the principal subspace of the training features.
  • This residual is converted into a logit by scaling it to match the mean of the maximum logits across training samples.
  • The OOD score is defined as the softmax probability of this virtual logit, which serves as a confidence measure for OOD samples.
  • The method leverages both class-agnostic information from the feature residual and class-dependent information from the original logits, enabling complementary detection.
  • The scaling factor is a learnable constant that aligns the virtual logit's mean with the average maximum logit across the training set.
  • The method is compatible with both CNNs and vision transformers and requires no model fine-tuning or retraining.
Figure 1 : The AUROC (in percentage) of nine OOD detection algorithms applied to a BiT model trained on ImageNet-1K. The OOD datasets are ImageNet-O ( $x$ -axis) and OpenImage-O ( $y$ -axis). Methods marked with box $\Box$ use the feature space; methods with triangle $\triangle$ use the logit; and m
Figure 1 : The AUROC (in percentage) of nine OOD detection algorithms applied to a BiT model trained on ImageNet-1K. The OOD datasets are ImageNet-O ( $x$ -axis) and OpenImage-O ( $y$ -axis). Methods marked with box $\Box$ use the feature space; methods with triangle $\triangle$ use the logit; and m

Experimental results

Research questions

  • RQ1Can combining feature-level and logit-level signals improve OOD detection performance beyond single-source methods?
  • RQ2How does the proposed virtual logit matching mechanism compare to existing OOD scoring functions in terms of accuracy and efficiency?
  • RQ3What is the impact of using a large-scale, human-annotated OOD benchmark on the evaluation of OOD detection models?
  • RQ4Does the ViM method generalize across different architectures, such as ResNets and vision transformers?
  • RQ5How does ViM perform under grouping strategies based on semantic taxonomy, especially for vision transformers?

Key findings

  • ViM achieves an average AUROC of 90.91% across four difficult OOD benchmarks when applied to the BiT-S model, outperforming the best baseline by 4 percentage points.
  • On the newly created OpenImage-O dataset, which is 8.8× larger than existing benchmarks and human-annotated, ViM achieves an AUROC of 97.61% and an FPR95 of 12.61%.
  • ViM is the fastest among the four most competitive OOD methods tested, with inference time of 1.49s on OpenImage-O, compared to 249.97s for KL Matching and 2135.13s for Mahalanobis.
  • The method remains effective even when applied to vision transformers, achieving 97.64% AUROC on OpenImage-O with ViT, and outperforming MSP and MaxGroup in most settings.
  • Grouping strategies based on semantic taxonomy provide minimal improvement for ViM on ViT, suggesting that ViM’s performance is robust and less sensitive to class hierarchy.
  • Visualizations show that ViM detects different OOD examples than feature-based methods like Residual and logit-based methods like KL Matching, confirming its complementary detection capability.
Figure 2 : Comparison of AUROC for OOD detection algorithms that are based on probability (marked with diamond $\Diamond$ ), logit ( $\triangle$ ), and feature ( $\Box$ ) of 9 OOD detection algorithms applied to a BiT model trained on ImageNet-1K. The OOD datasets are Texture ( $x$ -axis) and iNatur
Figure 2 : Comparison of AUROC for OOD detection algorithms that are based on probability (marked with diamond $\Diamond$ ), logit ( $\triangle$ ), and feature ( $\Box$ ) of 9 OOD detection algorithms applied to a BiT model trained on ImageNet-1K. The OOD datasets are Texture ( $x$ -axis) and iNatur

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.