Stacked Residuals of Dynamic Layers for Time Series Anomaly Detection

Luca Zancato, Alessandro Achille, Giovanni Paolini, Alessandro Chiuso, Stefano SoattoarXiv 2022

Abstract

We present an end-to-end differentiable neural network architecture to perform anomaly detection in multivariate time series by incorporating a Sequential Probability Ratio Test on the prediction residual. The architecture is a cascade of dynamical systems designed to separate linearly predictable components of the signal such as trends and seasonality, from the non-linear ones. The former are modeled by local Linear Dynamic Layers, and their residual is fed to a generic Temporal Convolutional Network that also aggregates global statistics from different time series as context for the local predictions of each one. The last layer implements the anomaly detector, which exploits the temporal structure of the prediction residuals to detect both isolated point anomalies and set-point changes. It is based on a novel application of the classic CUMSUM algorithm, adapted through the use of a variational approximation of f-divergences. The model automatically adapts to the time scales of the observed signals. It approximates a SARIMA model at the get-go, and auto-tunes to the statistics of the signal and its covariates, without the need for supervision, as more data is observed. The resulting system, which we call STRIC, outperforms both state-of-the-art robust statistical methods and deep neural network architectures on multiple anomaly detection benchmarks.

Introduction

Anomaly detection in multivariate time series requires a delicate balance between model flexibility and reliability. Modern deep learning approaches, such as Transformers and Temporal Convolutional Networks (TCNs), offer high capacity but often lack the inductive biases necessary to handle non-stationary signals effectively. These models frequently struggle with data where the mean or variance shifts over time, such as growing trends or seasonal cycles.

Conversely, classical statistical models like SARIMA are robust and interpretable but fail to capture complex, non-linear correlations across high-dimensional variables. Furthermore, many existing detectors rely on knowing the underlying distribution of "normal" data, a requirement that is rarely met in real-world, large-scale applications. This paper introduces STRIC (Stacked Residuals of Interactive Components), an architecture designed to bridge this gap by combining interpretable linear dynamics with powerful non-linear modeling.

The STRIC Architecture

STRIC is built upon three primary pillars that allow it to decompose signals into meaningful components while maintaining end-to-end differentiability.

1. Cascade of Dynamic Layers

Instead of a single black-box network, STRIC utilizes a hierarchy of layers. The initial stages consist of Linear Dynamic Layers (LDLs) specifically initialized to capture and remove "simple" components like trends and seasonality. The remaining residual signal—the portion the linear model cannot explain—is passed to a generic TCN to model complex, non-linear dependencies.

The STRIC architecture decomposes signals through a cascade of Trend, Seasonal, and Linear layers before passing residuals to a TCN.

2. Fading Memory Regularization

To mitigate overfitting, the authors developed a novel regularization scheme inspired by Bayesian learning. This "fading memory" mechanism automatically determines the relevance of past data points, forcing the model to focus on characteristic time scales and ignore distant, irrelevant history. This effectively treats the look-back window as a learnable parameter.

3. Non-parametric CUMSUM

For detection, STRIC adapts the classic Cumulative Sum (CUMSUM) algorithm. By using a variational approximation of $f$-divergences, the model estimates likelihood ratios directly from the data. This makes the detector distribution-free and capable of identifying both sudden spikes and gradual "set-point" changes.

Experimental Evaluation

The model was evaluated on a comprehensive suite of benchmarks, including multivariate datasets like Credit Card fraud, CICIDS, GECCO, SWAN-SF, SMD, and PSM. It was also tested on univariate benchmarks (Yahoo, NAB) and a qualitative real-world experiment using 200-dimensional embeddings of New York Times articles to detect major historical events.

Key Results

STRIC demonstrated state-of-the-art performance across nearly all benchmarks, significantly outperforming leading models such as Anomaly Transformer and OmniAnomaly. On the SMD dataset, it achieved an F1-score of 0.926, a substantial improvement over the previous best of 0.850.

Performance comparison across multivariate datasets shows STRIC consistently achieving the highest F1-scores.

Beyond raw performance, the fading memory regularization reduced the generalization gap by approximately 35% compared to standard TCNs. In the NYT experiment, the model successfully identified major news cycle anomalies corresponding to the 9/11 attacks and the 2004 Indian Ocean tsunami without any prior human labeling.

Discussion and Conclusion

STRIC provides a unique blend of interpretability and power. By forcing early layers to behave like classical filters, the model gains the robustness of statistical methods. Users can inspect the output of specific LDLs to visualize estimated trends and seasonality, providing clear explanations for detected anomalies.

While highly robust, the model currently relies on hyperparameters for the window lengths used in the CUMSUM detector. Future work will focus on making these window lengths fully adaptive and developing optimal rules for calibrating detection thresholds based on specific user tolerances for false alarms.

Summary updated

BibTeX
@misc{zancato2022stacked,
  author = {Luca Zancato and Alessandro Achille and Giovanni Paolini and Alessandro Chiuso and Stefano Soatto},
  title = {{Stacked Residuals of Dynamic Layers for Time Series Anomaly Detection}},
  year = {2022},
  eprint = {2202.12457},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2202.12457},
}
Figure