← the iceberg
Layer 4 · Deep Learning

Draw a Digit

Same idea as the layer above, more of it: instead of one hidden layer with four neurons, this network has two hidden layers with 128 and 64 — and that stacking is all the word "deep" has ever meant. It trains in your browser tab, right now, on 400 real handwritten digits, using ReLU activations, a softmax output and the Adam optimiser. Then you draw with your finger and it tells you what you drew. Nothing is precomputed and nothing is faked; if you refresh the page, it learns the whole thing again.

browser version uses a plain multilayer perceptron in place of a convolutional network — and 8×8 images in place of 28×28. Real digit recognisers use convolutions, which understand that a stroke means the same thing wherever it sits; this one has no such notion, so centre your digit in the box. Training data is scikit-learn's bundled load_digits (UCI, 1998), sampled offline and inlined.

Training run · happening now, in this tab

0
epoch
cross-entropy
train accuracy
held-out (60)
draw here

Draw big, and roughly centred.

what the net sees

64 numbers, 0–16. That is the whole input.

?
draw something
How it works

Your drawing is cropped to its ink, centred, and averaged down to an 8×8 grid of intensities — 64 numbers, which is genuinely all the network ever receives. Those 64 values flow through two hidden layers of 128 and 64 units, each applying a weight matrix, a bias, and the ReLU non-linearity that simply zeroes out negative values, before a final layer produces ten scores that softmax turns into probabilities summing to one. Training minimises cross-entropy loss — the surprise of the correct label — with Adam, which keeps a running estimate of each weight's gradient and its variance so that every parameter gets its own effective step size. The mathematics is identical to the XOR network one layer up; only the size, the optimiser and the output shape differ, which is the honest answer to what separates "neural networks" from "deep learning". Its blind spot is worth knowing: with no convolutions the model has no concept of a shape being the same shape when shifted, so a digit drawn in a corner may confuse it completely.