# Transformers in Time Series: A Survey

Survey organizes how Transformers are adapted for time series tasks

Qingsong Wen, Tian Zhou, Chaoli Zhang, Weiqi Chen, Ziqing Ma, Junchi Yan and 1 more · arXiv · 2022-2-15

- **Problem** Vanilla self-attention costs O(N^2) in time and memory, so long time series strain it. Seasonality and long-range dependencies are also hard to capture together.
- **Method** The authors sort time series Transformers by network changes and by task. Network changes cover positional encoding and attention, and tasks cover forecasting, anomaly detection and classification.
- **Results** On ETTm2, the vanilla Transformer's lowest MSE came at 6 layers, at 0.439. Deeper settings did not beat it, with 0.461 at 48 layers.

## Where vanilla Transformers strain on time series

Vanilla Transformers have no recurrence, so they add positional encodings to the input embeddings to recover order. Their self-attention costs O(N^2) in time and memory, with N the input series length. For long series, that quadratic cost becomes the computational bottleneck. Time series also carry seasonality and periodicity, and capturing long-range and short-range dependency together with seasonality remains hard.

Many Transformer variants had already been applied to forecasting, anomaly detection and classification. Surveys of deep learning for time series existed, but none covered Transformers for time series comprehensively. The authors therefore set out to organize this growing body of work.

## Sorting the variants by design and task

The authors use two axes, network modifications and application domains. Network modifications split into module-level changes, such as positional encoding and attention, and architecture-level changes. Applications split into forecasting, anomaly detection and classification, and forecasting further splits into time series, spatio-temporal and event forecasting.

Attention is where most efficiency work happens, and that work falls into two groups. One group adds an explicit sparsity bias, as LogTrans and Pyraformer do, while the other exploits the low-rank property of the attention matrix, as Informer and FEDformer do. Table 1 lists training costs of O(N log N) for LogTrans, Informer and Autoformer, and O(N) for Pyraformer and FEDformer.

## Positional encodings, attention and hierarchy

The first lever is the positional encoding, which the authors sort into vanilla, learnable and timestamp forms. The vanilla form uses fixed sine and cosine functions of the position index, with a hand-crafted frequency for each dimension. The learnable form trains embedding vectors for each position jointly with the other parameters, as Zerveas et al.

do. Timestamp encoding adds calendar and event timestamps through learnable embedding layers, as Informer does.

The second lever is the attention module, where the efficient variants change which query and key pairs are computed. LogTrans builds queries and keys with causal convolutions and applies a Logsparse mask, which reduces the cost from O(N^2) to O(N log N). Informer instead keeps only the dominant queries, chosen by their similarity to the keys.

The third lever is hierarchy, which matches the multi-resolution nature of time series. Pyraformer arranges nodes in a C-ary tree, where fine-scale nodes match the raw series and coarser nodes summarize lower resolutions. Pyraformer adds intra-scale and inter-scale attention, so information flows within and across resolutions.

## Forecasting variants and the linear baseline

Most forecasting variants keep the vanilla layout and change the attention module, the normalization or the input tokens. FEDformer applies attention in the frequency domain with Fourier and wavelet transforms, and it randomly keeps a fixed-size subset of frequencies for linear complexity.

Autoformer uses a seasonal-trend decomposition with an auto-correlation block, which scores time-delay similarity and aggregates the top-k similar sub-series. PatchTST treats each univariate channel separately and splits each series into subseries-level patches that serve as tokens. Crossformer, by contrast, models cross-dimension dependency through a two-stage attention layer.

DLinear, an MLP-based model, asks whether Transformers are needed for long-term forecasting. The authors point out that PatchTST achieves better numerical results than DLinear for long-term forecasting. They call the case against Transformers, built on DLinear results alone, an overclaim.

## Longer input windows

The vanilla Transformer's MSE rises from 0.557 at input length 96 to 1.691 at input length 720. At input length 1440 it falls back to 0.936, so the curve is not monotone.

Informer follows a similar path, going from 0.428 at input length 96 to 1.898 at input length 1440. Autoformer goes from 0.239 at input length 96 to 0.552 at input length 1440. The authors note that these efficient designs usually run on a short fixed input in their own experiments, which makes them question their practical use. They argue that this makes many carefully designed Transformers impractical for long-term forecasting.

## Whether more layers help

In NLP and CV, Transformers gain prediction power by growing, and their layer count is usually 12 to 128. The authors test the vanilla Transformer from 3 to 48 layers on ETTm2, forecasting 96 steps. Its MSE is lowest at 6 layers, 0.439, compared to 0.557 at 3 layers. Deeper settings do not beat 6 layers, with 0.556 at 12 layers and 0.461 at 48.

Shallow models often did better, so the authors ask how to design deeper Transformers that add capacity and still forecast better.

## Seasonal-trend decomposition as a performance lever

Several works treat seasonal-trend decomposition as a crucial part of Transformer forecasting performance. The authors test this by adding a simple moving average decomposition, the one from Autoformer, to several attention modules.

On ETTm2 with prolonged output length, FEDformer's MSE at output length 96 drops from 0.457 without decomposition to 0.203 with it. The text summarizes the boost from decomposition as 50% to 80%. The authors call decomposition a unique block and suggest that more advanced decomposition schemes deserve study.

The test varies the output length, not the input length. The gain seems consistent across the attention modules tested, according to the authors.

## Anomaly detection and classification examples

Anomaly detection papers pair Transformers with generative models such as VAEs and GANs. TranAD trains adversarially with two Transformer encoders and two Transformer decoders, which amplifies reconstruction errors on small deviations. Replacing its Transformer-based encoder-decoder cuts the F1 score by nearly 11%.

TransAnomaly combines a VAE with a Transformer to allow more parallelization, and it reduces training costs by nearly 80%, according to the authors. AnomalyTrans starts from the idea that anomalies form weak associations with the whole series but strong ones with adjacent points. It models prior- and series-associations together and uses a minimax strategy to widen their discrepancy.

In classification, GTN uses one tower for time-step-wise attention and one for channel-wise attention.

## Open directions the authors name

The authors name inductive biases, combinations of GNNs and Transformers, pre-training, architecture-level variants and NAS as future directions. On inductive biases, PatchTST removes cross-channel dependency, while Crossformer uses cross-dimension dependency, and both improve results. For pre-training, existing studies mainly focus on time series classification.

## Limits of the evidence

The empirical checks use one dataset, ETTm2, and only forecasting. The comparison with ARIMA, ETS and basic RNN and CNN models rests on earlier results from Zhou et al. and Wu et al. The authors state that those models perform worse in the earlier results, and the survey does not rerun them.

The tables report only MSE, and the complexity comparison in Table 1 lists complexity rather than measured runtime. Some entries are NaN or OOM, and the survey doesn't discuss them further.

The authors leave open how to build deeper Transformers that gain capacity. They also leave open how to make better use of long input sequences.

## Paper info

- **Authors**: Qingsong Wen, Tian Zhou, Chaoli Zhang, Weiqi Chen, Ziqing Ma, Junchi Yan, Liang Sun
- **Venue**: arXiv · Preprint
- **First published**: 2022-2-15
- **Added**: 2026-11-12
- **Updated**: 2023-5-11
- **Version**: v5
- **arXiv**: 2202.07125
- **Category**: cs.LG · cs.AI · eess.SP · stat.ML
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/2202.07125v5) · [PDF ↗](https://arxiv.org/pdf/2202.07125v5)

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

Qingsong Wen, Tian Zhou, Chaoli Zhang, Weiqi Chen, Ziqing Ma, Junchi Yan, Liang Sun (2022). Transformers in Time Series: A Survey. arXiv:2202.07125v5. https://arxiv.org/abs/2202.07125v5

**BibTeX**

```
@misc{wen2022transformers,
  title = {{Transformers in Time Series: A Survey}},
  author = {Qingsong Wen and Tian Zhou and Chaoli Zhang and Weiqi Chen and Ziqing Ma and Junchi Yan and Liang Sun},
  year = {2022},
  eprint = {2202.07125},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2202.07125v5}
}
```

## Other paper commentary

- [Learning Spatio-Temporal Representation with Pseudo-3D Residual Networks](https://refivu.com/en/papers/1abae7bf-e238-4385-8721-5bae52a43535-learning-spatio-temporal-representation-with-pseudo-3d.md)
- [LoFTR: Detector-Free Local Feature Matching with Transformers](https://refivu.com/en/papers/7c0476a6-4dcb-4eab-beac-aaa3eb492203-loftr-detector-free-local-feature-matching-with-transformers.md)
- [Generalized Cross Entropy Loss for Training Deep Neural Networks with Noisy Labels](https://refivu.com/en/papers/41c59d55-611c-4abf-a4e2-459eb900711f-generalized-cross-entropy-loss-for-training-deep-neural.md)
- [Hypergraph Neural Networks](https://refivu.com/en/papers/cf9d7d35-b5ef-4472-b64e-4c332f808ace-hypergraph-neural-networks.md)
- [Deep Ordinal Regression Network for Monocular Depth Estimation](https://refivu.com/en/papers/e525192f-9651-4698-8525-b6cda281195b-deep-ordinal-regression-network-for-monocular-depth.md)
- [Stacked Attention Networks for Image Question Answering](https://refivu.com/en/papers/aa94a5f2-b4fb-441a-af4b-22eda9ad2985-stacked-attention-networks-for-image-question-answering.md)
- [InceptionTime: Finding AlexNet for Time Series Classification](https://refivu.com/en/papers/d38dc30f-c8c7-476b-b7e9-0b2838d7c2a1-inceptiontime-finding-alexnet-for-time-series-classification.md)
- [DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligence](https://refivu.com/en/papers/a9b5666a-9125-4553-968a-b6f76e0d19db-deepseek-coder-when-the-large-language-model-meets.md)
- [OpenAI GPT-5 System Card](https://refivu.com/en/papers/678bc558-0d7f-4ee8-9fa0-55c5eb2daf22-openai-gpt-5-system-card.md)
- [Siren's Song in the AI Ocean: A Survey on Hallucination in Large Language Models](https://refivu.com/en/papers/b7a8b2ba-0d8c-47b1-8619-757da5d13fc9-siren-s-song-in-the-ai-ocean-a.md)
- [Generative Adversarial Network in Medical Imaging: A Review](https://refivu.com/en/papers/52fe40f2-c64e-4c29-a115-6564288d69f5-generative-adversarial-network-in-medical-imaging-a-review.md)
- [Vision Mamba: Efficient Visual Representation Learning with Bidirectional State Space Model](https://refivu.com/en/papers/178fce5e-d4f5-44ae-8265-df3fb75ee87b-vision-mamba-efficient-visual-representation-learning-with.md)

## Terms in this paper

- [Transformer](https://refivu.com/en/terms/48e8be2570bc-transformer)
- [positional encoding](https://refivu.com/en/terms/4544e2c25b3b-positional-encoding)
- [MSE](https://refivu.com/en/terms/aaced1b84616-mse)
- [multi-head attention](https://refivu.com/en/terms/370ae5c971cd-multi-head-attention)
- [Informer](https://refivu.com/en/terms/d78e669bc4ea-informer)
- [Scaled Dot-Product Attention](https://refivu.com/en/terms/0e345f72fc32-scaled-dot-product-attention)
- [Autoformer](https://refivu.com/en/terms/609d9af96ac4-autoformer)
- [LogTrans](https://refivu.com/en/terms/0446cb24885e-logtrans)
- [Time Series Forecasting](https://refivu.com/en/terms/c2a8e3800569-time-series-forecasting)
- [DLinear](https://refivu.com/en/terms/3a673a8a953a-dlinear)
- [FEDformer](https://refivu.com/en/terms/25034520d6f8-fedformer)
- [Pyraformer](https://refivu.com/en/terms/12d77e295bff-pyraformer)
- [PatchTST](https://refivu.com/en/terms/d57fd5e9ee4f-patchtst)
- [seasonal-trend decomposition](https://refivu.com/en/terms/bbb913a69797-seasonal-trend-decomposition)
- [vanilla Transformer](https://refivu.com/en/terms/a6fa16a93ae1-vanilla-transformer)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/27ce8af6-dbd0-40be-9dc3-c7b1708ee930-transformers-in-time-series-a-survey)
