Neural-Engine: a neural network from first principles

A neural network and autograd engine in about 200 lines of plain Python, with no libraries. It learns XOR, and it ships with lessons, gradient checks and an interactive guide so you can watch backpropagation happen.

PythonAutogradBackpropagationMLPGradient descentInteractive guide

Open the interactive guide (opens in new tab) · Source on GitHub (opens in new tab)

Why build it

Frameworks like PyTorch hide the part that matters most: how a network actually learns. Neural-Engine rebuilds that part with nothing but Python, so every number can be traced from the input to the loss and back.

How it works

weight = weight - learning_rate * gradient

Learning path

python3 lessons/01_what_is_a_gradient.py
python3 lessons/02_backprop_by_hand.py
python3 test_engine.py   # gradient checks: prove it works
python3 train.py         # learn XOR

The interactive guide

The guide is a single page where you drag sliders on a neuron, roll a ball down a loss curve, try learning rates from “too small” to “blows up”, step through backpropagation and watch a network learn XOR live.

What it shows

I build production AI systems on top of LLM APIs, and I want to understand what is underneath them. This project is the foundation: gradients, backpropagation and optimisation, written so someone else can learn them too.

Get in touch View source (opens in new tab)