I built micromlp: a single file of Python, no dependencies, no PyTorch. It downloads a real dataset, builds a 2-layer MLP, implements automatic differentiation from scratch, trains with gradient descent, and makes predictions. The task: the California housing dataset from chapter 2 of Hands-On Machine Learning — predict a district’s median house value from its census stats.
This is inspired by Karpathy’s microgpt. I’ve used PyTorch for years. I’d never actually written backprop by hand. There’s a difference between knowing .backward()
exists and knowing what it does when you call it — I found it worth closing that gap once, on a toy, instead of taking it on faith forever.