Test Time Learning for Time Series Forecasting

Panayiotis Christou, Shichu Chen, Xupeng Chen, Parijat Dube · Submission to ICLR 2025 · Rejected

TL;DR

By swapping out Mamba state-space blocks for Test-Time Training (TTT) modules inside the state-of-the-art TimeMachine forecasting architecture, this paper shows how online gradient updates at inference time enable models to handle extreme look-back contexts (up to 5,760 steps) and long prediction horizons. The resulting model consistently outperforms existing Transformer- and Mamba-based baselines, particularly on high-dimensional datasets with non-stationary dynamics.

What Problem Does This Paper Address?

Long-Term Time Series Forecasting (LTSF) is essential for power grids, traffic networks, and financial planning, but real-world time series exhibit non-stationary distributions and long-range temporal dependencies.

  • Transformers capture global context well, but their quadratic self-attention complexity $\mathcal{O}(L^2)$ makes scaling to large look-back windows ($L$) computationally prohibitive.
  • State Space Models (SSMs) like Mamba offer linear complexity $\mathcal{O}(L)$ and fast inference, but their reliance on fixed-size hidden states and static state transitions limits memory retention over extended horizons and makes adaptation to distribution shifts difficult.

Most existing benchmarks constrain look-back windows to modest lengths (e.g., $L=96$), leaving the question open: How can we scale sequence and prediction lengths into thousands of steps while adapting dynamically to changing data patterns?

Methods

The authors build on the TimeMachine architecture—which uses a two-level hierarchical downsampling scheme to capture both high- and low-resolution context across channel-mixing and channel-independent modes—with the following innovations:

  1. Test-Time Training (TTT) Sequence Blocks: Rather than using fixed recurrent transitions, the authors replace Mamba with TTT layers. In TTT, the hidden state is represented as the weights $W_t$ of an internal linear/MLP model. At test time, these weights are continually adapted using an unsupervised reconstruction loss via gradient descent: $$W_t = W_{t-1} - \eta \nabla \ell(W_{t-1}; x_t)$$ This gives the model an effectively unbounded context window and dynamic adaptability without catastrophic forgetting.

  2. Convolutional Hidden Layers: To provide a local temporal inductive bias before the global sequence modeling block, the authors introduce and ablate convolutional feature extractors, evaluating single 1D convs (kernel sizes 3 and 5), cascaded stacks (Conv Stack 3, Conv Stack 5), Inception blocks, and ModernTCN.

  3. Reversible Instance Normalization (RevIN): Applied to stabilize training and mitigate distribution shifts before mapping through hierarchical MLP embeddings.

Datasets

The authors evaluated on seven standard LTSF benchmark datasets:

  • Large-scale, multivariate: Traffic (862 channels, 17,544 steps) and Electricity (321 channels, 26,304 steps).
  • Environmental: Weather (21 channels, 52,696 steps).
  • Electricity Transformer Temperature (ETT): ETTh1, ETTh2 (hourly), and ETTm1, ETTm2 (15-minute intervals).

No new datasets were introduced; evaluations followed standard benchmark configurations while scaling sequence and prediction lengths well beyond standard protocols.

Key Insights and Ideas

  • Dynamic Hidden States Outperform Fixed SSM States: Mamba compresses history into fixed hidden state vectors. TTT represents history as weight matrices updated via gradient steps, allowing it to adapt to non-stationarity and distribution shifts "on the fly" during inference.
  • Local Convolutions Synergize with Global TTT: Pure linear or MLP hidden layers struggled on complex temporal patterns, while deep structures like ModernTCN caused memory bottlenecks. A simple two-layer cascade with kernels 5 and 3 (Conv Stack 5) struck the best balance, delivering the highest accuracy gains.
  • SOTA Benchmarks Constrain Potential: Existing benchmarks often artificially cap input sequences to $L=96$. Expanding the context up to $L=5760$ and horizons to $T=2880$ demonstrated that TTT maintains resilience against error compounding where fixed-parameter models deteriorate.

Key Results

  • Standard Benchmark ($L=96$, Horizons $T \in \{96, 192, 336, 720\}$): TTT with Conv Stack 5 beat or tied 12 strong baselines (including TimeMachine, iTransformer, PatchTST, and TimesNet).
  • Electricity: Consistently outperformed all models across all horizons (e.g., MSE 0.135 at $T=96$ vs. TimeMachine's 0.142; 0.199 at $T=720$ vs. 0.207).
  • Traffic: Achieved superior long-horizon performance (MSE 0.456 at $T=720$ vs. TimeMachine's 0.467 and iTransformer's 0.467).
  • Weather: Led at longer horizons (MSE 0.246 vs. 0.256 at $T=336$, and 0.339 vs. 0.342 at $T=720$).
  • Extended Contexts ($L=2880$ and $L=5760$):
  • At $L=5760$ and prediction horizon $T=720$, TTT reached an MSE of 0.509 compared to TimeMachine's 0.546.
  • At an extreme prediction horizon of $T=2880$ ($L=2880$), TTT maintained an MSE of 0.456 compared to TimeMachine's 0.485.

Limitations and Future Work

  • Inference Latency and Memory Overhead: Because TTT performs gradient descent steps during test time, its inference complexity is $\mathcal{O}(U \cdot T \cdot d^2)$ (where $U$ is the number of update iterations). This creates higher computational latency and activation memory demands than purely static models, which could bottleneck real-time or high-frequency forecasting systems.
  • Model Tuning: Complex additions like ModernTCN struggled with GPU memory scaling on single A100 setups, suggesting that lightweight feature extractors remain necessary.
  • Future Directions: The authors identify parameter-efficient test-time adaptation (e.g., low-rank updates or freezing specific layers), reducing update steps $U$, and formal failure-case analyses under sudden anomalies as promising next steps.

Summary updated

BibTeX
@misc{christou2024test,
  author = {Panayiotis Christou and Shichu Chen and Xupeng Chen and Parijat Dube},
  title = {{Test Time Learning for Time Series Forecasting}},
  year = {2024},
  eprint = {2409.14012},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.14012},
}
Figure