SAMformer
One-layer transformer with channel-wise attention and RevIN for multivariate long-term forecasting.
Time series · 26 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Time series
- Parameters
- 328.3K
- Operations
- 26
- Framework
- PyTorch
- Recurrent
- No
- Published
- ICML 2024
- Cited by
- 1 (as of 29 October 2026)
- Authors
- Romain Ilbert, Ambroise Odonnat, Vasilii Feofanov and others
- Source
- GitHub: romilbert/samformer
- License
- Apache-2.0
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m19949
- Graph hash
- 7da9d963565c73e2684092d80f59b506bee47c32132f97160fcc71dfde1107b7
- Skeleton hash
- 262eab83ecf6e0f84e43a5814405cdca5b0dc6ab8c1955b1126ff3ac015b1160
- Architecture hash
- d6d4f0c230ce17fc40f28eb9e8dad7222b0bc4d4d31dbe3f3a6528d3f8ee0f4c
- Diagram SHA-256
- 82cc7dd2f362bf48425e9473836b2100ed1c5e73986c95b28de31e83a1116565
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
SAMformer is a lightweight transformer for multivariate time series forecasting, a setting where the paper notes that transformers remain inferior to simpler linear baselines. Working from a toy linear forecasting problem, the authors identify the attention of transformers as responsible for this low generalization capacity.
The network is a simplified one-layer transformer with one head of attention and without feed-forward. Channel-wise attention is applied to the input, followed by a residual connection, and a linear layer on top of that outputs the prediction. Attending over features rather than time steps makes the model invariant to feature permutation, so it needs no positional encoding. Reversible Instance Normalization (RevIN) is added to handle the shift between the training and testing time series. The model dimension is 16 and stays the same in all of the paper's experiments.
The SAM in the name is sharpness-aware minimization, the optimizer used in training to make the model converge to flatter local minima. The experiments use 8 publicly available datasets of real-world multivariate time series. On them the paper reports that SAMformer surpasses TSMixer by 14.33% while having about 4 times fewer parameters. The same architecture is used for all the datasets.
Key idea. The paper shows that a shallow transformer with channel-wise attention, optimized with sharpness-aware minimization, escapes bad local minima in multivariate long-term forecasting.
- SAMformer
- time series forecasting
- multivariate long-term forecasting
- sharpness-aware minimization
- SAM
- channel-wise attention
- RevIN
- lightweight transformer
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{ilbert2024samformerunlockingpotentialtransformers,
title={SAMformer: Unlocking the Potential of Transformers in Time Series Forecasting with Sharpness-Aware Minimization and Channel-Wise Attention},
author={Romain Ilbert and Ambroise Odonnat and Vasilii Feofanov and Aladin Virmaux and Giuseppe Paolo and Themis Palpanas and Ievgen Redko},
year={2024},
eprint={2402.10198},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2402.10198},
}