Chronos — Amazon's pretrained time series forecasters, used zero-shot.
chronos-forecasting package. TuiML ships no weights; chronos fetches its own checkpoint from the Hugging Face Hub on first use. The package and every checkpoint this wrapper names (chronos-bolt-small, chronos-bolt-base, chronos-2) are Apache-2.0, which is compatible with TuiML's BSD-3-Clause license, so there is no usage restriction to accept.Classes
Zero-shot forecasting with a pretrained Chronos checkpoint.
Chronos is a family of time series foundation models from Amazon: a transformer trained once, on a large corpus of real and synthetic series, to forecast any univariate series it is shown. Your series is the context; the model emits a full quantile forecast for every future step in a single forward pass. Nothing is estimated on your data -- there is no gradient step, no hyperparameter search and no fitted coefficient -- which is why fit is instant and all the cost lands in predict.
One class covers the whole family. checkpoint selects the model:
-
amazon/chronos-bolt-{tiny,mini,small,base}-- Chronos-Bolt, a
-
amazon/chronos-2-- Chronos-2, the successor that extends the
__init__( self, checkpoint: str = 'amazon/chronos-bolt-small', context_length: Optional[int] = None, quantile_levels: Sequence[float] = DEFAULT_QUANTILES, device: Optional[str] = None) -> None, )
Overview
-
The last
context_lengthpoints of the series are scaled by their
- The scaled context is cut into fixed-length patches and each patch is
- A transformer encoder attends over the patch sequence; the decoder emits
- The quantiles are unscaled back to the series' units.
-
predictreturns the median;predict_quantilesreturns
Theory
Chronos-Bolt is trained with the quantile (pinball) loss summed over a fixed set of levels Q, which makes each output head a consistent estimator of the corresponding conditional quantile:
The original Chronos instead tokenised values into a vocabulary and trained a language model over them; Bolt replaces that with patching and the direct quantile head, which is where the speed-up comes from. Both rest on the same bet: a model that has seen enough series learns the patterns -- trend, seasonality, regime change -- as general knowledge, so at your series the whole "learning algorithm" is one forward pass.
Parameters
checkpoint
KNOWN_CHECKPOINTS.
context_length
None passes the whole series; the model itself caps what it attends to (2048 for Chronos-Bolt, 8192 for Chronos-2) and silently drops older points.
quantile_levels
predict_quantiles. Must include a value at or near 0.5, which predict reports.
device
'cpu', 'cuda', 'mps', or None to let the upstream pipeline choose.
Attributes
model_
chronos.BaseChronosPipeline.
series_
fit.
n_obs_
fit.
quantile_levels_
predict_quantiles.
Notes
Requires pip install 'tuiml[foundation]', which pulls in chronos-forecasting and PyTorch. Importing TuiML and constructing this class work without either; only fit needs them.
Weights are not shipped by TuiML. On first use chronos downloads the checkpoint from the Hugging Face Hub into ~/.cache/huggingface (about 190 MB for Bolt-small, 800 MB for Bolt-base and Chronos-2). Code and weights are Apache-2.0, compatible with TuiML's BSD-3-Clause, so there is no commercial-use restriction to accept. That is not true of every forecasting foundation model: Moirai's weights, for instance, are non-commercial, which is why it is not integrated here.
Saved models stay small. Pickling a fitted wrapper stores the context and the hyperparameters, never the checkpoint; the model is reloaded from the Hugging Face cache on the first forecast after loading.
Complexity: fitting costs one checkpoint load. Prediction is one transformer forward pass over n_{\text{context}} / P patches (patch length P = 16), independent of the horizon up to the model's native horizon of 64 steps; longer horizons are produced by feeding predictions back as context. A GPU is worth roughly an order of magnitude.
When to use ChronosForecaster:
- A strong forecast with zero tuning, on a series you have not modelled
- Many short series, where fitting a statistical model to each is the
- When you need calibrated quantiles, not just a point.
ThetaForecaster or SARIMAXForecaster when you need a model you can inspect, exogenous regressors, or a CPU-only deployment without PyTorch.References
See Also
Constructing and inspecting the model needs no optional dependency:
>>> from tuiml.foundation import ChronosForecaster
>>> model = ChronosForecaster(checkpoint="amazon/chronos-bolt-base")
>>> model.checkpoint
'amazon/chronos-bolt-base'
>>> "context_length" in model.get_parameter_schema()
True
Fitting requires pip install 'tuiml[foundation]' and downloads the
checkpoint on first use:
>>> import numpy as np # doctest: +SKIP
>>> t = np.arange(200) # doctest: +SKIP
>>> y = 10 + 0.05 * t + np.sin(2 * np.pi * t / 12) # doctest: +SKIP
>>> model.fit(y).predict(steps=3).round(1) # doctest: +SKIP
array([20.5, 21. , 21.4])
>>> model.predict_quantiles(steps=3).shape # doctest: +SKIP
(3, 9)