Pre-converted safetensors weights for the NeuroRVQ multi-scale biosignal tokenizer, ready for use with neurorvq-rs (pure-Rust inference on Burn 0.20) or any framework that supports safetensors.
Weights are converted from the official PyTorch .pt checkpoints published at ntinosbarmpas/NeuroRVQ.
Verified against the official PyTorch reference implementation:
Layer
Max Abs Error
Notes
Encoder features
< 8 × 10⁻³
12 transformer layers, f32 accumulation
Encode heads
< 2 × 10⁻³
After Tanh squashing
RVQ quantized vectors
≈ 0 ¹
Exact with random-init codebooks
Token indices
99.3% exact ²
Pretrained weights
Decode outputs
< 8 × 10⁻¹ ¹
Dominated by ≤0.7% boundary tokens
¹ Differences stem from the ≤0.7% of tokens near codebook decision boundaries — a natural consequence of f32 arithmetic differences between frameworks.
² With random-init weights: 100% match (all "mismatches" resolve to identical codebook vectors, i.e., ties).
Benchmarks
Platform: Apple M4 Pro, 64 GB RAM, macOS 15 (arm64)
Tokenize Latency — All Backends
Configuration
Modality
PyTorch CPU
Rust NdArray
Rust wgpu (GPU)
EEG 4ch × 64t
EEG
179 ms
661 ms
51 ms
EEG 8ch × 32t
EEG
180 ms
662 ms
60 ms
EEG 16ch × 16t
EEG
180 ms
664 ms
62 ms
EEG 32ch × 8t
EEG
178 ms
664 ms
65 ms
EEG 64ch × 4t
EEG
179 ms
664 ms
68 ms
ECG 4ch × 150t
ECG
272 ms
1881 ms
92 ms
ECG 8ch × 75t
ECG
273 ms
1874 ms
92 ms
ECG 12ch × 50t
ECG
272 ms
1877 ms
93 ms
ECG 15ch × 40t
ECG
272 ms
1878 ms
93 ms
EMG 4ch × 64t
EMG
255 ms
998 ms
90 ms
EMG 8ch × 32t
EMG
255 ms
998 ms
88 ms
EMG 16ch × 16t
EMG
254 ms
1001 ms
90 ms
Tokenize Latency: NdArray vs wgpu vs PyTorch
Tokenize Comparison
Encode Latency: NdArray vs wgpu vs PyTorch
Encode Comparison
Rust — Tokenize Latency by Configuration
Tokenize Latency
Rust — EEG Scaling by Channel Count
EEG Scaling
Rust — Model Construction Time
Construction Time
Backend Comparison Summary
Comparison
Result
wgpu vs NdArray
wgpu is ~12× faster (GPU acceleration)
wgpu vs PyTorch CPU
wgpu is ~3× faster for EEG/EMG/ECG
NdArray vs PyTorch CPU
PyTorch is ~3.7× faster (optimized BLAS)
Key Observations
wgpu (GPU) is the fastest backend — 51–93 ms across all configurations
PyTorch CPU uses Apple Accelerate/AMX BLAS and fused operators, making it faster than Rust NdArray on CPU
Latency scales with total patch count, not the channel/time decomposition — EEG (256 patches) < EMG (256 patches, 16 RVQ) < ECG (600 patches)
Construction time is ~13 ms (warm) / ~54 ms (cold start for EMG with larger kernels)
Standard deviation < 1% — highly stable inference latency
Why Rust?
Python + PyTorch
Rust + Burn
Dependencies
pip, torch, numpy, einops, ...
Zero (single static binary)
GPU support
CUDA, MPS
wgpu (Metal, Vulkan, WebGPU)
Deployment
Interpreter + venv
Single binary, WASM, embedded
Memory
GC pauses
Deterministic, no GC
Latency (GPU)
—
51–93 ms (wgpu Metal)
Conversion
These weights were converted from the official .pt files:
python
1import torch
2from safetensors.torch import save_file
34state_dict = torch.load("model.pt", map_location="cpu")5converted ={k: v.float().contiguous()for k, v in state_dict.items()6ifisinstance(v, torch.Tensor)and v.is_floating_point()}7save_file(converted,"model.safetensors")