ts-ara / README.md
funara's picture
Upload folder using huggingface_hub
dddd694 verified
|
Raw History Blame Contribute Delete
15.9 kB
metadata
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, production-grade probabilistic time-series forecasting model and ONNX runtime derived from theforecastingcompany/t0-gamma (~256M parameters, 24-layer alternating 2:1 time/group patch transformer, patch size 32), ready for zero-shot univariate and multivariate forecasting with past and known-future covariates directly on standard CPUs without PyTorch.

  • Production-default Mixed FP16 (ts-ara): Matches full FP32 t0-gamma accuracy (0.5580 vs. 0.5580 Norm. CRPS on Real-TSF/TIME) at half the weight footprint (488.1 MB vs. 975.1 MB), lower CPU memory and latency (1731.2 MB vs. 2201.8 MB RAM, 178.6 ms vs. 256.3 ms, zero PyTorch dependency) by keeping scalers and normalization in FP32.
  • Built-in production enhancements: Outperforms base FP32 t0-gamma on fev-bench (71.4% vs. 67.0% SQL Win Rate) with Fourier calendar alignment (add_calendar_features), protects against noisy or shifted drivers (guard_covariates), and keeps 80% prediction intervals calibrated under distribution shifts (73.2% -> 80.2%) and long horizons (h = 1,152) via online DtACI calibration.
  • Edge & low-RAM CPU tier (ts-ara-small): Mixed INT8 (256.9 MB, -74% size, -75% CPU RAM at 542.0 MB) runs in <0.1 s per forecast (91.8 ms p50) and outputs 21 native quantiles (0.01–0.99).

Visual Forecast Example

Zero-shot 168-hour probabilistic forecast examples on CPU

Live zero-shot 168-hour CPU ONNX forecasts on autogluon/fev_datasets: ts-ara (R² = 0.95, 91.7% 80% PI coverage, 220 ms CPU) on epf_de (2017-11-27–2017-12-03, with known-future load/renewable covariates) and ts-ara-small (R² = 0.94, 79.2% 80% PI coverage, 69 ms CPU) on solar_with_weather_1H (2022-08-03–2022-08-10), showing median (q0.50), 50% PI, and 80% PI.

Artifact Tiers & CPU Footprint

Tier Artifact Path Precision Artifact Size p50 Latency (CPU) Peak RAM (Isolated)
ts-ara (Default) onnx/ts-ara.onnx Mixed FP16 488.1 MB 178.6 ms 1731.2 MB
ts-ara-small (Edge/CPU) onnx/ts-ara-small.onnx Mixed INT8 256.9 MB 91.8 ms 542.0 MB
Master model.safetensors FP32 975.1 MB 256.3 ms 2201.8 MB

Quick start

pip install "ts-ara[onnx,dataframe]"
import numpy as np
from huggingface_hub import snapshot_download
from ts_ara import TSAraForecaster

local_dir = snapshot_download(
    repo_id="funara/ts-ara",
    allow_patterns=["config.json", "onnx/ts-ara.onnx"],
    # or "onnx/ts-ara-small.onnx"
)

model = TSAraForecaster.from_tier("ts-ara", exports_dir=local_dir)
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])

Covariates, Calendar Features & Conformal Calibration

from ts_ara import DynamicAdaptiveConformalCalibrator, TSAraForecaster

model = TSAraForecaster.from_tier("ts-ara", exports_dir=local_dir)
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")

Production Enhancements

Built-in export and inference-time upgrades engineered for reliable CPU deployment (preserving the unmodified pretrained weights):

  • Mixed-Precision ONNX Export: Eliminates host-device syncs for ONNX Runtime execution. ts-ara (Mixed FP16) keeps scalers and normalization in FP32 to prevent overflow; ts-ara-small (Mixed INT8) keeps the 6 Patch Encoder (3) and Quantile Decoder (3) MatMul nodes in FP32 while quantizing all 96 transformer linear projections (24 layers) to INT8, eliminating sinh tail amplification (-74% size, -75% RAM).
  • Fourier Calendar Features (add_calendar_features): Opt-in (False default, "auto" detrended harmonic $R^2$ + Bretherton $N_{\text{eff}}$ gate, or True span-gated) known-future $\sin/\cos$ periodic features to align phase across fixed 32-step patches on calendar-driven series.
  • Adaptive Conformal Calibration (CQR + ACI + DtACI): Pure-NumPy post-hoc calibration wrapper (Romano et al., 2019; Gibbs & Candès, 2021, 2024) with multi-horizon delayed feedback: recovers abrupt distribution shifts (73.2% -> 80.2%) and maintains long-horizon h=1,152 coverage (79.4%) at ~0.6 ms/step.
  • Zero-Leakage Preprocessing (guard_covariates, context_scales): Length-bucketed ragged batching, opt-in historical correlation/lag Covariate Guard (guard_covariates=True), and opt-in Dual-Context Vincentization (context_scales=(3072, 9216), Lichtendahl et al., 2013).

Benchmark Results

fev-bench (mini-cpu, 13 mini tasks, 2,013 forecasts)

The Scaled Quantile Loss (SQL) is a scale-invariant metric for evaluating probabilistic forecasts.

Model SQL Win Rate ↑ MASE Win Rate ↑ SQL Skill Score ↑ MASE Skill Score ↑
ts-ara (FP16) 71.4% 70.3% 0.5139 0.4395
Timestral-209M 69.2% 68.1% 0.5320 0.4574
t0-gamma (base) 67.0% 67.0% 0.5105 0.4354
ts-ara-small (INT8) 64.8% 60.4% 0.5082 0.4310
timesfm-3 59.3% 58.2% 0.5170 0.4434
Chronos-2 37.4% 42.9% 0.4685 0.3882
TiRex-2 30.8% 33.0% 0.4558 0.3813

Skill scores relative to Seasonal Naive (0.0000 SQL / 0.0000 MASE, 0.0% win rate); ts-ara tiers evaluated with span-gated Fourier calendar features enabled.

Real-TSF/TIME (12-task stratified subset of 98 tasks)

Model Norm. CRPS ↓ Norm. MASE ↓ CRPS Win Rate ↑
Timestral-209M 0.5574 0.6776 79.8%
t0-gamma (base) 0.5580 0.6660 63.1%
ts-ara (FP16) 0.5580 0.6661 60.7%
ts-ara-small (INT8) 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 logs on the exact same 12 tasks (so absolute numbers might be 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 surges). 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 h > 1,024. One-shot static quantile outputs with no observe(...) feedback loop.
Covariate Guard (guard_covariates=True) False Noisy, uninformative, or shifted external drivers (especially with ts-ara-small on sensor/weather channels). Curated, sparse, or nonlinear domain drivers where historical linear correlation may drop rare spikes.
Dual-Context Vincentization (context_scales=(3072, 9216)) None Long (>4,096) periodic or regime-shifting series when ~2x CPU 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, 488.1 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 and NOTICE). It is an independent, 0-gradient ONNX optimization and runtime distribution derived from theforecastingcompany/t0-gamma and 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.

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
Conformalized Quantile Regression (CQR) Romano, Patterson & Candès (NeurIPS 2019) Heteroscedastic nonconformity intervals over quantile outputs arXiv:1905.03222
Adaptive Conformal Inference (ACI) Gibbs & Candès (NeurIPS 2021) Online miscoverage tracking under non-exchangeable time-series shifts arXiv: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
SmoothQuant Xiao et al. (ICML 2023) Channel-wise outlier scaling for INT8 quantization (ts-ara-small) arXiv:2211.10438
Wanda Sun et al. (ICLR 2024) Training-free weight-and-activation pruning guardrail arXiv:2306.11695
RAP: KV-Cache Compression via RoPE-Aligned Pruning Xin et al. (2026) Paired $2 \times 2$ RoPE head-pair constraint for rotary attention safety arXiv:2602.02599
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
fev-bench & Real-TSF/TIME Shchur et al. (2025); Real-TSF Standardized probabilistic time-series evaluation suites arXiv:2509.26468 · Real-TSF/TIME

Citation

@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}
}