ts-ara / README.md
funara's picture
Upload folder using huggingface_hub
6118811 verified
|
Raw History Blame Contribute Delete
16.1 kB
---
license: apache-2.0
base_model: theforecastingcompany/t0-gamma
base_model_relation: quantized
pipeline_tag: time-series-forecasting
tags:
- onnx
- time-series
- forecasting
- probabilistic-forecasting
- foundation-model
- zero-shot
- covariates
- multivariate
- quantized
- cpu
---
# ts-ara
**ts-ara** is an **open-weight, Apache-2.0** probabilistic time-series forecasting runtime and model distribution derived from [`theforecastingcompany/t0-gamma`](https://huggingface.co/theforecastingcompany/t0-gamma) (~256M parameters, 21 native quantiles `0.01–0.99`) — ready for zero-shot univariate and multivariate forecasting with past and known-future covariates on standard CPUs and GPUs.
- **`ts-ara` *(Default ONNX, 488 MB)*:** Matches full-precision `t0-gamma` accuracy at half the weight footprint (`488.0 MB` vs. `975.1 MB`), with lower CPU memory (`1731.2 MB` vs. `2201.8 MB`) and no PyTorch runtime required (`178.6 ms` p50 CPU latency, CPU & CUDA compatible).
- **`ts-ara-small` *(Edge/CPU ONNX INT8, 257 MB)*:** Quantized for low-RAM and edge CPU deployment (`-74%` footprint, `-75%` peak RAM at `542.0 MB`, `91.8 ms` p50 latency).
- **Production Toolkit:** Unified NumPy arrays and `pandas` / `polars` / `pyarrow` DataFrames (`narwhals`), past and known-future covariates, optional periodic calendar alignment and covariate protection, and pure-NumPy online conformal calibration (`DtACI`).
## Visual Forecast Example
![Zero-shot 168-hour 2x2 probabilistic forecast examples on CPU](./assets/forecast_example.png)
*Zero-shot 168-hour CPU ONNX forecasts with 80% prediction intervals (512-hour context):*
* **Top row** shows `ts-ara` on energy price (`epf_de`) and solar generation (`solar_with_weather_1H`); *
* ***Bottom row** shows `ts-ara-small` (INT8) on the same series.*
## Artifact Tiers & CPU Footprint
| Tier | Artifact Path | Precision | Artifact Size | p50 Latency (CPU) | Peak RAM (Isolated) |
| :---------------------------------------- | :------------------------- | :-------------- | ---------------------: | --------------------: | ---------------------: |
| **`ts-ara`** *(Default)* | `onnx/ts-ara.onnx` | ONNX FP16  | `488.0 MB` | `178.6 ms` | `1731.2 MB` |
| **`ts-ara-small`** *(Edge/CPU)* | `onnx/ts-ara-small.onnx` | ONNX Mixed INT8 | **`256.9 MB`** | **`91.8 ms`** | **`542.0 MB`** |
| **Master** *(PyTorch)* | `model.safetensors` | PyTorch FP32 | `975.1 MB` | `256.3 ms` | `2201.8 MB` |
## Quick start
```bash
pip install "ts-ara[onnx,dataframe]"
```
> **How model weights work:** `pip install` installs the lightweight Python package and runtime. On your first `TSAraForecaster.from_tier(...)` call, the required ONNX weights are automatically downloaded from [`funara/ts-ara`](https://huggingface.co/funara/ts-ara) and cached locally for offline reuse.
```python
import numpy as np
from ts_ara import TSAraForecaster
model = TSAraForecaster.from_tier("ts-ara") # auto-downloads & caches once (~488 MB); or "ts-ara-small" (~257 MB)
history = 10 + np.sin(np.arange(500, dtype=np.float32) / 24 * 2 * np.pi)
fc = model.predict(history, horizon=48, quantile_levels=[0.1, 0.5, 0.9])
```
*(Optional)* Pre-download `"ts-ara"`, `"ts-ara-small"`, or `"both"`, or pass `exports_dir="/path/to/local/weights"` in air-gapped environments:
```python
from ts_ara import download_models
download_models("both") # "ts-ara", "ts-ara-small", or "both"
```
## DataFrames, Covariates & Conformal Calibration
```python
from ts_ara import DynamicAdaptiveConformalCalibrator, TSAraForecaster
model = TSAraForecaster.from_tier("ts-ara")
calibrator = DynamicAdaptiveConformalCalibrator(alpha=0.2)
fc_df = model.predict_df(
history_df,
horizon=24,
future_df=future_df,
covariate_cols=["temperature", "holiday"],
add_calendar_features="auto",
guard_covariates=False,
)
interval = calibrator.predict_interval(
fc_df["q_0.1"].to_numpy(), fc_df["q_0.9"].to_numpy(), forecast_id="win_0"
)
calibrator.observe(actual_y, forecast_id="win_0")
```
## Key Capabilities
- **PyTorch-Free ONNX Runtime:** Trace-clean ONNX graphs run cleanly on CPU and CUDA without PyTorch overhead, preserving unmodified pretrained weights while reducing memory footprint by 50% (`ts-ara`) to 74% (`ts-ara-small`).
- **Native DataFrames & Covariates:** `predict_df` accepts `pandas`, `polars`, and `pyarrow` panels via `narwhals`, supporting univariate, multivariate (`group_ids`), past-only (`past_covariate_cols`), and known-future (`covariate_cols`) exogenous features with ragged length-bucketed batching.
- **Calendar Alignment & Covariate Guard:** Opt-in `add_calendar_features` (`"auto"` or `True`) injects deterministic `sin`/`cos` periodic signals for calendar-driven series, while opt-in `guard_covariates=True` filters uninformative or noisy exogenous drivers based solely on historical context.
- **Adaptive Conformal Calibration (`CQR + ACI + DtACI`):** Pure-NumPy post-hoc calibration wrapper with multi-horizon delayed feedback keeps empirical interval coverage well calibrated under distribution shift and long rollouts.
## Benchmark Results
### `fev-bench` (`mini`, 20 official tasks)
The [Scaled Quantile Loss (SQL)](https://auto.gluon.ai/dev/tutorials/timeseries/forecasting-metrics.html#autogluon.timeseries.metrics.SQL) is a **scale-invariant** metric for evaluating **probabilistic** forecasts.
| Model | SQL Skill Score ↑ | MASE Skill Score ↑ | SQL Win Rate ↑ |
| :------------------------- | -----------------: | ------------------: | --------------: |
| `Timestral-209M` | **0.5619** | **0.4625** | **72.5%** |
| `timesfm-3` | 0.5496 | 0.4517 | 61.9% |
| `t0-gamma` | 0.5460 | 0.4452 | 68.8% |
| **`ts-ara`** | **0.5444** | **0.4435** | 62.5% |
| **`ts-ara-small`** | **0.5413** | **0.4383** | 55.6% |
| `Chronos-2` | 0.5112 | 0.4036 | 33.1% |
| `TiRex-2` | 0.4970 | 0.3936 | 28.1% |
*Skill scores relative to `Seasonal Naive` (`0.0000` SQL / `0.0000` MASE, `0.0%` win rate).*
### `Real-TSF/TIME` (12-task stratified tasks)
| Model | Norm. CRPS ↓ | Norm. MASE ↓ | CRPS Win Rate ↑ |
| :------------------------- | ---------------: | ---------------: | ---------------: |
| `Timestral-209M` | **0.5574** | 0.6776 | **79.8%** |
| `t0-gamma` | 0.5580 | **0.6660** | 63.1% |
| **`ts-ara`** | **0.5580** | **0.6661** | 60.7% |
| **`ts-ara-small`** | **0.5636** | **0.6662** | 57.1% |
| `TimesFM-3` | 0.5641 | 0.6772 | 70.2% |
| `Chronos-2` | 0.5851 | 0.7079 | 33.3% |
| `TiRex` | 0.5867 | 0.6849 | 32.1% |
*Normalised against `Seasonal Naive` (`1.0000` CRPS / `1.0000` MASE, `3.6%` win rate). All rival scores are aggregated from official per-task [`Real-TSF/TIME-Output`](https://huggingface.co/datasets/Real-TSF/TIME-Output) logs on the exact same 12 tasks (so absolute numbers differ from the full 98-task leaderboard).*
## Opt-In Feature Guidance
| Feature & Parameter | Default | Enable When | Leave Off When |
| :------------------------------------------------------------------------ | :-------: | :--------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------- |
| **Fourier Calendar** (`add_calendar_features="auto"` or `True`) | `False` | Sub-daily (`<1D`), daily (`1D`), or weekly (`1W`) calendar-driven series (`"auto"` filters out non-seasonal series). | Monthly/annual (`>=28D`), irregular grids, or latency-critical single-row calls. |
| **DtACI Calibration** (`DynamicAdaptiveConformalCalibrator`) | Wrapper | Production loops with sequential ground-truth feedback needing calibrated intervals under shift or long horizons. | One-shot static quantile outputs with no `observe(...)` feedback loop. |
| **Covariate Guard** (`guard_covariates=True`) | `False` | Noisy, uninformative, or shifted external drivers. | Curated, sparse, or nonlinear domain drivers where historical linear correlation may filter rare events. |
| **Dual-Context Vincentization** (`context_scales=(3072, 9216)`) | `None` | Long (`>4,096`) periodic or regime-shifting series when higher latency is acceptable. | Short contexts (`<=4,096`) or strict latency budgets. |
## Model Details
| Field | Value |
| :------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Parameters** | ~256M |
| **Architecture** | 24-layer alternating 2:1 patch transformer (16 time-attention + 8 group-attention, patch size 32) |
| **Horizon & Output** | Any horizon (parallel up to 1,024 steps, rollout beyond); 21 quantiles (`0.01–0.99`) |
| **ONNX Variants** | `onnx/ts-ara.onnx` (FP16 weights / FP32 compute, `488.0 MB`) · `onnx/ts-ara-small.onnx` (Mixed INT8, `256.9 MB`) |
| **Master Weights** | `model.safetensors` (FP32 unmodified `t0-gamma` weights, `975.1 MB`) |
| **Repository Files** | `model.safetensors`, `onnx/ts-ara.onnx`, `onnx/ts-ara-small.onnx`, `config.json`, `SHA256SUMS.txt`, `LICENSE`, `NOTICE`, `assets/forecast_example.png` |
## Limitations
- Requires a regular time grid; irregular timestamps must be resampled first.
- Outputs marginal quantiles rather than correlated joint sample paths.
- Enable `add_calendar_features` only on calendar-driven periodic series (or use `"auto"` on mixed panels).
- Forecasts are probabilistic estimates; validate on historical backtests before production use.
## Lineage & License
**ts-ara** is released under the **Apache License, Version 2.0** (see [`LICENSE`](./LICENSE) and [`NOTICE`](./NOTICE)). It is an independent, 0-gradient ONNX optimization and runtime distribution derived from [`theforecastingcompany/t0-gamma`](https://huggingface.co/theforecastingcompany/t0-gamma) and [`theforecastingcompany/tfc-t0`](https://github.com/theforecastingcompany/tfc-t0), and is **not** affiliated with or endorsed by The Forecasting Company. All upstream attributions (The Forecasting Company, Toto by Datadog, Chronos-2 by Amazon, TiRex by NXAI, and `rotary-embedding-torch` by Phil Wang) are preserved in [`NOTICE`](./NOTICE).
## References
`ts-ara`'s runtime architecture, quantization strategy, post-hoc calibration stack, and benchmarks build upon the following papers and datasets:
| Paper / Benchmark | Authors / Source | Role in `ts-ara` | Link |
| :--------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------- | :------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------- |
| **$t_0$: A Time-Series Foundation Model for Forecasting with Context** | Meyer et al. (2026) | Base 256M alternating time/group patch transformer & quantile forecasting | [arXiv:2609.24559](https://arxiv.org/abs/2609.24559) |
| **Conformalized Quantile Regression (CQR)** | Romano, Patterson & Candès (NeurIPS 2019) | Heteroscedastic nonconformity intervals over quantile outputs | [arXiv:1905.03222](https://arxiv.org/abs/1905.03222) |
| **Adaptive Conformal Inference (ACI)** | Gibbs & Candès (NeurIPS 2021) | Online miscoverage tracking under non-exchangeable time-series shifts | [arXiv:2106.00170](https://arxiv.org/abs/2106.00170) |
| **Conformal Inference for Online Prediction with Arbitrary Distribution Shifts (DtACI)** | Gibbs & Candès (JMLR 2024) | Parameter-free online expert aggregation over candidate step sizes | [arXiv:2208.08401](https://arxiv.org/abs/2208.08401) |
| **SmoothQuant** | Xiao et al. (ICML 2023) | Channel-wise outlier scaling for INT8 quantization (`ts-ara-small`) | [arXiv:2211.10438](https://arxiv.org/abs/2211.10438) |
| **Vincentization (Horizontal Quantile Averaging)** | Lichtendahl, Grushka-Cockayne & Winkler (*Management Science*, 2013) | Opt-in multi-context quantile averaging (`context_scales`) | [doi:10.1287/mnsc.1120.1667](https://doi.org/10.1287/mnsc.1120.1667) |
| **`fev-bench` & `Real-TSF/TIME`** | Shchur et al. (2025); Real-TSF | Standardized probabilistic time-series evaluation suites | [arXiv:2509.26468](https://arxiv.org/abs/2509.26468) · [Real-TSF/TIME](https://huggingface.co/datasets/Real-TSF/TIME) |
## Citation
```bibtex
@misc{tsara2026,
title = {ts-ara: Training-Free ONNX Optimization and Conformal Calibration for Time-Series Foundation Models},
author = {funara},
year = {2026},
howpublished = {\url{https://huggingface.co/funara/ts-ara}}
}
@article{meyer2026t0,
title = {$t_0$: A Time-Series Foundation Model for Forecasting with Context},
author = {Meyer, Lucas and Sole, Claudio and Xiang, Huikan and Li, Nicolas and Franceschino, Lucas and Quera-Bofarull, Arnau and Scholl, Maarten P. and Fainberg, Joachim and N{\'e}giar, Geoffrey},
journal = {arXiv preprint arXiv:2609.24559},
year = {2026}
}
```