Context-Alignment: Activating and Enhancing LLMs Capabilities in Time Series

Yuxiao Hu, Qian Li, Dongxiao Zhang, Jinyue Yan, Yuntian Chen

Executive Summary

This paper introduces Context-Alignment (CA), a framework that moves beyond superficial "token-to-token" mapping to help Large Language Models (LLMs) truly comprehend time series data. By using Dual-Scale Graph Neural Networks (DSCA-GNNs) to encode structural and logical relationships between data and prompts, the authors activate the LLM's inherent linguistic reasoning, leading to state-of-the-art performance in zero-shot and few-shot forecasting.

The "Language Gap" in Time Series

While LLMs have shown promise in time series (TS) tasks, there is a fundamental "language gap." Most current methods rely on token-level alignment: they chop time series into patches and project them into the same embedding space as words.

The authors argue this approach is superficial. LLMs do not merely process embeddings; their real power lies in their deep understanding of linguistic logic and structure. A long string of time series "tokens" lacks the coherent semantic structure found in natural language, making it difficult for an LLM to contextualize the data. To effectively use an LLM for time series, the field must move from matching individual tokens to aligning the entire context of the task.

Methodology: Context-Alignment via DSCA-GNNs

To bridge this gap, the authors propose a new paradigm called Context-Alignment (CA), implemented via Dual-Scale Context-Alignment GNNs (DSCA-GNNs).

Architecture of Dual-Scale Context-Alignment GNNs

The framework consists of two main pillars:

  1. Structural Alignment: TS data is processed at two scales. A fine-grained GNN preserves individual token features, while a coarse-grained GNN aggregates tokens into a single "linguistic component." This dual-scale approach allows the LLM to perceive a long sequence of numbers as a unified entity (akin to a sentence or paragraph) rather than a disjointed list of values.
  2. Logical Alignment: The model uses directed edges in a graph to define the relationship between the TS data and the natural language prompt (e.g., instructions to predict future values). These edges guide the LLM's attention, ensuring coherent semantic flow between the data and the instructions.

The authors specifically highlight Few-Shot prompting Context-Alignment (FSCA). In this setup, the TS data is divided into segments where earlier segments serve as "demonstration examples" for the LLM, mimicking few-shot prompting in natural language. This module can be plugged into multiple layers of a pre-trained LLM (such as GPT-2) to repeatedly reinforce the logical structure.

Key Insights

  • LLMs as Logic Engines: The core insight is that LLMs excel at following logical structures rather than just processing raw sequences. Framing time series as a structured "linguistic environment" taps into the LLM's pre-trained reasoning capabilities.
  • The Power of Priors: Context-Alignment provides a powerful prior. In zero-shot settings, having a structural understanding of how data relates to a prompt is more critical than having seen similar numerical patterns before.
  • Dual-Scale is Essential: The coarse-grained branch helps the LLM "see the forest," while the fine-grained branch ensures it doesn't "lose the trees" (the specific data points needed for accurate prediction).

Experimental Results

The model was evaluated on a comprehensive suite of standard benchmarks, including long-term forecasting (ETT, Weather, Electricity, Traffic, ILI), short-term forecasting (M4), classification (10 UEA datasets), and cross-domain zero/few-shot tasks.

Long-term forecasting performance comparison
  • Long-term Forecasting: FSCA outperformed all baselines, including specialized models like PatchTST (3.1% MSE reduction) and other LLM-based methods like Time-LLM (12.2% improvement).
  • Few-Shot Dominance: When trained on only 5% of the data, FSCA achieved a 6.7% reduction in MSE compared to the previous best LLM-based model ($S^2$IP-LLM).
  • Zero-Shot Performance: In cross-domain tasks (training on one dataset and testing on another without fine-tuning), FSCA showed a 13.3% improvement over PatchTST, proving that logical alignment generalizes better than raw data patterns.
  • Classification: FSCA achieved an average accuracy of 76.4% across 10 UEA datasets, a 2.4% increase over the previous state-of-the-art.

Limitations and Future Work

  • Backbone Constraints: GPT-2’s input length constraints limited the use of the FSCA approach for multi-class classification with many categories, forcing a fallback to a simpler "Vanilla" version (VCA).
  • Computational Overhead: The addition of GNN layers and dual-scale processing naturally increases the parameter count and training time compared to simpler linear projections.
  • Scaling to Larger LLMs: Future work could explore whether these contextual priors become even more powerful when applied to massive models like Llama 3 or Mistral.
  • Prompt Engineering: Because the model relies on specific natural language prompts, exploring how different "logical instructions" affect the GNN's alignment remains a fruitful area for research.

Summary updated

BibTeX
@inproceedings{hu2025context,
  author = {Yuxiao Hu and Qian Li and Dongxiao Zhang and Jinyue Yan and Yuntian Chen},
  title = {{Context-Alignment: Activating and Enhancing LLMs Capabilities in Time Series}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=syC2764fPc},
}
Figure