TL;DR
Non-stationarity and distribution shifts severely degrade time series forecasting, but current fixes are either limited to simple statistics or locked into specific model architectures. This paper introduces IN-Flow, a model-agnostic framework that decouples shift-removal from forecasting using a novel invertible neural network trained via bi-level optimization. By adaptively transforming complex distributions, IN-Flow consistently boosts the accuracy of various deep learning backbones across synthetic and real-world datasets.
What Problem Does This Paper Address?
Real-world time series data—such as electricity consumption, traffic flow, or weather patterns—are rarely stationary; their underlying statistical properties change over time. This phenomenon, known as distribution shift, means a model trained on past data often fails to generalize to future data.
Existing solutions generally fall into two categories:
- Statistic-based normalization: Methods like RevIN scale data using simple statistics (like mean and standard deviation). These fail when the distribution shift is complex or non-linear.
- Architecture-specific mechanisms: Methods like Non-stationary Transformers modify internal network components (like attention layers). These cannot be easily adapted to other or future forecasting architectures.
The authors set out to design a solution that is both highly expressive (capable of capturing complex shifts beyond simple statistics) and entirely model-agnostic.
Methods
The authors decouple the problem into two distinct tasks: distribution transformation and forecasting. Their framework consists of three core components:
- Decoupled Formulation: The pipeline splits into a transformation module and a forecasting module. The transformation module maps the raw, non-stationary input data into a stationary "cleaned" target distribution. The forecasting module makes predictions within this stable space, and the inverse transformation is then applied to the outputs to map them back to the original raw data space.
- Bi-level Optimization: To train these modules jointly without relying on fixed statistics, the authors frame the training as a bi-level optimization problem. The inner loop optimizes the forecasting module to minimize training errors on the transformed data, while the outer loop optimizes the transformation module to minimize validation errors. This ensures the transformation specifically targets and removes shifts that hinder generalization.
- Instance Normalization Flow (IN-Flow): Traditional normalizing flows map complex distributions to a simple prior (like a Gaussian) for generative purposes. IN-Flow, however, stacks instance normalization layers and affine coupling layers to adaptively remove shifted information while preserving the underlying temporal patterns critical for forecasting.
Datasets
The framework was validated on both synthetic and real-world benchmarks:
- Synthetic Datasets (Synthetic-1, Synthetic-2): Generated using cosine waves with randomly shifted amplitudes, periods, phases, and levels to simulate severe, complex distribution shifts.
- Real-World Benchmarks: Six widely recognized time series datasets: ETT (ETTh1, ETTm2) for electricity transformer temperatures, Electricity consumption, Weather indicators, CAISO (California electricity load), and NordPool (European energy production).
Key Insights and Ideas
- Moving Beyond Simple Statistics: Traditional normalization assumes that distribution shifts can be corrected by adjusting the mean and variance. IN-Flow demonstrates that treating shift-removal as a learnable, non-linear distribution transformation captures complex shifts that standard statistics miss.
- The Power of Invertibility: By utilizing an invertible neural network architecture, the framework guarantees that no critical forecasting information is lost during the normalization process. The transformation can be perfectly reversed to output final predictions in the original data space.
- Validation-Driven Normalization: Optimizing the transformation module based on validation error (via bi-level optimization) forces the network to explicitly learn how to resolve distribution discrepancies between the training and testing phases.
Key Results
The authors evaluated IN-Flow across four prominent deep learning backbones: PatchTST, iTransformer, Autoformer, and N-BEATS.
- Consistent Performance Gains: IN-Flow consistently improved forecasting accuracy across all datasets. On average, it reduced Mean Squared Error (MSE) by 28.3% on PatchTST, 21.3% on iTransformer, 28.5% on Autoformer, and 12.1% on N-BEATS.
- Extreme Case Improvements: In some scenarios, the improvements were massive. For instance, applying IN-Flow to the Autoformer backbone on the CAISO dataset resulted in a 54.0% reduction in MSE.
- Robustness to Severe Shifts: On synthetic datasets where baseline methods like RevIN and Non-stationary Transformers failed significantly (sometimes degrading performance by over 10%), IN-Flow successfully mitigated the shifts and improved accuracy.
Limitations and Future Work
- First-Order Approximation: To maintain computational efficiency and avoid prohibitive hyper-gradient calculations, the authors adopt a first-order approximation for the bi-level optimization. While this yields fast training with negligible performance compromise, exploring exact bi-level optimization methods remains a future direction.
- Abrupt Shifts: While IN-Flow handles continuous and complex distribution shifts well, extremely abrupt, adversarial, or catastrophic structural breaks in time series data might still pose challenges.
Summary updated