Skip to content
Dark Matter

Neural network

Watch a neural network learn. Each neuron draws a line; together they draw any shape. And if you let it learn by heart, it does worse on anything new.

Step 1 of 4 · A single neuron isn't enough

The network has one neuron, and a neuron can only draw a straight line (the white one). No straight line separates the pink points inside from the blue ones outside, so it stays around 50%, a coin toss.

● learns from it · ○ test, never seen while learning · background: what the network believes · thin lines: its neurons

epoch 0 · training: error 0.000, right 0% · test: error 0.000, right 0%

Error over time: training (solid) and test (dashed)

Problem

Network

layers: 2 → 1

Learning rate

Touching the plane adds

Challenges

Separate the two groups with no hidden layer: a single neuron, a single line.

The circle: a single neuron can't. How many do you need?

The spiral: over 90% right on the test points.

Make it memorise: nearly perfect on training, poor on test.

Ask Claude

Answered by Claude Haiku 5.5, from Anthropic. What you write is sent to Anthropic to answer; we don't keep it.

What's happening

An artificial neuron does something very simple: it adds up what it receives, each input times a weight, and decides which side of a line it falls on. A single one can only split with a straight line. Several, in layers, combine those lines and can draw circles, spirals, whatever it takes. Learning is adjusting the weights to be wrong less often: backpropagation works out how much each weight is to blame for the error, and gradient descent nudges it a little, thousands of times. Models like Claude or ChatGPT are this, with billions of weights. They also share its risk: memorising the examples instead of learning the rule. That's why part of the data is always kept aside to test with.

a = tanh(W·x + b) · w ← w − η · m̂ / (√v̂ + ε) (Adam)

How to play

It starts with a single neuron on a circle, and it can't: add a layer and neurons, and watch it bend the line into a ring. The background is what the network believes at every spot; the faint lines are its first neurons; hollow points are the test, never seen while learning. Try the spiral, add noise, and touch the plane to add points of your own.

How it's made

A neural network written from scratch for this game: tanh layers, a sigmoid output, cross-entropy and the Adam optimiser (its variant AdamW trains most large models). Every challenge was checked in a script before it reached you. The network learns in your browser; asking Claude what's happening sends it only the problem, the layers and the scores.