iTransformer: Inverted Transformers Are Effective for Time Series Forecasting

Yong Liu, Tengge Hu, Haoran Zhang, Haixu Wu, Shiyu Wang, Lintao Ma, Mingsheng Long

Introduction

In recent years, the "Transformer revolution" in time series forecasting hit an unexpected snag. Despite their massive success in Natural Language Processing and Computer Vision, standard Transformer-based forecasters were frequently outperformed by surprisingly simple linear models.

The authors of the iTransformer identify a fundamental mismatch in how Transformers have traditionally been applied to multivariate time series. Standard models treat a single timestamp's values across all variables as a "temporal token." This approach suffers from two major flaws:

  1. Semantic Confusion: It fuses disparate physical measurements (e.g., temperature, price, and humidity) into a single embedding, making it difficult for the model to learn meaningful, variable-specific representations.
  2. Temporal Weakness: Applying attention across time points often fails to capture long-term dependencies effectively. As the "lookback window" (the historical data used for prediction) grows, many standard Transformers actually experience performance degradation and computational explosion.

The iTransformer Architecture

To address these issues, the authors propose the iTransformer (Inverted Transformer). Instead of modifying the Transformer's internal components, they simply change what constitutes a "token."

Comparison of vanilla vs. inverted Transformer views

The core innovations include:

  • Inversion: Each univariate series (the entire lookback window of a single variable) is embedded into a single variate token.
  • Multivariate Attention: The self-attention mechanism is applied across these variate tokens rather than across time. This allows the model to explicitly learn the correlations and dependencies between different variables.
  • Temporal Feed-Forward Networks (FFN): The FFN is applied to each variate token independently. Because a token now represents a sequence over time, the FFN acts as a powerful nonlinear learner for temporal patterns.
  • Layer Normalization: By applying LayerNorm across the temporal dimension of each series, the model becomes more robust to non-stationarity (changes in the statistical properties of the data over time).

Key Insights

The iTransformer's design leads to several powerful advantages:

  • Repurposing Strengths: The authors realized that the FFN is actually better suited for temporal modeling than attention, while attention is perfectly suited for capturing the complex web of correlations between different sensors or variables.
  • Scaling with History: Unlike previous Transformers, the iTransformer's performance consistently improves as the lookback window increases, effectively utilizing more historical information to make better predictions.
  • Variate Generalization: Because the FFNs are shared across all variate tokens, the model learns intrinsic time series patterns. This allows it to generalize remarkably well to variables it did not even see during training.

Performance and Results

The authors evaluated iTransformer on a comprehensive suite of real-world benchmarks, including standard datasets (ETT, ECL, Exchange, Traffic, Weather, Solar-Energy) and high-dimensional datasets (PEMS and a newly introduced Market dataset).

Performance comparison across various datasets

The iTransformer achieved state-of-the-art (SOTA) results across the board, significantly outperforming both previous Transformers and the linear models that had recently challenged them:

  • Massive Performance Boost: It achieved an average 38.9% improvement over the vanilla Transformer and outperformed the previous SOTA, PatchTST, on most datasets.
  • High-Dimensional Mastery: On the notoriously difficult PEMS dataset, iTransformer showed a massive lead over patching-based methods.
  • Efficiency: By using an efficient training strategy—training on a random subset of variables in each batch—the model can handle datasets with thousands of variables while maintaining a small memory footprint.

Limitations and Future Directions

While the iTransformer solves many existing pain points, some challenges remain. The attention mechanism still scales quadratically with the number of variables ($N$), making extremely high-dimensional data computationally demanding without linear-complexity attention variants. Additionally, the current model uses a simple MLP for temporal processing; incorporating more specialized temporal architectures (like TCNs) could further improve performance. Finally, the model's ability to generalize to unseen variables opens the exciting possibility of building large-scale "foundation models" for time series forecasting.

Summary updated

BibTeX
@inproceedings{liu2024itransformer,
  author = {Yong Liu and Tengge Hu and Haoran Zhang and Haixu Wu and Shiyu Wang and Lintao Ma and Mingsheng Long},
  title = {{iTransformer: Inverted Transformers Are Effective for Time Series Forecasting}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=JePfAI8fah},
}
Figure