Understanding the Role of Textual Prompts in LLM for Time Series Forecasting: an Adapter View

Tian Zhou, Peisong Niu, Xue Wang, L. Sun, Rong Jin · DOI

Abstract

In the burgeoning domain of Large Language Models (LLMs), there is a growing interest in applying LLM to time series forecasting, with multiple studies focused on leveraging textual prompts to further enhance the predictive prowess. This study aims to understand how and why the integration of textual prompts into LLM can effectively improve the prediction accuracy of time series, which is not obvious at the glance, given the significant domain gap between texts and time series. Our extensive examination leads us to believe that (a) adding text prompts is roughly equivalent to introducing additional adapters, and (b) It is the introduction of learnable parameters rather than textual information that aligns the LLM with the time series forecasting task, ultimately enhancing prediction accuracy. Inspired by this discovery, we developed four adapters that explicitly address the gap between LLM and time series, and further improve the prediction accuracy. Overall, our work highlights how textual prompts enhance LLM accuracy in time series forecasting and suggests new avenues for continually improving LLM-based time series analysis.

Introduction

Large Language Models (LLMs) have recently shown surprising talent in time series (TS) forecasting. To bridge the gap between numerical sequences and natural language, many researchers use "textual prompts"—descriptions like "This is electricity data from a transformer..."—to guide the model. However, a fundamental mystery remains: Why does an LLM, trained on text, care about these descriptions when processing numerical sequences? This paper investigates whether the semantic content of these prompts actually matters and seeks a more efficient way to align LLMs with the unique inductive biases of time series data.

The Implicit Adapter Hypothesis

To investigate the role of semantics, the authors conducted a "sanity check" by comparing standard, meaningful prompts against Random Textual Tests (meaningless sentences) and Random Word Embedding Tests (random learnable values).

Comparison of standard and random prompting/embedding strategies used for the sanity check.

The finding that random gibberish performed as well as meaningful text led to a pivotal insight: the LLM doesn't necessarily "understand" the context of the data. Instead, prompts act as "implicit adapters," providing a high-dimensional space of learnable parameters that allow the model to "reprogram" the time series data for the frozen LLM backbone.

Proposed Methodology: Explicit Time-Series Adapters

Recognizing that prompts are essentially an inefficient way to add parameters, the authors developed four explicit, lightweight adapters designed specifically for time series. These adapters are integrated into the transformer blocks of frozen models like GPT-2 and LLaMA.

The proposed architecture integrating specialized time-series adapters into a pretrained LLM backbone.

The framework includes four specialized components:

  1. Temporal & Channel Adapters: Use a bottleneck structure to capture correlations across different time steps and variables without overfitting.
  2. Frequency Adapter: Uses Fast Fourier Transforms (FFT) to capture seasonal and global patterns in the frequency domain.
  3. Anomaly Adapter: Uses a Gaussian kernel to measure the "discrepancy" in the self-attention matrix, helping the model identify outliers.
  4. Select Gate: A learnable sigmoid-based gating mechanism that allows the model to adaptively weight which adapter is most important for a specific dataset.

Key Results and Insights

The study utilized a massive battery of standard benchmarks across forecasting, anomaly detection, and imputation. The results demonstrate that architectural alignment is more important than raw model scale:

  • Superior Forecasting: The proposed GPT2-adapter(6) achieved a 4.4% average MSE reduction over the previous state-of-the-art (OFA) in long-term forecasting.
  • SOTA Anomaly Detection: The model reached an average F1-score of 95.35%, outperforming specialized anomaly detection models.
  • Scale Invariance: A small GPT-2 model (6 layers) equipped with these specialized adapters matched or beat a LLaMA-32B model using standard prompting. This proves that "bigger" isn't always "better" if the alignment is right.

Conclusion

This research demonstrates that the primary value of textual prompts in LLM-based time series forecasting is parametric rather than semantic. By replacing these implicit prompts with explicit, time-series-aware adapters, significant gains in both accuracy and efficiency can be achieved. Future work will explore how to truly integrate cross-modality information—such as actual metadata or external news events—in a way that the model uses semantically rather than just parametrically.

Summary updated

BibTeX
@misc{zhou2023understanding,
  author = {Tian Zhou and Peisong Niu and Xue Wang and L. Sun and Rong Jin},
  title = {{Understanding the Role of Textual Prompts in LLM for Time Series Forecasting: an Adapter View}},
  year = {2023},
  eprint = {2311.14782},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.14782},
}
Figure