NeuroForge: A Neural Network You Can Watch Learn
A Neural Network You Can Watch Learn
An interactive playground where the network is trained by a backpropagation engine I wrote in vanilla JavaScript, with no TensorFlow, autograd or dependencies. Build a net, drop it on a dataset, hit Train, and watch the decision boundary bend around the data in real time.

- Year
- Dec 2025
- Timeline
- 6 weeks
- Type
- Machine Learning
- Status
- Live
~2e-10
Maximum relative error between my analytic gradients and a numerical gradient check, which is machine precision.
Overview
Most "neural network demos" are a thin UI over a library that does the work. In NeuroForge the learning algorithm is the project. The forward pass, the gradients, the optimizers and the weight initialization are all hand-written and readable in about 250 lines. Build a network by hand, drop it on a spiral, and watch the boundary bend, the connection weights thicken and fade, and the loss and accuracy curves move live.
The hard parts
- 01
A gradient that is wrong but doesn't crash is the worst kind of bug. The first run threw no error, but the boundary never moved.
- 02
The decision-boundary heatmap is an 80×80 grid, which is 6,400 forward passes per frame and ruins the framerate if recomputed naively.
- 03
Keeping the picture accurate: a teaching tool that draws an approximate boundary teaches the wrong thing.
- 04
Re-implementing the charts, the RNG and weight init by hand, because the goal was zero dependencies.
The approach
I caught the wrong gradient the way control work at DRDO taught me: check the clever code against ground truth. A central-difference numerical gradient check traced a batch-averaging bug to one line, and it now agrees with the analytic backprop to about 2e-10. The heatmap renders into an 80×80 offscreen canvas scaled up by the GPU and only recomputes when weights change. The renderer calls the real forward() on real featurized coordinates, so if you toggle X₁² the boundary becomes a true circle, because that is the function the net is now fitting.
Outcome
It trains XOR, the circle, moons and the two-spiral problem to about 100% accuracy at a steady 60fps, with the weights reorganizing live as the optimizer works. If you want to understand backpropagation, 250 lines of commented JavaScript that solves a spiral is a good place to read it.
What I'd do differently
Nested JS arrays mirror the math but are slow. I would move training to a Web Worker and switch to Float32Array. The single sigmoid output means binary classification only, and softmax with cross-entropy would add multi-class. A scrubber over recorded weight snapshots would let you replay training history.
Stack
Like what you see?
Let's build the next one.
Hiring, or have a problem that needs this kind of engineering? I read every message myself.

