For the curious

How the neural network on our 404 works.

When you draw digits on our 404 page, no server or cloud service is doing the recognition. A miniature but real neural network runs in your browser, trained by us from scratch. It has 9,946 parameters and takes up 13 kB after quantisation, less than a single emoji photo.

your drawing14×14 input1964810network 196×48×100123498 %56789softmax confidence

How it reads your drawing

You draw on a 256×256 canvas. Before recognition, the drawing is normalised the same way the training data was: the bounding box of your strokes is found, the digit is scaled so its longer side is 10 pixels, placed on a 14×14 grid and shifted so its centre of mass sits in the middle. The result is 196 numbers between 0 and 1, the brightness of each cell.

How it decides

The network is a multilayer perceptron: 196 inputs, a hidden layer of 48 neurons with ReLU activation, and an output layer of 10 neurons, one per digit. The outputs go through softmax, which turns them into the confidence percentages you see under the canvas. The whole computation is a few thousand multiplications; your browser finishes it in a fraction of a millisecond.

How it learned

We trained it on the MNIST dataset: 60,000 handwritten digits, expanded fivefold with one-pixel shifts. Six epochs of classic gradient descent in plain NumPy, no frameworks. It reaches 96.9 percent accuracy on the test set. The weights were then quantised to 8-bit integers, shrinking the model fourfold with no loss of accuracy.

Privacy

The whole model ships with the page and runs exclusively in your browser. Your drawings are never sent anywhere; no network request is made. It is a deliberate demonstration of what our homepage talks about: AI should work where the data belongs.

Credits

The MNIST dataset was created by Yann LeCun, Corinna Cortes and Christopher Burges from data collected by NIST. Thank you; this toy would not exist without it.

← Back to the homepage