Small model lab

If a model starts from nothing, why doesn't every neuron learn the same thing?

A network with 12 neurons per layer learns to separate a two-colour spiral, live in your browser, with the backprop written out by hand. Change how its weights start and watch what breaks.

It never starts from nothing. It starts from random numbers, and that randomness is what lets neurons become different. Start them all equal and every layer stays one neuron copied 12 times, forever. Start them random but at the wrong size and the signal fades away or the neurons die.

Train one

2 inputs, 1 to 8 hidden layers of 12 neurons, 1 output. 200 points, full-batch gradient descent, up to 12,000 steps.

Starting weights
Activation
3
0.30
Run
Step0
Loss–
Accuracy–
Different neurons per layer–

What it thinks

one arm, the other. The shading is the network's guess; stronger means surer.

Loss

Log scale. The dashed line is a coin flip (ln 2 ≈ 0.693).

LayerSignal size (spread of its outputs)Gradient size (how hard it learns)DifferentDead or stuck

Things to try

  1. Scaled random (the default): it learns the spiral in about 40 steps, and every layer keeps 12 of 12 different neurons.
  2. All the same: "Different" drops to 1 of 12 and stays there. Every neuron gets the same blame, so every neuron gets the same update. With tanh it still learns a little, as one neuron per layer.
  3. All zeros: every hidden gradient is exactly 0. Nothing moves except the output bias.
  4. Tiny random: the signal shrinks about 30 times per layer. Set 6 layers and the last one is down around 10-10. The loss sits on the coin-flip line.
  5. Huge random with tanh: most neurons are pinned at ±1, yet at 3 layers it still learns, even faster than scaled. Slide to 6 layers and it usually stalls.
  6. Huge random with ReLU: the first update is so big it pushes every neuron negative. A ReLU that outputs 0 everywhere gets no gradient, so they never come back.
  7. Hit New random draw a few times on scaled: each start takes its own path and draws a slightly different boundary, and they all get there.

What it says

Measured offline

Same network and data, step size 0.3, 3 random draws each, 6,000 steps. "Step" is when it first reached 97% accuracy.

Starting weightstanh, 3 layerstanh, 6 layersReLU, 3 layersReLU, 6 layers
All zeros50%, never moves50%, never moves50%, never moves50%, never moves
All the same80%, 1 neuron per layer58%, 1 neuron per layer50%, all dead50%, all dead
Tiny randomloss stuck at 0.693loss stuck at 0.693loss stuck at 0.693loss stuck at 0.693
Scaled randomstep 40–52step 12–25step 38–55step 22–60
Huge randomstep 11–241 of 3 (step 2,417); others 68%, 75%50%, all dead50%, all dead

With tiny random weights the accuracy floats above 50% (23–89%) only because the output is a hair off zero. The loss says it knows nothing.