Neural Networks
Running the forward pass…
Initializing Sorting Algorithms...
Sorting
Trees
Graphs
Preparing interactive visualizations...
Neural Networks
Running the forward pass…
A neuron is a weighted sum and a bend. Stack enough of them, train them with the chain rule, and they can draw almost any boundary — watch real ones learn, and fail, in your browser.
One neuron, trained live: every mistake nudges the line towards the point it got wrong. On separable data it always stops; on XOR it never can.
ŷ = step(w·x + b), w ← w + η (y − ŷ) xLogistic RegressionLearn from MistakesStep, sigmoid, tanh, ReLU and GELU side by side with their slopes — and what a stack of layers can draw with each one, and with none.
ReLU(z) = max(0, z), σ(z) = 1 / (1 + e^−z)The PerceptronBend the LineTrace one input through a 2-3-2 network, multiply by multiply: weighted sums, activations, then softmax turns two scores into probabilities.
h = f(W₁x + b₁), p = softmax(W₂h + b₂)Activation FunctionsLayer by LayerWatch a trained network stretch, shift and squash the plane layer by layer until two tangled moons come apart along a straight line, and see why two units per layer can never cut a ring off its core.
h = tanh(Wx + b), then the cut v · h + c = 0Forward PassBend the PlaneRecord L = (wx + b − y)² as a tape of tiny operations, each storing its own local derivatives, replay it newest first, then use w twice and watch its gradient become a sum.
∂L/∂w = 2(wx + b − y) · xForward PassRecord, Then ReplayStep through every gradient of a real network: upstream × local on each edge, sums where paths meet, each checked against finite differences. Then train XOR and break it.
∂L/∂x = Σ ∂L/∂out · ∂out/∂xComputational GraphsChain Rule in ReverseSGD, momentum, RMSProp and Adam race down the same narrow ravine from the same start. Watch who zig-zags, who overshoots, who reaches the floor first and who cannot stay there, then turn the ravine 45°.
θ ← θ − η · m̂ / (√v̂ + ε)Gradient DescentSmarter StepsFollow a gradient back through 12 layers and watch it shrink to 10⁻¹¹ with sigmoid, still vanish with ReLU at the default scale, explode at twice He’s, and keep its size with He initialisation.
δₖ₋₁ = Wₖᵀ (f′(zₖ) ⊙ δₖ), n · Var(w) · E[f′²] ≈ 1BackpropagationProducts Shrink or GrowBatch norm and layer norm, computed on a batch you can read: subtract the mean, divide by the spread, then let γ and β put back what training wants.
x̂ = (x − μ) / √(σ² + ε), y = γ x̂ + βVanishing and Exploding GradientsRe-centre Every LayerTrain an oversized network on a few noisy points and watch it memorise them; then switch on dropout or weight decay and watch the boundary calm down.
L + (λ/2) Σ w², h ← h · m / (1 − p)Overfitting and UnderfittingRegularize the NetworkPick a dataset, stack layers, choose activations, an optimizer and regularisation, and train it live — with every unit’s picture of the plane on view.
ŷ = f_L(W_L … f₁(W₁x + b₁) … + b_L)BackpropagationBuild, Train, BreakImage models, speech recognisers and language models are all neural networks trained by backpropagation. The pieces on this page — layers, activations, gradients, optimizers — are the pieces they are built from.
A loss that will not fall, a network that predicts one class, gradients that vanish twelve layers down: each has a cause you can see here and a fix you can try, on a network small enough to read.
Every number on these pages is computed in your browser, by networks that really train. Once you have watched one unit bend a line, a billion of them stop being mysterious.