AI basics

How do neural networks work? A beginner's guide

A neural network is layers of simple maths units that learn patterns from examples by adjusting millions of numbers. Neurons, layers, weights, training and backpropagation explained without the maths.

4 min read

Short answer

A 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 , 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 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.

x₁× w₁x₂× w₂x₃× w₃Σ+ biasReLUyinputsweighted sumoutput
One artificial neuron: weigh the inputs, add them up and pass the total through an activation.

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 , 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 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.

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 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.
  4. Gradient descent. Nudge every weight slightly in the direction that reduces the error. The size of the nudge is the learning rate.
  5. Repeat over many examples and many passes (epochs) until the error stops falling.

The lessons on gradient descent and backpropagation show each step with sliders you can move.

Types of neural networks

  • Feedforward networks (MLPs): the basic layered kind above.
  • **Convolutional networks (CNNs):** 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 to relate every part of the input to every other part; they power ChatGPT and most modern AI. See 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, tuned automatically to fit the examples.

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.

Learn it properly, free

Terms in this post

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 and further reading

Read next

Spotted a mistake? Suggest an edit