Skip to content
SK Subham KumarTSF Hub · time-series forecasting
Foundation & quantum2024Zero-shotPretrainedProbabilistic

Foundation models

Pretrained time-series foundation models: Chronos, TimesFM, Moirai, Lag-Llama, TimeGPT

Large models pretrained on huge collections of time series that forecast new series zero-shot, with no training on your data.

Overview

Inspired by large language models, these models are pretrained on very large and diverse corpora of real and synthetic series. At inference you pass a context window and get a forecast, often probabilistic, without fitting anything. That makes them attractive for cold-start products, thousands of short series, and quick baselines.

ModelFromArchitectureOutputWeights
ChronosAmazon, 2024T5 language model on scaled, quantised values (tokens)Sample pathsOpen
TimesFMGoogle Research, 2024Decoder-only Transformer on patchesPoint + quantilesOpen
MoiraiSalesforce, 2024Masked-encoder Transformer, multiple patch sizes, any-variate attentionMixture distributionOpen
Lag-Llama2023–24Decoder-only (LLaMA-style) with lag featuresStudent-t distributionOpen
TimeGPTNixtla, 2023Transformer encoder–decoderPoint + intervalsAPI only

How it works

Chronos, for example, scales each context window by its mean absolute value, quantises the scaled values into \(B\) bins, and trains a language model with cross-entropy to predict the next token:

\[\tilde x_t=\frac{x_t}{s},\quad s=\frac{1}{C}\sum_{t=1}^{C}\lvert x_t\rvert,\qquad z_t=\mathrm{bin}(\tilde x_t)\in\{1,\dots,B\}\] \[\mathcal L=-\sum_{t}\log p_\theta\big(z_{t+1}\mid z_{1:t}\big)\]

Sampling tokens autoregressively and mapping them back gives forecast sample paths, and therefore quantiles.

When to use it

Use it for

  • Thousands of series where per-series models are impractical
  • New products or sensors with little history
  • Fast baselines before building custom models

Avoid it for

  • Assuming zero-shot beats a tuned model: always benchmark
  • Strict latency or memory limits (models are large)
  • Data with strong covariate effects the model can’t see

Key settings

SettingWhat it controlsTypical value
context lengthHow much history you pass inmodel maximum, e.g. 512
prediction_lengthHorizonwithin the model’s recommended range
num_samples / quantilesProbabilistic output20–100 samples
model sizeTiny to large checkpointsstart small, scale if it helps

Python example

Follows the library’s documented API · needs PyTorch/TensorFlow, not run hereDownload chronos_zero_shot.py
# pip install chronos-forecasting   (needs PyTorch; the model downloads on first run)
import numpy as np
import pandas as pd
import torch
from chronos import ChronosPipeline

pipeline = ChronosPipeline.from_pretrained("amazon/chronos-t5-small", device_map="cpu",
                                           torch_dtype=torch.bfloat16)

URL = "https://raw.githubusercontent.com/jbrownlee/Datasets/master/airline-passengers.csv"
y = pd.read_csv(URL)["Passengers"].to_numpy(dtype=float)
context, actual = torch.tensor(y[:-12]), y[-12:]

# zero-shot: no training. Returns sample paths with shape [series, samples, horizon]
samples = pipeline.predict(context, prediction_length=12, num_samples=50)
low, median, high = np.quantile(samples[0].numpy(), [0.1, 0.5, 0.9], axis=0)
print(f"Chronos MAE: {np.mean(np.abs(median - actual)):.1f}")
print(f"80% interval coverage: {np.mean((actual >= low) & (actual <= high)):.0%}")

Tips & pitfalls

  • Benchmark against seasonal naive and ETS on your own data. Benchmarks used in papers may overlap with pretraining data.
  • Fine-tuning on your domain often helps more than switching models.
  • Respect licences and data-privacy rules, especially for API-based models.

References

  1. Ansari, A. F., et al. (2024). Chronos: Learning the Language of Time Series. Transactions on Machine Learning Research.
  2. Das, A., Kong, W., Sen, R., & Zhou, Y. (2024). A decoder-only foundation model for time-series forecasting. Proceedings of ICML 2024.
  3. Woo, G., Liu, C., Kumar, A., Xiong, C., Savarese, S., & Sahoo, D. (2024). Unified Training of Universal Time Series Forecasting Transformers. Proceedings of ICML 2024.
  4. Rasul, K., et al. (2023). Lag-Llama: Towards Foundation Models for Probabilistic Time Series Forecasting. arXiv:2310.08278.
  5. Garza, A., & Mergenthaler-Canseco, M. (2023). TimeGPT-1. arXiv:2310.03589.