Voltar ao ranking

thuml/iTransformer

Pythonarxiv.org/abs/2310.06625

Official implementation for "iTransformer: Inverted Transformers Are Effective for Time Series Forecasting" (ICLR 2024 Spotlight)

time-series-forecastingtransformer
Crescimento de estrelas
Estrelas
2.2k
Forks
366
Crescimento semanal
Issues
15
1k2k
out. de 2023set. de 2024ago. de 2025jul. de 2026
ArtefatosPyPIpip install itransformer
README

iTransformer

The repo is the official implementation for the paper: iTransformer: Inverted Transformers Are Effective for Time Series Forecasting. [Slides], [Poster], [Intro (CN)]. .

Updates

:triangular_flag_on_post: News (2024.10) TimeXer, a Transformer for predicting with exogenous variables, is released. Code is available here.

:triangular_flag_on_post: News (2024.05) Many thanks for the great efforts from lucidrains. A pip package for the usage of iTransformer variants can be simply installed via pip install iTransformer

:triangular_flag_on_post: News (2024.04) iTransformer has benn included in NeuralForecast. Special thanks to the contributor @Marco!

:triangular_flag_on_post: News (2024.03) Introduction of our work in Chinese is available.

:triangular_flag_on_post: News (2024.02) iTransformer has been accepted as ICLR 2024 Spotlight.

:triangular_flag_on_post: News (2023.12) iTransformer available in GluonTS with probablistic head and support for static covariates. Notebook is available here.

:triangular_flag_on_post: News (2023.12) We received lots of valuable suggestions. A revised version (24 Pages) is now available.

:triangular_flag_on_post: News (2023.10) iTransformer has been included in [Time-Series-Library] and achieves state-of-the-art in Lookback-$96$ forecasting.

:triangular_flag_on_post: News (2023.10) All the scripts for the experiments in our paper are available.

Introduction

🌟 Considering the characteristics of multivariate time series, iTransformer breaks the conventional structure without modifying any Transformer modules. Inverted Transformer is all you need in MTSF.

🏆 iTransformer achieves the comprehensive state-of-the-art in challenging multivariate forecasting tasks and solves several pain points of Transformer on extensive time series data.

Overall Architecture

iTransformer regards independent time series as variate tokens to capture multivariate correlations by attention and utilize layernorm and feed-forward networks to learn series representations.

The pseudo-code of iTransformer is as simple as the following:

Usage

  1. Install Pytorch and the necessary dependencies.
pip install -r requirements.txt
  1. The datasets can be obtained from Google Drive or Baidu Cloud.

  2. Train and evaluate the model. We provide all the above tasks under the folder ./scripts/. You can reproduce the results as the following examples:

# Multivariate forecasting with iTransformer
bash ./scripts/multivariate_forecasting/Traffic/iTransformer.sh

# Compare the performance of Transformer and iTransformer
bash ./scripts/boost_performance/Weather/iTransformer.sh

# Train the model with partial variates, and generalize to the unseen variates
bash ./scripts/variate_generalization/ECL/iTransformer.sh

# Test the performance on the enlarged lookback window
bash ./scripts/increasing_lookback/Traffic/iTransformer.sh

# Utilize FlashAttention for acceleration
bash ./scripts/efficient_attentions/iFlashTransformer.sh

Main Result of Multivariate Forecasting

We evaluate the iTransformer on challenging multivariate forecasting benchmarks (generally hundreds of variates). Comprehensive good performance (MSE/MAE $\downarrow$) is achieved.

Online Transaction Load Prediction of Alipay Trading Platform (Avg Results)

General Performance Boosting on Transformers

By introducing the proposed framework, Transformer and its variants achieve significant performance improvement, demonstrating the generality of the iTransformer approach and benefiting from efficient attention mechanisms.

Zero-Shot Generalization on Variates

Technically, iTransformer is able to forecast with arbitrary numbers of variables. We train iTransformers on partial variates and forecast unseen variates with good generalizability.

Model Analysis

Benefiting from inverted Transformer modules:

  • (Left) Inverted Transformers learn better time series representations (more similar CKA) favored by forecasting.
  • (Right) The inverted self-attention module learns interpretable multivariate correlations.

Citation

If you find this repo helpful, please cite our paper.

@article{liu2023itransformer,
  title={iTransformer: Inverted Transformers Are Effective for Time Series Forecasting},
  author={Liu, Yong and Hu, Tengge and Zhang, Haoran and Wu, Haixu and Wang, Shiyu and Ma, Lintao and Long, Mingsheng},
  journal={arXiv preprint arXiv:2310.06625},
  year={2023}
}

Acknowledgement

We appreciate the following GitHub repos a lot for their valuable code and efforts.

This work was supported by Ant Group through the CCF-Ant Research Fund and awarded as Outstanding Projects of CCF Fund.

Contact

If you have any questions or want to use the code, feel free to contact:

Repositórios relacionados
amazon-science/chronos-forecasting

Chronos: Pretrained Models for Time Series Forecasting

PythonPyPIApache License 2.0forecastinglarge-language-models
arxiv.org/abs/2510.15821
5.6k676
awslabs/gluonts

Probabilistic time series modeling in Python

PythonPyPIApache License 2.0time-seriesdeep-learning
ts.gluon.ai
5.2k823
Nixtla/nixtla

TimeGPT-1: production ready pre-trained Time Series Foundation Model for forecasting and anomaly detection. Generative pretrained transformer for time series trained on over 100B data points. It's capable of accurately predicting various domains such as retail, electricity, finance, and IoT with just a few lines of code 🚀.

Jupyter NotebookOthertime-seriestime-series-forecasting
nixtla.io/docs
4k333
ddz16/TSFpaper

This repository contains a reading list of papers on Time Series Forecasting/Prediction (TSF) and Spatio-Temporal Forecasting/Prediction (STF). These papers are mainly categorized according to the type of model.

deep-learningtime-series
3.2k268
qingsongedu/time-series-transformers-review

A professionally curated list of awesome resources (paper, code, data, etc.) on transformers in time series.

MIT Licensetimeseriestransformer
3k269
Alro10/deep-learning-time-series

List of papers, code and experiments using deep learning for time series forecasting

Jupyter NotebookApache License 2.0time-series-forecastinglstm-neural-networks
2.8k528
KimMeen/Time-LLM

[ICLR 2024] Official implementation of " 🦙 Time-LLM: Time Series Forecasting by Reprogramming Large Language Models"

PythonPyPIApache License 2.0cross-modal-learningcross-modality
arxiv.org/abs/2310.01728
2.7k468
curiousily/Getting-Things-Done-with-Pytorch

Jupyter Notebook tutorials on solving real-world problems with Machine Learning & Deep Learning using PyTorch. Topics: Face detection with Detectron 2, Time Series anomaly detection with LSTM Autoencoders, Object Detection with YOLO v5, Build your first Neural Network, Time Series forecasting for Coronavirus daily cases, Sentiment Analysis with BER

Jupyter NotebookApache License 2.0pytorchdeep-learning
mlexpert.io
2.5k643
cure-lab/LTSF-Linear

[AAAI-23 Oral] Official implementation of the paper "Are Transformers Effective for Time Series Forecasting?"

PythonPyPIApache License 2.0deep-learningforecasting
2.5k509
AIStream-Peelout/flow-forecast

Deep learning PyTorch library for time series forecasting, classification, and anomaly detection (originally for flood forecasting).

PythonPyPIGNU General Public License v3.0deep-learningpytorch
flow-forecast.atlassian.net/wiki/spaces/FF/overview
2.3k302
IBM/AssetOpsBench

AssetOpsBench - Industry 4.0: A unified benchmark and framework for building, orchestrating, and evaluating domain-specific AI agents for Industry 4.0 asset operations and maintenance, with 460+ scenarios, 5 specialist agents (IoT, FMSR, TSFM, Work Order,...), and multi-agent orchestration blueprints (MetaAgent, AgentHive) over MCP.

PythonPyPIApache License 2.0llm-agentsmodel-context-protocol
2.1k293
kwuking/TimeMixer

[ICLR 2024] Official implementation of "TimeMixer: Decomposable Multiscale Mixing for Time Series Forecasting"

PythonPyPIApache License 2.0deep-learningmachine-learning
openreview.net/pdf
2k239