Built a neural network from scratch using only NumPy — no PyTorch, no TensorFlow, no autograd. Trained on MNIST (60k images), 97.91% test accuracy.
The challenging part was getting backpropagation right. Specifically, the Softmax + CrossEntropy backward pass — the combined gradient simplifies to (predictions - y_true) / batch_size, which means CrossEntropy needs no backward method at all. That only becomes obvious when you’re writing the math yourself instead of calling .backward().
Most proud of the fact that every single component — forward pass, backprop, weight updates, L2 regularization, Xavier initialization, the MNIST binary parser — is written by hand. Nothing is hidden behind a framework.
To test: draw any digit (0–9) on the canvas and click Predict Digit. Draw it centered and reasonably large for best results. The model runs entirely in the browser using weights exported from the trained NumPy model.
- 1 devlog
- 10h