The problem
I wanted to understand what an ML framework does between evaluating an expression and updating its parameters. Building the scalar graph made that hidden step small enough to inspect.
What I worked on
Keep the local derivative beside the operation
Each scalar operation creates a value with references to its parents and a small backward function. Addition, multiplication, and tanh each supply their local derivative. A reverse topological traversal then propagates the output gradient.
Accumulate contributions from shared values
Backward functions add to a parent’s gradient rather than replacing it. That matters when the same scalar appears on more than one path: x × x + x has three contributions to combine. A tiny expression is easier to reason about than a whole training loop.
Keep the project’s scope small
I built neurons, layers, and graph visualization around that scalar core. It is an educational implementation. The checked-in training example and tests are limited, so I do not use the repository as evidence of a complete production training framework.
What I take forward
When a high-level system feels opaque, I like rebuilding one small mechanism until I can explain each step.
