Introduction
Modern time series forecasting often relies on end-to-end deep learning models that learn features and prediction functions simultaneously. However, these models frequently suffer from entanglement, where internal representations conflate independent underlying processes, such as long-term economic trends and recurring seasonal cycles. This lack of separation makes models fragile under distribution shifts—where the trend might change while seasonality remains constant—and prone to overfitting on inherent stochastic noise.
To address these challenges, the authors introduce CoST (Contrastive Seasonal-Trend), a representation learning framework designed to disentangle the latent factors of time series data. By separating trend and seasonal components through a combination of time-domain and frequency-domain contrastive learning, CoST achieves significant improvements in forecasting accuracy and robustness.
A Causal Perspective on Disentanglement
CoST is grounded in a structural causal model that treats a time series $X$ as a composition of Trend ($T$), Seasonal ($S$), and Error ($E$) variables. The primary objective is to learn a latent space where $T$ and $S$ are isolated and invariant to interventions on the error variable $E$.
By applying data augmentations—such as scaling, shifting, and jittering—as proxies for interventions on the error variable, the framework's contrastive tasks force the encoder to extract representations of trend and seasonality that are robust to noise. This causal grounding ensures that the learned features are not merely correlations but represent the stable, underlying drivers of the data.
The CoST Framework Architecture
The CoST architecture consists of a backbone encoder followed by two specialized disentanglers. This dual-path approach allows the model to capture the distinct characteristics of trends and periodicities effectively.
1. Backbone Encoder
A Temporal Convolutional Network (TCN) typically serves as the backbone, mapping raw input signals into an intermediate latent space. While TCNs are standard, the framework is backbone-agnostic and has shown success with LSTMs and Transformers.
2. Trend Feature Disentangler (TFD)
Capturing trends is challenging due to varying lookback windows. CoST employs a Mixture of Auto-Regressive Experts, utilizing a set of 1D causal convolutions with different kernel sizes. This allows the model to adaptively capture trend scales. The TFD is trained using a time-domain contrastive loss (MoCo-based) to ensure the trend features are discriminative.
3. Seasonal Feature Disentangler (SFD)
Periodic patterns are more easily disentangled in the frequency domain. The SFD uses a Discrete Fourier Transform (DFT) followed by a learnable Fourier layer to capture frequency interactions. It is optimized via a novel Frequency Domain Contrastive Loss that considers both amplitude and phase. This allows the model to identify periodicities without requiring prior knowledge of the exact period length.
Experimental Evaluation
The researchers evaluated CoST against high-profile benchmarks, including the Electricity Transformer Temperature (ETT) datasets, hourly consumption data (Electricity), and the M5 retail dataset.
Key Results
- State-of-the-Art Performance: CoST achieved a 21.3% improvement in MSE over the previous leading representation learning method, TS2Vec, on multivariate benchmarks.
- Superiority over End-to-End Models: The framework outperformed top end-to-end forecasting models like Informer and LogTrans by a margin of 39.3% in MSE.
- Robustness and Scalability: Ablation studies confirmed that learning high-quality disentangled representations followed by a simple linear regressor (e.g., Ridge regression) often yields better results than complex, entangled architectures.
Conclusion
CoST demonstrates that explicit disentanglement of trend and seasonal components is a powerful strategy for time series forecasting. By leveraging both time and frequency domains through contrastive learning, it provides a robust solution to the problem of distribution shift and noise sensitivity. Future work may extend this disentangled approach to related tasks such as anomaly detection and time-series classification.
Summary updated