Abstract
Deep learning models for time-series forecasting typically assume that the future will mirror the past. However, real-world data is often non-stationary, characterized by shifting distributions driven by economic cycles, policy changes, or unexpected events. This paper introduces Self-Adaptive Forecasting (SAF), a method that leverages test-time training to update model weights for every individual prediction. By performing a self-supervised "backcasting" task at the moment of inference, SAF enables models to pivot in real-time, significantly improving accuracy in volatile environments.
Introduction: The Challenge of Non-Stationarity
Most machine learning frameworks rely on the Independent and Identically Distributed (IID) assumption, where training and test data are expected to share the same underlying distribution. In time-series analysis, this assumption is frequently violated. Economic shifts, pandemic waves, and evolving consumer behaviors create "distribution drift," where a model trained on historical data becomes obsolete as the "rules" of the system change.
Traditional approaches often attempt to mitigate this by incorporating exogenous variables (e.g., adding weather data to retail models). However, these variables rarely capture the full complexity of regime shifts. The fundamental challenge remains: how can a model recognize it has entered a new regime and adapt its internal logic before making a forecast?
The SAF Framework: Learning at Inference
The authors propose Self-Adaptive Forecasting (SAF) to address this gap. Unlike static models that are frozen after training, SAF continues to learn during the inference phase.
The Core Mechanism: Backcasting
To adapt at test time without access to future targets, SAF utilizes a self-supervised task known as backcasting. The process involves:
- Masking: The model selects a window of recent observed data and masks the initial portion.
- Prediction: It attempts to "predict the past" (the masked segment) using the subsequent portion of the window.
- Update: The model calculates the error of this backcast and performs a gradient descent step to update its encoder weights.
This adaptation allows the encoder to capture the current "state" or "regime" of the data. Furthermore, the "backcastability" error signal itself is used as an additional input feature. A high error signal indicates a volatile regime, prompting the forecaster to adjust its output—for instance, by avoiding extreme outliers in favor of more typical values. Importantly, SAF is architecture-agnostic and can be integrated with LSTMs or Temporal Fusion Transformers.
Experimental Results and Real-World Impact
SAF was evaluated across a diverse range of datasets, including synthetic autoregressive processes, Covid-19 death counts, Walmart retail sales (M5), and financial indices (S&P 500 and Cryptocurrency).
The performance gains were most pronounced in highly non-stationary environments:
- Covid-19 Forecasting: SAF achieved a remarkable 41.6% reduction in Mean Absolute Error (MAE) for LSTM-based models and a 19.9% reduction for Transformer architectures.
- Cryptocurrency: In the notoriously volatile crypto market, the model saw an 18.6% improvement in Mean Squared Error (MSE).
- Synthetic Shifts: On data featuring abrupt state changes, SAF reduced forecasting error by approximately 10%.
As shown in the Covid-19 experiments, SAF effectively prevents the "unrealistic exponential growth" predictions that often plague standard LSTMs during regime shifts, grounding the forecast in the continuity of the most recent data.
Discussion and Future Directions
While SAF offers significant advantages for non-stationary data, it is not a universal solution. The researchers identified a "stationarity tax": on datasets that are already stable, the adaptation step can introduce noise, leading to slightly degraded performance. Additionally, the requirement for a gradient update at every test sample increases computational overhead, which may be a constraint for high-frequency applications.
Future work may explore gating mechanisms to determine when adaptation is necessary, as well as more complex self-supervised tasks beyond simple L1/L2 backcasting losses to further enhance representation learning at test-time.
Conclusion
Self-Adaptive Forecasting represents a shift from static to dynamic modeling. By treating inference as a continuous learning process, SAF provides a robust framework for navigating the inherent unpredictability of real-world time-series data.
Summary updated