Neural Networks:
the Basics
The architecture behind almost every modern AI system. This lesson explains how artificial neurons work, how they connect into layers, and how backpropagation enables learning.
A two-year-old child can recognise their parent's face from any angle, in any lighting,
after seeing it thousands of times. No one sat the child down and wrote rules about
the distance between eyes, the shape of the nose, or the curvature of the jaw.
The brain simply learned, from exposure and feedback, what faces look like.
In 2012, a team at the University of Toronto built a neural network called AlexNet.
They fed it 1.2 million labelled images and let it learn. It cut the image recognition
error rate almost in half overnight. Nobody told it what an edge was, or what a texture was,
or what a face was. It worked it out from the data. The modern AI revolution started there.
Krizhevsky, Sutskever and Hinton. ImageNet Classification with Deep Convolutional Neural Networks. 2012.
From biological to artificial neurons
A biological neuron receives electrical signals from other neurons through its dendrites. If the total incoming signal is strong enough, it fires - sending a signal down its axon to other neurons. Everything in your brain is ultimately patterns of these firing events.
An artificial neuron works similarly. It takes several numeric inputs, multiplies each by a weight (how important that input is), adds them together, then passes the total through an activation function that decides whether and how strongly the neuron fires. The output becomes an input to the next layer of neurons.
Neurons are organised into layers. The first layer receives the raw input (pixel values, word frequencies, sensor readings). The final layer produces the output (a classification, a probability, a generated token). Every layer in between is a hidden layer - it learns increasingly abstract representations of the data.
A network with many hidden layers is called a deep neural network. This is where the term deep learning comes from.
Watch signals flow through a network
Click "Forward Pass" to watch a signal travel from the input layer, through the hidden layers, to the output. Each lit neuron represents one that has "fired." The brightness represents its activation strength.
Tune a single neuron
Every neuron in a neural network does the same calculation: multiply each input by its weight, add them all up, then squash the result through an activation function. Adjust the sliders below and watch the calculation update live at every step.
The sigmoid function compresses any number into the range 0 to 1. Very large sums produce outputs near 1 (firing). Very negative sums produce outputs near 0 (suppressed). This is how a neuron "decides" how strongly to pass a signal to the next layer - and during training, the weights are adjusted automatically to produce the right outputs.
One forward pass
A small neural network classifies emails as spam or not. Work through each calculation step manually - tracing the values from input all the way to the output decision. Complete each step in order to unlock the next.
suspicious
word count
external
link count
hidden
neuron 1
hidden
neuron 2
spam?
Activation: ReLU - any negative weighted sum becomes 0. If final output > 0.5 the email is classified as SPAM.
Questions worth thinking about
What to remember
Explore further
Wikipedia makes an excellent starting point for established computing concepts. For any specific fact or claim, scroll to the References section at the bottom of the article and go to the primary source directly.
Check your understanding
Exam-style practice
Practice what you've learned
Three printable worksheets covering neurons, layers, weights, and the training process at three levels: Recall, Apply, and Exam-style.