Table of Contents
Fetching ...

DCAC: Dynamic Class-Aware Cache Creates Stronger Out-of-Distribution Detectors

Yanqi Wu, Qichao Chen, Runhe Lai, Xinhua Lu, Jia-Xin Zhuang, Zhilin Zhao, Wei-Shi Zheng, Ruixuan Wang

TL;DR

DCAC tackles overconfident OOD predictions by exploiting a class-specific insight: OOD samples predicted for the same class tend to be visually similar to one another. It introduces a training-free, test-time calibration module that maintains per-ID-class caches of high-entropy samples and uses a fixed two-layer transformation on cached features and probabilities to adjust raw logits. The approach is architecture-agnostic and integrates with existing OOD detectors for both unimodal and vision-language models, delivering consistent improvements with modest overhead. Empirically, DCAC achieves substantial gains on ImageNet-1K far-OOD benchmarks and other datasets, reducing false positives and tightening score distributions without requiring additional training data.

Abstract

Out-of-distribution (OOD) detection remains a fundamental challenge for deep neural networks, particularly due to overconfident predictions on unseen OOD samples during testing. We reveal a key insight: OOD samples predicted as the same class, or given high probabilities for it, are visually more similar to each other than to the true in-distribution (ID) samples. Motivated by this class-specific observation, we propose DCAC (Dynamic Class-Aware Cache), a training-free, test-time calibration module that maintains separate caches for each ID class to collect high-entropy samples and calibrate the raw predictions of input samples. DCAC leverages cached visual features and predicted probabilities through a lightweight two-layer module to mitigate overconfident predictions on OOD samples. This module can be seamlessly integrated with various existing OOD detection methods across both unimodal and vision-language models while introducing minimal computational overhead. Extensive experiments on multiple OOD benchmarks demonstrate that DCAC significantly enhances existing methods, achieving substantial improvements, i.e., reducing FPR95 by 6.55% when integrated with ASH-S on ImageNet OOD benchmark.

DCAC: Dynamic Class-Aware Cache Creates Stronger Out-of-Distribution Detectors

TL;DR

DCAC tackles overconfident OOD predictions by exploiting a class-specific insight: OOD samples predicted for the same class tend to be visually similar to one another. It introduces a training-free, test-time calibration module that maintains per-ID-class caches of high-entropy samples and uses a fixed two-layer transformation on cached features and probabilities to adjust raw logits. The approach is architecture-agnostic and integrates with existing OOD detectors for both unimodal and vision-language models, delivering consistent improvements with modest overhead. Empirically, DCAC achieves substantial gains on ImageNet-1K far-OOD benchmarks and other datasets, reducing false positives and tightening score distributions without requiring additional training data.

Abstract

Out-of-distribution (OOD) detection remains a fundamental challenge for deep neural networks, particularly due to overconfident predictions on unseen OOD samples during testing. We reveal a key insight: OOD samples predicted as the same class, or given high probabilities for it, are visually more similar to each other than to the true in-distribution (ID) samples. Motivated by this class-specific observation, we propose DCAC (Dynamic Class-Aware Cache), a training-free, test-time calibration module that maintains separate caches for each ID class to collect high-entropy samples and calibrate the raw predictions of input samples. DCAC leverages cached visual features and predicted probabilities through a lightweight two-layer module to mitigate overconfident predictions on OOD samples. This module can be seamlessly integrated with various existing OOD detection methods across both unimodal and vision-language models while introducing minimal computational overhead. Extensive experiments on multiple OOD benchmarks demonstrate that DCAC significantly enhances existing methods, achieving substantial improvements, i.e., reducing FPR95 by 6.55% when integrated with ASH-S on ImageNet OOD benchmark.
Paper Structure (14 sections, 5 equations, 9 figures, 4 tables, 1 algorithm)

This paper contains 14 sections, 5 equations, 9 figures, 4 tables, 1 algorithm.

Figures (9)

  • Figure 1: The t-SNE visualization of normalized image features for test samples predicted as the same class (left) and OOD detection performance using CLIP-B/16 (right).
  • Figure 2: Overview of the Dynamic Class-aware Cache (DCAC) framework. DCAC maintains caches for each ID class to collect unconfident samples during testing guided by their entropy and the cache capacity. For calibration, cache samples generate a signal for each test sample which is combined with raw prediction to produce calibrated outputs for OOD detection.
  • Figure 3: DCAC integrated with existing methods.
  • Figure 4: AUROC over the first 10 batches under different cache initialization strategies with mean and standard deviation.
  • Figure 5: AUROC for the temporal drift OOD scenario settings with different update strategies.
  • ...and 4 more figures