What Is a Neural Network?
See why neural networks learn from examples instead of rules, how they are organized in layers, and why they took off after decades of slow progress.
Welcome back!
Step 1 of 12Learn
A program nobody wrote
Try to write a program that recognizes handwritten digits. A scanned digit is a grid of 28 × 28 = 784 pixels, each a brightness value. You might start with rules: "a 1 is a vertical stroke," "a 0 is a loop." Within an hour the exceptions pile up. Some people put a hat on their 1, some 7s have a bar, some 4s are open at the top, and a sloppy 5 looks like a 6.
A neural network takes a different route. Nobody types in rules about loops and strokes. Instead, you show it tens of thousands of labeled examples (the classic MNIST dataset has 60,000 training images) and let it adjust millions of internal numbers until its answers match the labels. After training, a small network gets about 98% of new, unseen digits right.
That is the core idea of this course: a neural network is a function with adjustable numbers, and training is the process of finding numbers that make the function useful. Everything else, from the neuron to backpropagation to transformers, is detail about how that function is built and how those numbers are found.
Step 2 of 12Practice · Choose one
Which task is the best fit for a neural network rather than hand-written rules?
Step 3 of 12Learn
Learning from examples
Most networks you will meet are trained with supervised learning. Each training example is a pair: an input (the 784 pixels) and a label (the correct digit, say 7). The cycle looks like this:
- The network makes a prediction for an input.
- A loss function measures how wrong the prediction is.
- The network's internal numbers, called parameters (mostly weights), are nudged so the loss gets a little smaller.
- Repeat for thousands or millions of examples.
This phase is training, and it is expensive: it may take minutes on a laptop for a small model or weeks on thousands of chips for a large one. Once training ends, the parameters are frozen and the network is used for inference: making predictions on new inputs. Inference is far cheaper, which is why a phone can run a model that took a data center to train.
A useful mental picture: training is like a student studying with an answer key; inference is the exam, where no answer key is available and the student must rely on what was learned.
Step 4 of 12Practice · Diagram
The supervised learning loop
Training repeats this loop thousands or millions of times. Tap each stage.
Which stage only happens during training, never when the finished app labels a new photo?
Tap the shape that answers the question, then press Check.
- Predict
The network turns an input (the 784 pixels) into an output, for example "probably a 3".
- Compare with the label
The correct answer, say 7, comes with the training example.
- Measure the error
A single number, the loss, says how wrong the prediction was.
- Nudge the weights
Every weight moves a tiny amount in the direction that would have lowered the loss.
Step 5 of 12Practice · Sort into groups
Sort each activity into training or inference.
Tap an item, then tap its group (or drag it there).
Step 6 of 12Learn
Inspired by the brain, not a copy of it
The name comes from biology. A brain neuron receives signals from other neurons through branches called dendrites, and if the combined signal is strong enough, it fires a pulse down its axon to the next cells. Connections can be strong or weak, and learning changes their strength.
An artificial neuron borrows only the outline of that idea. It receives numbers, multiplies each by a weight (the strength of the connection), adds them up, and passes the result through a simple function. Neurons are arranged in layers: an input layer that holds the raw data, one or more hidden layers that compute intermediate features, and an output layer that produces the answer. In a fully connected network, every neuron in one layer feeds every neuron in the next.
Don't push the analogy too far. Real neurons communicate with timed electrical spikes and chemicals, rewire themselves constantly, and a human brain has roughly 86 billion of them. Artificial networks are math: matrix multiplications running on chips. The biology was the inspiration, but the success of modern networks comes from statistics, calculus and lots of computing power.
Step 7 of 12Timeline
Milestones in neural networks
- 1943First mathematical neuron
McCulloch and Pitts describe a neuron as a simple on/off logic unit.
- 1958The perceptron
Frank Rosenblatt builds a machine that learns its own weights from examples.
- 1969The XOR setback
Minsky and Papert show single-layer perceptrons cannot learn some simple patterns, and funding cools.
- 1986Backpropagation popularized
Rumelhart, Hinton and Williams show how to train networks with hidden layers efficiently.
- 1998LeNet-5
A convolutional network reads handwritten digits on bank checks.
- 2012AlexNet
A deep convolutional network trained on GPUs wins the ImageNet image contest by a wide margin.
- 2017The transformer
The paper "Attention Is All You Need" introduces the architecture behind modern language models.
- 2020sLarge language models
Transformers with billions of parameters, trained on huge text collections, become everyday tools.
Step 8 of 12Learn
Why it finally worked
The basic ideas behind neural networks were known by the late 1980s, yet they stayed a niche tool for two more decades. Three things changed around 2010:
- Data. The internet produced huge labeled datasets. ImageNet, for example, contains over a million labeled photos. Large networks need large amounts of data, or they simply memorize.
- Compute. Graphics processing units (GPUs), built for video games, turned out to be excellent at the one operation networks need most: multiplying big matrices. Training that would have taken months on CPUs took days.
- Better techniques. Simple changes, such as the ReLU activation function, smarter weight initialization, dropout and better optimizers, made deep networks trainable where they used to stall.
Together these produced deep learning: networks with many layers, each building on the features found by the one before. When AlexNet won the 2012 ImageNet competition, its error rate was roughly 10 percentage points lower than the runner-up, and the field shifted almost overnight. The same recipe (more data, more compute, better architectures) later produced speech recognition, machine translation and large language models.
Step 9 of 12Practice · Chart
ImageNet challenge: best top-5 error by year
In the ImageNet competition a model gets five guesses per photo across 1,000 categories. Watch what happened once deep networks entered.
Tap the year a deep convolutional network trained on GPUs first won, cutting the error by about 10 points in one go.
Tap the bar that answers the question, then press Check.
Step 10 of 12Practice · True or false
A trained neural network contains the explicit rules a programmer typed in, such as "a zero is a closed loop."
Step 11 of 12Practice · Match the pairs
Match each part of a network to its role.
Tap an answer, then tap the place where it belongs (or drag it there).
- Input layer
- Hidden layer
- Output layer
- Weight
Step 12 of 12Practice · Choose one
Which combination best explains why deep learning took off after about 2010?
Lesson complete!