Multi-Patch Prediction: Adapting Language Models for Time Series Representation Learning

Yuxuan Bian, Xuan Ju, Jiangtong Li, Zhijian Xu, Dawei Cheng, Qiang Xu

TL;DR

This paper introduces aLLM4TS, a framework that successfully adapts pre-trained Large Language Models (LLMs) for time series analysis. By treating time series forecasting as a causal, "next-patch" prediction task and introducing a highly efficient patch-wise decoder, the model avoids the overfitting traps of previous methods and achieves state-of-the-art performance across forecasting, imputation, and anomaly detection tasks.

The Challenge: Adapting LLMs for Time Series

Learning generalizable representations for time series data is notoriously difficult. Traditional self-supervised methods rely on contrastive learning (which struggles to align with low-level tasks like forecasting) or masked reconstruction (which disrupts natural temporal dependencies).

Recently, researchers have tried adapting pre-trained LLMs (like GPT-2 or LLaMA) for Time Series Analysis (TSA) to leverage their incredible sequence-modeling capabilities. However, current LLM-for-TSA methods usually fall into a trap: they use massive sequence-wise decoders. After the LLM processes the time series "patches" (small chunks of the time series treated as tokens), these models flatten everything and use a giant linear layer to predict the future. This massive decoder often overfits to the specific downstream task and prevents the LLM backbone from actually learning a good, disentangled representation of the time series itself. Furthermore, many methods use masked reconstruction, which misaligns with the causal (next-token) way LLMs were originally trained.

The aLLM4TS Approach

To overcome these limitations, the authors propose aLLM4TS, which fundamentally changes how LLMs are adapted for time series through two main innovations: patch-wise decoding and a two-stage causal training process.

Comparison of aLLM4TS with previous methods

1. Patch-Wise Decoding

Instead of a giant sequence-level linear layer, aLLM4TS uses a small, shared linear layer that decodes each patch independently back into the time domain. This drastically reduces the decoder's parameter count (to as little as 0.34% of previous models) and forces the LLM backbone to do the heavy lifting of understanding temporal relationships, rather than relying on the decoder to memorize sequence patterns.

2. Two-Stage Causal Pre-training & Fine-tuning

The framework aligns the time-series task with the LLM's native causal architecture:

Detailed architecture of the two-stage training process
  • Stage 1 (Causal Next-Patch Pre-training): Instead of randomly masking patches, the model is trained on diverse time-series datasets to predict the next patch based on historical patches. This perfectly mirrors the causal "next-token" prediction used to train LLMs on text, naturally syncing the LLM's architecture with temporal dynamics.
  • Stage 2 (Multi-Patch Prediction Fine-tuning): For a specific target dataset, the model uses non-parametric methods to create initial "anchors" for future predictions. The LLM then refines these anchors using a position-aware attention mask to forecast multiple future patches simultaneously.

Key Insights

  • Text pre-training actually helps time series: Interpretability studies show that the pre-trained weights of an LLM (like GPT-2) inherently capture fundamental periodicities and cycle attributes. They serve as a vastly superior initialization anchor compared to random weights.
  • Sequence decoders are a crutch: By swapping the traditional sequence-wise decoder for a patch-wise decoder, the authors proved that massive decoders were causing downstream overfitting and hindering true representation learning.
  • Align the modality with the architecture: Masked reconstruction doesn't work as well for generative LLMs. By switching the time-series pre-training task to causal next-patch prediction, the framework works with the LLM's native design rather than against it.

Key Results

The framework was rigorously evaluated across a wide variety of benchmarks, including long-term and short-term forecasting, anomaly detection, and classification.

  • Long-Term Forecasting: aLLM4TS outperformed the previous state-of-the-art LLM-based model (GPT4TS) by an average of 9.71% across standard benchmarks (Weather, Traffic, Electricity, ILI, and ETT datasets).
  • Few-Shot Learning: When trained on only 5% of the available data, aLLM4TS achieved an 8.6% MSE reduction over GPT4TS, and roughly a 30% reduction over traditional deep learning models like DLinear and TimesNet.
  • Anomaly Detection: Achieved a state-of-the-art average F1-score of 87.51% across five major anomaly detection datasets.
  • Zero-Shot Horizon Adaptation: Because the patch-wise decoder operates independently of the sequence length, aLLM4TS can be trained on one prediction horizon (e.g., 720 steps) and seamlessly forecast arbitrary horizons without needing to be retrained—a major efficiency win over previous methods.

Limitations and Future Work

  • Overfitting Risks with Unfrozen LLM Layers: The authors note that they had to keep most of the LLM backbone frozen (only unfreezing the Layer Normalization and Position Embeddings). Trying to fine-tune the Attention or Feed-Forward layers resulted in severe performance drops due to overfitting on the limited downstream time-series data.
  • Context Window Sensitivity: The model's performance can degrade if there is a mismatch between the look-back window length used in the first-stage pre-training and the downstream fine-tuning tasks. The authors had to manually extend the pre-training window to accommodate longer downstream forecasting horizons.
  • Future Work: The success of this causal pre-training approach suggests a clear path toward building massive, unified "Foundation Models" for time series that can handle diverse frequencies and domains out-of-the-box.

Summary updated

BibTeX
@inproceedings{bian2024multi,
  author = {Yuxuan Bian and Xuan Ju and Jiangtong Li and Zhijian Xu and Dawei Cheng and Qiang Xu},
  title = {{Multi-Patch Prediction: Adapting Language Models for Time Series Representation Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=Rx9GMufByc},
}
Figure