g
gcw_coj3XaOd/ibm-research_flowstate
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

ibm-research/flowstate - Ascend NPU Time Series Forecasting

1. Model Overview

Name: ibm-research/flowstate (FlowState v1.1) HF: https://huggingface.co/ibm-research/flowstate Paper: https://arxiv.org/abs/2508.05287 Architecture: S5 SSM Encoder + LEGs Decoder Parameters: ~9M (9,069,312) Type: Time Series Foundation Model (zero-shot forecasting)

FlowState is the first time-scale adjustable Time Series Foundation Model, combining a State Space Model (SSM) Encoder with a Functional Basis Decoder. It transitions into a timescale-invariant coefficient space and makes continuous forecasts, seamlessly adjusting to all possible sampling rates.

2. Dependencies

DepVersionNote
Python>=3.103.11 recommended
torch>=2.1.0PyTorch
torch_npu>=2.1.0Ascend NPU backend
safetensors>=0.4.0weight loading
numpy<2.0

| CANN | 8.0+ | 8.5.1 recommended |

Install: pip install torch>=2.1.0 torch_npu>=2.1.0 safetensors>=0.4.0 numpy<2.0.0

3. Inference

3.1 Environment Check

npu-smi info
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"

3.2 Model Download

huggingface-cli download ibm-research/flowstate --local-dir ./model_cache

3.3 Run Inference

# Standard forecast (context=2048, pred_len=960, scale=0.25)
python inference.py --model-path ./model_cache --device npu --prediction-length 960 --scale-factor 0.25

# Short forecast
python inference.py --model-path ./model_cache --device npu --prediction-length 96 --scale-factor 1.0

3.4 Parameters

ParamDefaultDescription
--model-pathrequiredcheckpoint dir
--devicenpunpu/cpu/cuda
--context-length2048input timesteps
--prediction-length960forecast horizon
--scale-factor0.25temporal scale
--batch-size1batch size
--n-channels1channels
--seed42random seed

4. Inference Logs

4.1 Single Inference

[Model] ibm-research/flowstate
[Device] Ascend910_9362 (npu:0)
[Input] context=2048, channels=1, scale_factor=0.25
[Output] (1, 9, 960, 1) batch x quantiles x pred_len x channels
[Time] 7201.78 ms
[Status] SUCCESS

4.2 Benchmark (varying pred_len)

pred_len= 96:  5920.3ms  output=(1, 9, 96, 1)
pred_len= 192: 5922.0ms  output=(1, 9, 192, 1)
pred_len= 336: 6075.5ms  output=(1, 9, 336, 1)
pred_len= 720: 6808.0ms  output=(1, 9, 720, 1)
pred_len= 960: 7201.8ms  output=(1, 9, 960, 1)

5. Sample Output

Sample 1: pred_len=960, scale_factor=0.25

python inference.py --model-path ./model_cache --device npu --prediction-length 960 --scale-factor 0.25

Output:

输出 shape: (1, 9, 960, 1)
推理耗时: 7201.78 ms
预测值范围: min=-262.3329, max=15.7595, mean=-37.4078

各分位数预测均值 (前5步):
    步长  q0.1    q0.2    q0.3    q0.4    q0.5    q0.6    q0.7    q0.8    q0.9
  t=1    0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
  t=2    1.3843  1.5806  1.4096  1.3438  0.8274  0.4663  0.3287 -0.1217 -0.8358
  t=3    1.7180  2.4204  2.2112  2.0450  1.3269  0.5962  0.1438  0.0909 -1.0805
  t=4    1.6329  2.8549  2.8972  2.7896  2.1379  1.3958  0.8096  0.8434 -0.2109
  t=5    2.9130  4.2228  4.5362  3.9090  3.1055  2.1397  1.7134  1.8109  1.8198

Sample 2: pred_len=192, scale_factor=1.0

python inference.py --model-path ./model_cache --device npu --prediction-length 192 --scale-factor 1.0

Output: shape=(1, 9, 192, 1), time=5922.0ms, SUCCESS

6. Agent Adaptation Screenshots

6.1 Agent Workflow

Agent Workflow

6.2 NPU Device Log

NPU Device

6.3 Model Result

Model Result

7. Evaluation

Metrics:

MetricValueNote
Parameters9,069,312~9M
Model Size34.6 MBsafetensors
Inference (960 steps)7201.78 msAscend910 NPU
Inference (96 steps)5920.3 msAscend910 NPU
Quantiles9q0.1 to q0.9
SSM Hidden Dim512S5 state space
Context Length2048input timesteps

Command:

python inference.py --model-path ./model_cache --device npu --prediction-length 960 --scale-factor 0.25

Output:

输出 shape: (1, 9, 960, 1)
推理耗时: 7201.78 ms
预测值范围: min=-262.3329, max=15.7595, mean=-37.4078
[状态] SUCCESS

8. NPU Configuration

  • Chips: 2 x Ascend910_9362
  • Inference Card: npu:0
  • Memory: ~77 MB model, 3134 MB HBM available
  • CANN: 8.5.1
  • Operator Support: 100% standard PyTorch ops, no CUDA/Triton kernels required

9. Known Issues

  1. Partial SSM Weight Loading: B_tilde/C_tilde projection matrices use random init (not in state_dict). Inference works but accuracy may differ from original tsfm_public.
  2. Simplified Basis Functions: LEGs decoder uses fixed sinusoidal basis functions.
  3. Sequential SSM Scan: For-loop implementation; parallel scan optimization possible for speedup.