Backpropagation, unwrapped like a cheap sandwich
A 1,093-star repo that demystifies neural network training by showing the math step-by-step in plain Python.

What it does
This is a single Python script that trains a tiny neural network on the XOR problem using backpropagation. It exists to make the algorithm tangible: you can trace every weight update, every partial derivative, every sigmoid squashing. The accompanying blog post walks through the same example by hand with a calculator.
The interesting bit
The code is deliberately primitive — no PyTorch, no autograd, no GPU. That is the point. You are meant to read it like a textbook that happens to execute. For anyone who has nodded along to “the gradient flows backward” and secretly wondered what actually multiplies what, this is the missing semester.
Key highlights
- Single-file implementation, ~100 lines of pure Python with NumPy
- Hardcodes the classic XOR dataset so the logic is self-contained
- Matches the hand-worked example in Matt Mazur’s blog post line for line
- MIT licensed; has been a teaching reference since 2015
- Author now runs Emergent Mind, an AI research assistant tool
Verdict
Grab this if you are teaching backprop, learning it for the first time, or debugging a framework and need a ground-truth reference. Skip it if you want production training code, modern optimizers, or anything that scales past a toy problem.