APT: Affine Prototype-Timestamp for Time Series Forecasting Under Distribution Shift

Yujie Li, Zezhi Shao, Chengqing Yu, Yuhong Fu, Tao Sun, Yongjun Xu, Fei Wang

TL;DR

This paper introduces Affine Prototype-Timestamp (APT), a novel plug-in module for time series forecasting that tackles the challenge of distribution shifts. APT dynamically generates affine parameters based on timestamps and prototype learning, allowing models to better adapt to changing statistical properties and significantly improving forecasting accuracy.

What Problem Does This Paper Address?

Time series forecasting is crucial for understanding complex dynamic systems, but it's often hampered by "distribution shifts." These shifts occur when the statistical properties of the data change over time due to external factors, making it difficult for standard forecasting models to maintain accuracy. Existing methods like Reversible Instance Normalization (RevIN) try to address this by decoupling distribution and pattern information. However, they often struggle with issues like missing values, noisy data, and fail to capture global distribution changes, instead relying on local statistics that become unreliable during shifts. This paper aims to bridge this gap by providing a more robust way to incorporate global distributional information into forecasting models.

Methods

The core innovation is the Affine Prototype-Timestamp (APT) module. It acts as a lightweight, model-agnostic plug-in that enhances existing forecasting pipelines. Here's how it works:

  • Timestamp Encoding: APT leverages timestamps (e.g., "Time in Day," "Day in Week") as proxies for global temporal semantics. These timestamps are embedded into a representation space.
  • Prototype Learning: To overcome the sparsity of timestamp combinations and improve robustness, APT uses prototype learning. Instead of directly using raw timestamp embeddings, it matches them against a library of learnable prototypes. This allows it to learn more generalized temporal patterns.
  • Dynamic Affine Parameters: APT then uses these prototype-based representations to dynamically generate affine parameters ($\gamma$ and $\beta$). These parameters are used to modulate the normalized time series before it enters the forecasting model and after the model outputs predictions. This modulation helps reintroduce global distributional features that might have been suppressed by normalization or distorted by distribution shifts.
  • Self-Supervised Pre-training: To stabilize training and ensure effective learning of timestamp semantics, APT is pre-trained using self-supervised losses:
  • Orthogonal Loss: Encourages diversity among timestamp and prototype embeddings.
  • Load Balancing Loss: Prevents certain prototypes from dominating, promoting uniform usage.
  • Affine Regularization Loss: Prevents trivial or unstable affine parameters.
  • Integration: APT can be seamlessly integrated into existing normalization-forecasting pipelines. The forward transformation is applied after normalization and before the model, and the inverse transformation is applied after the model output and before de-normalization.

Datasets

The paper evaluates APT on six benchmark datasets:

  • ECL
  • ETTh1
  • ETTh2
  • Exchange
  • Traffic
  • Weather

These datasets are chosen to represent various scenarios, including those with strong distribution shifts.

Key Insights and Ideas

  • Timestamps as Global Context: The paper highlights that simple timestamps, often overlooked, contain rich global temporal semantics that are crucial for understanding and adapting to distribution shifts.
  • Prototype Learning for Robustness: Moving beyond raw timestamp embeddings to prototype matching is key to handling the sparsity of timestamp combinations and achieving better generalization, especially in few-shot learning scenarios.
  • Dynamic Affine Modulation is Crucial: The dynamic generation of affine parameters, conditioned on global temporal context (timestamps), is shown to be significantly more effective than static affine transformations for handling distribution shifts.
  • Self-Supervised Pre-training for Stability: The self-supervised losses are essential for stabilizing the learning of timestamp semantics and ensuring APT's effectiveness, preventing performance degradation to baseline levels.

Key Results

  • Significant Performance Gains: APT consistently improves forecasting accuracy across various backbone models (Informer, iTransformer, SparseTSF, CATS) and normalization strategies (RevIN, Dish-TS, SAN, FAN).
  • Robustness on Challenging Datasets: On datasets with strong distribution shifts like ETTh1/2 and Exchange, APT achieves performance gains of 4%-40%.
  • Competitive Performance: Even with weaker backbones, APT combined with robust normalization can match or surpass state-of-the-art results.
  • Minimal Overhead: APT is designed to be lightweight and introduces minimal computational overhead, making it a practical plug-in solution.

Limitations and Future Work

  • Limitations:
    • The paper acknowledges that while APT improves robustness, it doesn't fully eliminate the impact of distribution shifts.
  • The current implementation relies on discrete timestamp features; more sophisticated temporal feature extraction could be explored.
  • Future Work:
    • The authors suggest exploring online adaptation for streaming data.
  • Incorporating external modalities like text or images to further enhance shift awareness is a promising direction.
  • Investigating how APT can be applied to other time series tasks beyond forecasting.

Summary updated

BibTeX
@inproceedings{li2026apt,
  author = {Yujie Li and Zezhi Shao and Chengqing Yu and Yuhong Fu and Tao Sun and Yongjun Xu and Fei Wang},
  title = {{APT: Affine Prototype-Timestamp for Time Series Forecasting Under Distribution Shift}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2026},
  doi = {10.1609/aaai.v40i18.38542},
}
Figure