Large Language Models Are Zero-Shot Time Series Forecasters

Nate Gruver, Marc Anton Finzi, Shikai Qiu, Andrew Gordon Wilson

Introduction

Time series forecasting—the prediction of future values based on historical observations—is a critical component of fields ranging from meteorology to financial market analysis. Despite its importance, the field remains fragmented. Unlike Natural Language Processing (NLP) or Computer Vision, which have converged around "foundation models" like GPT-4 or CLIP, time series analysis typically relies on a patchwork of specialized architectures or classical statistical methods like ARIMA.

Deep learning models designed specifically for time series often struggle with the inherent messiness of real-world data, such as inconsistent scales and missing values, sometimes failing to outperform simple linear baselines. This research investigates a provocative alternative: can the massive pattern-recognition capabilities and internal "knowledge" of Large Language Models (LLMs) be repurposed for zero-shot time series forecasting?

The LLMTIME Framework

The researchers introduce LLMTIME, a method that transforms an LLM into a forecaster without any task-specific fine-tuning. The framework relies on several key technical adaptations to bridge the gap between text and numerical data:

  1. Digit-Wise Tokenization: Standard LLM tokenizers (such as Byte Pair Encoding) often group numbers into inconsistent chunks (e.g., "422" might be one token, while "423" is split into two). LLMTIME bypasses this by representing numbers as strings of individual digits separated by spaces (e.g., 1 2 3 , 1 2 5). This forces the model to attend to the underlying numerical structure.
  2. Percentile Rescaling: To ensure numerical values fall within a range the model can effectively process, the data is rescaled based on its distribution percentiles.
  3. Next-Token Prediction: The forecasting task is framed as a standard completion task. The model is prompted with a historical sequence and asked to predict the following digits.
  4. Probabilistic Forecasting: Rather than generating a single point estimate, the researchers sample multiple completions from the LLM. This allows for the construction of a distribution of potential future outcomes.
  5. Continuous Density Estimation: The discrete probabilities assigned to tokens are converted into a continuous probability density, enabling sophisticated uncertainty estimation and the calculation of metrics like the Continuous Ranked Probability Score (CRPS).

Experimental Evaluation

The authors evaluated LLMTIME against a diverse array of standard benchmarks, including:

  • Darts: A collection of eight real-world univariate datasets (e.g., AirPassengers, GasRateCO2).
  • Monash Forecasting Archive: A massive repository of 30 public datasets; the study focused on 19, covering domains like COVID-19 mortality, electricity demand, and Bitcoin prices.
  • Informer: Multivariate datasets frequently used to benchmark Transformer-based forecasting architectures.
  • Synthetic Datasets: Custom mathematical patterns (sines, sigmoids) designed to test the model's inherent "simplicity bias."

Key Insights and Results

Zero-Shot Superiority

LLMTIME, utilizing models like GPT-3 or LLaMA-2 (70B), achieved performance that matched or exceeded state-of-the-art specialized models (such as N-BEATS and TCN) on the Darts benchmark. This is particularly notable because the LLMs were never explicitly trained on time series data.

The "Occam’s Razor" Bias

LLMs exhibit an inherent "simplicity bias," preferring completions that follow regular, repetitive, or simple mathematical rules. Because many real-world time series are governed by seasonal trends and cyclical patterns, this bias acts as an effective prior for forecasting.

Resilience to Missing Data

Because LLMs are trained on text, they are naturally adept at handling interruptions in context. By simply inserting "NaN" into a numerical string, the model can "read through" the gap and maintain a coherent forecast, often outperforming traditional imputation methods.

The Alignment Tax

In a surprising finding, GPT-4 occasionally performed worse than its predecessor, GPT-3. The authors suggest this may be due to "alignment" processes like Reinforcement Learning from Human Feedback (RLHF). While RLHF makes models better conversationalists, it may inadvertently degrade their numerical tokenization or uncertainty calibration.

Sample Efficiency and Scaling

LLMs proved to be highly data-efficient, producing high-quality forecasts with significantly less historical data than specialized deep learning models require. Furthermore, performance scaled with model size; LLaMA-2 70B consistently outperformed the 7B version.

Limitations and Future Directions

Despite its success, LLMTIME faces several hurdles:

  • Context Windows: The length of a time series is limited by the model's maximum token capacity. High-frequency data or very long historical records may exceed these limits.
  • Multivariate Complexity: Currently, LLMTIME predicts different variables independently, making it difficult to capture complex inter-variable correlations (e.g., the relationship between temperature and energy consumption).
  • Arithmetic and Cost: LLMs are not calculators and can struggle with precise arithmetic in highly complex patterns. Additionally, the cost of using proprietary APIs for high-volume forecasting can be prohibitive compared to local, lightweight models.

Conclusion

This research demonstrates that LLMs are surprisingly capable zero-shot forecasters. By treating time series as a specialized language, LLMTIME leverages the pattern-matching strengths of foundation models to provide a robust, flexible, and accurate alternative to traditional forecasting methods. Future work will likely focus on expanding context windows and developing fine-tuning procedures specifically optimized for numerical reasoning.

Summary updated

BibTeX
@inproceedings{gruver2023large,
  author = {Nate Gruver and Marc Anton Finzi and Shikai Qiu and Andrew Gordon Wilson},
  title = {{Large Language Models Are Zero-Shot Time Series Forecasters}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=md68e8iZK1},
}
Figure