← things I build
MLPersonal · on PyPIPUBLISHED ON PYPI

learngrad.

A scalar-valued autograd engine and small neural network library built to learn how backpropagation works. Inspired by micrograd.

TECH USED
PythonNumPyPytestGitHub Actions
Two plots from the learngrad demo notebook: the make_circles dataset and the decision boundary the trained network learned
01Notebook outputDataset and learned decision boundary from notebooks/demo.ipynb
the full path

From problem to what's next.

In the order it actually happened. Use the route to jump around.

01THE PROBLEM

Frameworks hide how backpropagation works. Reverse-mode autodiff is easiest to understand when the whole engine is small enough to read and every gradient can be checked.

02THE SOLUTION

A Value node stores data, gradient, parents and a backward closure; a topological sort drives reverse-mode accumulation. Neuron, Layer and MLP build on it, with SGD, momentum, RMSProp and Adam optimizers.

WHAT I BUILT
  1. 01Built the Value engine: scalar nodes with reverse-mode backprop over a topologically sorted graph.
  2. 02Added Neuron, Layer and MLP with ReLU hidden layers, and SGD, SGD with momentum, RMSProp and Adam, each with learning-rate decay.
  3. 03Checked every operation's gradient against finite differences, with 24 tests running on Python 3.10 to 3.13 in CI.
  4. 04Packaged and published it to PyPI, with a demo notebook that trains on make_circles.
03HOW IT'S BUILT

The system, end to end.

TRAINING LOOP
  1. STEP 01Valuedata · grad · backward closure
  2. STEP 02MLPNeuron, Layer, MLP on Value
  3. STEP 03Losshinge plus L2 in the demo
  4. STEP 04OptimizerSGD · momentum · RMSProp · Adam
04WHAT BROKE,
AND THE FIX

FIX →Reworked the f-strings, added a Python 3.10 to 3.13 CI matrix and 24 tests, and merged the fix as 0.2.2.
05WHERE IT IS NOW
  1. IDEA
  2. BUILDING
  3. LIVE

Published on PyPI, with CI on Python 3.10 to 3.13.