Timestral-28M (ONNX)
ONNX export of mistralai/Timestral-28M (revision 49b2640; d_model 384, 6 heads, 12 blocks) for onnxruntime and onnxruntime-web (wasm and WebGPU). fp32, 111.8 MB.
It powers the browser game Unpredictable, where you try to escape Timestral's forecast of your own pen.
What is in the graph
Only the network: patch embedding, the transformer, and the quantile head. Timestral computes its causal per-patch statistics in float64, which WebGPU can't do, so normalization and everything after the head stay outside the graph. You must reproduce them; reference/prep.ts (TypeScript) and reference/core.py (Python, against the upstream timestral package) do.
The export uses a fixed context of 512 steps (16 patches of 32) and a horizon of 32 steps (one patch). With a one-patch horizon, upstream's block-refinement step is skipped, so this graph plus the pre/post-processing reproduces TimestralForecaster.forecast(context, prediction_length=32) exactly. Longer contexts, longer horizons and covariates are not supported by this export.
| Input | Type | Shape | Meaning |
|---|---|---|---|
scaled |
float32 | [R, 512] | asinh((x − loc) / scale), causal per-patch stats; 0 where missing |
missing |
float32 | [R, 512] | 1 where the value is missing (left padding = missing) |
time_mask |
bool | [R, 1, 17, 17] | 16 context tokens + 1 forecast token |
variate_mask |
bool | [17, 1, R, R] | identity for independent rows |
positions |
int64 | [R, 17] | token index minus the first observed patch |
Output: preds float32 [R, 32, 21], normalized quantiles at levels 0.01, 0.05, 0.1, …, 0.95, 0.99. Denormalize with the last patch's loc/scale: sinh(p) * scale + loc. Then clamp non-finite values, cap at ±1e4·scale around the context range, and (upstream defaults) average with the mirrored forecast of −x and clip at 0 for non-negative contexts. Feed rows [x, −x] as R=2 to get symmetric averaging in one call.
Parity
Max |Δ| over all 21 quantiles × 32 steps against upstream forecast() (timestral a534bdb), across 9 fixtures (sine, random walk, step, flat, noise, three human-like strokes, a short left-padded context):
| Runtime | Worst |Δ| | |---|---| | onnxruntime (Python, CPU) | 5.60e-6 | | onnxruntime-web 1.30, wasm | 6.20e-6 | | onnxruntime-web 1.30, WebGPU | 2.32e-6 |
Latency
One forecast = pre-processing + one R=2 session.run + post-processing, in a Web Worker, Chromium on an Apple M3 Pro, 200 runs:
| Backend | p50 ms | p95 ms |
|---|---|---|
| wasm | 80.30 | 82.70 |
| webgpu | 56.10 | 74.50 |
Files
onnx/model.onnx: the graph (opset 18, dynamic R)config.json: upstream config, for referencereference/prep.ts: pre/post-processing in TypeScript (used by the game)reference/core.py,reference/export_onnx.py: how the graph and its inputs were built
License and attribution
The weights are Mistral AI's, released under a modified MIT license; see LICENSE (attribution notice: 2026 - Mistral AI). It includes a revenue threshold: read it before commercial use. Upstream code: Apache-2.0 at github.com/mistralai/timestral.
- Downloads last month
- 190
Model tree for onnx-community/Timestral-28M-ONNX
Base model
mistralai/Timestral-28M