Skip to content

X-Mahalanobis: Transformer Feature Mixing for Reliable OOD Detection

2025 · Neural Information Processing Systems · 8 citations · ⚡ 2 influential · 60 references
Computer Science

TL;DR

A straightforward feature mixing approach for pre-trained Transformers is presented, which combines multi-layer representations via calculated importance weights, and identifies OOD samples using Mahalanobis distance in the blended feature space.

Abstract

Recognizing out-of-distribution (OOD) samples is essential for deploying robust machine learning systems in open-world environments. While conventional OOD detection approaches rely on feature representations from the penultimate layer of neural networks, they often overlook informative signals embedded in intermediate layers. In this paper, we present a straightforward feature mixing approach for pre-trained Transformers, which combines multi-layer representations via calculated importance weights, and identifies OOD samples using Mahalanobis distance in the blended feature space. When in-distribution samples are accessible, we show that parameter-efficient fine-tuning strategies effectively balance classification accuracy and OOD detection performance. We conduct extensive empirical analyses to validate the superiority of our proposed method under zero-shot, and fine-tuning settings using both class-balanced and long-tailed datasets. The source code is available at https://github.com/SEUML/X-Maha .

View source

Similar papers

Aug 2026

Feature-alteration Robustness for Out-of-distribution Detection.

Detecting and rejecting out-of-distribution (OOD) data is crucial for enhancing the reliability and minimizing potential risks associated with models, such as neural networks, in their deployment phase. In this paper, we find that a well-pretrained in-distribution (ID) model can memorize and recognize ID patterns, even when the features undergo alterations. The networks remain robust on the altered ID features whereas the OOD features are heavily distorted, containing distinctive clues for OOD detection in the feature space. Therefore, we introduce a novel method, Feature-alteration Robustness (FAR), designed to efficiently detect OOD samples by measuring feature map robustness under alterations. Specifically, FAR alters the feature maps of intermediate layers, and then evaluates the foreground-background deviations after several layers. We provide a theoretical analysis to help understand our method FAR. The experimental results show that our methods FAR and FAR+ASH can achieve state-of-the-art on various benchmarks.

Xue Jiang, Feng Liu, Zhen Fang et al. · 0 citations
Preprint Jul 2026

Sparse Autoencoders for Interpretable Out-of-Distribution Detection

A novel approach that leverages sparse autoencoders (SAEs) to learn interpretable features from these intermediate activations and proposes a new OOD score derived from the cosine similarity between the sparse feature activations of a test sample and the mean activations of ID classes.

Ayush Karmacharya, Luke Luschwitz, Lucia Romero et al. · 0 citations
Book Open access Aug 2026

When Models Leave the Training Distribution: A Tutorial on OOD Detection

This tutorial covers recent developments in OOD detection from both theoretical and practical perspectives, including four major categories: (1) post-hoc methods, (2) training-based methods with auxiliary outliers, (3) training methods without auxiliary outliers, and (4) foundation model-based approaches, along with recent advances in each area.

Suranga Seneviratne, Dishanika Denipitiyage, Sanjay Chawla et al. · 0 citations
Preprint Jul 2026

Pseudo-label distillation for discriminative anomalous sound detection

Discriminative anomalous sound detection (ASD) methods train a feature extractor through a classification task using machine-information labels. They then detect anomalies in the resulting feature space based on distances to normal samples. The discriminative feature space effectively captures machine characteristics, leading to high ASD performance. However, this approach benefits from detailed labels, which are costly to obtain. An alternative is a self-supervised learning (SSL)-based label-free approach. This approach directly uses SSL features for ASD and has shown competitive performance. However, SSL models are typically large and computationally expensive. To address these problems, we propose a simple pseudo-label distillation framework. The proposed method generates pseudo labels from SSL features and trains a compact discriminative feature extractor using these pseudo labels. To suppress the effect of noise on pseudo-label generation, we also propose lightweight noise-robust feature transformation (NRFT) methods utilizing a small amount of clean machine-sound data or isolated noise data. We conducted comprehensive evaluations and analyses on the DCASE 2020-2025 Task 2 datasets using four SSL models. The results demonstrate that pseudo-label distillation not only transfers the performance of SSL models to a compact model but also further improves performance by leveraging available coarse labels and data augmentation. Also, our NRFT methods provide further gains.

Takuya Fujimura, Tomoki Toda · 1 citation
Conference Aug 2026

WhisperEngineClassifier: A Transfer Learning Framework for Audio-Based Engine State Classification

The process of diagnosing and monitoring automotive systems through audio-based engine state classification has become more vital for intelligent vehicle systems as real-world applications face challenges from background noise, device differences, and class distribution problems which are issues addressed in this research. The VGG-Sound engine sound database was developed through ontology-based filtering, manual annotation, preprocessing, and five-state source-disjoint splitting. Eight CNN baselines were benchmarked under a unified training setup, revealing limitations in modeling long-range temporal dependencies. The development of WhisperEngineClassifier requires the adaptation of a pre-trained Whisper speech encoder through the removal of its decoder and the addition of lightweight pooling heads which will be fine-tuned in two different phases. The proposed model achieved 85.0% accuracy and 0.850 F1-score, outperforming the best CNN baseline, DenseNet169, by 16.2% in accuracy and showing clear gains on difficult classes. The system shows its ability to operate in real-world applications through a Flask-based deployment that uses FP16 quantization and GPU acceleration to support automotive telematics and predictive maintenance.

Yasin Arafat, Nayeem Miah, Shihab Uddin Ahammad et al. · 0 citations

DINO-MAC: First-Place Winner Solution of the CVPR2026 Robust DeepFake Detection Challenge

DINO-MAC is a simple yet effective model for robust deepfake detection under degraded conditions and is the first-place winner of the “NTIRE 2026 - Robust Deepfake Detection Challenge @ CVPR 2026”, significantly outperforms all competitors.

Chenfan Qu, Lianwen Jin, Junchi Li et al. · 2 citations