Training datasets for unsupervised anomaly detection are often assumed to be anomaly-free, but in practice, they frequently contain malicious or anomalous contamination. This contamination severely degrades the dependability and security of downstream detection models. While some contamination-robust methods exist, they rarely generalize across different model architectures and typically rely on a priori knowledge of the contamination ratio\textemdash information that is rarely available in real-world security operations. In this paper, we propose a novel, self-contained preprocessing framework for anomaly detection that identifies and removes training set contamination without relying on known contamination ratios. Our approach performs a dynamic analysis of the cosine similarity between each data point and its reconstruction during the early training stages of an auto-encoder, mapping points into a dynamic space where anomalous regions naturally exhibit lower density. By executing ``hard cleaning''\textemdash removing all identified anomalous candidates from the training pool\textemdash we systematically improve data quality. Because this cleaning occurs at the data level, the security and reliability improvements generalize seamlessly across various downstream anomaly detection architectures. Evaluating our framework across 8 distinct models and 10 security-relevant datasets, our approach achieves up to 100% contamination reduction, yielding average improvements of 11.2% in F1 score and 7.3% in classification accuracy.
Figures & tables
Fig. 1 : Blue and red inliers and anomalies respectively. ( 1(a) ): original vs ( 1(b) ) dynamic space.
Fig. 2 : Bopeto’s architecture.
Data set
# samples
# attributes
untreated anomaly (%)
CICIOT
416985
41
45
CIFAR-10
6000
1024
90
CREDIT
234333
30
0.2
ECG
4998
140
58
IDS
430256
95
43
KITSUNE
210171
116
23
TABLE I : The characteristics of data sets.
Fig. 3 : Visualisation of training data sets.
Fig. 4 : A sample of the dynamic space. Blue points are inliers and red are anomalies. A t - SNE projection is used for visualization.
Fig. 5 : (Left) shows the level of contamination per round across 9 different contamination ratios for each dataset. (Middle) displays the reduction in contamination ratio following data cleaning. (Right) demonstrates that Bopeto not only removes contamination but also retains at least 90% of inliers.
Fig. 6 : Differences in F 1 scores between models trained on Bopeto data and those trained on the original data are shown. Positive values indicate better performance with Bopeto. For instance, if the F 1 scores are 0.7 (Bopeto) and 0.55 (original), then ΔF1 = +0.15. The first row reports detailed ΔF1 values for each contamination ratio (as in Figure 5 ), while the second row shows the distributions of ΔF1 scores across contamination ratios.
Fig. 7 : Differences between models trained on Bopeto data and the original data using ( 7(a) ) accuracy, ( 7(b) ) precision and ( 7(c) ) recall. Positive values indicate the superiority of Bopeto. First row represents detailed performance differences per ith contamination ratio and second row represents their distributions across contamination ratios.
CICIOT
CIFAR
CREDIT
ECG
IDS
KDD
KITSUNE
MNIST
MVTEC
VISA
AE
original
0.73 ± 0.00
0.74 ± 0.10
0.47 ± 0.00
0.90 ± 0.05
0.60 ± 0.16
0.93 ± 0.00
0.56 ± 0.00
0.80 ± 0.55
0.76 ± 0.40
0.75 ± 0.35
Bopeto
0.73 ± 0.00
0.79 ± 0.15
0.47 ± 0.00
0.92 ± 0.05
0.70 ± 0.09
0.93 ± 0.00
0.56 ± 0.00
0.82 ± 0.05
0.77 ± 0.25
0.75 ± 0.45
SVDD
original
0.61 ± 0.03
0.66 ± 0.13
0.66 ± 0.03
0.76 ± 0.09
0.50 ± 0.33
0.72 ± 0.14
0.60 ± 0.09
0.65 ± 0.20
0.66 ± 0.15
0.67 ± 0.12
Bopeto
0.64 ± 0.04
0.67 ± 0.14
0.67 ± 0.01
0.81 ± 0.09
0.68 ± 0.36
0.83 ± 0.10
0.68 ± 0.04
0.68 ± 0.20
0.66 ± 0.05
0.69 ± 0.20
IF
original
0.39 ± 0.08
0.15 ± 0.01
0.28 ± 0.27
0.01 ± 0.00
0.24 ± 0.36
0.58 ± 0.01
0.44 ± 0.05
0.42 ± 0.06
0.45 ± 0.09
0.48 ± 0.08
Bopeto
0.53 ± 0.04
0.08 ± 0.01
0.67 ± 0.27
0.02 ± 0.01
0.70 ± 0.24
0.56 ± 0.01
0.50 ± 0.06
0.53 ± 0.07
0.49 ± 0.05
0.55 ± 0.04
TABLE II : Different rows (except the last row) represent average F 1 -scores. Last row counts successful cases where Bopeto shows superiority for anomaly detection. Improvement ratio represents the ratio of contamination identified by Bopeto, e.g, if there are 1,000 malicious instances in the training data set and the model identifies 700 of them, the ratio would be 70%.
CICIOT
CIFAR
CREDIT
ECG
IDS
KDD
KITSUNE
MNIST
MVTEC
VISA
p-value
effect size
Differences of F 1 scores
AE
0.00
0.10
0.00
0.02
0.10
0.00
0.00
0.06
0.04
0.04
3.32 ×10−13
0.45
SVDD
0.03
0.22
0.01
0.05
0.18
0.11
0.08
0.20
0.16
0.10
4.21 ×10−11
0.49
IF
0.14
0.02
-0.07
0.39
0.01
0.46
-0.02
0.12
0.12
0.11
1.41 ×10−15
0.54
LOF
0.34
0.21
0.04
0.21
0.54
0.47
0.58
0.06
0.09
0.07
5.53 ×10−23
0.61
ALAD
-0.01
0.12
-0.01
0.10
0.27
0.04
0.01
0.04
0.10
0.03
1.41 ×10−23
0.55
TABLE III : Differences of F 1 scores and AUC of various unsupervised anomaly detectors on original and Bopeto data. Positive values indicate the positive impact of Bopeto on the underline baseline anomaly detection method. The last three methods are those relying on contamination ratio information. The last two columns are p-value and effect size between performances of methods on original and Bopeto data. Reduction of statistical contamination using density-based clustering and isolation forest for identification of anomalies on dynamic spaces. The threshold for the p-value is set at 0.01.
Fig. 8 : Differences in F 1 scores between AE or SVDD trained on Bopeto data using IAD and their counterparts trained on the original data. Positive values indicate the superiority of Bopeto. First row represents detailed Δ F 1 scores per ith contamination ratio (as defined in Figure 5 ) and second row represents distributions of Δ F 1 scores across contamination ratios.
Fig. 9 : 5 runs of Bopeto. Contamination reduction (first row) and false positive (second row).
Fig. 10 : Illustrations of where Bopeto fails: tn, tp, fn and fp denote true negative, true positive, false negative and false positive respectively. Anomaly is the positive class here.
AE Architecture
IF
LOF
OCSVM
AE
p=0.27,d=0.08
p=0.41,d=0.05
p=0.35,d=0.07
DUAD
p=0.18,d=0.12
p=0.64,d=0.03
p=0.22,d=0.10
DAGMM
p=0.53,d=0.04
p=0.89,d=0.01
p=0.31,d=0.09
TABLE IV : Statistical comparison (p-value at 1% threshold and effect size) between AE architectures and traditional AD methods applied on the dynamic space on F 1 scores.
Semi-supervised anomaly detection, which aims to improve the anomaly detection performance by using a small amount of labeled anomaly data in addition to unlabeled data, has attracted attention. Existing semi-supervised approaches assume that most unlabeled data are normal, and train anomaly detectors by minimizing the anomaly scores for the unlabeled data while maximizing those for the labeled anomaly data. However, in practice, the unlabeled data are often contaminated with anomalies. This weakens the effect of maximizing the anomaly scores for anomalies, and prevents us from improving the detection performance. To solve this, we propose the deep positive-unlabeled anomaly detection framework, which integrates positive-unlabeled learning with deep anomaly detection models such as autoencoders and deep support vector data descriptions. Our approach enables the approximation of anomaly scores for normal data using the unlabeled data and the labeled anomaly data. Therefore, without labeled normal data, our approach can train anomaly detectors by minimizing the anomaly scores for normal data while maximizing those for the labeled anomaly data. We also provide a theoretical analysis establishing a generalization error bound for the proposed objective, guaranteeing that the empirical minimizer converges asymptotically to the ideal minimizer. Our approach achieves better detection performance than existing approaches on various datasets.
Anomaly detection (AD) under data contamination is critical for deploying unsupervised defect detection in industrial environments, where curating perfectly clean training sets is impractical. However, existing methods are sensitive to contamination, suffering significant performance degradation as the noise ratio increases. In this paper, we propose Memory-Distilled Selection (MeDS), a training algorithm based on data selection. MeDS constructs an ensemble of partial memories via random subsampling, where the resulting sparsity acts as a low-pass filter that captures nominal patterns across a wide range of noise ratios, enabling coarse-level identification of contaminated samples. The aggregated distances to the bootstrapped memories are then distilled into a reconstruction score network, which is subsequently fine-tuned on clean data filtered using scores from the distilled model, enabling fine-grained localization of anomalies. MeDS is robust across a wide range of noise ratios without requiring noise-ratio-specific hyperparameter tuning, achieving 99.16% image-level AUROC on MVTecAD at a 40% noise ratio, and attaining state-of-the-art performance on both VisA and Real-IAD under noisy settings. We thoroughly verify the efficacy of MeDS on industrial AD benchmarks under noisy data scenarios, accompanied by in-depth empirical analyses.
Sirojbek Safarov, Jaewoo Park, Yoon Gyo Jung +4
AIVEX Inc. · Northeastern University · Mitsubishi Electric Research Laboratories (MERL).
Machine-learning-based anomaly detection is increasingly used in industrial control systems (ICS), yet most studies assume that detector training data is trustworthy. In practice, training data may be corrupted through compromised logs, labeling errors, manipulated historian records, or unsafe retraining processes. This paper evaluates the robustness of offline ICS anomaly-detection pipelines on the Secure Water Treatment (SWaT) benchmark under training-time contamination. We assess 11 heterogeneous anomaly detectors under three contamination strategies: random injection, similarity-targeted injection, and feature-noise injection. The first two insert attack samples into the nominal training pool, while the third adds bounded Gaussian noise to selected normal training samples. These attacks are contamination-based rather than gradient-driven poisoning methods. Contamination budgets from 1% to 10% are evaluated using clean validation and test sets under a unified offline protocol. The results show that robustness is strongly model-dependent and cannot be predicted from clean-data performance alone. Injection-based contamination causes the greatest degradation, particularly for local-density and distance-based detectors, whereas feature-noise contamination has a comparatively limited effect. PCA, SVM, HBOS, and IForest remain relatively stable, while the tuned neural detectors demonstrate intermediate robustness. Overall, the findings highlight the importance of training-data integrity in ML-enabled ICS monitoring, subject to the evaluated dataset, models, and threat assumptions.