# How do neural networks work? A beginner's guide · AI in Bed

https://www.aiinbed.com/blog/how-do-neural-networks-work · Published 2026-11-25

**Short answer:** A neural network is a stack of layers made of simple units called neurons. Each neuron multiplies its inputs by weights, adds them up and passes the result through an activation function to the next layer. The network learns by comparing its outputs with correct answers and nudging all the weights to reduce the error, using backpropagation and gradient descent, millions of times over.

### A neuron is a tiny calculator

Despite the name, an artificial neuron is very simple. It takes a few numbers in, multiplies each by a **weight** that says how much it matters, adds them up with a **bias**, and passes the total through an [activation function](https://www.aiinbed.com/glossary/activation-function) that decides how strongly to "fire".

Example: deciding whether to go for a run. Inputs might be "is it sunny", "am I tired" and "do I have time". The weights say sunshine helps a bit, tiredness hurts a lot. The neuron's output is a score for "go". That's it: one neuron is a weighted vote.

### Layers turn simple votes into rich patterns

One neuron can't do much. Wire thousands together in **layers** and it gets powerful:

- The **input layer** takes raw data: pixel brightness, word embeddings, sensor readings.
- **Hidden layers** each take the previous layer's outputs and combine them. In an image network, early layers respond to edges, middle layers to shapes like eyes or wheels, later layers to whole objects.
- The **output layer** gives the answer: "92% cat", a predicted price, or the next word.

A network with many hidden layers is a **deep** network, which is where [deep learning](https://www.aiinbed.com/glossary/deep-learning) gets its name. The activation functions matter here: without them, all the layers would collapse into one big linear sum and the network couldn't learn curves or complex patterns.

Play with one in the [neural networks lesson](https://www.aiinbed.com/learn/beginner/neural-networks-gently).

### How a neural network learns

Nobody sets the weights by hand. A network starts with random weights and learns from labelled examples:

1. **Forward pass.** Feed in an example, say a photo, and get a guess.
2. **Measure the error.** A [loss function](https://www.aiinbed.com/glossary/loss-function) scores how wrong the guess was.
3. **Backpropagation.** Work backwards through the network to calculate how much each weight contributed to the error. See [backpropagation](https://www.aiinbed.com/glossary/backpropagation).
4. **Gradient descent.** Nudge every weight slightly in the direction that reduces the error. The size of the nudge is the [learning rate](https://www.aiinbed.com/glossary/learning-rate).
5. **Repeat** over many examples and many passes ([epochs](https://www.aiinbed.com/glossary/epoch)) until the error stops falling.

The lessons on [gradient descent](https://www.aiinbed.com/learn/intermediate/gradient-descent) and [backpropagation](https://www.aiinbed.com/learn/intermediate/backpropagation) show each step with sliders you can move.

### Types of neural networks

- **Feedforward networks (MLPs):** the basic layered kind above.
- **Convolutional networks ([CNNs](https://www.aiinbed.com/glossary/cnn)):** scan images with small filters; long the standard for vision.
- **Recurrent networks (RNNs):** read sequences one step at a time; once common for text and speech.
- **Transformers:** use [attention](https://www.aiinbed.com/glossary/attention) to relate every part of the input to every other part; they power ChatGPT and most modern AI. See [what is a transformer](https://www.aiinbed.com/blog/what-is-a-transformer).
- **Diffusion models:** learn to remove noise step by step to generate images.

### Are neural networks like the brain?

Only loosely. They were inspired by neurons in the 1940s and 50s, but real brain cells are far more complex, and brains don't learn by backpropagation as far as we know. A better mental model is a huge, flexible formula with millions or billions of adjustable [parameters](https://www.aiinbed.com/glossary/parameters-weights), tuned automatically to fit the examples.

> A big risk is memorising the training examples instead of learning the pattern. That's called [overfitting](https://www.aiinbed.com/glossary/overfitting), and it's why networks are always tested on data they haven't seen.

### Key takeaways

- Neuron = weighted sum of inputs + an activation function.
- Layers stack up: early ones find simple patterns, later ones combine them.
- Learning means adjusting weights to shrink a loss, step by step.
- "Deep learning" just means neural networks with many layers.

### Questions

**How does a neural network work in simple terms?**

It passes numbers through layers of simple units. Each unit weighs its inputs, adds them up and passes the result on. The network learns by adjusting those weights, over many examples, to make its answers less wrong.

**What is the difference between a neural network and deep learning?**

Deep learning is the use of neural networks with many layers. All deep learning uses neural networks; a very small, shallow network isn't usually called deep learning.

**What are weights in a neural network?**

Weights are the adjustable numbers that set how strongly each input affects each neuron. Training a network means finding good values for its weights.

**Do I need maths to understand neural networks?**

Not to understand the idea. To build them from scratch, a little algebra, the idea of a derivative and some Python help. See our guide on whether you need maths to learn AI.

### Sources

- [Neural networks](https://www.3blue1brown.com/topics/neural-networks) by 3Blue1Brown
- [Neural Networks and Deep Learning](http://neuralnetworksanddeeplearning.com/) by Michael Nielsen
- [TensorFlow Playground](https://playground.tensorflow.org/) by Google
- [Neural Networks: Zero to Hero](https://karpathy.ai/zero-to-hero.html) by Andrej Karpathy
