Inside the Black Box

How Neural Networks Think — An Interactive Explorable Explanation

1. The Input (Pixels to Neurons)

When you see a handwritten '3', your brain instantly recognizes it. But a computer just sees a grid of pixels. To build a neural network, our first step is to unroll that 2D grid into a single 1D column of numbers. We call these containers Neurons.

Try it: Click and drag to draw on the left grid. Hover over any pixel to see a line connect it to its exact neuron in the vertical layer. Notice how a bright white pixel equals an activation of 1.0, while black is 0.0.

2. Building Abstractions (Why Layers?)

We don't jump straight from pixels to the final answer. Neural networks use Hidden Layers to build abstractions. Imagine if the second layer learned to recognize tiny edges, and the third layer combined those edges into loops and lines.

Try it: You are viewing the 'Top Loop' neuron. Why are the connections in the middle red? Because if there are pixels in the middle, it's probably an '8', not a '9' or a '0'. Negative weights tell the neuron to stay quiet.

3. The Math of a Single Neuron

Let's zoom in on just one neuron to see the math. A neuron calculates its activation by taking a weighted sum of all the neurons connected to it, plus a baseline bias.

Output = σ(
1.0
* 1 +
-1.0
* 0 +
0.5
* 1 )
+ Bias:
0.0
= 0.82
Try it: Click the input neurons (cyan circles) to toggle them on/off. Drag the Bias slider down to -5.0. Notice how the output stays dark even when inputs are on? A negative bias means the neuron needs a lot of positive input before it fires.

4. The "Squishification" Function

There's a catch in the math above. A weighted sum can result in any number, like +45 or -12. But we want our neuron's activation to represent an intensity between 0 and 1. To fix this, we pump the result through an Activation Function like the Sigmoid curve.

Try it: Drag the glowing dot left and right. Notice how a negative sum gets squished to exactly 0? This non-linear squishing is what allows the network to make complex decisions.

5. The Full Forward Pass (Matrix Math)

When you have 13,000 weights, calculating them one by one is too slow. Engineers group the activations into a vector, the weights into a matrix, and compute the whole layer at once using Linear Algebra.

Weights (W)
×
In (a⁰)
+
Bias (b)
=
Out (a¹)
Try it: Click "Step Forward". This single equation represents thousands of individual connections firing at once. But underneath the intimidating matrix math, it's just pixels, positive signals, and negative signals.