In this series / On this page· 6 of 6

Timestral: Mistral's Forecasting Transformer, and How to Run It

How Mistral's Timestral turns patches of numbers into 21 quantiles, what its license allows, and verified code to run and serve it on a CPU.

20 min readUpdated
A blueprint drawing of a past time series carved as a relief and cut into patches, entering a block engraved with Mistral's pixel M, with the forecast continuing as gold slabs holding a widening quantile band.
The series goes in as patches of 32 steps and comes out as a forecast with its uncertainty. The Mistral AI logo is a trademark of Mistral AI.

On 15 October 2026, Mistral released Timestral, four transformers that forecast time series instead of writing text: 5M to 209M parameters, open weights, and fast enough to run on a CPU. You give it the history of one or more series and it returns 21 quantiles for every future step, under a weights license that stops at $20M of monthly revenue.

What Mistral released

It is the lab's first time-series model family: one architecture in four sizes, read here from each model's config.json and file sizes on Hugging Face.

Timestral-5M 28M 123M 209M
Width (d_model) 192 384 640 768
Layers 8 12 20 24
Attention heads 3 6 10 12
Weights (FP32 safetensors) 21 MB 111 MB 490 MB 837 MB

All four read up to 32,768 past steps and answer with the same 21 quantile levels, from 0.01 to 0.99. Mistral says the 209M model "ranks first on all three of the field's main public benchmarks, GIFT-Eval, TIME, and fev-bench". That is Mistral's claim; we did not re-run the benchmarks.

How it works

The whole inference package is about 1,700 lines of PyTorch in mistralai/timestral, so every step below can be checked in the code.

Patches, not tokens. There is no vocabulary. Each series is normalized causally, with the mean and standard deviation of everything observed up to the end of each patch and an asinh squash on top (scaler.py), then cut into patches of 32 steps. A small MLP turns each patch, its 32 values plus 32 missing-value flags, into one embedding. Three weeks of 15-minute data, 2,016 steps, becomes 63 positions in the sequence: an LLM reading the same span as text would need thousands of tokens.

Context tokens, then forecast queries. After the context patches, the model appends forecast-query tokens: one learned vector, repeated once per future patch. The context tokens attend causally, as in a decoder. Each forecast token reads the whole context and the forecast tokens before it in its block. (With covariates the layout becomes two streams, a context token and a query token per patch, under the same rule.) Mistral calls the training scheme DHF, decoupled horizon forecasting: the history stays in the sequence intact and separate tokens ask the questions. Toto 2.0 and TimesFM-3, Mistral writes, instead mask out the values to forecast, which then look like missing data and are lost as context for later forecasts.

Two attention axes. Most layers attend along time, within one series. One layer in four (the time_variate entries of block_schedule) also attends across the rows of one group: the target variates of a multivariate series and their covariates.

Quantiles out, never crossing. Each forecast token's output head emits 32 × 21 numbers: 21 quantiles for each of its 32 steps. The median is free, and the others fan out from it by cumulative positive widths (softplus, then cumsum), so the 0.9 quantile can never fall below the 0.8 (monotone_quantiles). Training minimizes a pinball loss over the 21 levels, which penalizes a forecast above the truth and one below it in the proportion each quantile implies.

A series of 2,016 steps cut into 63 patches of 32 steps; each patch becomes a context token; 3 forecast-query tokens follow; the model returns, for each of the 96 future steps, 21 quantiles drawn as nested bands around the median.A series of 2,016 steps cut into 63 patches of 32 steps; each patch becomes a context token; 3 forecast-query tokens follow; the model returns, for each of the 96 future steps, 21 quantiles drawn as nested bands around the median.

Nothing is cached between calls: each pass re-reads the whole context, which at 66 positions is cheap.

No KV cache, no decode loop. One forward pass takes the context and up to 32 forecast tokens (1,024 steps) through the network together; the default forecast() call runs two such passes (below). Nothing is kept between calls, and each call re-reads the whole context. For a horizon past 1,024 steps, the forecaster chains blocks, appending each block's median to the context before the next pass.

An LLM Timestral
Input text tokens from a vocabulary patches of 32 numbers
Output one token per step, sampled 21 quantiles for each step
Passes per answer prefill, then one decode step per token (prefill and decode) one per 1,024 steps (two with the default averaging)
State between steps the KV cache none
Sequence length at 3 weeks of 15-minute data thousands of tokens 63 patches + 3 forecast tokens

That is why a CPU is enough. At about 2 FLOPs per parameter per position, one pass of the 209M model over 66 positions is about 28 GFLOP, a few tens of milliseconds for eight modern cores, and there is no cache to hold in fast memory.

Trained mostly on synthetic data. Mistral pretrained on purely synthetic series (trends, seasonality, noise, then nonlinear dependencies between them) at a context of 8,192, and post-trained on real and synthetic data at 4× that. This matters for benchmarks: models trained on public datasets can meet their test series in training, and the Chronos-2 report measured that leakage per model on fev-bench. Synthetic pretraining doesn't rule it out, since post-training uses real data, but it shrinks the surface.

Covariates

A covariate is a series you feed alongside the target to help forecast it. Timestral gives every row of the input a role, and the attention masks enforce what each role may read:

Role Known over Example Argument shape
Target the context requests per minute, power draw, sales context: (B, V, T)
Past-only covariate the context observed temperature, queue depth past_covariates: (B, C, T)
Known-future covariate the context and the horizon holidays, a planned release, a weather forecast known_covariates: (B, C, T + H)
Categorical covariate either region, day type, machine state categorical_past_covariates / categorical_known_covariates

Information flows only from covariates to targets. A covariate row never reads a target, and a known-future row never reads a causal row (variate_firewall): without that second rule, a covariate's view of the future could carry the target's own future back into it. A known-future row holding only 0 and 1 skips the normalization and the asinh squash, so an indicator stays a 0/1 switch. Categorical codes are target-encoded per series: for a single-target series, each code becomes the smoothed mean of the target where it occurred, so you pass codes, not one-hot columns. A code that never changes within a series encodes to that series' own mean, a flat row that adds nothing: a categorical covariate has to vary over time to help. Covariates are not free: each row becomes its own token sequence, with a context and a query token per patch, so the work grows with the number of rows.

This is where Timestral differs from the forecasters most people tried first: in the Chronos-2 report's capability table, TimesFM-2.5 and Moirai-2.0 take only the series itself. Amazon's Chronos-2, released in October 2025, already takes all three kinds.

Running it

The package needs PyTorch 2.4 or later, NumPy, safetensors and huggingface_hub. Everything below ran on the GX10's CPU (Arm Cortex-X925 and A725 cores) in a python:3.12-slim container with PyTorch 2.15.0 (CPU build) and timestral at commit a534bdb, the repository's only commit.

$ pip install https://github.com/mistralai/timestral/archive/a534bdbd244d64f3d9d743f46c7bf6fc330ed4ff.zip

The input is an array shaped (series, variates, time), or (series, time) for single-variate series, oldest step first. NaN marks a missing value, so gaps and series of different lengths need no special handling:

import numpy as np
from timestral import TimestralForecaster

forecaster = TimestralForecaster.from_pretrained("mistralai/Timestral-209M")   # device="cuda" for a GPU

history = ...                                  # your data, shape (4, 2016): 4 series, 3 weeks at 15 minutes
fc = forecaster.forecast(history, prediction_length=96)

fc.quantiles.shape        # (4, 1, 96, 21): series, variates, horizon, quantile levels
fc.median                 # (4, 1, 96)
fc.quantile(0.9)          # (4, 1, 96); levels are fc.quantile_levels, 0.01 to 0.99

Covariates go in the same call. Here, a planned event known in advance as a 0/1 row, and a day type (weekday or weekend) as a categorical code; both cover the context and the horizon, 2,016 + 96 steps:

event = np.zeros((4, 1, 2016 + 96)); event[:, :, 2016 + 40 : 2016 + 56] = 1     # 4 hours, tomorrow
step = np.arange(2016 + 96)
day_type = np.tile(((step // 96) % 7 >= 5).astype(float), (4, 1, 1))     # 0 weekday, 1 weekend
fc = forecaster.forecast(history, prediction_length=96,
                         known_covariates=event, categorical_known_covariates=day_type)

On our synthetic load series, these two covariates moved the median by up to 5.1% of the mean level. Get the length wrong by one step and the call stops with known_covariates must be (B=4, C, 2112), got (4, 1, 2111).

Two defaults change what you pay and what you get. forecast() runs the model twice unless told otherwise: once on the history and once on its negation, then reflects the second forecast and averages the two (forecaster.py):

# src/timestral/forecaster.py (lines 220-230) @ a534bdb, TimestralForecaster.forecast
quantiles = self._forecast_raw(inputs, mask, prediction_length, **covariates)
if symmetric_averaging:
    # ... (trimmed: assert that the quantile levels are symmetric about 0.5)
    mirrored = self._forecast_raw(-inputs, mask, prediction_length, **mirrored_covariates)
    quantiles = 0.5 * (quantiles + (-mirrored).flip(-1))
if clip_nonnegative:
    eligible = nonnegative_context(inputs, mask)
    quantiles = torch.where(eligible[..., None, None], quantiles.clamp_min(0), quantiles)

symmetric_averaging=False halves the compute, and the latency with it: every size in the table below runs in half the time without it. clip_nonnegative clamps the forecast at zero for any series whose history never went negative.

We timed Mistral's case: one series, three weeks of 15-minute history (2,016 steps), one day ahead (96 steps). The run used 8 threads pinned to the same machine's eight performance cores (Cortex-X925), and each figure is the median of 20 calls after 3 warm-ups:

Model Default (two passes) symmetric_averaging=False
5M 13 ms 7 ms
28M 24 ms 11 ms
123M 72 ms 35 ms
209M 113 ms 57 ms

Mistral reports 17 ms and 113 ms for the 5M and 209M on an 8-thread server CPU, and the 28M 3.6 times faster than the 209M; here the gap between sizes was wider, 4.8 times. Start with the 28M: one day-ahead forecast costs 24 ms on eight cores, and more series ride in the same call. Move up only if a backtest on your own data says the larger model is worth 3 to 5 times the CPU. Core type matters as much as size, see the gotcha on pinning.

Offline and pinned. from_pretrained fetches only config.json and model.safetensors. For a machine without network access, download them once, then load with local_files_only=True (or HF_HUB_OFFLINE=1); revision= pins a Hub commit. The repositories are already being edited (README changes on 19 October), so pin, and a weights update can't change your forecasts silently (we ran revisions bdd20cf, 49b2640, 5a14728 and 9874d25 for the four sizes):

from huggingface_hub import snapshot_download

snapshot_download("mistralai/Timestral-28M", allow_patterns=["config.json", "model.safetensors"])
forecaster = TimestralForecaster.from_pretrained("mistralai/Timestral-28M", local_files_only=True)

As a service. No inference engine serves Timestral and Hugging Face lists no inference provider for it. Mistral's docs list the four sizes as "Public Preview" models, but we found no API endpoint or price for them, so serving it yourself means a small HTTP wrapper. This one takes series of any length, left-pads them with NaN (the model reads that as missing history) and forecasts the whole request in one batched call:

# serve.py: MODEL=mistralai/Timestral-28M uvicorn serve:app --host 0.0.0.0 --port 8000
import os

import numpy as np
import torch
from fastapi import FastAPI
from pydantic import BaseModel
from timestral import TimestralForecaster

torch.set_num_threads(int(os.environ.get("THREADS", "8")))
forecaster = TimestralForecaster.from_pretrained(os.environ.get("MODEL", "mistralai/Timestral-28M"))
app = FastAPI()


class Request(BaseModel):
    series: list[list[float | None]]           # one list per series, oldest first; null = missing
    horizon: int
    quantiles: list[float] = [0.1, 0.5, 0.9]


@app.post("/forecast")
def forecast(req: Request):
    t = max(len(s) for s in req.series)
    context = np.full((len(req.series), t), np.nan)
    for i, s in enumerate(req.series):
        context[i, t - len(s):] = [np.nan if v is None else v for v in s]
    fc = forecaster.forecast(context, prediction_length=req.horizon)   # all series in one batch
    return {str(q): fc.quantile(q)[:, 0].tolist() for q in req.quantiles}

And its image, CPU-only PyTorch, weights baked in so the container starts without network access:

FROM python:3.12-slim
RUN pip install --no-cache-dir torch==2.15.0 --index-url https://download.pytorch.org/whl/cpu \
 && pip install --no-cache-dir \
      https://github.com/mistralai/timestral/archive/a534bdbd244d64f3d9d743f46c7bf6fc330ed4ff.zip \
      fastapi==0.162.0 "uvicorn[standard]==0.54.0"
ARG MODEL=mistralai/Timestral-28M
ENV MODEL=$MODEL HF_HUB_OFFLINE=1
RUN HF_HUB_OFFLINE=0 python -c "from huggingface_hub import snapshot_download as d; \
d('$MODEL', allow_patterns=['config.json', 'model.safetensors'])"
COPY serve.py /app/
WORKDIR /app
CMD ["uvicorn", "serve:app", "--host", "0.0.0.0", "--port", "8000"]
$ docker build -t timestral-serve . && docker run -d --cpus 8 -e THREADS=8 -p 8000:8000 timestral-serve
$ until curl -sf localhost:8000/docs > /dev/null; do sleep 1; done     # the model loads first
$ curl -s localhost:8000/forecast -H 'content-type: application/json' \
    -d '{"series": 1, 2, null, 4, 1, 2, null, 4, 1, 2, null, 4, "horizon": 4, "quantiles": [0.5]}'
{"0.5":1.0248886346817017,1.9376325607299805,2.5093917846679688,4.443225860595703}

The step that was always missing in the history comes back as about 2.5, between its neighbors 2 and 4: the series never showed a value there to repeat.

FP32 is the only precision Mistral validated (load_model casts to float32), and the forecaster batches along the series axis: send many series in one call rather than one call per series. Batching stops at the request, though. A plain def endpoint runs in FastAPI's thread pool, so two concurrent requests run two forecasts at once, each with THREADS threads: run one worker per container and scale with replicas, or put a queue in front. And quantiles must be among the 21 levels; 0.15 raises, which comes back as a 500.

Fine-tuning is not in the open repository, which holds inference code only and does not accept pull requests. Mistral offers it through Forge, its paid training pipeline, with on-premises, VPC and air-gapped deployment.

The license

Read this before you build on it. The code is Apache-2.0, but the weights are under a Modified MIT license that does not apply "if the global consolidated monthly revenue of your company (or that of your employer) exceeds $20 million", and the restriction "applies to the Model and any derivatives, modifications, or combined works based on it". Above that line the license grants you nothing, evaluation included: you need a commercial license, which Mistral "may grant you at its sole discretion", or "Mistral AI's hosted services".

Model Weights license
Timestral (all sizes) Modified MIT: free below $20M monthly revenue, commercial license above
TimesFM 3.0 TimesFM Non-Commercial License v1.0: no commercial or production use (2.5 and earlier: Apache-2.0)
Chronos-2 Apache-2.0

Gotchas

Each call is two forward passes by default. symmetric_averaging=True forecasts the negated series too. Turn it off when latency matters, and check on your own data that the medians barely move. On our synthetic load series (four series with daily and weekly cycles), turning it off moved the median by at most 2.3% of the mean level.

clip_nonnegative assumes the past predicts the sign. A series that was never negative in its context gets a forecast floored at zero, which is wrong for a balance, a temperature in °C in autumn, or a net flow that can reverse. Pass clip_nonnegative=False for those.

Past 1,024 steps, the bands will tend to be too narrow. Later blocks are conditioned on the median of earlier ones, not on their spread, so the uncertainty of the first day does not carry into the second. For long horizons, use a coarser step instead: daily data forecasts a year in one block.

Containers see the host's cores. In a container limited to 8 CPUs on a 20-core host, PyTorch still started 20 threads and oversubscribed the quota. Set torch.set_num_threads (or OMP_NUM_THREADS) to the CPUs you were given. On a CPU with mixed core types, pin those CPUs too (--cpuset-cpus): the 209M model took 113 ms on eight performance cores and 381 ms on a mix of mostly efficiency cores.

Categorical covariates cost CPU in Python. Target encoding runs a Python loop per series and per covariate, in NumPy, before the model sees anything. For thousands of series per call, encode once on your side and pass the result as numeric covariates.

Known-future covariates depend on the checkpoint. Only a layer schedule with variate layers accepts them; check forecaster.supports_known_covariates before relying on them in a fine-tuned or future checkpoint (true for all four released sizes).

Where this leads

If you serve LLMs, the table comparing the two is the useful part: the KV cache Timestral never builds is what bounds an LLM's batch, and the KV cache, sized computes how big it gets for a real model.

Sources

  1. How an LLM Request Becomes TokensThe KV Cache, Sized: What the Formula Says and What Your Engine Gives You

Inference Notes

Once a week: what changed in serving AI models, and what it means if you build, run or pay for them, in about five minutes.

Read past issues