liveBook · Manning

Time-LLM

As explained in Time Series Forecasting Using Foundation Models

Time-LLM is a language-model-based framework that adapts existing large language models for time-series forecasting.

Time-LLM reprograms an existing large language model for time-series forecasting. It combines historical values with a natural-language prompt, aligning numeric time-series patches with the LLM’s text modality. section 9.0 section 9.7

Figure 9.1 General architecture of Time-LLM. (Right) The raw series is fed to the framework and undergoes patching before entering the patch-reprogramming phase. (Left) A prompt is used to provide context about the data. The prompt and reprogrammed patches are joined as a patch embedding, which is sent to the LLM. Then the output is projected to create a forecast for our series.
A diagram of a patch

Description automatically generated

Follow the data path: patch the raw series, reprogram patches into text-aligned representations, prepend contextual prompt information, run the LLM, and project its output into numeric forecasts. section 9.1

A practical Time-LLM workflow includes these decisions:

  • Provide a prompt describing the series, such as store-sales trends or weekday and weekend seasonality. section 9.2.1 section 10.2.8
  • Choose an open-source LLM available through Hugging Face, then provide its tokenizer, configuration, and hidden dimension. section 9.1 section 9.2.1
  • Train the patch-reprogramming components and output projection; unlike zero-shot forecasters, Time-LLM always requires training steps. section 9.2.2 section 9.6
  • Use NeuralForecast to manage fitting, prediction, frequency configuration, and cross-validation, while supplying univariate series data. section 9.2 section 10.2.8

Weekly store-sales forecasting

A weekly store-sales dataset can be forecast over an eight-step horizon after removing exogenous columns because the demonstrated Time-LLM setup supports only univariate forecasting. One evaluation reported MAE of $80,417 and sMAPE of 2.51% across four eight-week cross-validation windows. The result was better than direct LLM prompting in that experiment, but not better than every specialized forecasting model. section 9.2 section 9.4

Time-LLM is easy to access through NeuralForecast, but reprogramming can be computationally expensive, especially with large backbones or many training steps. Forecast quality and anomaly-detection performance depend on training effort and evaluation design; one anomaly experiment produced an F1 score of 0.15. section 9.6 section 9.5.2

How Time Series Forecasting Using Foundation Models covers it

How deep it goes
Explains patch alignment, prompts, projections, initialization, training, forecasting, and evaluation, but stops short of detailed optimization internals.
Examples
Uses weekly store sales, daily blog visits with weekly seasonality, and daily taxi-ride anomaly detection.
What it assumes
Assumes Python forecasting workflow familiarity while teaching prompts, patch reprogramming, backbone configuration, and univariate constraints.
What you can do after
Apply it via NeuralForecast to configure, train, forecast, cross-validate, and evaluate an LLM-based time-series model.
How it connects
Connects multimodal learning, large language models, prompt engineering, time-series forecasting, anomaly detection, and NeuralForecast.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Time Series Forecasting Using Foundation Models. The section links point to the parts of the book it draws on.