Abstract
Time Series Anomaly Detection (TSAD) is essential for maintaining system integrity across various domains. Traditional approaches often rely on temporal prediction or reconstruction, which can overlook spatial inter-dependencies and suffer from model overfitting. We propose STEN (Spatial-Temporal Normality learning), a self-supervised framework designed to capture both temporal continuity and spatial proximity. STEN employs two novel pretext tasks: Order Prediction-based Temporal Normality (OTN) and Distance Prediction-based Spatial Normality (DSN). OTN requires the model to reconstruct the original sequence from shuffled sub-sequences, while DSN learns to predict pairwise distances in a feature space defined by random projections. Our comprehensive evaluation across five public benchmarks demonstrates that STEN achieves state-of-the-art performance, significantly improving detection accuracy over existing methods.
Introduction
Anomaly detection in multivariate time series is a foundational task for applications such as industrial monitoring and financial analysis. The prevailing paradigm focuses on temporal modeling—predicting future values or reconstructing inputs—where high errors signify anomalies. However, this approach often ignores the spatial dimension, i.e., how sequences relate to each other in a high-dimensional feature space. Furthermore, reconstruction-based models can inadvertently learn to reconstruct anomalies, leading to poor discriminative power.
To address these gaps, we introduce STEN, which redefines "normality" through a dual-lens approach. By integrating spatial and temporal perspectives, STEN provides a more robust representation of normal behavior, as illustrated in the conceptual overview above.
Methodology
The STEN framework consists of two primary modules that operate without the need for labeled data.
Order Prediction-based Temporal Normality (OTN)
OTN focuses on the temporal logic of the data. The input sequence is partitioned into sub-sequences, which are then shuffled. The model is tasked with predicting the original permutation. This forces the network to learn the contextual flow and temporal dependencies inherent in normal data. The discrepancy is measured using Jensen-Shannon (JS) divergence between the predicted and ground-truth order distributions.
Distance Prediction-based Spatial Normality (DSN)
To capture spatial relationships, DSN utilizes random projections. A fixed, random neural network projects data into a feature space, preserving the relative topology (closeness) of the sequences. A separate learnable network is then trained to predict these pairwise distances. Normal data typically follows a Gaussian-like distance distribution, whereas anomalies tend to deviate toward a uniform distribution.
The final anomaly score is derived from a weighted combination of the losses from both modules, capturing discrepancies in both temporal order and spatial distance.
Experiments and Results
We evaluated STEN on five diverse benchmarks: PSM, MSL, SMAP, Epilepsy, and DSADS. STEN consistently outperformed eight state-of-the-art competitors, including Anomaly Transformer and DCdetector.
- Superior Accuracy: STEN achieved an average AUC-ROC of 0.997 and an AUC-PR of 0.973 across all datasets.
- Significant Gains: On the SMAP dataset, STEN improved the AUC-PR by a margin ranging from 2% to 34.7% depending on the competitor.
- Robustness: Qualitative analysis confirms that STEN is particularly effective at reducing false positives by distinguishing between normal fluctuations and true contextual anomalies that lack proper spatial-temporal context.
Conclusion
STEN represents a significant advancement in self-supervised anomaly detection by jointly modeling spatial and temporal normality. While the calculation of pairwise distances introduces some computational overhead compared to simpler forecasting models, the gains in accuracy and robustness are substantial. Future research will explore more efficient spatial affinity modeling to enhance scalability for even larger datasets.
Summary updated