Introduction
In time series forecasting, identifying fundamental patterns—such as seasonal cycles or long-term trends—is crucial for accurate prediction. These patterns are often referred to as "bases." Traditional methods like N-BEATS or FiLM rely on fixed, predefined bases (e.g., Fourier or Legendre polynomials). While these are interpretable, they often lack the flexibility to capture the complex, irregular nuances of real-world data. Conversely, modern deep learning models like Transformers learn implicit bases through their weights but often struggle with flexibility, applying the same transformations regardless of individual series characteristics.
BasisFormer bridges this gap by introducing an end-to-end architecture that learns data-driven bases while allowing each individual time series to flexibly associate with them. By combining self-supervised contrastive learning with a bidirectional cross-attention mechanism, BasisFormer achieves state-of-the-art accuracy with efficient linear computational complexity.
The BasisFormer Architecture
BasisFormer consists of three primary components designed to acquire, match, and project temporal patterns:
- Basis Acquisition (Self-Supervised Learning): The model treats the historical "look-back" window and the future "forecast" window as two distinct views of the same underlying pattern. Using a contrastive loss (InfoNCE), the model ensures that the relationship between a time series and its basis remains consistent across both past and future views.
- Coef Module (Similarity Matching): This module utilizes a Bidirectional Cross-Attention Block (BCAB). It treats the input time series and the learned bases as nodes in a bipartite graph, calculating "similarity coefficients" that determine which bases are most relevant to a specific input series.
- Forecast Module: Once coefficients are derived from historical data, this module selects and merges the "future" portions of the corresponding bases to generate the final prediction.
To ensure the learned bases represent continuous, interpretable temporal patterns rather than overfitted noise, the authors incorporate a smoothness regularization term during training.
Efficiency and Interpretability
Standard Transformers often suffer from $O(L^2)$ complexity relative to sequence length $L$. BasisFormer avoids this bottleneck by performing attention across the basis dimension ($N$) rather than the time dimension. Since $N$ is a small, fixed hyperparameter (typically around 10), the model achieves linear complexity. Furthermore, because the bases are smooth and learnable, they represent "prototypical" patterns—such as daily or weekly cycles—that researchers can visualize and interpret.
Evaluation and Results
BasisFormer was evaluated on six standard real-world forecasting benchmarks, including ETT (Electricity Transformer Temperature), Electricity, Exchange, Traffic, Weather, and Illness (ILI) data.
As shown in the experimental results, BasisFormer sets a new performance benchmark:
- Superior Accuracy: The model outperformed previous state-of-the-art (SOTA) methods like FEDformer and Autoformer by an average of 11.04% for univariate tasks and 15.78% for multivariate tasks.
- Periodic Data Performance: The model showed significant gains on the Traffic dataset, where its learnable bases proved highly effective at capturing rigid periodicity.
- Ablation Studies: Replacing learnable bases with fixed sine/cosine waves resulted in a performance drop of 5-9%, confirming that the "learning" aspect of the basis acquisition is critical to the model's success.
Conclusion and Future Work
BasisFormer demonstrates that learnable, data-driven bases can significantly improve forecasting accuracy while maintaining computational efficiency. While the model is highly effective, its performance is sensitive to data scaling, requiring careful normalization. Future work may explore mathematical transformations to map disparate data into a universal feature space, potentially reducing the reliance on manual normalization. Additionally, while the self-supervised approach excels in predictable environments, further research is needed to improve robustness in extremely high-entropy or noisy datasets.
Summary updated