Abstract
Time series anomaly detection models frequently fail to identify "shapelet" anomalies—sub-sequence morphological deviations that are often obvious to human observers. This paper presents TShape, a novel framework designed to bridge this gap using multi-scale convolutions and a patch-wise dual-attention mechanism. By capturing both fine-grained local shapes and long-range periodic dependencies, TShape achieves a significant 10% absolute improvement in Event F1 scores over state-of-the-art baselines across diverse real-world and synthetic datasets.
1. Introduction
In modern IT operations, monitoring high-dimensional time-series data—such as CPU utilization, memory usage, and server response times—is critical for maintaining system reliability. While machine learning (ML) has largely automated this process, existing algorithms often suffer from a significant blind spot: they are primarily optimized for point-to-point relationships or global trends, frequently missing shapelet anomalies.
A shapelet anomaly occurs when the morphological structure of a sub-sequence deviates from the norm, even if the individual data points remain within typical ranges. For instance, a periodic system cycle might usually feature a sharp peak followed by a smaller convex peak; a shapelet anomaly occurs if that second peak flattens or changes its slope. Human operators can easily spot these visual inconsistencies, but standard ML models struggle to model the intricate local patterns and global periodicities simultaneously. TShape is proposed to address this limitation by enabling models to "see" anomalies with human-like structural perception.
2. Methodology: The TShape Architecture
To effectively detect shapelet anomalies, TShape moves away from traditional point-wise analysis in favor of a patch-based architecture. This approach allows the model to process segments of time-series data as cohesive units. The framework consists of three primary components:
2.1 Multi-scale Convolution
Rather than feeding raw data patches directly into an encoder, TShape utilizes parallel 1D convolutions with varying kernel sizes. This multi-scale approach extracts features at different temporal resolutions, allowing the model to capture the specific "shape" of a window regardless of its duration or frequency. This step is crucial for identifying anomalies that manifest at different scales.
2.2 Patch-wise Positional Encoding
To maintain the temporal context of the sequence, learnable embeddings are integrated with the convolutional features. This ensures that the model understands the relative and absolute positioning of each patch within the broader time series.
2.3 Patch-wise Dual-Attention
The core innovation of TShape is its dual-attention mechanism, which processes data through two parallel streams:
- Local Attention: Focuses on intra-patch dependencies, emphasizing the most relevant features within a specific temporal segment to identify micro-deviations.
- Global Attention: Analyzes inter-patch relationships to capture long-range dependencies and recurring periodic motifs across the entire sequence.
A learnable gating network dynamically fuses these two streams, allowing the model to balance local morphological details with macro-level context based on the characteristics of the input data.
3. Experimental Setup
The authors evaluated TShape using the EASYTSAD benchmark protocol across five diverse datasets:
- AIOPS: Multidimensional data from five major internet firms (e.g., Tencent, Alibaba) featuring evolving distributions.
- WSD: High-frequency web service KPIs from Baidu, Sogou, and eBay.
- UCR: A standard repository containing 203 time-series from domains including medical and IoT.
- TODS: A synthetic dataset with controlled seasonality and noise.
- NAB: Streaming data from AWS cloud metrics and social media.
Performance was measured using the Event F1 score. Unlike point-wise metrics, Event F1 treats continuous anomalous intervals as single events, providing a more realistic assessment of a model's utility in real-world operational environments.
4. Results and Discussion
TShape was benchmarked against 16 state-of-the-art models, including TimesNet, TranAD, and FCVAE. The results demonstrate a clear superiority in detecting complex anomalies:
- Performance Leap: TShape achieved an average Event F1 score of 0.8170, representing a 10% absolute improvement over the next best competitor, FCVAE (0.7161).
- Robustness and Generalization: While many baseline models showed significant performance degradation when switching between datasets (e.g., the SAND model's performance dropped nearly sixfold between WSD and NAB), TShape consistently ranked 1st across all five datasets.
- Ablation Insights: Studies confirmed that multi-scale convolution is essential; simple sliding-window pooling proved insufficient for complex datasets where anomalies occur at varying temporal resolutions.
5. Conclusion and Future Work
TShape effectively addresses the "shapelet" detection gap by combining multi-scale feature extraction with a dual-attention mechanism that mirrors human visual perception. By balancing local and global contexts, it sets a new state-of-the-art for time-series anomaly detection.
Currently, TShape processes multivariate datasets by treating each channel independently. A promising avenue for future research involves extending the patch-wise dual-attention framework to explicitly model cross-channel correlations, potentially further improving detection accuracy in highly interdependent system environments.
Summary updated