gcw_6a3w2yXz/ibm-research-ttm-r3-NPU-model
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

ibm-research-ttm-r3-NPU

#NPU Ascend910 TTM TinyTimeMixer

  • Model: ibm-research/ttm-r3 (revision: aca5d4956c59726b320c1562a6eaebb7fd7ec9b9, local sha: see config)
  • Task: time-series forecasting (context 512 -> prediction 30, multivariate)
  • Architecture: TinyTimeMixerForDecomposedPrediction (decomposed trend-residual, d_model=128, num_layers=10, patch 9x9, student_t distribution, multi-quantile head)
  • Weights URL: https://huggingface.co/ibm-research/ttm-r3

Data Contract

  • Source: Synthetic deterministic series + ETTh1-style sinusoidal (seed 42, same as notebook)
  • Schema: past_values [B, T, C] = [2, 512, 1], past_observed_mask [2,512,1] all ones
  • Channel: 1 (univariate), frequency token default, no exogenous
  • Preprocessing: StandardScaler (std scaling) internal to model, no external categorical encoding
  • Split: Single inference window per series, no train/test leakage, deterministic generation: sin(0.02t)+noise, cos(0.015t)+noise
  • Dtype: FP32, no quantization

Environment

  • NPU: Ascend910_9362, 2 devices, used npu:0 (Phy 4, 0000:0A:00.0)
  • Toolkit: CANN 8.5.1, torch 2.9.0+cpu, torch_npu 2.9.0.post1, transformers 4.57.6, huggingface_hub 0.34.0, tokenizers 0.22.0, tsfm_public 0.3.9.dev4, Python 3.11.14
  • Command: python inference.py (default, no args, uses npu:0)

Dependencies

torch==2.9.0
torch_npu==2.9.0.post1
transformers==4.57.6
huggingface_hub==0.34.0
tokenizers==0.22.0
datasets==5.0.1
numpy==1.26.4
pandas==3.0.2
scikit-learn==1.7.0
einops>=0.7
granite-tsfm @ git+https://github.com/ibm-granite/granite-tsfm.git@v0.2.22
deprecated

NPU Inference

pip install -r requirements.txt
python inference.py

loads TinyTimeMixerForDecomposedPrediction from ibm-research/ttm-r3, moves to npu:0, runs synchronize-wrapped forward, prints device/dtype/input/output and benchmark.

Real Results (npu:0, seed 42)

  • Input: past [2,512,1] mean 0.1481 std 0.6927, first 5 series0 [0.1927,0.1687,0.1301,-0.1506,0.1478]
  • Output: [2,30,1] mean -0.3287 min -0.8937 max 0.3000, first window series0 [-0.6887,-0.7043,-0.7207,-0.7327,-0.7471], last window [-0.8841,-0.8872,-0.8896,-0.8937,-0.8922]
  • Device verified: model param npu:0, output npu:0, torch.npu.is_available True, npu-smi shows Ascend910_9362

Consistency

  • CPU vs NPU: same weights, same synthetic input, same FP32, seed 42
  • Max_abs 0.00025, mean_abs 0.00013, shape [2,30,1]
  • Threshold: atol 5e-4 rtol 1e-3 (FP32, NPU fused conv/attention causes 1e-4-scale drift, documented)
  • Result: PASS with python scripts/compare_outputs.py --atol 5e-4 --rtol 1e-3

Performance

  • First (compile): 0.2887s (includes NPU kernel compile)
  • Stable: avg 0.0173s min 0.0169s max 0.0181s p50 0.0172s p90 0.0180s p95 0.0181s over 10 runs after 3 warmup, torch.npu.synchronize each
  • Throughput: 115.43 windows/s (batch 2, ctx 512, horizon 30) ; 230.86 rows? per second equivalent
  • Batch/context/horizon: 2 / 512 / 30 / 1ch / FP32

Evidence

  • assets/agent_workflow.png – full workflow: inspect, download, cpu baseline, npu verify, compare, benchmark, validate
  • assets/npu_device_call.png – npu-smi, check_npu.py, param device, input/output device
  • assets/model_result.png – default python inference.py complete stdout

Generated via scripts/render_xterm_evidence.mjs --style raw from real logs (no Pillow simulation).

Limitations

  • Only past_values + observed_mask path tested; frequency token, exogenous, static categorical not exercised
  • Synthetic data only; real ETTh1/ETT datasets would require additional preprocessing but same model path
  • FP32 only; FP16/BF16 not validated
  • Single NPU (910B) tested; multi-NPU not benchmarked