Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.One model for every series
Usually each series gets its own model, fitted to its own past. A foundation model turns this around. It learns from millions of different series once, and then forecasts a series it has never seen, straight away. This helps most when a series is new and has little history. It helps least when the new series behaves unlike anything in the training collection.
Chronos (Amazon, 2024) turns numbers into tokens and trains an ordinary language model on them, the same kind of model used for text.
- 1. Zero-shot forecasting means…
- 2. Foundation models help most when a series…
- 3. They are pretrained on…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Global versus local models: a local model is fitted to one series; a global model shares parameters across many series. A foundation model is a global model trained on a huge, diverse corpus and used on new series.
- Scale-free inputs: series differ in units and level, so each window is normalised by its own statistics (mean and standard deviation, or mean absolute value as in Chronos) and the forecast is scaled back.
- Architectures: TimesFM (Google, 2024) is a decoder-only transformer on patches; Chronos (Amazon, 2024) quantises scaled values into a vocabulary of 4096 tokens and trains T5 language models; Moirai (Salesforce, 2024) handles any number of variables; Lag-Llama, TimeGPT and MOMENT are other examples.
- Pretraining data: public archives (Monash, M4, electricity, traffic, weather) plus synthetic series, for example Chronos’ KernelSynth, which samples from Gaussian processes with random kernel combinations.
- Adaptation: zero-shot, in-context (longer context), fine-tuning, or linear probing of the output layer on the target series.
- 1. A local model is fitted to…
- 2. Chronos represents values as…
- 3. Per-window normalisation makes the model…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.A miniature foundation model
Exercise 1.
- A synthetic family: up to two seasonal cycles with calendar-like periods 4, 7, 12 or 24, a small trend, AR(1) noise, and random level and scale.
- 12,000 windows of 64 values with the next 16 as targets, each normalised by its context mean and standard deviation.
- A one-hidden-layer MLP (128 ReLU units) pretrained with Adam, then used zero-shot on two new sine series at level 1000.
Practice.
- Start with a zero-shot baseline: it is cheap and often strong, especially for new or short series.
- Compare with local baselines (seasonal naive, ETS, ARIMA) on your own data before adopting one.
- Check for overlap between the model’s pretraining data and your benchmark; leakage inflates zero-shot scores.
- Fine-tune or refit the output layer when you have long histories with unusual patterns.
- Tools: chronos-forecasting, timesfm, uni2ts (Moirai), Nixtla TimeGPT; GIFT-Eval is a public benchmark.
import numpy as np
def zero_shot(model, context):
m, s = context.mean(), context.std() + 1e-8
return model((context - m) / s) * s + m- 1. Before adopting a foundation model, compare it with…
- 2. A risk when evaluating zero-shot models on public data:
- 3. A library for Chronos:
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Equivariance from normalisation. If a forecaster f standardises its context and undoes the scaling at the end, then f(a·x + b) = a·f(x) + b for every a > 0 and b. The model therefore never has to learn about units or levels, and one set of weights can serve series of any size. In Exercise 1 a series at level 1000 was forecast by a model trained only on standardised windows.
What zero-shot can and cannot do. The pretrained model learns the average best forecast over its pretraining family. When a new series comes from that family, the model starts with the right knowledge, so a short context is enough. When it does not, nothing in the weights matches: in Exercise 1 the 12-step cycle was forecast with RMSE below 10 (amplitude 50), but a 17-step cycle gave RMSE above 20.
Global versus local. A local model with p lags and horizon H estimates (p + 1)·H coefficients from roughly n − p − H windows of its own history. With n = 80, p = 24 and H = 16 that is 400 coefficients from 41 windows, so it overfits. The global model’s parameters were estimated from 12,000 windows, so its variance is low, but its bias on unfamiliar series stays.
- 1. A standardise-then-unscale forecaster satisfies f(a·x + b) =…
- 2. Zero-shot fails when the new series…
- 3. A local model with few windows tends to…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Does a model pretrained on many series beat a model fitted to each new series alone, and how does the answer depend on the length of history and on whether the series resembles the pretraining data?
History.
- Global forecasting models across many series appeared in competitions such as M4 (2018); N-BEATS (B. Oreshkin et al., 2020) showed transfer between datasets.
- 2023–2024 brought pretrained models: TimeGPT (A. Garza and M. Mergenthaler-Canseco), Lag-Llama (K. Rasul et al.), TimesFM (A. Das et al.), Chronos (A. F. Ansari et al.), Moirai (G. Woo et al.) and MOMENT (M. Goswami et al.).
Exercise 2.
- Pretrain the MLP of Exercise 1 on 12,000 windows from 3000 synthetic series.
- Test on 200 new series per setting, with 80, 160 or 400 points of history, from two families: seasonal periods seen in pretraining (4, 7, 12, 24) and unseen periods (5, 9, 17, 30).
- Models: repeat the last value; a local ridge model fitted on each series’ own history (direct 16-step forecast from 24 lags); and the pretrained global model zero-shot (it sees only the last 64 points).
- Error: mean squared error of the 16 forecasts in units of the variance of the last 64 points.
Seed 0:
| periods | history | repeat last | local | global zero-shot |
|---|---|---|---|---|
| seen | 80 | 1.9 | 2.0 | 0.56 |
| seen | 160 | 1.9 | 0.65 | 0.65 |
| seen | 400 | 2.0 | 0.54 | 0.64 |
| unseen | 80 | 2.0 | 2.3 | 1.5 |
| unseen | 160 | 2.2 | 0.61 | 1.4 |
| unseen | 400 | 2.0 | 0.42 | 1.5 |
- With 80 points the global model won clearly: about 3 to 4 times lower error than the local model on familiar series, in all three seeds. The local model was even worse than repeating the last value, because it overfits.
- With 160 points the two were tied on familiar series, and with 400 points the local model was ahead (0.54 against 0.64).
- On unfamiliar periods the global model improved only modestly on repeating the last value (1.4–1.5 against 2.0–2.2), while the local model, given 160 or more points, was 2.4 to 3.6 times better than it.
- Seeds 1 and 2: with 80 points of a familiar series, global 0.43 and 0.5 against local 1.5 and 1.5. With 400 points of an unfamiliar series, local 0.6 and 0.62 against global 1.6 and 1.5.
Foundation models in practice
- Benchmarks: on broad benchmarks such as GIFT-Eval, pretrained models are competitive with or better than tuned local statistical models on average, but rankings vary by domain and frequency.
- Where they shine: cold-start series, large collections of short series, and quick baselines without tuning.
- Where to be careful: unusual dynamics, important covariates, very long histories, and benchmarks that overlap the pretraining data.
- Probabilistic output: Chronos samples token paths and TimesFM and Moirai output quantiles or distributions; see the next topic for how to evaluate them.
References
- A. F. Ansari et al. (2024). “Chronos: learning the language of time series.” Transactions on Machine Learning Research.
- A. Das, W. Kong, R. Sen and Y. Zhou (2024). “A decoder-only foundation model for time-series forecasting.” ICML.
- G. Woo et al. (2024). “Unified training of universal time series forecasting transformers.” ICML.
- K. Rasul et al. (2023). “Lag-Llama: towards foundation models for probabilistic time series forecasting.” arXiv.
- B. N. Oreshkin, D. Carpov, N. Chapados and Y. Bengio (2020). “N-BEATS: neural basis expansion analysis for interpretable time series forecasting.” ICLR.