How does a neural network work?
Follow one email through a neural network, step by step: how it turns into numbers, gets a spam score, and how the network learns from its mistakes.
Open your spam folder. Somewhere in there is an email like “You won a prize! Claim now”, and you never had to deal with it. A neural network looked at it and decided. The same idea, at a far larger size, runs ChatGPT, Claude and every other modern AI model.
This guide follows that one email through a network, step by step. No maths beyond multiplying and adding.
- 1Turn it into numbers — the email becomes a list of numbers the network can work with
- 2Multiply and add — each connection has a weight; neurons add up the weighted inputs
- 3Give a score — the last layer turns the result into a prediction, like a spam score
- 4Learn from mistakes — compare with the right answer, nudge the weights, repeat
Every one of those 70 billion weights is a single number. Those weights are the model’s parameters, and learning means setting them.
Stay to the end and you’ll also know what the “deep” in deep learning means.
What it is, and what it isn’t
A network of simple units arranged in layers. Each unit adds up the numbers it receives, scaled by a weight on each connection, and passes the result on. Learning means adjusting the weights.
The name makes people picture a digital brain. The word “neuron” was only a loose inspiration. There’s no understanding inside, just arithmetic done very many times.
- What people imaginea digital brain that understands
- What it actually islayers of numbers: multiply, add, repeat
Follow one email through the network
Spam filters are a common job for neural networks. A message goes in one side, “spam” or “not spam” comes out the other, and the network learned the pattern from emails people had already marked as spam.
The numbers below are made up to keep the example small. A real filter uses far more inputs and weights, but each step works the same way.
1. The email becomes numbers
A network can’t read words, so the email is turned into numbers first. In our tiny example, three questions:
- Does it contain “prize”? Yes = 1
- Is the sender unknown? Yes = 1
- Does it mention a meeting? No = 0
2. Each neuron multiplies and adds
Every connection has a weight: how much that input matters. A big positive weight pushes towards “spam”, a negative one pushes away from it. Say this neuron’s weights are 2.0 for “prize”, 1.5 for “unknown sender” and -1.0 for “meeting”:
1 × 2.0 + 1 × 1.5 + 0 × (-1.0) = 3.5
Each neuron also has a starting lean, called a bias. Here it’s -2, so the total is 3.5 - 2 = 1.5.
3. The neuron decides how strongly to fire
A small rule, the activation, turns that total into a firing strength. A common one squeezes any number into a range between 0 and 1. Our 1.5 becomes about 0.82. Big totals end up near 1 (fires strongly), very negative ones near 0 (stays quiet).
4. Out comes a score
In a real network, many neurons do this side by side, layer after layer, and the last layer gives the answer. Here it’s 82% spam. The filter might move anything above 50% to your spam folder.
How it learns from mistakes
Nobody types in those weights. A new network starts with random ones, so its first guesses are random too. Learning is a loop:
- 01Guess
- 02Compare with the right answer
- 03Measure the error
- 04Nudge every weight a little
Say a real email, “Team meeting moved to 3 pm”, gets a 70% spam score. The right answer, from people who marked it, is “not spam”. The error is big, so the weights that pushed towards spam get turned down a little, and the “meeting” weight gets a bit more negative. Next time, a similar email scores lower.
The nudges are tiny on purpose. One email shouldn’t undo what the network learned from thousands of others. Over millions of rounds, the small nudges add up.
What “deep” means
One layer on its own can only draw a straight line between “spam” and “not spam”. Real data is messier than that: plenty of normal emails mention prizes, and plenty of spam doesn’t.
More layers solve it. Each layer combines what the one before it found into something more complex. In image models, the first layers notice edges, the next ones shapes, and later ones whole faces.
“Deep learning” just means a neural network with many layers.
From a spam filter to ChatGPT
An LLM is the same idea at a giant size. The input is text turned into numbers (see tokens), the output is a guess at the next piece of text, and training nudged billions of weights over a huge pile of text. Same loop: guess, compare, nudge, repeat.
Common questions
Do I need maths to understand this? No. The core is multiply and add. The hard part is doing it billions of times, and computers handle that.
Does it understand the email? No. It doesn’t understand, remember or decide the way people do. It finds patterns in data, extremely well.
Why does spam still get through? The network only knows patterns from the examples it learned from. A new trick that doesn’t look like those examples can slip past until it’s retrained.
Can you look inside and see what it learned? Not easily. What it learned is spread across all its weights as plain numbers, not written down as rules you can read.
The picture to keep
Not a brain: a giant mixing board. Each slider is a weight. Sound goes in, every slider boosts or dampens part of it, and a mix comes out. Training is someone slowly nudging billions of sliders until the mix sounds right.
Quick recap
- A neural network is layers of weighted connections: multiply, add, pass it on.
- Inputs become numbers, neurons add them up with weights, and the last layer gives a score.
- It learns by guessing, comparing with the right answer and nudging every weight a little, millions of times.
- “Deep” means many layers, which lets it find complex patterns.
- An LLM is the same idea with billions of weights.
Next: Attention Is All You Need, the 2017 paper that made modern LLMs possible.
Related concepts
LLM · Parameters · Fine-tuning · Token