libann Workbench

libann

A neural network library in 7,728 lines of ANSI C, compiled to WebAssembly. Every network on this page is trained and run by that C code in your browser. Nothing is sent anywhere.

Pick a shape and watch a network carve up the plane. Tap the plot to add points. The library keeps training on the new data, one mini-batch at a time, with ann_train_step.

Cross-entropy loss per mini-batch (smoothed), log scale.

Under the hood

This build

Library sources
unmodified, from the repo
Compiled module
…
Imports from the browser
…
Heap in use now
…
Heap high-water mark
…

The build uses plain clang --target=wasm32 with no Emscripten. A C shim of 1108 lines supplies malloc, printf and an in-memory file system, so ann_load_network_binary reads its model with no changes.

libann is written by Mark Seminatore and released under the MIT license: github.com/mseminatore/ann. The digit model was trained with the library itself, on scikit-learn's 8×8 digits with added shifts, rotations and stroke-width changes. It scores about 98% on 360 held-out digits.