Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

The Forecasting Company

t0 for MLX

PyPI Python versions License

Open-weights time-series forecasting foundation model from The Forecasting Company. t0 is a transformer-based model that produces probabilistic multi-horizon forecasts and natively operates on multiple covariates. t0-alpha is our first iteration of the model.

tfc-t0-mlx is the first-party inference runtime optimized for Apple silicon. It loads the same original t0-alpha safetensors checkpoint as tfc-t0 and does not install PyTorch.

The MLX and PyTorch runtimes are developed together in this repository while remaining separate PyPI distributions with independent dependency trees.

You can use t0 on Retrocast, our platform for forecasting on your own data. You can also compare forecasts across different open-weight models.

Choose how to run t0-alpha

Use case Install or open
Local inference on Apple silicon with MLX pip install tfc-t0-mlx
Local inference with PyTorch pip install tfc-t0
Managed inference without local weights The Forecasting Company API

Both local runtimes load the same model repository and offer a closely matched T0Forecaster.predict() API. MLX compilation is available as an opt-in optimization for repeated input shapes.

t0 forecasting French national electricity demand in Retrocast

t0 forecasting French national electricity demand in Retrocast. Data: Enedis open data.

📈 Forecasting with covariates

t0 leverages covariate information, in the past and future when available, to improve its forecast.

Without covariates With covariates
t0 forecast without covariates t0 forecast with covariates

Data: Medic'AM, monthly drug reimbursements from the French national health insurance.

The Quickstart below shows the API for both a plain univariate forecast and a multivariate forecast that conditions on historical and known-future covariates.

🚀 Quickstart

tfc-t0-mlx requires Apple silicon, macOS 14 or newer, and a native arm64 Python 3.10 or newer. MLX uses the Apple GPU automatically; there is no PyTorch-style device selection or .to("mps") step.

pip install tfc-t0-mlx

The model repository is gated. Accept its terms on Hugging Face and run hf auth login before the first download.

The simplest path is a univariate forecast through predict:

import numpy as np
from t0_mlx import T0Forecaster

model = T0Forecaster.from_pretrained("theforecastingcompany/t0-alpha").eval()

context = np.random.randn(4, 512).astype(np.float32)  # 4 series, 512 past timesteps
out = model.predict(context, horizon=64, quantiles=[0.1, 0.5, 0.9])
out.quantiles.shape  # (4, 64, 3)
out.median.shape     # (4, 64)

predict accepts NumPy and MLX arrays. One-dimensional contexts are automatically promoted to a single-row batch. NaN in the context is read as a missing observation; to say that some cells are padding instead, pass a mask — see batched inference.

For a shape that will be called repeatedly, compilation is opt-in:

model.compile()
out = model.predict(context, horizon=64)

Forecasting with covariates

Anything you know over the past goes in context — alongside the target, extra variates attend to it and are forecast together. Anything you know over the future (calendar features, planned promotions, weather forecasts) goes in future_covariates, shaped [B, F, context + horizon]; the model conditions on it but does not forecast it.

import numpy as np
from t0_mlx import T0Forecaster

model = T0Forecaster.from_pretrained("theforecastingcompany/t0-alpha").eval()

context = np.random.randn(2, 512).astype(np.float32)
future_covariates = np.random.randn(2, 3, 512 + 64).astype(np.float32)

out = model.predict(
    context,
    horizon=64,
    quantiles=[0.1, 0.5, 0.9],
    future_covariates=future_covariates,
)
out.quantiles.shape  # (2, 64, 3)
out.median.shape     # (2, 64)

Batched inference

import numpy as np
from t0_mlx import T0Forecaster, batch_series

model = T0Forecaster.from_pretrained("theforecastingcompany/t0-alpha").eval()

daily = np.random.randn(180)    # one series, 180 past timesteps
store = np.random.randn(2, 96)  # one series of 2 variates, 96 past timesteps
hourly = np.random.randn(1024)  # one series, 1024 past timesteps

context, mask, group_ids = batch_series([daily, store, hourly])
context.shape  # (4, 1024) — variates stacked, right-aligned to the longest
group_ids      # [0, 1, 1, 2] — `store`'s two variates are forecast jointly

out = model.predict(
    context,
    horizon=24,
    quantiles=[0.1, 0.5, 0.9],
    mask=mask,
    group_ids=group_ids,
)
out.quantiles.shape  # (4, 24, 3)
out.median[0]        # the 24-step median forecast for `daily`

For efficient inference at scale, look at Retrocast.

🏗️ Architecture

t0 is a decoder-style patch transformer that alternates time and covariate attention layers. It predicts 5 quantiles (0.1, 0.25, 0.5, 0.75, 0.9), decoding multiple horizons in parallel — up to 1024 timesteps in one forward pass — and falling back on autoregressive rollout for longer horizons.

Parameters ~102M
Layers 24
Embedding dim 512
Feedforward dim 2048
Attention heads 8
Patch size 32
Quantile levels 0.1, 0.25, 0.5, 0.75, 0.9

Performance

On an Apple M1 Pro, compiled MLX was 3.37–3.59x faster than PyTorch MPS and 5.23–6.86x faster than PyTorch CPU across three representative workloads. MLX eager was 2.61–2.67x faster than PyTorch MPS. These measurements exclude model loading and the compiled path's shape-dependent first call.

See the complete benchmark for the reproducible script, environment, methodology, raw timings, and compilation caveats.

🧬 Lineage

t0 builds on ideas — and in places, code — from open-source forecasting models. We gratefully acknowledge:

  • Toto by Datadog (repo) and Chronos-2 by Amazon (repo) — factorizing attention in the time and variates dimensions.
  • TiRex by NXAI (repo) — contiguous patch masking.
  • rotary-embedding-torch by Phil Wang (repo) — rotary position embedding behavior.

Code-level attributions are listed in NOTICE, under their respective open-source licenses. This MLX implementation is based on the first-party PyTorch architecture and checkpoint.

🧰 Public API

The top-level API mirrors tfc-t0:

  • T0Forecaster — MLX nn.Module with from_pretrained, save_pretrained, opt-in compile / uncompile, and the user-facing predict(context, horizon, quantiles, future_covariates, mask, group_ids).
  • Forecast — the object returned by the model.
  • T0Config — the configuration of the model; T0Config.medium() is the published one.
  • MaskType — the reason a time step is masked out, including PAD and MISSING.
  • batch_series — utility to batch time series of potentially different lengths.

The runtime supports univariate and multivariate inputs, missing values, explicit groups, known-future covariates, requested-quantile interpolation, and arbitrary positive horizons. Forecasts beyond the native 1024-step pass continue autoregressively, matching tfc-t0.

Development

From the repository root:

cd mlx
uv sync
uv run pytest
uv run ruff check .

To run checkpoint-backed parity tests, point them at a local directory holding the original config.json and model.safetensors. The checked release record is in PARITY.md:

T0_MLX_CHECKPOINT=/path/to/t0-alpha uv run --extra parity pytest

The MLX parameter tree has the same tensor names, shapes, dtypes, and linear-layer orientation as the original checkpoint, so no numerical weight conversion or separate MLX checkpoint is required. tools/validate_checkpoint.py validates this contract without copying or rewriting the weights.

📚 Citation

If our model is useful, please use the following citation and star our repo!

@misc{tfc-t0,
  title  = {t0: A time-series forecasting foundation model},
  author = {The Forecasting Company},
  year   = {2026},
  url    = {https://huggingface.co/theforecastingcompany/t0-alpha},
}

⚖️ License

Apache-2.0 — see LICENSE and NOTICE.

Metadata

Release files for tfc-t0-mlx 0.1.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tfc-t0-mlx 0.1.0a1
File Size Uploaded Provenance
tfc_t0_mlx-0.1.0a1.tar.gz 37.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tfc-t0-mlx 0.1.0a1
File Interpreter ABI Platform
tfc_t0_mlx-0.1.0a1-py3-none-any.whl Python 3 none any Details

Total release size: 64.2 kB

Release files / tfc_t0_mlx-0.1.0a1.tar.gz

Download URL tfc_t0_mlx-0.1.0a1.tar.gz
Size 37.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3dff078a38f63e33ebd66265dc5f4e377407992748512e214d5f184f10fd8057
BLAKE2b-256 checksum
How to use checksums
34a9860f0f8eb9003789e1b77a8108483e06cf41b215699a3859a294c4807751
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.

Transparency log

Release files / tfc_t0_mlx-0.1.0a1-py3-none-any.whl

Download URL tfc_t0_mlx-0.1.0a1-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14da0eee3671a8c228515d862e232bb4f6ac6f0972f81b549c39bfa11e7ebb93
BLAKE2b-256 checksum
How to use checksums
48915f0d2094620c43af70dea100d0c310d5c2bd25c7a2d87c3821023a784d85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.

Transparency log

Security for tfc-t0-mlx 0.1.0a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tfc_t0_mlx-0.1.0a1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page