- Introduced by
- Gerald Woo et al. (Salesforce)
- Year
- 2024
- Type
- Foundation model for zero-shot time-series forecasting
- Family
- Time-series forecasting
What does it do?
Moirai is a time-series foundation model for forecasting across domains, introduced by Gerald Woo and colleagues at Salesforce and presented at ICML in 2024.
A single Transformer is pre-trained on the LOTSA corpus, a large and mixed collection of time-series data, so that it can produce forecasts for series it has not seen, in a zero-shot setting, without task-specific training. The architecture combines patch-based tokenization, attention across variates and time, and a mixture-of-distributions output head that yields probabilistic predictions.
The intuition behind the method
Moirai can be thought of as a large language model applied to numbers rather than words. Instead of predicting the next token of text, it predicts the next segment of a numeric sequence. Because pre-training draws on a large, mixed corpus of series from many domains and sampling frequencies, the model learns temporal patterns that recur across those domains. Given a new series, it uses these learned patterns to produce a forecast and a distribution over possible futures, without updating its weights.
History
Moirai was developed at Salesforce AI Research and presented at the International Conference on Machine Learning (ICML) in 2024 by Gerald Woo, Chenghao Liu, Akshat Kumar, Caiming Xiong, Silvio Savarese, and Doyen Sahoo. It was released with the Large-scale Open Time Series Archive (LOTSA), the pre-training corpus used for the model. It is part of a group of time-series foundation models that includes Chronos (Amazon) and TimesFM (Google).
When to use it
Moirai is most useful when historical data for the target series is short or missing, so that zero-shot forecasting is the practical option, and when many series with different frequencies must be forecast with one deployed model. It assumes that the target series shares broad temporal structure with the pre-training corpus. It is a weaker choice when a long, stable history of the target series exists, since a model fitted to that series may be more accurate, when the series has strong domain-specific dynamics or structural breaks not reflected in pre-training data, when compute or latency budgets are tight, or when the forecast must be explained through interpretable components. Classical models such as ETS or ARIMA, and the other foundation models listed as related, are reasonable comparators and should be evaluated on the same data.
Limitations and considerations
- Inference cost is higher than lightweight statistical models such as ETS or ARIMA
- Performance may degrade on series with highly domain-specific dynamics that are underrepresented in pre-training data
- The foundation model paradigm offers limited interpretability compared to classical decomposition methods
- Requires careful context window selection; very long historical contexts may challenge memory and latency budgets
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Forecasts new series without retraining, which is useful when per-series history is short
- One set of weights is intended to cover series with different sampling frequencies through its multiple patch-size configurations
- The mixture-distribution head produces a full predictive distribution, from which quantiles and intervals can be derived rather than a point forecast alone
- Any-variate attention allows the same architecture to accept different numbers of input channels
Applications
- Retail demand forecasting for many items with limited history per item
- Energy load and generation forecasting at different temporal resolutions
- Financial time-series analysis where forecast uncertainty bands are needed
- Forecasting of sensor streams with varying sampling rates, where a single model is preferred to many series-specific ones
How it works
How it works
The input series is split into contiguous, non-overlapping patches of fixed length, and each patch is linearly projected into an embedding vector with a positional term added. Working on patches rather than single timesteps shortens the token sequence and lets the Transformer operate on short temporal segments, which is the basis for handling different sampling frequencies under one representation.
Formula
\text{Given a time series } \mathbf{x} \in \mathbb{R}^{T}, \text{ divide into non-overlapping patches of length } p: \mathbf{z}_i = \mathbf{W}_\text{emb}\, \mathbf{x}_{[ip:(i+1)p]} + \mathbf{e}_i, \quad i = 1, \ldots, \lfloor T/p \rfloorSelf-attention is applied jointly over the token sequence formed from patches of all input variates, so attention can relate values across channels as well as across time. Because the token sequence is built from whatever channels are supplied, the same architecture can accept series with different numbers of variates.
Formula
\text{Attention across variates and time: } \text{Attn}(Q, K, V) = \text{softmax}\!\left(\frac{QK^\top}{\sqrt{d_k}}\right)V, \text{ applied jointly over the token sequence from all variates}Several patch sizes are supported, and the patch length used for an input is tied to its sampling frequency through the frequency metadata supplied with the series. The model is intended to serve series recorded at different granularities with one set of weights. The precise mechanism, including how the model handles the different patch configurations internally, should be confirmed against the original paper before it is relied on.
Formula
\text{Multiple patch sizes } \{p_1, p_2, \ldots, p_m\} \text{ are supported via a shared encoder; inputs are re-tokenized and a mixture-of-distributions output head combines predictions: } \hat{y} = \sum_{k} \pi_k \, f_k(\mathbf{h})Rather than returning a single point forecast, the output head parameterizes a mixture of probability distributions over each future step of the horizon, with components such as Normal, Student-t, and Negative Binomial. This list of component families is illustrative rather than exhaustive. The mixture weights and distribution parameters are predicted from the Transformer's hidden state, so quantiles and prediction intervals can be derived from the predicted distribution.
Formula
\text{The forecasting head parameterizes a mixture distribution } p(y_{t+h} \mid \mathbf{h}_t) = \sum_{k=1}^{K} \pi_k \, \mathcal{D}_k(\mu_k, \sigma_k) \text{ enabling calibrated probabilistic predictions over horizon } hCommon pitfalls
- Assuming zero-shot accuracy will match a well-tuned, series-specific model without checking on held-out data from the target series
- Omitting or mis-specifying frequency metadata when building the input, which can lead to the wrong patch size being used and degrade accuracy
- Feeding a context window that spans a structural break or intervention without accounting for it, so the model conditions on a regime that no longer applies
- Judging the model on point-forecast error alone; its main added value is the predictive distribution, so calibration of the intervals should be evaluated as well
Frequently asked questions
Does Moirai require fine-tuning on target data to be useful?
No. Moirai is designed for zero-shot forecasting, so it can produce forecasts for a new series without task-specific training. Whether adapting the model with data from the target series would improve accuracy is not established here and should be tested on held-out data before any such step is adopted.
How does Moirai handle time series with different sampling frequencies?
Moirai supports several patch-size configurations, each corresponding to a different temporal granularity, and frequency metadata guides how the input is tokenized. The exact rule by which patch sizes are selected or combined at inference should be checked against the original paper before the model is deployed for a specific frequency mix.
What kind of uncertainty estimates does Moirai produce?
The output head parameterizes a mixture of probability distributions, such as Normal, Student-t, and Negative Binomial components, over the forecast horizon. From the predicted distribution, quantile forecasts, prediction intervals, and expected values can be derived. Whether these intervals are well calibrated for a particular dataset should be verified on that dataset.
Related methods
Sources
Woo, G., Liu, C., Kumar, A., Xiong, C., Savarese, S., & Sahoo, D. (2024). Unified training of universal time series forecasting transformers. ICML.
Open publication reference