Lab · MNIST

Digit recognizer - how a neural net learns to read

A real neural network, built from scratch and trained live in your browser on the MNIST dataset. No server, no magic - just pixels, weights and a little calculus.

This tutorial is a hands-on lab that runs entirely in your browser - no setup, no server. You build a real neural network, train it live, and watch it learn to read handwriting.

Open the lab

A neural network doesn't "recognise" digits. It receives 784 numbers - one greyscale value per pixel of a 28×28 image - and computes ten values from them, one per possible digit. The largest one wins. Everything in between is multiplications, additions and a handful of simple functions. No understanding, no meaning, no magic.

That is exactly what you get to see here, live. You draw a digit with the mouse, the network tells you what it takes it for, and next to that you see how confident it is. Then you train it yourself - in the browser, no server, no installation, no account.

Why this is more than a demo

MNIST is the standard example of machine learning, and most explanations of it stop at a diagram. Here the training loop runs in front of you: you watch the error drop steeply in the first seconds and then turn stubborn. You see what happens when the learning rate is too high - the network overshoots and gets worse instead of better. You see why a network with too few neurons fails at certain digits as a matter of principle.

And you see the point where it gets interesting: the drawings the network gets wrong. A hastily drawn seven that looks like a one, a nine with too small a loop. Producing those cases yourself teaches, without further explanation, what training data has to do with behaviour - and why a model trained on tidy handwriting need not work on yours.

Prerequisites

None. You need neither Python nor a graphics card nor a background in maths; the formulas are there, but the explanation works without them. If you have trained models before, there is still something here: a network where learning rate, architecture and batch size can be changed in seconds and compared immediately.

Budget around twenty minutes for a first pass. Most people stay longer, because the drawing part is hard to put down.