iTransformer: The Latest Breakthrough in Time Series Forecasting | by Marco Peixeiro | Apr, 2024

Editor
2 Min Read


Discover the architecture of iTransformer and apply the model in a small experiment using Python.

Photo by David Clode on Unsplash

The field of forecasting has seen a lot of activity in the realm of foundation models, with models like Lag-LLaMA, Time-LLM, Chronos and Moirai being proposed since the beginning of 2024.

However, their performance has been a bit underwhelming (for reproducible benchmarks, see here), and I believe that data-specific models are still the optimal solution at the moment.

To that end, the Transformer architecture has been applied in many forms for time series forecasting, with PatchTST achieving state-of-the-art performance for long-horizon forecasting.

Challenging PatchTST comes the iTransformer model, proposed in March 2024 in the paper iTransformer: Inverted Transformers Are Effective for Time Series Forecasting.

In this article, we discover the strikingly simple concept behind iTransformer and explore its architecture. Then, we apply the model in a small experiment and compare its performance to TSMixer, N-HiTS and PatchTST.

For more details, make sure to read the original paper.

Let’s get started!

The idea behind iTransformer comes from the realization that the vanilla Transformer model uses temporal tokens.

This means that the model looks at all features at a single time step. Thus, it is challenging for the model to learn temporal dependencies when looking at one time step at a time.

A solution to that problem is patching, which was proposed with the PatchTST model. With patching, we simply group time points together before tokenizing and embedding them, as shown below.

Visualizing patching. Here, we have a sequence of 15 timesteps, with a patch length of 5 and a stride of 5 as well, resulting in three patches. Image by the author.

In iTransformer, we push patching to the extreme by simply applying the model on the inverted dimensions.

Share this Article
Please enter CoinGecko Free Api Key to get this plugin works.