Skip to content

MNIST

A little recognition.

Your handwriting. Ten possibilities. Draw a digit and see what a tiny neural network makes of it. Nothing you draw leaves this browser.

97.67%

held-out MNIST accuracy

10,000 test images · not your sketches

Run the experiment

Choose a checkpoint and compute backend. Inference stays on your device.

Idle · choose Start experiment to load the model

01 / Make your mark

ONE DIGIT, 0–9

Draw with a mouse or touch. Prefer a keyboard? Choose a real held-out example below.

Use the held-out example selector as a keyboard-accessible alternative to drawing.

First occurrence of each digit in the official test split. No cherry-picking.

02 / Read its mind

MNIST test example · digit 7

What the model sees: 28 × 28 pixels

Original MNIST pixels / 255

A guess is waiting.

Start, then classify. Switch checkpoints to compare learning.

  1. 0—
  2. 1—
  3. 2—
  4. 3—
  5. 4—
  6. 5—
  7. 6—
  8. 7—
  9. 8—
  10. 9—

Confidence is a softmax score, not a guarantee. This network must pick a digit, even for letters or nonsense. Blank sketches are not classified.

A small, real learner

109,386 parameters. Three dense layers: 784 → 128 → 64 → 10. Trained from scratch with tinygrad autograd and Adam, not pretrained weights. The untrained baseline gets 10.69%; the trained model gets 97.67% on the same 10,000 held-out digits.

An honest test

55,000 training images, 5,000 validation images, and a separate official test split. Checkpoint selection uses validation only. Your sketches are resized and centered, but they are not MNIST: style, stroke width, and ambiguous digits can fool it.

Local by design

Generated WGSL on WebGPU, or JavaScript CPU only when you choose it. Same weights, checked against Python. No upload or server inference. MNIST by LeCun, Cortes, and Burges; this is a digit experiment, not a robotics model.

Method, dataset terms & reproducible source ↗