Invariant Anomaly Detection under Distribution Shifts: A Causal Perspective
João B. S. Carvalho, Mengtao Zhang, Robin Geyer, Carlos Cotrini, Joachim M. Buhmann
Abstract
Anomaly detection (AD) is the machine learning task of identifying highly discrepant abnormal samples by solely relying on the consistency of the normal training samples. Under the constraints of a distribution shift, the assumption that training samples and test samples are drawn from the same distribution breaks down. In this work, by leveraging tools from causal inference we attempt to increase the resilience of anomaly detection models to different kinds of distribution shifts. We begin by elucidating a simple yet necessary statistical property that ensures invariant representations, which is critical for robust AD under both domain and covariate shifts. From this property, we derive a regularization term which, when minimized, leads to partial distribution invariance across environments. Through extensive experimental evaluation on both synthetic and real-world tasks, covering a range of six different AD methods, we demonstrated significant improvements in out-ofdistribution performance. Under both covariate and domain shift, models regularized with our proposed term showed marked increased robustness. Code is available at: https://github.com/JoaoCarv/invariant-anomaly-detection . 1 Introduction Anomaly detectors are the subject of increased interest in fields such as finance (Ahmed et al. [2016], Hilal et al. [2022]), medicine (Schlegl et al. [2019]), and security (Mothukuri et al. [2021], Siddiqui et al. [2019], Hosseinzadeh et al. [2021] ). Having been trained on a sample from an unknown distribution, these models are capable of identifying abnormal objects unlikely to come from the original distribution (Bishop and Nasrabadi [2006] ). Anomaly detection (AD) stands apart from supervised classification as it does not involve anomalies during training, making it challenging to articulate a model that depicts the class of objects deemed as normal. AD as a field boasts a plethora of diverse methodologies (Ruff et al. [2021] ). Current detectors have demonstrated the advantage of approaches based on representation learning (Reiss and Hoshen [2021], Deng and Li [2022] ). In this context, an encoder maps objects to representations which capture the most distinctive features of an object. In addition, it strives to map the class of normal objects onto a subset characterized by a more regular shape, thereby rendering representations from abnormal samples easily identifiable by comparison. Central to this second goal is a notable vulnerability of representation learning-based methods: they hinge on the assumption of independent and identically distributed (i.i.d.) training and test data. This implies that normal samples in the training data are expected to be sampled identically in the test data, thereby being mapped to the same vicinity in the representation space -an assumption that is frequently violated in real-world scenarios (Koh et al. [2021] ). Indeed, distribution shifts in the context of AD present a unique challenge because it involves discerning two types of distribution shifts targeting the distribution of the normal objects, p n . Anomalies 37th Conference on Neural Information Processing Systems (NeurIPS 2023).
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext a836f0b3-cb56-4881-85d6-a938bd9b9c77Cited by top-tier papers2
- DP-DGAD: A Generalist Dynamic Graph Anomaly Detector with Dynamic PrototypesJialun Zheng, Jie Liu, Jiannong Cao, Xiao Wang et al.WWW 2026 · 5 citations
- REACT: Residual-Adaptive Contextual Tuning for Fast Model Adaptation in Threat DetectionJiayun Zhang, Junshen Xu, Bugra Can, Yi FanWWW 2025 · 3 citations
Builds on26
- A Simple Framework for Contrastive Learning of Visual RepresentationsTing Chen, Simon Kornblith, Mohammad Norouzi, Geoffrey E. HintonICML 2020 · 24,064 citations
- WILDS: A Benchmark of in-the-Wild Distribution ShiftsPang Wei Koh, Shiori Sagawa, Henrik Marklund, Sang Michael Xie et al.ICML 2021 · 1,773 citations
- Memorizing Normality to Detect Anomaly: Memory-Augmented Deep Autoencoder for Unsupervised Anomaly DetectionDong Gong, Lingqiao Liu, Vuong Le, Budhaditya Saha et al.ICCV 2019 · 1,646 citations
- Distributionally Robust Neural NetworksShiori Sagawa, Pang Wei Koh, Tatsunori B. Hashimoto, Percy LiangICLR 2020 · 1,578 citations
- CSI: Novelty Detection via Contrastive Learning on Distributionally Shifted InstancesJihoon Tack, Sangwoo Mo, Jongheon Jeong, Jinwoo ShinNeurIPS 2020 · 755 citations
Related papers
- Anomaly Detection under Distribution ShiftTri Cao, Jiawen Zhu, Guansong PangICCV 2023 · 54 citations
- Filter or Compensate: Towards Invariant Representation from Distribution Shift for Anomaly DetectionZining Chen, Xingshuang Luo, Weiqiu Wang, Zhicheng Zhao et al.AAAI 2025 · 9 citations
- ResAD: A Simple Framework for Class Generalizable Anomaly DetectionXincheng Yao, Zixin Chen, Chao Gao, Guangtao Zhai et al.NeurIPS 2024 · 42 citations
- When Model Meets New Normals: Test-Time Adaptation for Unsupervised Time-Series Anomaly DetectionDongmin Kim, Sunghyun Park, Jaegul ChooAAAI 2024 · 43 citations
- Learning Causality-inspired Representation Consistency for Video Anomaly DetectionYang Liu, Zhaoyang Xia, Mengyang Zhao, Donglai Wei et al.ACM MM 2023 · 48 citations
