Invariant Anomaly Detection under Distribution Shifts: A Causal Perspective

João B. S. Carvalho, Mengtao Zhang, Robin Geyer, C. Jiménez, J. Buhmann
2/12/2026

No official code found. Best implementation: joaocarv/invariant-anomaly-detection (14 stars, MIT, last commit 2023-10-27).

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-of-distribution 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.

View on arXivView PDF

Code Implementations(1)

MIT

Implementation of robust deep anomaly detection models using Partial Conditional Invariant Regularization (PCIR). Accepted to NeurIPS 2023.

146Python, MakefileOct 27, 20232 years agoMIT

Similar Papers

Cite this paper

@article{carvalho2026invariant,
  title  = {Invariant Anomaly Detection under Distribution Shifts: A Causal Perspective},
  author = {João B. S. Carvalho and Mengtao Zhang and Robin Geyer and C. Jiménez and J. Buhmann},
  year   = {2026},
  eprint = {2312.14329},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2312.14329},
  journal = {NEURIPS 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2312.14329.svg)](https://codeofpaper.com/paper/2312.14329)

Discussion