liaogx_/toto-2.0-2.5b-ft
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Toto-2.0-2.5B-FT on Ascend NPU

Datadog Toto-2.0-2.5B-FT is the GIFT-Eval fine-tuned checkpoint of the largest member of the Toto 2.0 family of time-series foundation models for multivariate forecasting (technical report: arXiv:2605.20119, TIME benchmark: arXiv:2602.12147). It shares the exact architecture of Toto-2.0-2.5B — a u-μP-scaled decoder-only patched transformer with alternating time-axis (causal) and variate-axis (full) attention, a quantile output head (9 knots 0.1…0.9 trained with pinball loss), contiguous patch masking (CPM) for single-pass parallel decoding, a robust arcsinh input scaler and a residual MLP patch projection — fine-tuned for 10k steps on a mix that includes the GIFT-Eval training split (a benchmarking checkpoint released for reproducibility, #2 on the GIFT-Eval leaderboard: CRPS 0.463, MASE 0.679).

This adaptation deploys the model for service-based probabilistic forecasting on an Ascend 910 NPU via torch_npu. vLLM-Ascend 0.18 does not support this custom time-series architecture, so the standalone Toto2Model (from DataDog/toto, vendored) is used as-is on torch_npu — zero source modification to the model; only the GluonTS wrapper was stripped from the vendored package.

Model

AttributeValue
Parameters2.5B (fp32 safetensors 9.8 GB)
Architecturedecoder-only transformer, d_model=2048, num_layers=48, num_heads=32, qk_dim/v_dim=64, d_ff=5464, patch_size=32, xPos RoPE, SwiGLU MLP, τ-rule residual, MuP (per-dim scale)
Attentiontime/variate alternating groups (layer_group_size=48, last layer = variate)
Output9 quantiles [0.1 … 0.9], shape [9, batch, n_variate, horizon]
Taskzero-shot multivariate time-series forecasting (GIFT-Eval leaderboard submission)
Base modelDatadog/Toto-2.0-2.5B (fine-tuned)

Environment

  • Ascend 910 ×2 (64 GB HBM/card), CANN 8.5.1
  • Python 3.11, torch 2.9.0 + torch-npu 2.9.0.post1
  • unit-scaling==0.3.5 (PyPI) + vendored dd_unit_scaling + vendored toto2 (GluonTS-stripped)
  • fastapi / uvicorn / pydantic

Quick start

# 1. download weights (ModelScope, parallel-shard + sha256-verified)
python3 download_model.py

# 2. generate a demo test series
python3 make_test_data.py

# 3. run a one-shot forecast on NPU
python3 inference.py --device npu:1 --num-variates 3 --time-steps 1024 --prediction-length 96

# 4. start the HTTP service (default port 8058, device npu:1)
./start_serve.sh 8058 npu:1

Service API

POST /v1/forecast

{
  "series": [[1.0, 2.0, ...], [...], ...],   // [variate, time_steps]; 1D accepted; NaN allowed
  "prediction_length": 96,                   // future steps (1..4096)
  "decode_block_size": 768,                  // CPM block size (multiple of 32)
  "has_missing_values": true
}

Response: {quantiles: {"0.1": […], …, "0.9": […]}, median, prediction_length, n_variates, latency_ms}, each quantile a [n_variate, horizon] array.

Test cases & results (Ascend 910, npu:1)

ConfigLatency (server p50)Notes
3 var / ctx 1024 / pred 96229.1 msquantiles monotonic
3 var / ctx 4096 / pred 336228.4 mslong context
  • Model load: ~34 s; process HBM ~10 GB (npu:1, PID 60187)
  • NPU vs CPU (fp32) over 2 variates × 256 steps × pred 48: per-quantile max_abs_diff ≤ 2.4e-5, cosine ≥ 0.9999999, median corr = 1.000000 → PASS (NPU 0.47 s vs CPU 9.83 s ≈ 21×)

NPU adaptation notes

  • Engine: torch_npu. vLLM-Ascend 0.18 (317-architecture registry) has no entry for this custom time-series model, so the standalone Toto2Model is loaded directly.
  • Zero source patch: native F.scaled_dot_product_attention → aclnnFlashAttentionScore; fp64 causal patch scaler, asinh, quantile head and torch.distributions all run natively on NPU.
  • Vendored packages (toto2/, dd_unit_scaling/): the toto2 Toto2GluonTSModel (GluonTS wrapper, pulls in lightning) is stripped — see patches/toto2_ascend_npu.patch. dd_unit_scaling (u-μP layer wrappers) is vendored; upstream unit-scaling comes from PyPI.
  • NaN handling: masked NaN positions are zero-filled on input so the causal scaler's cumsum is not poisoned; the model still treats them as missing via target_mask.

Deliverables

inference.py (torch_npu engine + CLI) · server.py (FastAPI /v1/forecast) · download_model.py (ModelScope parallel-shard + sha256) · make_test_data.py · verify_npu_vs_cpu.py · test_server.py · start_serve.sh · toto2/ + dd_unit_scaling/ (vendored) · patches/toto2_ascend_npu.patch · requirements.txt · assets/ (screenshots)

Weights are not included in this repo — download them with download_model.py (source: ModelScope Datadog/Toto-2.0-2.5B-FT, sha256 217fb05d…07e).