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.
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).
Things to try
- Scaled random (the default): it learns the spiral in about 40 steps, and every layer keeps 12 of 12 different neurons.
- 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.
- All zeros: every hidden gradient is exactly 0. Nothing moves except the output bias.
- 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.
- 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.
- 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.
- 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
- Randomness is the tie-breaker. Gradient descent can only make neurons more different than they already are. If they start identical, the maths keeps them identical.
- The size of the random numbers matters as much as the randomness. Each neuron sums 12 inputs, so the spread grows or shrinks by a fixed factor every layer. Scaled init divides by √(inputs) so that factor is about 1. Too small and the signal fades; too big and ReLUs die.
- Saturation hurt less than I expected. Huge random with tanh learned faster than scaled at 3 layers. Deep stacks are where it bites: at 6 layers, 2 of 3 random draws stalled.
- Real language models add LayerNorm, residual connections and smaller per-layer scales on top, which make this much less fragile. This page has none of that, on purpose.
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 weights | tanh, 3 layers | tanh, 6 layers | ReLU, 3 layers | ReLU, 6 layers |
|---|---|---|---|---|
| All zeros | 50%, never moves | 50%, never moves | 50%, never moves | 50%, never moves |
| All the same | 80%, 1 neuron per layer | 58%, 1 neuron per layer | 50%, all dead | 50%, all dead |
| Tiny random | loss stuck at 0.693 | loss stuck at 0.693 | loss stuck at 0.693 | loss stuck at 0.693 |
| Scaled random | step 40–52 | step 12–25 | step 38–55 | step 22–60 |
| Huge random | step 11–24 | 1 of 3 (step 2,417); others 68%, 75% | 50%, all dead | 50%, 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.