Auditing Attention Head Masking for Out-of-Distribution Detection: Cross-Architecture Wins, Failures, and Polarity Inversions
Vishnu B Balachandran
NeurIPS page · Open on the map
Category: Graphs, OOD Detection & Medical Imaging › Out-Distribution Detection Methods · Type: empirical study · Keywords: out-of-distribution detection, attention head masking, cross-architecture evaluation, empirical audit, transformer models
Areas: Safety & Security › Adversarial Security › Out-of-Distribution Detection; Evaluation & Benchmarks › Model Capability Diagnostics › Out-of-Distribution Detection; Evaluation Methodology & Auditing › Interpretability and Explanation Quality › Metrics Auditing
Summary
We audit attention-head-masking-based out-of-distribution detection across transformer architectures, revealing cross-architecture wins, failures, and polarity inversions.
Explained to a 5-year-old
We look at how computers tell if something is weird, like a picture that doesn't belong. We check how well the tricks work on different kinds of computers that read words, pictures, and documents. Some tricks work great on some computers but fail on others, and we found that sometimes the tricks even do the opposite of what we want.
Explained to a 5-year-old, longer
Imagine you have a smart robot that reads words, looks at pictures, and understands documents. To know if something is out of place, you can watch how the robot pays attention inside its brain. Scientists tried a few ways to see if the robot is confused. They tested these ways on three different robots: one that reads documents, one that looks at photos, and one that reads text. They ran many tests and found that some ways worked well on some robots but not on others. One method even gave the opposite result on the text robot, making it think everything was normal when it wasn't. They also saw that when the weird thing looked a bit like the normal thing, all the methods got much worse at spotting the difference. All these results were recorded and shared so other scientists can learn from them and improve the tricks.
For a technical reader
The work performs a systematic empirical audit of post-hoc OOD scoring that leverages attention head masks across multiple transformer architectures (LayoutLMv3, ViT-B/16, RoBERTa-base) and modalities (document, image, text). It evaluates seventeen baselines under a uniform protocol with five random seeds, applying paired statistical tests. Key findings include a new AHM variant (mahAvgAvg_AHM) beating X-Mahalanobis on certain tasks, the collapse of Monte-Carlo Dropout on vision models, polarity inversion of AHSS on text, and substantial performance drops on near-OOD splits. The authors release data, masks, and code to support replication.
Problem
Current out-of-distribution detection methods are evaluated on a single model architecture and data type, leaving their behavior across diverse transformers and modalities unclear.
Method
The authors conduct a large-scale empirical evaluation of post-hoc scoring functions that leverage internal transformer representations to detect OOD inputs, applying a uniform protocol across multiple architectures and modalities, comparing against numerous baselines, and using paired statistical tests.
Results
Within the AHM family, mahAvgAvg_AHM significantly outperforms X-Mahalanobis on Tobacco-Cross (p=0.031) and RoBERTa SST-2→20-Newsgroups (p=0.031), while X-Mahalanobis remains state-of-the-art on CIFAR; Monte-Carlo Dropout collapses to chance on ViT, AHSS inverts polarity on RoBERTa (AUROC≈0.296), and near-OOD splits cause 25-42 pp drops for all methods.
Contributions
A comprehensive cross-architecture audit of attention-head-masking-based OOD detection, uncovering three architecture-dependent phenomena missed by standard evaluations, and releasing per-seed measurements, masks, and code for replication.
Limitations and assumptions
Evaluated on a limited set of architectures and modalities; findings may not generalize to all transformer families or domains.
Practical relevance
Provides practitioners with guidance on which OOD scoring methods reliably work across different models and highlights critical failure modes to avoid.
Research questions this paper is counted under
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction