Tiny Neural Net Playground
Place dots on a canvas, press Train, and watch a small neural network literally learn the boundary between them — weights, loss curve and all.
Runs 100% in your browser — check the network tab1 of 3 — Watch it learn
This is "Two blobs" — two clearly separate groups of points. Press Train below and watch the colored boundary bend to match them. Zero hidden layers, and it'll nail it: this is the simplest case a network can solve.
Epoch 0
Hover a connection to see its weight
Press Train to see the loss curve — lower means fewer mistakes.
Under the Hood
Right now, this network’s weights are just random numbers. Press Train and watch what happens: for every point in the dataset, it makes a guess, checks how wrong that guess was, and nudges every weight a tiny bit in whichever direction would have made that guess less wrong. Do that for every point, over and over, thousands of times — that repeated nudging is gradient descent, and it’s the entire mechanism behind “the model learns from data.”
Large language models run the exact same loop. The differences are all scale: billions of weights instead of about 30, predicting the next word in a sentence instead of a point’s color, and months of training on thousands of GPUs instead of a few seconds in your browser. Nothing here is a simplified stand-in for what LLMs do — it’s the same algorithm, just small enough to watch happen.
Why does XOR need a hidden layer? With zero hidden layers, this network can only draw a single straight line through the plane and call one side “class A,” the other “class B.” XOR’s two classes sit in diagonally opposite corners — no single straight line can separate them. A hidden layer lets the network combine several straight lines into a bent, non-linear shape, which is exactly what XOR (and circle, and spiral) need.
Go deeper
The output layer uses a sigmoid squashed into [0, 1] and binary cross-entropy loss. Trained together, their gradient has a famously clean form: the error signal at the output is just prediction − actual label — no extra chain-rule term at that one spot, which is part of why this pairing is the standard choice for binary classifiers.
Every hidden layer uses tanh, not ReLU. ReLU is the more common choice in real networks (and trains faster at scale), but its “flat below zero, straight line above” shape is a less intuitive first mental model for what a neuron’s “bend” looks like — tanh’s smooth S-curve is easier to reason about when you’re staring at just one or two neurons in a diagram.
“Reckless” (learning rate 0.5) can make training worse, not better, especially on harder datasets like spiral: each step overcorrects past where it should have nudged to, and the loss oscillates or climbs instead of settling down. That’s not a bug — real training runs can and do diverge exactly this way when the learning rate is too high for the shape of the loss landscape.