Abstract
This study proposes an anomaly detection method based on the Transformer architecture with integrated multiscale feature perception, aiming to address the limitations of temporal modeling and scale-aware feature representation in cloud service environments. The method first employs an improved Transformer module to perform temporal modeling on high-dimensional monitoring data, using a self-attention mechanism to capture long-range dependencies and contextual semantics. Then, a multiscale feature construction path is introduced to extract temporal features at different granularities through downsampling and parallel encoding. An attention-weighted fusion module is designed to dynamically adjust the contribution of each scale to the final decision, enhancing the model's robustness in anomaly pattern modeling. In the input modeling stage, standardized multidimensional time series are constructed, covering core signals such as CPU utilization, memory usage, and task scheduling states, while positional encoding is used to strengthen the model's temporal awareness. A systematic experimental setup is designed to evaluate performance, including comparative experiments and hyperparameter sensitivity analysis, focusing on the impact of optimizers, learning rates, anomaly ratios, and noise levels. Experimental results show that the proposed method outperforms mainstream baseline models in key metrics, including precision, recall, AUC, and F1-score, and maintains strong stability and detection performance under various perturbation conditions, demonstrating its superior capability in complex cloud environments.
Introduction
Cloud service environments are highly dynamic and generate massive streams of high-dimensional telemetry data, such as CPU utilization, memory usage, and network logs. Detecting anomalies in these environments is challenging due to two primary factors: temporal complexity and non-stationarity. Anomalies often occur at different time scales—from microsecond jitters to long-term resource leaks—and "normal" system behavior shifts constantly based on user demand and task scheduling. Traditional deep learning models, such as LSTMs or standard Transformers, often struggle to capture these multi-layered patterns simultaneously. This paper introduces a Transformer-based framework utilizing multiscale feature perception to address these challenges.
Methodology
The proposed architecture focuses on "scale-aware" feature representation through several key components.
Multiscale Feature Construction
Rather than relying on a single temporal window, the model creates parallel processing paths. It uses downsampling to extract features at different granularities, allowing the system to observe both fine-grained details and broad trends simultaneously.
Attention-Weighted Fusion
Not all time scales are equally relevant for every anomaly. An attention-weighted fusion module was designed to dynamically calculate contribution weights for each scale, prioritizing the most informative granularity for the final detection decision.
Improved Transformer Backbone and Input Refinement
The core model uses a self-attention mechanism to capture long-range dependencies across high-dimensional data. Input modeling involves standardized multidimensional time series combined with learnable positional encodings to maintain temporal awareness.
Experimental Setup
The model was evaluated using the Alibaba Cluster Trace 2018, a real-world dataset covering over 4,000 servers. It includes job scheduling logs, container allocations, and resource metrics with annotated anomaly events. The researchers employed a sliding window approach with a size of 60 and a stride of 1 to generate training samples.
Results and Discussion
The proposed model (referred to as "Ours") consistently outperformed mainstream baselines across all primary metrics, achieving a significant boost in F1-score and AUC.
| Method | Precision | Recall | F1-Score | AUC |
|---|---|---|---|---|
| ResNet | 0.812 | 0.765 | 0.788 | 0.874 |
| LSTM | 0.841 | 0.809 | 0.824 | 0.888 |
| Transformer | 0.868 | 0.844 | 0.856 | 0.912 |
| Ours | 0.902 | 0.887 | 0.894 | 0.941 |
Key Insights
- Activation Function Performance: The GELU (Gaussian Error Linear Unit) activation function was found to significantly outperform ReLU or LeakyReLU. Its smoothness and higher-order differentiability allow for better modeling of the complex, non-linear patterns in cloud telemetry.
- Optimizer Selection: AdamW (Adam with Weight Decay) provided the best results by balancing convergence speed with improved generalization.
- Robustness to Noise: Sensitivity analysis confirmed that the multiscale fusion approach is more resilient to data perturbations and noise injection than single-scale baselines.
Conclusion
The integration of multiscale feature perception into a Transformer-based architecture provides a powerful tool for anomaly detection in cloud services. While the model demonstrates superior performance, future work will address the quadratic computational cost of self-attention and explore unsupervised learning techniques to handle environments with limited labeled data.
Summary updated