Train a tiny GPT in your browser

Press Train to train a small GPT on nursery rhymes, then press Sample to read what it writes. Nothing is installed and nothing is sent to a server.

This page runs the interpreter of frugl, a compiler for training tiny GPT models, compiled from Rust to WebAssembly. It trains in a background thread, one character at a time. frugl's C backend on a laptop CPU is faster: a step of this model takes 0.66 ms on one core of an Apple M4.

Loading frugl.wasm...

training loss   loss on held-out rhymes  



Sample



The program

This is examples/tiny/tiny.frugl: 2 layers, 32 channels and 27,008 params. You can edit it. Changes apply at the next Train, and the Steps field above replaces the program's steps.

Training text and held-out text

The training text, rhymes.txt:

The held-out text, rhymes_val.txt: