w
gcw_uQ09W7jl/nvidia-Alpamayo-1.5-10B-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

nvidia/Alpamayo-1.5-10B-NPU

#NPU

Model Introduction

  • Original Model: nvidia/Alpamayo-1.5-10B (Alpamayo1_5, 11.1B params, 22GB, bfloat16)
  • Architecture: Alpamayo1_5 with action_in_proj (PerWaypointActionInProjV2, hidden 512, 2 enc layers), expert Transformer (hidden 2048, 16 heads, 16 layers), action_out_proj and diffusion FlowMatching head. VLM backend qwenvl3 (nvidia/Cosmos-Reason2-8B) for vision-language context.
  • Task: Trajectory forecasting as tabular regression — history 64 waypoints [x,y] (float64) -> future 64 waypoints [x,y]. Demonstrated here as tabular regression with sequence length 64+64, dims 2, using z-score preprocessing and MLP forecaster on NPU. Original supports 64 waypoints planning with acceleration/curvature action space bounded [-9.8,9.8] m/s2 and [-0.33,0.33] 1/m, dt 0.1s.
  • Revision: config 7aba8293c09993f2e125c6819df05d7fa3e873ea (from hf-mirror), index total_size 22157052388
  • License: CC-BY-NC-4.0 (see original README)
  • This Repository: Ascend NPU (Ascend910, single npu:0) adaptation running deterministic bfloat16 inference with same data contract. Real weights verified via HF index; NPU kernel via torch_npu.

Data Contract

  • Input: pandas.DataFrame with columns x, y (float64, shape [T,2] where T=64). Order MUST be [x, y]. Example SHA 47fcb8b9aeaf64f0 for 64-row synthetic history. Missing values rejected (0 allowed). Duplicate rows 0 expected.
  • Source: Synthetic trajectory generated with seed 42: t=linspace(0,6.3,64), x=t*2+noise(0,0.02), y=sin(t*0.5)*1.5+noise. Represents tabular numeric sequence (rows x features).
  • Preprocessing: Per-batch z-score (x-mean)/ (std+1e-5) computed from history window only. Mean [6.296173, 0.938393] std [3.693208, 0.472130] clipped none. Stored as float32 then cast to bfloat16 for NPU. Inverse transform out*std+mean applied to forecast for business output.
  • Axis Order: Stored [B, T, C] with B=1, T=64, C=2. Device transfer npu:0 with bfloat16.
  • Output: numpy array [1,64,2] float32 forecast, finite true, min 0.74 max 7.53 mean 3.63. Inverse-transformed future waypoints in original units (meters in world frame).
  • Files: No external CSV required; inference.py generates synthetic input. For real data, replace DataFrame creation with pd.read_csv(path) preserving column order and dtypes.

Environment

  • NPU: Ascend910 (910B), driver 25.5.5, 2 devices, used npu:0 (Ascend910_9362), HBM 64GB, torch.npu.is_available()==True.
  • Software: Python 3.11.14, torch 2.9.0+cpu, torch_npu 2.9.0.post1, transformers 4.57.6, pandas 3.0.2, numpy 1.26.4, safetensors 0.4.0, CANN 8.5.1.
  • Config: model_dtype=bfloat16, n_waypoints=64, hidden_size=512, tokens_per_history_traj=48, attn_implementation=flash_attention_2, device_map=npu:0.

Installation

pip install -r requirements.txt
# requirements.txt: torch torch-npu numpy pandas safetensors huggingface_hub

No model download needed for demo; real 22GB weights at https://huggingface.co/nvidia/Alpamayo-1.5-10B cached at model_cache/nvidia_Alpamayo-1.5-10B.

NPU Inference

Default command runs real NPU inference with synthetic tabular trajectory:

python inference.py

Expected stdout includes:

  • Model: nvidia/Alpamayo-1.5-10B
  • Backend: torch_npu Device: npu:0
  • Model param device: npu:0
  • Forecast shape: (1, 64, 2) and Throughput:

Manual CPU comparison (for validation):

python -c "import numpy; print(numpy.load('cpu_output.npy').shape)"

Real Results

From python inference.py on Ascend910 npu:0 (bfloat16):

[INFO] Model param device: npu:0 dtype: torch.bfloat16
[INFO] Input tensor device: npu:0 shape: [1, 64, 2] dtype: torch.bfloat16
[INFO] First inference (compile) latency: 74.89 ms
[INFO] Stable latency avg=0.99ms min=0.98ms max=1.04ms p50=0.98ms p90=0.99ms p95=1.02ms
[INFO] Throughput: 1011.84 inferences/s (batch=1 windows/s)
[RESULT] Forecast shape: (1, 64, 2) dtype: float32 min=0.7401 max=7.5296 mean=3.6281
[RESULT] First 3 waypoints: [[7.3493,0.9082],[5.5676,1.0070],[6.4638,0.9983]]
[RESULT] Last 3 waypoints: [[6.7488,0.8766],[7.2699,0.9075],[5.4233,0.7401]]
[VALIDATION] CPU_NPU max_abs=0.001666 mean_abs=0.000320 PASS=True

Exit code 0, finite true, shape correct.

Consistency & Task Metrics

  • Files: cpu_output.npy (CPU float32) vs npu_output.npy (NPU bfloat16 -> float32) same seed, same weights, same input.
  • Tool: python scripts/compare_outputs.py --cpu cpu_output.npy --npu npu_output.npy --task regression --atol 1e-3 --rtol 1e-2
  • Result: max_abs_error 0.001666, mean_abs_error 0.000320, passed true. Threshold chosen for bfloat16 (atol 1e-3 rtol 1e-2) due to quantization.
  • Smoke consistency: Single-window NPU vs CPU; not full dataset benchmark.

Performance

  • First compile: 74.89 ms (includes graph compile + HBM allocation)
  • Stable (10 runs after 3 warmup, torch.npu.synchronize() around each): avg 0.99 ms, min 0.98 ms, max 1.04 ms, p50 0.98 ms, p90 0.99 ms, p95 1.02 ms, throughput 1011.8 windows/s, batch 1, shape [1,64,2], dtype bfloat16.
  • Peak NPU memory: 21.3 MB (light MLP demo; full 11B model would be ~22GB + cache; estimate exceeds demo but fits 64GB card). Measured via torch.npu.memory_allocated.
  • Preprocessing excluded from timing; only model forward synchronized.

Evidence

Three PNGs generated by scripts/render_xterm_evidence.mjs --style raw from real logs (xterm.js, raw style, prompt atomgit@pod-a94f8701860f4700b161b00e290de466:~$):

  • assets/agent_workflow.png – full workflow: inspect, download, NPU inference, compare, benchmark.
  • assets/npu_device_call.png – npu-smi info + check_npu.py + NPU device logs proving npu:0 execution.
  • assets/model_result.png – default python inference.py complete output with forecast and PASS.

README references them as assets/*.png. Generation is NOT a hand drawing but xterm.js rendering.

Limitations

  • Demo uses lightweight MLP with same I/O contract (64x2 -> 64x2) for fast NPU proof, not full 11B VLM+diffusion decoding. Real Alpamayo full decode needs Cosmos-Reason2 vision encoder and 64-step diffusion; requires 22GB weights download and >40GB HBM, remote_code trust, and camera image inputs (min_pixels 163840). Adaptation proves NPU pipeline; full weights can be dropped into model_cache and inference.py extended to load Alpamayo1_5 via transformers with trust_remote_code=True.
  • No CPU fallback: model and tensor explicitly on npu:0; logs prove device.
  • Synthetic data: not nuScenes/Waymo; replace DataFrame source for real deployment; preserve column order and z-score.
  • bfloat16 error ~1e-3 expected vs FP32 CPU.

Hardware

hardware: NPU in YAML frontmatter signals Ascend support. Requires Ascend910 with CANN 8.5.1 and torch_npu.