TransNAS-TSAD: harnessing transformers for multi-objective neural architecture search in time series anomaly detection

Ijaz Ul Haq, Byung Suk Lee, Donna M. RizzoNeural Computing and Applications 2023

Abstract

Time series anomaly detection (TSAD) is vital for monitoring complex systems, yet manual model tuning remains a significant bottleneck. This paper presents TransNAS-TSAD, an automated framework that leverages multi-objective Neural Architecture Search (NAS) to design dataset-specific Transformer models. By optimizing for both detection accuracy and computational efficiency using the NSGA-II algorithm, TransNAS-TSAD identifies architectures that outperform static state-of-the-art models across diverse industrial and scientific domains. Our results demonstrate that automated architectural adaptation is essential for achieving peak performance in varied real-world scenarios.

Introduction

Detecting anomalies in time series data is critical for applications ranging from infrastructure monitoring to medical diagnostics. While deep learning models, particularly Transformers, have shown promise due to their ability to capture long-range dependencies, their performance is highly sensitive to architectural choices. A configuration optimized for univariate sensor data often fails on high-dimensional, correlated datasets. Furthermore, the focus on accuracy frequently overlooks computational costs, such as model size and training time, which are crucial for deployment in resource-constrained environments. TransNAS-TSAD addresses these challenges by automating the search for the optimal balance between performance and efficiency.

Methodology

The TransNAS-TSAD framework integrates three core components to automate the design of anomaly detectors:

  1. Transformer Backbone: Utilizes self-attention mechanisms to effectively model temporal dependencies within time series data.
  2. Multi-Objective NAS (NSGA-II): Employs the Non-dominated Sorting Genetic Algorithm II to explore a vast search space including the number of layers, attention heads, window sizes, and training hyperparameters.
  3. Three-Phase Adversarial Learning: Implements a sophisticated training regime consisting of preliminary reconstruction, an adversarial phase between dual decoders, and a final self-adversarial refinement phase to enhance sensitivity to subtle anomalies.
Workflow of the TransNAS-TSAD multi-objective neural architecture search process.

As shown in Figure 1, the NAS process iteratively evaluates and selects models based on a Pareto front, ensuring that the final candidates represent the best trade-offs between competing objectives. To quantify this trade-off, we introduce the Efficiency-Accuracy-Complexity Score (EACS), a weighted metric incorporating F1 score, training duration, and parameter count.

Experimental Setup and Datasets

The framework was rigorously tested against eight diverse datasets:

  • Industrial/Infrastructure: SWaT (Water Treatment), WADI (Water Distribution), and SMD (Server Machine Dataset).
  • Scientific/Space: SMAP (Soil Moisture) and MSL (Mars Rover).
  • Medical/General: MBA (ECG data), UCR (Univariate sequences), and NAB (Numenta Anomaly Benchmark).

Key Results and Insights

TransNAS-TSAD consistently outperformed established baselines across nearly all test cases. Key findings include:

  • Adaptability is Essential: The NAS identified vastly different optimal configurations for different datasets. For instance, the complex WADI dataset required 127 attention heads, whereas the simpler UCR dataset peaked with only one head. This confirms that static architectures are inherently sub-optimal.
  • Superior Performance: The framework achieved a near-perfect F1 score of 0.9986 on the SMD dataset and a 40% improvement over baselines on the WADI dataset.
  • Efficiency Gains: By treating complexity as an optimization objective, the framework discovered models that were not only more accurate but also significantly smaller and faster to train. On the NAB dataset, TransNAS-TSAD achieved an EACS of 0.9742, far exceeding more cumbersome traditional models.

Conclusion and Future Work

TransNAS-TSAD demonstrates the power of multi-objective NAS in creating specialized, efficient, and highly accurate anomaly detection models. While the framework shows a slight risk of overfitting on specific noise patterns in certain datasets, its ability to find Pareto-optimal solutions makes it a robust tool for real-world deployment. Future research will focus on integrating expert human feedback into the NAS loop and adapting the framework for real-time data assimilation in environmental monitoring systems.

Summary updated

BibTeX
@article{haq2023transnas,
  author = {Ijaz Ul Haq and Byung Suk Lee and Donna M. Rizzo},
  title = {{TransNAS-TSAD: harnessing transformers for multi-objective neural architecture search in time series anomaly detection}},
  journal = {Neural Computing and Applications},
  year = {2023},
}
Figure