TinyLanguageBuilder / The Tiny Textbook

The Tiny Textbook

How a language model works, one idea at a time. Every widget runs the real engine (the same Rust code that trains the model in this project) in your browser, so what you play with is not a mock-up. No GPU, no server, no account.

  1. 1. Tokens

    Text becomes numbers. Cut your own text into tokens and watch byte-pair encoding learn its merges.

  2. 2. Embeddings

    Train a tiny model and watch each token's vector change from random noise into something meaningful.

  3. 3. Attention

    Open up the real attention layers: who looks at whom, step by step, before and after training.

  4. 4. Learning

    Loss, gradient descent and a model improving in front of you: watch the loss fall and see what the model expected.

  5. 5. Sampling

    Temperature and top-k: turn the model's chances into words, and compare cool, normal and hot writing.