Temporal Saliency Detection Towards Explainable Transformer-based Timeseries Forecasting

Nghia Duong-Trung, Duc-Manh Nguyen, Danh Le-Phuoc · DOI

Abstract

Despite the notable advancements in numerous Transformer-based models, the task of long multi-horizon time series forecasting remains a persistent challenge, especially towards explainability. Focusing on commonly used saliency maps in explaining DNN in general, our quest is to build attention-based architecture that can automatically encode saliency-related temporal patterns by establishing connections with appropriate attention heads. Hence, this paper introduces Temporal Saliency Detection (TSD), an effective approach that builds upon the attention mechanism and applies it to multi-horizon time series prediction. While our proposed architecture adheres to the general encoder-decoder structure, it undergoes a significant renovation in the encoder component, wherein we incorporate a series of information contracting and expanding blocks inspired by the U-Net style architecture. The TSD approach facilitates the multiresolution analysis of saliency patterns by condensing multi-heads, thereby progressively enhancing the forecasting of complex time series data. Empirical evaluations illustrate the superiority of our proposed approach compared to other models across multiple standard benchmark datasets in diverse far-horizon forecasting settings. The initial TSD achieves substantial relative improvements of 31% and 46% over several models in the context of multivariate and univariate prediction.

Introduction

Long-horizon time series forecasting is a persistent challenge in deep learning. While Transformers have become the standard due to their attention mechanisms, they face hurdles in computational complexity and explainability. Current solutions often use "sparsification" to manage memory, which can discard vital information. This paper proposes Temporal Saliency Detection (TSD), which treats time series saliency like image segmentation to automatically learn and aggregate important temporal patterns across multiple scales.

Methods: The TSD Architecture

The core innovation of TSD is a U-Net-inspired encoder that replaces the standard stack of identical Transformer layers. This architecture allows the model to detect "saliency-related" temporal patterns automatically through a multiresolution analysis.

The TSD architecture featuring a TSA block followed by U-Net inspired contracting (ConvDown) and expanding (ConvUp) blocks with skip connections.
  • Temporal Self-Attention (TSA): A single multi-head attention block encodes initial correlations before passing them to the TSD blocks.
  • U-Net Style Encoder (TSD Block): The encoder uses a series of "contracting" (downsampling) and "expanding" (upsampling) blocks.
  • Downsampling (ConvDown): Employs Max-Pooling and 1D convolutions to capture coarse, high-level patterns.
  • Upsampling (ConvUp): Uses Transposed Convolutions to restore resolution and refine details.
  • Skip Connections: These link the contracting and expanding paths, ensuring that fine-grained details are preserved even as the model analyzes broad, long-term trends.

Datasets and Evaluation

TSD was evaluated on several standard benchmarks for long-term forecasting:

  • ETT (Electricity Transformer Temperature): Hourly (ETTh1, ETTh2) and 15-minute (ETTm1) data.
  • ILI (Influenza-like Illness): Weekly recorded influenza patient ratios.
  • Exchange: Daily currency exchange rates from 1990 to 2016.

Key Results

TSD demonstrated a significant leap over established models like Autoformer, Informer, and Reformer across various forecasting horizons.

Performance comparison of TSD (red line) against state-of-the-art models across various datasets and forecasting horizons. Lower values indicate better performance.
  • Multivariate Forecasting: TSD achieved an average 31% relative improvement in Mean Squared Error (MSE) across 46 test cases.
  • Univariate Forecasting: The model showed a 46% relative improvement in MSE and MAE (Mean Absolute Error).
  • Stability: Unlike some baselines, TSD remains stable and competitive even as the prediction horizon extends to 720 time points.

Key Insights

  • Borrowing from Vision: By treating time series saliency like image segmentation, TSD identifies "temporal objects" at various scales.
  • Feature Extraction over Deletion: Rather than just making attention sparse to save memory, TSD uses architectural downsampling to extract meaningful features.
  • Max Pooling Benefits: Ablation studies found Max Pooling to be more stable for long-term forecasting, likely because it better preserves significant "peaks" or events in the data.

Limitations and Future Work

While effective, TSD currently requires extensive manual hyperparameter tuning. Future research could utilize Neural Architecture Search (NAS) to automate design. Additionally, while the architecture is designed for saliency, further work is needed to create intuitive visualizations of these patterns for end-users in fields like finance or healthcare.

Summary updated

BibTeX
@misc{duongtrung2022temporal,
  author = {Nghia Duong-Trung and Duc-Manh Nguyen and Danh Le-Phuoc},
  title = {{Temporal Saliency Detection Towards Explainable Transformer-based Timeseries Forecasting}},
  year = {2022},
  eprint = {2212.07771},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.07771},
}
Figure