ElasTST: Towards Robust Varied-Horizon Forecasting with Elastic Time-Series Transformer

Jiawen Zhang, Shun Zheng, Xumeng Wen, Xiaofang Zhou, Jiang Bian, Jia Li

TL;DR

ElasTST (Elastic Time-Series Transformer) is a novel architecture designed to solve the "per-horizon" training headache in time-series forecasting. By introducing structured attention masks and tunable position embeddings, it allows a single trained model to generate robust forecasts across various future horizons—even those longer than seen during training—without sacrificing accuracy or consistency.

The Challenge of Varied-Horizon Forecasting

In the world of time-series forecasting (e.g., predicting electricity demand or traffic flow), most state-of-the-art models are "brittle" regarding their forecast horizon. If you train a model to predict 96 steps into the future, it often performs poorly if you suddenly ask it for 192 steps. Conversely, maintaining separate model checkpoints for every possible horizon (1-day, 1-week, 1-month) is a deployment nightmare.

Furthermore, many existing models lack horizon-invariance. Ideally, the prediction for "tomorrow" should stay the same regardless of whether you are forecasting just for tomorrow or for the entire next month. Most current Transformers fail this test because their internal attention mechanisms allow information to leak across the entire output window, meaning that changing the window size changes the individual predictions.

Introducing ElasTST: Methods and Architecture

ElasTST introduces several architectural innovations to achieve "elasticity" and robust varied-horizon forecasting:

ElasTST Architecture Overview
  • Structured Self-Attention Masks: To ensure horizon-invariance, the authors use a non-autoregressive design with "placeholders" for future values. They apply a specific mask that allows these placeholders to attend to observed historical data but prevents them from attending to each other. This ensures that adding more placeholders (extending the horizon) doesn't change the context for earlier ones.
  • Tunable Rotary Position Embedding (TRoPE): Standard Rotary Position Embeddings (RoPE) used in Large Language Models (LLMs) are tuned for text, where "distance" is abstract. Time series have concrete periodicities (daily, weekly, etc.). TRoPE makes the period coefficients learnable, allowing the model to adapt to the specific frequencies of the dataset.
  • Multi-Scale Patching: Instead of picking a single "patch" size (the number of time steps grouped together), ElasTST uses multiple patch sizes (e.g., 8, 16, and 32) simultaneously. This allows the model to capture both fine-grained local volatility and coarse-grained long-term trends.
  • Horizon Reweighting: During training, instead of the computationally expensive task of randomly sampling different horizons for every batch, the authors use a mathematical "reweighting" strategy. This approximates the effect of varied-horizon training using a single fixed-horizon setting.

Datasets

The model was rigorously evaluated on eight widely recognized public benchmarks:

  • ETT (Electricity Transformer Temperature): Four subsets (ETTh1, ETTh2, ETTm1, ETTm2).
  • Electricity: Hourly consumption data.
  • Traffic: Road occupancy rates.
  • Weather: Local climatological data.
  • Exchange: Daily currency exchange rates.

Key Insights and Results

  • The Invariance Breakthrough: The most significant breakthrough is the realization that blocking information exchange between future placeholders is the key to stable extrapolation. It prevents the "tail" of a long forecast from wagging the "dog" of the near-term forecast.
  • NLP Defaults are Suboptimal: The paper reveals that the default RoPE settings used in models like LLaMA (with a base frequency of 10,000) don't align well with time-series data. By shrinking the period range (e.g., to 1,000) and making it tunable, the model captures mid-to-high frequency patterns much more effectively.
  • Superior Extrapolation: When trained on a horizon of 720 and tested on an unseen horizon of 1024, ElasTST significantly outperformed top-tier models like iTransformer and PatchTST, which often saw performance collapse when pushed beyond their training limits.
  • Competitive with Foundation Models: ElasTST was compared against massive pre-trained foundation models like TimesFM and MOIRAI. Despite being trained from scratch on specific datasets, ElasTST provided more robust performance across different horizons and avoided the error propagation issues common in autoregressive models like TimesFM.
  • Efficiency: Despite the multi-scale design, ElasTST maintains a memory footprint and parameter count comparable to standard Transformer baselines, making it practical for real-world use.

Limitations and Future Work

The authors acknowledge a few areas for improvement:

  • Lack of Pre-training: Currently, ElasTST is trained on a per-dataset basis. Incorporating a large-scale pre-training phase (similar to LLMs) could further boost its "zero-shot" capabilities.
  • Dataset Breadth: While the 8 benchmarks used are standard, they don't cover every possible industrial scenario.
  • Optimal Reweighting: The current horizon reweighting scheme is effective but might not be the absolute "optimal" solution for every single type of data distribution.

Future work will focus on developing a "foundation model" version of ElasTST to see if these elastic properties hold up when trained on billions of time-series observations.

Summary updated

BibTeX
@inproceedings{zhang2024elastst,
  author = {Jiawen Zhang and Shun Zheng and Xumeng Wen and Xiaofang Zhou and Jiang Bian and Jia Li},
  title = {{ElasTST: Towards Robust Varied-Horizon Forecasting with Elastic Time-Series Transformer}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=ucXUtMPWhv},
}
Figure