TimeMachine: A Time Series is Worth 4 Mambas for Long-term Forecasting

Md. Atik Ahamed, Qiang Cheng

TL;DR

This paper introduces TimeMachine, a novel long-term time-series forecasting model that leverages Mamba, a state-space model, to achieve linear scalability and computational efficiency while capturing long-term dependencies. By employing an integrated quadruple-Mamba architecture, TimeMachine effectively handles both channel-mixing and channel-independent scenarios, demonstrating superior performance on benchmark datasets.

What Problem Does This Paper Address?

Long-term time-series forecasting (LTSF) is crucial for various applications, but it's notoriously challenging to simultaneously achieve accurate long-term dependency capture, linear scalability, and computational efficiency. Traditional methods often excel in one or two of these aspects but falter in others. Linear models offer scalability but struggle with complex dependencies. Transformer-based models, while powerful for capturing dependencies, suffer from quadratic complexity, limiting their scalability. State-space models (SSMs) show promise with linear complexity and context-aware selectivity, but their application to LTSF has been underexplored, partly due to challenges in effectively representing time-series context. This paper aims to bridge this gap by proposing a novel architecture that harnesses the strengths of SSMs for LTSF.

Methods

The core of TimeMachine is an integrated quadruple-Mamba architecture. Mamba, a selective state-space model, is chosen for its ability to model long-range dependencies with linear complexity. The model incorporates two key innovations:

  • Multi-scale Contextual Cues: TimeMachine extracts contextual information at two scales (high and low resolution) by progressively downsampling the input. This allows it to capture dependencies at different temporal granularities.
  • Unified Channel Handling: To address the varying nature of multivariate time series (MTS) data, TimeMachine unifies both channel-mixing (where channels are processed together) and channel-independence (where channels are processed separately) scenarios. This is achieved through four specialized Mamba modules, two of which are designed to process transposed tensor data, enabling flexibility based on the dataset's characteristics.
  • Embedded Representations: Before feeding data into the Mambas, the model generates two-stage embedded representations using Multi-Layer Perceptrons (MLPs). These embeddings help in capturing salient contextual cues.
  • Output Projection: The final predictions are generated through a two-stage output projection, mirroring the embedding process.

The model also incorporates residual connections to stabilize training and reduce overfitting, particularly for datasets with fewer channels.

Datasets

The paper evaluates TimeMachine on seven widely used benchmark datasets for LTSF:

  • Weather
  • Traffic
  • Electricity
  • Four ETT datasets: ETTh1, ETTh2, ETTm1, ETTm2

The Traffic and Electricity datasets are noted for their large number of channels (862 and 321, respectively). The authors explicitly exclude the ILI dataset due to its shorter temporal horizon, focusing on long-term forecasting.

Key Insights and Ideas

  • Mamba for LTSF is a promising direction: The paper demonstrates that SSMs, specifically Mamba, can be effectively adapted for LTSF, offering a compelling alternative to Transformer-based models.
  • Unified channel handling is crucial: The success of TimeMachine hinges on its ability to flexibly handle both channel-mixing and channel-independence scenarios, recognizing that neither approach is universally optimal for all MTS datasets.
  • Multi-scale context is key: Extracting contextual cues at different temporal resolutions (high and low) significantly improves the model's ability to capture long-term dependencies.
  • MLPs are less critical than expected: Ablation studies suggest that the performance of TimeMachine is not heavily reliant on the complexity of the initial MLP embeddings, indicating the Mamba core is the primary driver of performance.
  • Scalability is a major win: The linear complexity of Mamba translates to significant advantages in memory footprint and computational efficiency, especially for long sequences.

Key Results

  • Superior Accuracy: TimeMachine consistently outperforms 11 SOTA baselines across most datasets in terms of Mean Squared Error (MSE) and Mean Absolute Error (MAE).
  • Competitive on High-Channel Datasets: It achieves comparable or superior performance to iTransformer on the Traffic and Electricity datasets, which have a large number of channels.
  • Memory Efficiency: The model exhibits a significantly smaller memory footprint compared to Transformer-based baselines, making it more suitable for resource-constrained environments.
  • Linear Scalability: TimeMachine demonstrates linear scalability with respect to the input sequence length, a significant advantage over quadratic-complexity models.
  • Qualitative Improvements: Visualizations show TimeMachine closely following ground truth trends, with notable improvements over iTransformer on the Electricity dataset.

Limitations and Future Work

  • Weather Dataset Performance: While generally strong, TimeMachine ranks second on the Weather dataset with small prediction horizons (T), suggesting room for improvement in specific scenarios.
  • Alignment with Ground Truth: Qualitative analysis indicates potential for further enhancing the alignment with ground truth in predictions.
  • Future Work: The authors suggest exploring TimeMachine's application in a self-supervised learning setting.

Summary updated

BibTeX
@inproceedings{ahamed2024timemachine,
  author = {Md. Atik Ahamed and Qiang Cheng},
  title = {{TimeMachine: A Time Series is Worth 4 Mambas for Long-term Forecasting}},
  booktitle = {ECAI},
  year = {2024},
}
Figure