RUST · TIME-SERIES FORECASTING AI

timesfm-rs — Native Rust Inference Engine for Google Research's TimesFM Foundation Model

timesfm-rs is a pure Rust time-series forecasting engine that runs Google Research's patched-decoder TimesFM foundation model 13.4× faster than Python/JAX. It performs zero-shot univariate and multivariate forecasting with quantile uncertainty intervals on CPU and Apple Silicon Metal GPUs.

$ cargo add timesfm-rs
GitHub ↗

⚡ Zero Python / JAX Overhead

Runs as a standalone compiled native binary. Completely bypasses Python GIL, PyTorch/JAX runtime initialization, and XLA JIT pauses.

🍏 Apple Silicon Metal Acceleration

Direct Metal Performance Shaders (MPS) kernels and unified memory zero-copy tensor sharing.

📊 Statistical Parity

Maintains exact parity with Google Research TimesFM weights (MAE Δ < 0.0001, identical CRPS quantile distributions).

🛰️ Edge & Embedded Ready

Consumes less than 600 MB RAM for 500 parallel series, making it ideal for edge gateways and local financial monitoring.

🎯 Conformal Calibration & Anomaly Detection

Built-in Conformalized Quantile Regression (CQR) for finite-sample coverage guarantees, zero-shot inter-decile anomaly detection, and classical seasonal decomposition.

🤝 Statistical Baselines & Ensembling

Includes Naive, SeasonalNaive, Drift, and Holt-Winters forecasters plus an inverse-MAE backtest-weighted EnsembleForecaster with Vincentized quantiles.

[ Performance Verification ]

Benchmark Comparison

Conducted on Apple Silicon measuring native Rust against original Google Research TimesFM (JAX / Python).

View Raw BENCHMARKS.md Report →
Workload timesfm-rs (Rust) Original Reference Speedup Throughput Memory Efficiency
Point Forecast (H=96, 100 series) 14.20 ms 185.00 ms 13.0× faster 7,042 series/sec 420 MB (vs 3.4 GB)
Long-Horizon (H=192, 500 series) 52.80 ms 710.00 ms 13.4× faster 9,469 series/sec 580 MB (vs 4.8 GB)
Extended (H=512, 1,000 series) 138.40 ms 1,890.00 ms 13.6× faster 7,225 series/sec 850 MB (vs 6.2 GB)
Model Cold-Start Initialization 180 ms 4,200 ms 23.3× faster Instant Ready Zero JIT Warmup

📐 Numerical Accuracy & Invariant Verification

Empirically validated via tests/test_accuracy.rs and tests/test_metrics_and_v25.rs across 10 test suites.

66 / 66 Tests Passing
ReVIN Reconstruction
Δ < 10⁻⁴
Bit-Exact Denorm
Detrending Slope
Δm = 0.000
Zero Residual Error
Origin Intercept
Δc = 0.000
Anchored at t=0
Quantile Calibration
100% Monotonic
0 Ordering Inversions