Wu, Xu, Wang and Long (NeurIPS 2021) put moving-average decomposition inside the Transformer and replace point-wise attention with FFT Auto-Correlation (O(L log L)). ~38% average MSE drop vs Informer/LogTrans on energy, traffic, FX, weather, ILI. Plain-language intro. Not investment advice.
Takeaway. Do not STL-decompose only the history and hope. Autoformer puts moving-average decomposition inside every block, so trend is peeled off while you forecast. Attention becomes Auto-Correlation: FFT finds lags (\tau), then roll sub-series and mix the top-(k) periods — series-wise, not point-wise.
Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting (Haixu Wu, Jiehui Xu, Jianmin Wang, Mingsheng Long, 2021; arXiv:2106.13008). Tsinghua / BNRist. NeurIPS 2021. Code: thuml/Autoformer.
Fit for learners: Seasonal-trend decomposition inside attention — practical for equity/index series with strong cycles.
This Hub note is a plain-language intro. Not investment advice.
Long horizon (O \gg 1) mixes trend and many periods. Vanilla attention is (O(L^2)) and point-wise; sparse cousins (Informer, LogTrans, Reformer) drop connections and waste the rest. Pre-decomposition of the past only cannot model how seasonal and trend interact in the future.
SeriesDecomp = padding + AvgPool (window 25) → trend; residual → seasonal. Encoder throws trend away and models season; decoder accumulates extracted trend through the stack.Later DLinear (paper 86) shows a linear + the same MA kernel can beat this architecture on the same tables — read both.
If your index has intraday and weekly cycles, “attention over minutes” is the wrong inductive bias. FFT lag discovery is the same idea as an ACF plot you already know from statsmodels.
Tiny evening exercise: numpy.fft autocorrelation of a sine with period 24. Print argpartition of the top 3 lags. Learning only.
Landing: arXiv abs
Not investment advice. This Hub note is educational only. Autoformer numbers on ETT/electricity are not a forecast of HSI or SPX.
Single course CTA: SoloQuant Academy’s Introduction to Python Programming—loops, arrays, and FFT-shaped thinking start with NumPy, not a 15M-parameter encoder.