Timer-XL: Long-Context Transformers for Unified Time Series Forecasting

Yong Liu, Guo Qin, Xiangdong Huang, Jianmin Wang, Mingsheng Long

TL;DR

Timer-XL introduces a causal, decoder-only Transformer architecture that breaks the "context bottleneck" in time series forecasting, scaling lookback windows to thousands of tokens. By generalizing next-token prediction to multivariate series through a novel TimeAttention mechanism, it provides a unified, state-of-the-art foundation model for univariate, multivariate, and covariate-informed forecasting.

What Problem Does This Paper Address?

While Large Language Models (LLMs) and Vision Transformers routinely process contexts spanning thousands to millions of tokens, time-series Transformers have historically been trapped in a "context bottleneck." Most existing models operate on limited lookback windows of just a few hundred tokens (or patches).

This short-sightedness prevents models from capturing long-term global trends—such as yearly climate cycles or multi-month economic shifts—and struggles to handle non-stationary data. Furthermore, when existing encoder-only architectures are forced to process extra-long contexts, their forecasting performance frequently degrades. Timer-XL aims to deliver a scalable, decoder-only architecture capable of unifying diverse forecasting tasks under a single, long-context paradigm.

Figure 1: We compare the context length (measured by token number) of Transformers in different modalities and propose Timer-XL that increases the length to thousands of patch tokens. Given the generality across contexts, Timer-XL is a versatile solution for various forecasting tasks.

Methods

Timer-XL reworks the standard language modeling objective into multivariate next-token prediction. To handle multidimensional time series uniformly, the authors introduce two key technical components:

  1. TimeAttention: Instead of treating channels independently, Timer-XL flattens 2D time-series patches into a 1D sequence using a temporal-first ordering. It then applies a causal self-attention mask derived from the Kronecker product ($C \otimes T$) of a variable dependency graph ($C$) and a temporal causal mask ($T$). This elegantly preserves strict chronological causality while allowing flexible, fine-grained interactions across different variables.
  2. Permutation-Equivalent Position Embeddings: To ensure that shuffling the input order of channels doesn't break the model, Timer-XL decouples its positioning. It utilizes Rotary Position Embeddings (RoPE) for the temporal dimension and pairs them with learnable, head-specific scalars for the variable dimension to distinguish between endogenous and exogenous series.

Datasets

The model was evaluated across a broad suite of standard benchmarks alongside several newly introduced long-context datasets designed to test extended lookback capabilities:

  • Standard Benchmarks: ETT, Weather, ECL, Traffic, Solar-Energy, PEMS, and EPF (for covariate-informed forecasting).
  • ERA5-S / ERA5-MS / ERA5-Large: New benchmarks curated from 40 years of global climate reanalysis data. Lookback windows were scaled to monthly and yearly levels (up to 3,072 time points) across up to 4,920 stations.
  • GTWSF: The Global Temperature and Wind Speed Forecasting challenge, encompassing 3,850 worldwide stations.
  • Pre-training Corpora: Large-scale pre-training was executed on the UTSD (1 billion time points) and LOTSA datasets.

Key Insights and Ideas

  • Decoder-Only Architecture Scales Better: The authors reveal an important architectural divergence: while encoder-only models (like PatchTST) suffer from severe performance degradation as lookback windows expand into thousands of points, decoder-only causal Transformers natively mitigate this degradation and capitalize on longer contexts.
  • Causality is a Powerful Regularizer for Covariates: In covariate-informed tasks, enforcing a strict temporal causal mask on exogenous variables actually yields better results than processing them non-causally. Maintaining temporal causality across all inputs prevents overfitting and sets a higher upper limit for performance.
  • Unified Context via Kronecker Disentanglement: By using the Kronecker product to structure attention masks, the model can seamlessly pivot between univariate, multivariate, and covariate-informed forecasting without changing its underlying neural architecture.

Key Results

  • Task-Specific Superiority: Timer-XL achieves state-of-the-art results across task-specific benchmarks. It shows massive improvements over channel-independent models on high-dimensional datasets, including a 13.2% performance gain on ECL and a 6.3% gain on Traffic.
  • Zero-Shot Excellence: When pre-trained at scale, Timer-XL outperforms prominent time-series foundation models—such as Moirai, Chronos, and TimesFM—in zero-shot forecasting accuracy and sample efficiency.
  • Linear Scaling in Practice: Although multi-variable attention theoretically scales quadratically ($O(N^2T^2)$), integrating Timer-XL with FlashAttention reduces the actual memory footprint to $O(NT)$, making long-context multivariate training highly efficient on modern GPUs.

Limitations and Future Work

Because Timer-XL is an autoregressive model, it relies on iterative generation for long-term forecasting horizons. This can lead to error accumulation over multi-step rollouts and introduces inflexibility regarding output lengths. Additionally, the authors note that accuracy gains tend to plateau at excessively long lookbacks due to inherent noise in time-series data.

To address these bottlenecks, future work will focus on incorporating multi-resolution patching strategies and exploring new methods to improve context efficiency in massive, high-dimensional datasets.

Summary updated

BibTeX
@inproceedings{liu2025timer,
  author = {Yong Liu and Guo Qin and Xiangdong Huang and Jianmin Wang and Mingsheng Long},
  title = {{Timer-XL: Long-Context Transformers for Unified Time Series Forecasting}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=KMCJXjlDDr},
}
Figure