How Neural Networks Learn

Watch a tiny network teach itself the XOR problem, one gradient descent step at a time.

The Network

Input Hidden Output x₁ x₂ h₁ h₂ y 0.00 0.00 0.00 0.00 0.00
Positive weight
Negative weight
Thicker line = stronger weight

Controls

Bigger steps learn faster but can overshoot. Smaller steps are steadier but slower.

Ready. Click Train to start learning.

Loss Curve

Loss measures how wrong the network is. Gradient descent pushes it downward.

Truth Table

Input x₁ Input x₂ Target XOR Network Guess Error
000
011
101
110

What You're Seeing

Neurons

Each circle holds a number between 0 and 1. Brighter color means a stronger activation.

Weights

Connections carry multipliers. The network adjusts these during training to find the right pattern.

Hidden Layer

XOR can't be solved with a straight line. The hidden layer combines inputs in nonlinear ways.

Gradient Descent

After each guess, the network measures the error and nudges every weight to reduce it.