# Chronos — Pretrained Foundation Models for Time Series Forecasting > A family of pretrained language model-based forecasting models from Amazon Science that tokenize time series values and generate probabilistic predictions zero-shot. ## Install Save as a script file and run: # Chronos — Pretrained Foundation Models for Time Series Forecasting ## Quick Use ```bash pip install chronos-forecasting ``` ```python import torch from chronos import ChronosPipeline pipeline = ChronosPipeline.from_pretrained("amazon/chronos-t5-small", device_map="auto", torch_dtype=torch.float32) import numpy as np context = torch.tensor(np.random.randn(100)) forecast = pipeline.predict(context, prediction_length=12) ``` ## Introduction Chronos is a family of pretrained time series forecasting models developed by Amazon Science. Built on the T5 architecture, Chronos treats time series as a language modeling problem by tokenizing real-valued observations into discrete bins. This approach allows a single pretrained model to forecast any time series zero-shot, without task-specific fine-tuning. ## What Chronos Does - Provides pretrained foundation models (Tiny, Mini, Small, Base, Large) for zero-shot forecasting - Generates probabilistic forecasts with prediction intervals via sampling - Tokenizes continuous time series values into discrete tokens for language model processing - Supports fine-tuning on domain-specific datasets for improved accuracy - Integrates with Hugging Face Transformers for model loading and inference ## Architecture Overview Chronos is based on the T5 encoder-decoder architecture. Time series values are scaled and quantized into a fixed vocabulary of tokens. The encoder processes the context window of tokenized history, and the decoder autoregressively generates future token predictions. Multiple samples are drawn to produce probabilistic forecasts. Model sizes range from 8M parameters (Tiny) to 710M parameters (Large), trading speed for accuracy. ## Self-Hosting & Configuration - Install via `pip install chronos-forecasting` - Load models from Hugging Face Hub: `ChronosPipeline.from_pretrained("amazon/chronos-t5-small")` - Set `device_map="auto"` to use GPU if available, or specify a device explicitly - Adjust `num_samples` in `predict()` to control the number of probabilistic forecast samples - Use `torch_dtype=torch.float16` for faster inference on compatible hardware ## Key Features - Zero-shot forecasting on unseen time series without training - Probabilistic predictions with configurable sample counts - Multiple model sizes from 8M to 710M parameters - Hugging Face integration for easy model distribution and versioning - Trained on a large corpus of public and synthetic time series data ## Comparison with Similar Tools - **Darts** — Multi-model framework requiring per-dataset training; Chronos works zero-shot - **TimesFM** — Google's foundation model; Chronos is open-weight and uses a different tokenization - **Lag-Llama** — Autoregressive forecasting via LLM; Chronos uses encoder-decoder with binning - **GluonTS** — Probabilistic models needing training; Chronos provides pretrained weights - **Prophet** — Single statistical model; Chronos is a neural foundation model ## FAQ **Q: Does Chronos require training on my data?** A: No. Chronos works zero-shot out of the box. Fine-tuning is optional and can improve domain-specific accuracy. **Q: What hardware is needed to run Chronos?** A: The Tiny and Mini models run on CPU. Small and Base benefit from a GPU. Large requires a GPU with sufficient memory. **Q: How does tokenization handle different value scales?** A: Chronos normalizes each series by its mean absolute value before quantizing into bins, making it scale-invariant. **Q: What license is Chronos released under?** A: Chronos is released under the Apache 2.0 license. ## Sources - https://github.com/amazon-science/chronos-forecasting - https://arxiv.org/abs/2403.07815 --- Source: https://tokrepo.com/en/workflows/asset-050e6c76 Author: Script Depot