Ferric runs the same code on a datacenter GPU, a laptop, an edge robot, and a browser tab — a complete transformer, an ONNX importer, and a safetensors loader, with no Python or C++ in the hot path.
What it is
Browser AI today is JavaScript and C++-WASM; Rust's AI story is fragmented and weak in the browser. Ferric is the missing piece: build directly on the portable GPU layer (wgpu), own the kernels, the model runtime, weight loading, and browser packaging — one coherent stack where a model defined once runs, and computes the same, everywhere. Every result below is validated against an independent reference and builds fully offline from vendored source.
Proven
Each milestone checked against a CPU reference, onnxruntime, or numpy.
One matmul kernel, native Metal vs browser WebGPU — bit-identical.
Embed → RoPE GQA attention → RMSNorm → SwiGLU, stacked, matched to CPU.
Autoregressive decode, identical to a full recompute — token by token.
Real graphs incl. SmolVLA components, matching onnxruntime.
Loads an HF safetensors checkpoint (GQA, tied embeddings), matched to numpy.
Arbitrary rank, strided views, broadcasting, any-axis reductions, batched matmul — vs a CPU ref.
Reverse-mode autograd; an MLP fit on the GPU, gradients checked to 1.5e-5.
Strategic deps (wgpu, naga) forked in-tree; the whole build vendors.
The stack
ferric-tensorThe general N-D tensor runtime — strided views, broadcasting, reductions, batched matmul — with autograd for training.crates.io ↗Playground
This runs a full Llama-style forward pass on your GPU via WebGPU, compiled from the same Rust as the native crates — and checks its own output against an in-page CPU reference.
Weights here are fixed pseudo-random — an untrained demo net — so generation is deterministic, not meaningful language. The point is that a real transformer's compute runs correctly in a browser tab.