CHAIN: Long-Context History-Supervised Multivariate Time Series Anomaly Detection
Anomaly detection for multivariate time series is a critical task with broad applications in industrial monitoring, IT operations, and healthcare. Recent deep learning methods—including reconstruction-based, forecasting-based, and representation-learning approaches—have substantially improved detection accuracy by modeling complex temporal dependencies and inter-variable correlations within a fixed observation window. However, these methods have largely overlooked the historical context preceding the window-of-interest, referred to as the current window. Since time series anomalies are inherently contextual, modeling only the current window while neglecting long-term historical patterns inevitably leads to a high false alarm rate. In this paper, we propose CHAIN (long-Context History-supervised Anomaly detectIoN), a novel framework that explicitly captures long-term historical contexts under anomaly simulation and supervises current-window anomaly detection via masked cross-attention fusion. CHAIN adopts a history–current encoder–decoder design comprising three modules: a history context encoder based on the structured state space sequence model (S4) for efficient long-range modeling; a current context encoder based on a decoder-only Transformer for autoregressive forecasting; and a fused context decoder employing cascaded cross-attention layers that suppress simulated anomalous history via a learned mask. We jointly optimize autoregressive forecasting and a mask-prediction self-supervised auxiliary task in an end-to-end manner. Extensive experiments on three real-world benchmarks (SWaT, WADI, and SMD) demonstrate that CHAIN achieves competitive detection performance against fifteen state-of-the-art baselines. Ablation studies further verify the effectiveness of each proposed component.