Activation-Aware Negative Label Mining for OOD
- Activation-aware Negative Label Mining is a technique that dynamically selects negative labels at test time based on activation patterns to distinguish in-distribution from OOD samples.
- It leverages both historical and batch-level activation metrics, using FIFO queues and interpolation to adaptively update negative label sets without retraining models.
- The method achieves significant reductions in false positive rates across benchmarks, offering robust performance for CLIP-style vision-language models in diverse environments.
Activation-aware Negative Label Mining denotes a family of training-free techniques for out-of-distribution (OOD) detection in vision-LLMs, where negative labels are adaptively selected at test time based on observed activation patterns, rather than fixed a priori. Central to this approach is Test-time Activated Negative Labels (TANL), which mines negative labels with strong response to OOD samples using dynamically accumulated activation metrics drawn from historical and mini-batch test data. The resulting methodology enables online, robust, and adaptive distribution alignment for OOD detection across diverse data regimes without requiring re-training or modification of pre-trained CLIP-style models (Zhang et al., 26 Mar 2026).
1. Formal Framework and Notation
Let be the set of in-distribution (ID) labels and the corpus of candidate labels. For any test example , pre-trained encoders yield a normalized image feature and a normalized text feature for any label , where is a prompt template (e.g., “a photo of a ”).
The zero-shot softmax probability over labels is given by: where are the mined negative labels ().
This framework supports dynamic, test-time re-evaluation of as label activations shift during inference.
2. Label Activation Metrics
The informational content of a candidate negative label is quantified by its ability to activate upon OOD versus ID samples. The oracle activation difference is: where
In the absence of ground-truth OOD labels at inference, TANL maintains two size- FIFO queues— (predicted ID, high-confidence) and (predicted OOD, high-confidence)—to estimate the empirical activation gap: The high-confidence sets are updated per batch by thresholding an OOD score (defined below) with gap around .
3. Batch-Adaptive Activation Mining
In addition to historical activation statistics, TANL leverages batch-level adaptivity by extracting high-confidence positive and negative feature vectors within the current test batch (). The combined batch-adaptive metric is: with
where interpolates global and batch-local statistics. This enables TANL to rapidly adapt negative label selection in response to distribution drift or diversity in test-time batches.
4. Activation-aware OOD Scoring
Once the most activated candidate negatives are selected according to or , OOD scoring for any test image feature is performed via: This formula endows negatives with higher activation greater implicit weight: appears in all denominators, in all but one, etc. The score is maximized when is close to ID features and far from top-activated negatives, reflecting robust OOD/ID discrimination.
5. Algorithmic Workflow
The TANL procedure, summarized in the following pseudocode, alternates between online activation mining and OOD scoring:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Inputs: - ID labels Y_ID - Corpus labels Y_cor - Pretrained CLIP encoders f_img, f_txt - Test set X_test - Queue length L, negatives M, threshold γ, gap g, batch-tradeoff α Initialize: - X_pos ← L features from ID prompts - X_neg ← L features from random noise images For each test batch B ⊂ X_test: 1. Compute S_aa(v) for all v∈B with current top-M negatives 2. X_pos^b ← {v∈B | S_aa(v) ≥ γ+(1-γ)g} X_neg^b ← {v∈B | S_aa(v) < γ-γg} 3. Update X_pos, X_neg with respective FIFO queues 4. Compute batch-adaptive activations ĤA_b(ŷ) for all ŷ∈Y_cor 5. Select top-M labels by ĤA_b as Y_neg 6. Recompute S_aa for the next batch Output: - S_aa(v) for each test image |
In this process, negative labels are dynamically aligned to historic and in-batch activation, yielding distribution-adaptive OOD scoring without requiring model or corpus retraining (Zhang et al., 26 Mar 2026).
6. Theoretical Properties
Building on multilabel detection theory, the change in false positive rate at a fixed decision threshold is controlled by: where , . Effectiveness of additional negatives () for decreasing hinges on ; i.e., the selected negatives must activate more on OOD than ID. TANL’s metric is explicitly constructed to enforce this relationship, ensuring systematic selection of informative negatives (Zhang et al., 26 Mar 2026).
7. Empirical Performance and Robustness
The performance benefits of activation-aware mining are empirically validated across diverse benchmarks and architectures:
- On ImageNet-1K vs. {iNat, SUN, Places, Textures}, NegLabel (agnostic) achieves FPR95 ≈ 25.4%, while TANL attains FPR95 ≈ 9.8% (15.6 percentage point absolute reduction).
- Compared to recent conjugated-pool methods (FPR95 ≈ 17.5%), TANL achieves a 7.7 percentage point lower FPR95.
- TANL is robust to the number of negatives: for small it outperforms NegLabel, and for large the activation-aware score prevents the performance collapse observed in prior approaches.
- Ablations on OpenOOD ImageNet demonstrate progressive improvement: distribution-adaptive only yields FPR95 ≈ 61.6% (vs. NegLabel 69.5%), with further reductions from batch-adaptive and activation-aware variants.
- The method generalizes to various backbones (ResNet50, ViT-B/32, ViT-L/14) and is effective on CIFAR-10/100 and medical X-ray OOD benchmarks.
TANL integrates a principled activation metric, test-time adaptation, and an activation-aware scoring rule, mining the most informative negatives in an online fashion and effecting significant advances in CLIP-style OOD detection (Zhang et al., 26 Mar 2026).