TL;DR
TimeStacker is a novel forecasting framework designed to tackle "non-stationarity"—where a signal's statistical properties change over time. By combining a multi-level stacking mechanism with a frequency-based self-attention module, it achieves state-of-the-art accuracy while remaining significantly faster and more memory-efficient than traditional Transformer-based models.
The Challenge of Non-Stationarity
Most real-world time series data (like stock prices, weather patterns, or electricity usage) are non-stationary. Their mean, variance, and frequency characteristics are not constant; they evolve continuously.
Current deep learning models often struggle with this due to the time-frequency uncertainty principle: you cannot simultaneously achieve perfectly high resolution in both the time domain (knowing exactly when something happened) and the frequency domain (knowing exactly what the underlying pattern was).
If you use a large window to look at data, you capture global trends but lose local "spikes." Conversely, a tiny window reveals the spikes but obscures the big picture. Most existing models pick a single "patch size" and hope for the best, which frequently fails to capture the complex, shifting nature of non-stationary signals.
The TimeStacker Architecture
To sidestep the uncertainty principle, the authors introduce TimeStacker, built on two primary innovations:
- Multilevel Stacking Mechanism: Instead of choosing a single window size, TimeStacker employs a series of "Stacker Blocks" with decreasing patch sizes. It begins with large patches to capture overarching global features and low-frequency trends, then progressively "stacks" smaller patches to layer in fine-grained local details. This hierarchical approach allows the model to build a comprehensive representation of the signal across multiple resolutions.
- Inter-Patch Frequency-Based Attention (FreqAttention): Standard self-attention compares every time point to every other time point, which is computationally expensive ($O(L^2)$). TimeStacker shifts this comparison into the frequency domain using Fast Fourier Transforms (FFT). It uses learnable filters (via Hadamard products) to compute similarity between patches based on their frequency content. This effectively identifies patterns in non-stationary data and drops the complexity to $O(L \log L)$, making the model much faster.
- Smooth Layer: Each block includes a specialized convolution layer designed to mitigate the impact of outliers, ensuring that random noise doesn't derail the frequency analysis.
Experimental Evaluation
The model was evaluated on several standard, large-scale real-world benchmarks, including ETT (Electricity Transformer Temperature), San Francisco Traffic, Electricity consumption, Weather indicators, and Exchange-rate datasets.
Key Insights and Results
- The "Zoom-In" Strategy: The core insight is that we don't need to solve the uncertainty principle; we can bypass it by stacking different resolutions. By starting global and moving local, the model captures the "dynamic evolution of the spectrum."
- Frequency as a Proxy for Similarity: In non-stationary data, two time segments might look different in the raw time domain but share identical frequency signatures. By calculating attention in the frequency domain, TimeStacker uncovers "hidden" relationships that temporal models miss.
- State-of-the-Art Accuracy: TimeStacker consistently outperformed heavyweights like iTransformer, PatchTST, and DLinear. For example, on the ETTm1 dataset, it reduced Mean Absolute Error (MAE) by 7.07% compared to iTransformer. On the Weather dataset, MAE dropped by 5.04%.
- High Efficiency: Because the frequency-based attention uses FFT, the model scales exceptionally well to long sequences. In a head-to-head comparison on the ETTh1 dataset, TimeStacker required only 24.9 MB of memory and 115 ms per iteration, whereas Crossformer required over 1 GB of memory and was significantly slower.
Limitations and Future Work
The authors identify multivariate complexity as a current bottleneck. While TimeStacker excels at capturing patterns within a single variable (channel-independent), its performance dips slightly as the number of interacting variables increases. The model currently treats channels independently to reduce noise, which means it might miss complex cross-variable correlations.
In future work, the team plans to investigate "multi-channel prediction strategies" to better model the relationships between different time series (e.g., how humidity in one region affects temperature in another) without sacrificing the framework's current efficiency.
Summary updated