Paper commentary
A Time Series is Worth 64 Words: Long-term Forecasting with Transformers
PatchTST splits time series into patches so Transformers can forecast longer histories
- Problem Transformer forecasters use one token per time step, so attention cost grows quadratically with the look-back length. Long histories become expensive, and a simple linear model beat them on common benchmarks.
- Method PatchTST cuts each channel into short patches and feeds each patch to the Transformer as one token. Unlike point-wise tokens, it treats channels independently and shares weights across them.
- Results PatchTST/64 cuts overall MSE by 21.0% compared with the best Transformer-based results on long-term forecasting.
Why point-wise Transformers struggle with long histories
Long-term forecasting with Transformers runs into a cost problem at the input. Self-attention cost grows quadratically with the number of input tokens, and with one token per time step that number equals the look-back length L. A longer look-back window therefore costs more memory and compute, so the history a model can see is limited in practice.
Some earlier work shortens the input by sub-sampling the series or sparsifying attention, which keeps the token count down. Sub-sampling, however, throws away values, and single time steps carry little meaning on their own, as a word does in a sentence. A simple linear model then outperformed the previous Transformer models on a range of common benchmarks, which challenged whether Transformers suit this task.
Patches and channel independence as the key idea
The key idea is to cut each series into short patches and feed each patch to the Transformer as one token. Patches group neighbouring time steps, so the token carries local semantic information that a single time step lacks. Each channel is also handled on its own, so each token holds data from one channel and all channels share the same embedding and Transformer weights.
The authors expected this design to help in three ways: local meaning is kept, attention cost falls, and the model can reach further back in time. Channel-independence contrasts with channel-mixing, where one token takes all features at a time step and projects them together. Channel-independence had worked for CNNs and linear models, but it had not been applied to Transformer-based models.
How a patch becomes a forecast
The normalized series is cut into patches of length P with stride S, and the last value is repeated at the end so the count works out to \(N=\lfloor (L-P)/S\rfloor+2\). Because the token count is about L/S, the attention map shrinks by roughly a factor of S in memory and compute.
Each patch is projected to the latent dimension D by a trainable linear map, and a learnable position encoding is added so the model knows the patch order. The Transformer encoder then runs multi-head attention, followed by BatchNorm, a feed-forward network and residual connections. A flatten layer with a linear head turns the representation into the T future values of that channel, and training minimizes the MSE averaged over the channels.
Supervised forecasting results against baselines
Compared to the best Transformer-based results, PatchTST/64 gives an overall MSE reduction of 21.0% and an overall MAE reduction of 16.7%. PatchTST/42 uses the same 336-step look-back as DLinear, and its reductions are 20.2% for MSE and 16.4% for MAE. The baselines were rerun over six look-back windows and the best result was kept, so they are not weak comparators.
PatchTST outperforms DLinear in general, and the gap is largest on Weather, Traffic, Electricity and ILI. The comparison covers 8 datasets, each with a fixed set of prediction lengths, so it does not test every horizon or domain. Patch length P is 16 and stride S is 8 for both variants, while PatchTST/64 uses a 512-step window.
Where the patching gain comes from in the input-length study
On Traffic with horizon 96, point-wise tokens at look-back 96 gave MSE 0.518, and look-back 336 lowered it to 0.397. Patching at look-back 336 lowered MSE further to 0.367 with 42 input tokens. Sampling the look-back-380 series every 4 steps to 96 tokens gave 0.447, which beats the 0.518 of the most recent 96 steps.
At look-back 336, training running time on Traffic fell from 10040 s without patching to 464 s with it, a 22x gain. Electricity gained 19x and Weather gained 4x in running time. This gain follows from the lower token count, so the longer history costs less than point-wise tokens would.
Ablation and look-back sensitivity
On Weather at horizon 96, the full model reached 0.152 MSE, compared to 0.238 for the original Transformer without either design.
Figure 2 plots MSE across look-back windows from 24 to 720 on Electricity, Traffic and Weather. The authors say most Transformer-based baselines do not gain from a longer window, while PatchTST's MSE keeps falling as the window grows. That claim rests on three datasets and horizons 96 and 720, so it does not cover other domains.
Self-supervised pre-training and transfer
Pre-training uses input length 512 with patch size 12, which gives 42 patches, and masks 40% of the patches with zeros for 100 epochs. The learned encoder is then evaluated by linear probing for 20 epochs with the rest frozen, or by probing for 10 epochs and then fine-tuning the whole network for 20 epochs. On large datasets, pre-training improves on training from scratch, and linear probing alone comes close to full supervised training.
With 42 tokens at look-back 336, the self-supervised model reached MSE 0.349 on Traffic at horizon 96, the best value in that comparison. The authors report that self-supervised PatchTST outperforms the other Transformer-based models on all the listed datasets.
When pre-trained on Electricity and fine-tuned on Traffic, PatchTST reached MSE 0.388 at horizon 96, compared to 0.400 for DLinear. Fine-tuning on other datasets is slightly worse than pre-training on the same dataset, which the authors consider reasonable.
On ETTh1 with linear probing only, PatchTST's improvement over the best representation baseline ranges from 34.5% to 48.8% across prediction lengths. Some baseline numbers come from the original papers of TS2Vec, BTSF, TNC and TS-TCC rather than from the same runs.
Limitations
Channel-independence ignores correlations between channels, and the authors leave modeling cross-channel dependencies to future work. The paper tests patching only inside PatchTST and does not test it in other Transformer models. The look-back study covers three datasets, and the ETTh1 representation comparison uses linear probing only.
Paper info
- Authors
- Yuqi Nie, Nam H. Nguyen, Phanwadee Sinthong, Jayant Kalagnanam
- Venue
- arXiv · Preprint
- First published
- 2022-11-27
- Added
- 2026-11-12
- Updated
- 2023-3-5
- Version
- v2
- arXiv
- 2211.14730
- Category
- cs.LG · cs.AI
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Yuqi Nie, Nam H. Nguyen, Phanwadee Sinthong, Jayant Kalagnanam (2022). A Time Series is Worth 64 Words: Long-term Forecasting with Transformers. arXiv:2211.14730v2. https://arxiv.org/abs/2211.14730v2
BibTeX
@misc{nie2022time,
title = {{A Time Series is Worth 64 Words: Long-term Forecasting with Transformers}},
author = {Yuqi Nie and Nam H. Nguyen and Phanwadee Sinthong and Jayant Kalagnanam},
year = {2022},
eprint = {2211.14730},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2211.14730v2}
}