Skip to main content

mlx-timesfm

Pure MLX inference for Google TimesFM 3.0 on Apple silicon.

PyPI CI Python Apple Silicon MLX License

PyPI · Source

mlx-timesfm is an independent, inference-only implementation of TimesFM 3.0 for Apple MLX. It loads the original 330.7M-parameter FP32 checkpoint directly, without converted weights or a PyTorch runtime, and runs forecasting on Apple silicon through MLX and Metal.

Features

  • Native MLX model, transformer, normalization, masking, and forecast decode.
  • Direct mx.load() of the original model.safetensors checkpoint.
  • Univariate and multivariate forecasts with nine quantiles.
  • Past-only and past/future dynamic covariates.
  • Linear detrending, stitching, contiguous patch masking, and iterative RevIN.
  • Strict validation of all 445 checkpoint tensors and their shapes.
  • MLX-only CPU/GPU golden regression against a versioned real-data oracle.
  • Full-FP32 matrix kernels by default for numerically stable inference.

Status

Area Status
Core TimesFM 3.0 inference Implemented
Original checkpoint loading Validated
decode() and forecast() Implemented
Multivariate targets and covariates Validated
MLX CPU/GPU golden parity Passing
PyTorch-free runtime and tests Enforced
Training and fine-tuning Out of scope
KV-cache and compiled decode optimizations Not yet implemented

This is an initial alpha release. The reference inference path is implemented and parity-tested, but broader dataset validation and performance tuning remain ongoing.

Requirements

  • Apple silicon Mac with Metal support
  • Python 3.13
  • MLX 0.32.x
  • A separately downloaded TimesFM 3.0 checkpoint

Installation

Install from PyPI with uv:

uv add mlx-timesfm

Or install the current checkout for development:

git clone https://github.com/appautomaton/mlx-timesfm.git
cd mlx-timesfm
uv sync --locked

Model weights

Review and accept Google's checkpoint terms, then download the original files. One option is the Hugging Face CLI in an isolated uv tool environment:

uvx --from huggingface-hub hf download google/timesfm-3.0-pytorch \
  --local-dir models/timesfm_3_0/original

The checkpoint directory must contain:

models/timesfm_3_0/original/
├── config.json
└── model.safetensors

Weights remain local and are excluded from Git and all package distributions.

Quick start

import numpy as np

import mlx_timesfm

model = mlx_timesfm.load("models/timesfm_3_0/original")

# A batch of two univariate series, each with 512 context points.
target = np.random.default_rng(0).normal(size=(2, 512)).astype(np.float32)
quantiles = model.forecast(target, horizon=128)

print(quantiles.shape)  # (2, 1, 128, 9)
median = quantiles[..., 4]

Inputs may be one-dimensional (time), two-dimensional (batch, time), or three-dimensional (batch, variate, time). The output is always (batch, variate, horizon, 9), ordered from the 0.1 through 0.9 quantiles.

Covariates

target = np.zeros((1, 3, 512), dtype=np.float32)
past_only = np.zeros((1, 2, 512), dtype=np.float32)
past_future = np.zeros((1, 2, 512 + 128), dtype=np.float32)

quantiles = model.forecast(
    target,
    horizon=128,
    past_only_covariates=past_only,
    past_future_covariates=past_future,
)

Boolean masks use True for missing or invalid values. forecast() accepts a global context mask; decode() exposes separate masks for targets and both covariate groups.

Numerical precision

FP32 is the supported correctness baseline. MLX can otherwise choose reduced-precision matrix kernels while keeping FP32 array dtypes, so importing mlx_timesfm defaults MLX_ENABLE_TF32 to 0 before MLX computation. An explicit environment setting is preserved:

# Optional faster/reduced-precision experiment; not the parity baseline.
MLX_ENABLE_TF32=1 uv run python your_forecast.py

The model also pins the effective FP32 RMSNorm epsilon used to establish the golden oracle. FP16 and BF16 inference are not currently supported profiles.

Parity

The permanent regression uses 512 real context observations and a 128-step forecast from the UCI Appliances Energy Prediction dataset. It exercises three targets, two past-only covariates, two past/future covariates, every forecast quantile, and quantile ordering.

Comparison Maximum absolute difference Tolerance used Result
Frozen oracle → MLX CPU 0.00308228 3.3% of allowed band Pass
Frozen oracle → MLX GPU 0.00833130 8.2% of allowed band Pass

The golden manifest pins the dataset, source revision, checkpoint/config hashes, execution profile, output shape, and tolerance. These numbers establish implementation parity; they are not claims about forecast accuracy on every downstream dataset.

Development

uv sync --locked
uv run ruff check .
uv run pytest
uv build --no-sources

The normal test suite is MLX-only. With the original checkpoint present it runs the golden on MLX CPU and GPU; without the checkpoint, only the seven weight-dependent checks skip. A permanent hygiene test rejects retired framework imports and dependencies.

Release process

GitHub releases with tags matching v<version> trigger .github/workflows/workflow.yml. The workflow validates tag/version agreement, tests the project, builds and inspects both distributions, smoke-tests installed artifacts, and publishes through PyPI Trusted Publishing. Releases are not published from developer-machine credentials.

The pending PyPI publisher must match:

  • Owner: appautomaton
  • Repository: mlx-timesfm
  • Workflow: workflow.yml
  • Environment: pypi

Licensing

Project source code is Apache-2.0 licensed; see LICENSE. Third-party attributions are recorded in THIRD_PARTY_NOTICES.md. The separately distributed TimesFM 3.0 checkpoint has different, restrictive terms described above.

TimesFM is a Google trademark. This independent project is not affiliated with or endorsed by Google.


Built and maintained by AppAutomaton. Explore more MLX-native projects on GitHub and Hugging Face.

Metadata

Release files for mlx-timesfm 0.0.1

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

Source distribution (sdist)

Source distribution for mlx-timesfm 0.0.1
File Size Uploaded Provenance Actions
mlx_timesfm-0.0.1.tar.gz 82.1 kB With provenance Details for mlx_timesfm-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mlx-timesfm 0.0.1
File Interpreter ABI Platform Actions
mlx_timesfm-0.0.1-py3-none-any.whl Python 3 none any Details for mlx_timesfm-0.0.1-py3-none-any.whl

Total release size: 117.3 kB

Release files / mlx_timesfm-0.0.1.tar.gz

Download URL mlx_timesfm-0.0.1.tar.gz
Size 82.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f97b7e4dedb2ee4d21177a3cde1cfbbcbb0901a814135f542b76ad83e5b04bc8
BLAKE2b-256 checksum
How to use checksums
e625893f5eaadce0d59a1735b34335072f961bd5b7f30e160589cbfa6c021365
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 2, 2026.

Transparency log

Release files / mlx_timesfm-0.0.1-py3-none-any.whl

Download URL mlx_timesfm-0.0.1-py3-none-any.whl
Size 35.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
121f11ca8241a9ecce4c90b6bf072a752ec7bc3ae05b5b31065273be7dd1f35d
BLAKE2b-256 checksum
How to use checksums
3099d6a76329f19c5c025ec62d0c119717ad6d7a601674ae1849023f021cf324
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 2, 2026.

Transparency log

Security for mlx-timesfm 0.0.1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mlx_timesfm-0.0.1.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 2, 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

0.0.1 This release

2 release files Full provenance

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