Model Name: Datadog/Toto-2.0-22m
Revision: main (model.safetensors 84 MB, 22M params, d_model=512, num_layers=6, patch_size=32)
Model Weight URL: https://huggingface.co/Datadog/Toto-2.0-22m
Model Type: Time-Series Foundation Model (probabilistic forecasting)
Task Type: forecasting (quantile forecasting, 9 quantiles 0.1–0.9)
Architecture Family: Decoder-only Patched Transformer with alternating time/variate attention, u-μP scaling
Pipeline Tag: time-series-forecasting
Weights: model.safetensors (84 MB, fp32) + config.json
License: Apache-2.0
Toto 2.0 is Datadog's observability time-series foundation model family (4m–2.5B). 22m is the efficient default: 6 layers, 8 heads, d_model 512, d_ff 1368, patch_size 32, num_output_patches 1, u-μP-scaled, trained with quantile pinball loss. Input is [batch, n_var, time] (e.g. [2,2,512]), output is quantiles [9, batch, n_var, horizon] (horizon 96). Supports variable context/horizon, multivariate via variate attention, causal scaling (PatchedCausalStdScaler + arcsinh) and xPos RoPE.
| Field | Value |
|---|---|
| Input Format | [batch, n_variates, time] e.g. [2,2,512] |
| Axis Order | B N T (batch, variate, time) – Toto2Model expects target: [B,N,T] |
| Context Length | 512 (demo) – model supports arbitrary (patch_size 32, must be multiple, training up to 4096) |
| Prediction Length (horizon) | 96 (3 patches) |
| Channels / Variates | 2 (demo, supports N≥1, multivariate via variate attention layers) |
| Frequency | Agnostic (no freq token, continuous time) |
| Scaling | PatchedCausalStdScaler per variate (causal mean/std per patch, patch_size 32) + asinh transform, inverse not needed for quantile output (quantiles are in real space via loc/scale) |
| Mask | target_mask all True (clean synthetic), has_missing_values=False for deterministic path |
| Series IDs | series_ids [B,N] – [[0,1],[0,1]] distinct per variate to enable variate attention |
| Patch Size | 32 |
| Dtype | float32 (weights fp32, compute fp32, NPU float64 fallback to float32) |
| Preprocessing | Synthetic sinusoid: sin(2π freq t + phase) + 0.001*t + N(0,0.1), freq 0.02/0.025, seed 42 deterministic |
| Data Source | Synthetic deterministic (no external CSV), reproducible with seed 42 |
| SHA256 | Synthetic – no dataset file |
| Output | quantiles [9,B,N,H] float32 – 9 quantiles [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9] |
No fit() required; zero-shot inference.
torch.npu.is_available()==True, device Ascend910_9362, device_count 2, target npu:0npu-smi info and scripts/check_npu.pypip install -r requirements.txt
# additional: install toto2 and dd_unit_scaling from Datadog repo (requires --ignore-requires-python for Python 3.11)
pip install --ignore-requires-python --no-deps git+https://github.com/DataDog/toto.git#subdirectory=dd_unit_scaling
pip install --ignore-requires-python --no-deps git+https://github.com/DataDog/toto.git#subdirectory=toto2
# or use pre-cloned /tmp/toto if available
pip install --ignore-requires-python --no-deps /tmp/toto/dd_unit_scaling /tmp/toto/toto2Model weights: auto-loaded from /opt/atomgit/adapt-npu-agent/working/models/Toto-2.0-22m if present, else from https://huggingface.co/Datadog/Toto-2.0-22m via from_pretrained (requires HF_ENDPOINT mirror if needed). No extra tokenizer.
Default command (runs synthetic demo with NPU):
python inference.pyExpected output includes:
model_name, task, backend, device_name, target_deviceconfig: d_model=512, num_layers=6, patch_size=32target shape [2,2,512], sample values, stats[9,2,2,96], median sample, monotonic Truefirst_param device: npu:0, input device: npu:0, NPU quantiles shape: [9,2,2,96] device: npu:0first run (compile) time with torch.npu.synchronize() and second run timemax_abs, mean_abs, allcloseFinal state: SUCCESSSupports different horizon (e.g. 192) and decode_block_size for KV-cache block decoding.
Run: python inference.py (batch=2, n_var=2, context=512, horizon=96, float32, npu:0)
Input:
target [2,2,512], sample [0.1926, 0.2750, 0.3407, 0.1605, 0.5535], mean 0.2648 std 0.7235Output:
quantiles [9,2,2,96], median CPU [1.53833, 1.53186, 1.51287, 1.48750, 1.43271]quantiles [9,2,2,96], median NPU [1.53833, 1.53186, 1.51287, 1.48750, 1.43271] (max_abs 3.93e-06)[1.41978, 1.40434, 1.41403, 1.37293, 1.33509] vs NPU same diff <4e-06[1.65090, 1.64137, 1.63793, 1.61175, 1.57550] vs NPU samemonotonic True, finite TrueTiming (npu:0, synchronized):
No CPU fallback; all tensors on npu:0.
Saved CPU/NPU outputs to .npy and compared:
python .opencode/skills/npu-adapt-skills/scripts/compare_outputs.py --cpu /tmp/cpu_toto.npy --npu /tmp/npu_toto.npy --task forecasting --atol 1e-4 --rtol 1e-3Result: max_abs 3.9339e-06 mean_abs 7.09e-07 passed True (fp32 atol=1e-4). Quantile monotonic and finite checked, allclose True. Differences due to NPU float64→float32 fallback in scaler (acceptable within tolerance).
Warmup 3, test 10, synchronized:
model.forecast onlyAdditional: horizon 192 with decode_block_size=768 (KV-cache multi-block) validates KV-cache path: shape [9,2,2,192] correct.
Three PNGs generated by xterm.js from real logs (render_xterm_evidence.mjs --style raw):
assets/agent_workflow.png – workflow (inspect, download, NPU check, inference, compare, benchmark, validation)assets/npu_device_call.png – npu-smi + torch.npu availability + model param device + input/output deviceassets/model_result.png – full python inference.py outputImages are rendered from actual terminal logs, not screenshots, prompt atomgit@pod-a94f8701860f4700b161b00e290de466:~$ is display label only.

decode_block_size must be divisible by patch_size; KV-cache path validated for horizon 192.model.safetensors 84 MB.