In practice, machine learning methods commonly require anomaly detection (AD) to filter inputs or detect distributional shifts. Typically, this is implemented by running a separate AD model alongside the primary model. However, this separation ignores the fact that the primary model already encodes substantial information about the target distribution. In this paper, we introduce On-Model AD, a setting for anomaly detection that explicitly leverages access to a related machine learning model. Within this setting, we propose RangeAD, an algorithm that utilizes neuron-wise output ranges derived from the primary model. RangeAD achieves superior performance even on high-dimensional tasks while incurring substantially lower inference costs. Our results demonstrate the potential of the On-Model AD setting as a practical framework for efficient anomaly detection.
Figures & tables
Figure 1: Depiction of our proposed methodology . (a) represents the neural network, from which the sample activations per neuron are depicted in (b). From these distributions - to be considered normal - interval borders are derived. The activations produced for a new test input are then checked per neuron to see whether it falls inside the corresponding interval in (c). For every test sample xi the amount of feature-outputs lying outside of the corresponding interval indicates the anomaly grade of xi .
Figure 2: AUC-ROC of different anomaly detection methods over 12 tabular datasets. Our method is run three times with models having hidden-layer neuron counts of 100, 500, and 1000. It reaches the highest AUC-ROC on average compared to all competitors.
Figure 3: AUC-ROC and inference time of different anomaly detection methods averaged over 12 tabular datasets. Our method is run three times with models with hidden layer neuron counts of 100, 500, 1000. It achieves the highest detection performance while providing the fastest inference runtime of all competitors. We provide the same analysis on the training time in the supplementary material.
Dataset
in, 0.01
after, 0.01
in, 0.001
after, 0.001
IF
AE
DeepSVDD
INet + Ambivision
0.9893
0.9923
0.9945
0.9937
0.9985
0.9472
0.8830
INet + SpaceImages
0.9625
0.9094
0.9592
0.909
0.4977
0.1864
0.6757
INet + both
0.971
0.9355
0.9703
0.9357
0.6597
0.4266
0.6833
UrbanSound [ 43 ]
0.8804
-
0.9142
-
0.6939
0.8002
0.7927
Table 1: AUC-ROC of vision and time series tasks. "in" means in the network blocks, e.g. after GELU and Convolution-Layers; "after" means after the network blocks, e.g. Transformer-Block (vision-only). 0.01 and 0.001 is the quantile used. AE and DeepSVDD were trained with 10% of the INet testset for memory reasons. Our method reaches the most reliable performance across high-dimensional datasets.
Dataset
in, 0.01
after, 0.01
in, 0.001
after, 0.001
IF
AE
DeepSVDD
Inet + Ambivision
0.0151
0.0161
0.0131
0.0129
0.8197
240.9355
133.9441
Inet + SpaceImages
0.0131
0.012
0.0123
0.0129
0.8438
238.3285
138.8146
Inet + both
0.0129
0.0126
0.0129
0.0136
0.8560
251.041
141.8705
UrbanSound [ 43 ]
0.0138
-
0.0103
-
0.0711
0.8833
0.5184
Table 2: Inference time in seconds of vision and time series tasks. "in" means in the network blocks, e.g. after GELU and Convolution-Layers; "after" means after the network blocks, e.g. Transformer-Block (vision-only). 0.01 and 0.001 are the quantiles used. AE and DeepSVDD were trained with 10% of the INet testset for memory reasons. Our method requires multiple orders of magnitude less runtime as it is not using an additional model.
Figure 4: When using differently sized hidden layers in our neural networks, AUC ROC and model performance are correlated . The results represent the average of 5 runs with a standard deviation over the 12 tabular datasets.
This paper considers a practical few-shot anomaly detection (FSAD) setting, termed discriminative FSAD, where a limited number of both normal and anomalous examples are available as references during inference. Existing FSAD methods rely on normal-only references through normality matching, ignoring the discriminative clues in anomalous references, while directly fitting both references can overfit to the seen anomalies. We introduce IDEAL, an intrinsic deviation learning framework that leverages both reference types to learn intrinsic deviation patterns characterizing generalizable abnormality as deviations from normality. IDEAL decomposes the learning process into two novel components: 1) a Normal Variation Eraser to suppress nuisance normal variations that may lead to noisy deviations from normality, thereby highlighting anomaly-relevant deviation representations; 2) an Intrinsic Deviation Encoder to decompose these denoised deviation representations into intrinsic deviation vectors capturing the most discriminative orthogonal deviation directions. At inference, IDEAL scores query-to-normal deviations preserved after projection onto the learned intrinsic deviation vectors, enabling generalization for both seen and unseen anomalies. Extensive experiments on eight real-world datasets show that IDEAL generalizes effectively to unseen anomalies and consistently outperforms existing state-of-the-art FSAD methods. Code and data are available at https://github.com/mala-lab/IDEAL.
Huan Wang, Jun Shen, Jun Yan +1
Singapore Management University, Singapore · University of Wollongong, Australia
While deep learning models have achieved state-of-the-art performance in time series anomaly detection, their complex architectures incur substantial inference overhead. Existing methods typically apply a uniform inference strategy across all data points, which is inefficient given that anomalies are inherently scarce and the vast majority of temporal data consists of predictable normal patterns. To mitigate this bottleneck, we propose CARE, a model-agnostic cascaded inference framework that integrates a Lightweight Pre-filter Model (LPM) with an existing high-capacity Complex Detection Model (CDM). The LPM rapidly filters high-confidence normal samples using a Residual MLP AutoEncoder and a Normality-Conditioned Gating mechanism. Crucially, we introduce a Structure Attention module to explicitly capture channel-wise anomaly contributions, and optimize the gating network via a confidence-guided selective routing objective that learns reliable routing decisions to reduce unnecessary CDM invocations. Extensive experiments across eight real-world benchmarks demonstrate that CARE effectively isolates high-confidence normal samples. By routing only uncertain samples to the CDM, our framework achieves 2.7× to 4.8× inference speedup compared to the most accurate SOTA approaches, while still maintaining competitive detection quality.
Zemin Chao, Qianhui Xu, Jianhe Cen +3
Massive Data Computing Lab, Harbin Institute of Technology
Recent advances in anomaly detection (AD) for industrial inspection have pushed performance on standard benchmarks toward saturation. However, strong benchmark performance does not necessarily translate to real-world deployment, as these benchmarks are primarily collected under controlled acquisition conditions. Changes in illumination, background, viewpoint, and other environmental factors can shift normal samples away from the learned normal distribution and cause false anomaly responses. We address AD under such distribution shifts by explicitly modeling nuisance variation from changing imaging conditions in feature space. Without anomaly labels or target-domain data, our Nuisance-Filtered Anomaly Detection (NFAD) framework estimates a nuisance subspace from matched feature displacements induced by content-preserving perturbations and suppresses its contribution to anomaly residuals at inference. The same subspace supports two complementary branches: full projection for image-level detection and selective suppression for pixel-level localization, preserving evidence of localized defects. On AeBAD-S, a benchmark specifically designed for AD under acquisition shifts, NFAD achieves 91.0% image-level AUROC, establishing a new state of the art. Notably, this robustness does not come at the expense of conventional AD performance: NFAD remains competitive on standard benchmarks that do not explicitly evaluate distribution shift, including VisA, Real-IAD, and MVTec AD. These results show that explicitly suppressing such nuisance variation improves AD under distribution shift while preserving strong performance in standard settings.
Dat Cao, Son Nghiem, Phan Nguyen +2
Korea Advanced Institute of Science and Technology (KAIST), South Korea · Sony Computer Science Laboratories (Sony CSL), Japan · The University of Tokyo, Japan +1