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 (CPU, numpy, onnxruntime, or HF transformers) and builds fully offline from vendored source.
Proven
Every number below is checked against an independent reference — a CPU implementation, numpy, onnxruntime, or Hugging Face transformers.
SmolLM2-135M matches numpy 1.4e-6; Liquid AI LFM2-350M (novel conv-hybrid) matches transformers 4.7e-6.
Exact GPT-2 tokenizer (HF token-for-token) + O(S) KV-cache decode — end to end.
WebNN(npu) → CoreML → Apple Neural Engine, matching CPU to fp16. Plus every GPU + all CPU cores.
One matmul kernel, native Metal vs browser WebGPU — bit-identical.
Reverse-mode autograd — an MLP and a transformer (through attention) trained on the GPU.
f16/bf16, int8/int4 weight-only, and ternary (BitNet/PrismML) — 1/16 the memory.
Ternary LLMs, Liquid LFM2, EBMs, JEPA/V-JEPA2, Llama — plus ONNX + GGUF ingest.
Elementwise DAGs → one generated WGSL kernel (SSA+CSE), and activations fused into matmul.
The stack
ferric-tensorThe general N-D tensor runtime — strided views, broadcasting, reductions, batched matmul — with autograd for training.crates.io ↗ferric-ggufGGUF reader — F32/F16/Q8_0/Q4_0/Q4_K + TQ2_0 ternary: the llama.cpp/HF corpus.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.