What is a neural network?
A neural network is the kind of model behind most modern AI, from speech recognition to large language models. It is loosely inspired by the brain: many simple units, called neurons or nodes, are connected in layers, and each connection has a strength, called a weight. On its own a unit does almost nothing. Millions or billions of them together can recognise a face or write a paragraph.
How does a neural network work?
Data enters as numbers, passes through the layers and comes out as a prediction.
| Layer | What it does |
|---|---|
| Input layer | Receives the data: pixel values, word tokens, account features |
| Hidden layers | Each unit combines its inputs, weighted by connection strength, and passes a result on |
| Output layer | Produces the answer: a category, a number, or the next token |
Early layers tend to pick up simple patterns and later layers combine them into complex ones. In an image model, that might run from edges to shapes to whole objects.
How does a neural network learn?
- The network starts with random weights and makes a prediction.
- The prediction is compared with the correct answer, and the size of the error is measured.
- The error is traced back through the network to work out how much each weight contributed, a method called backpropagation.
- Each weight is nudged slightly in the direction that reduces the error.
- This repeats over a very large number of examples until the predictions stop improving.
Nobody programs the patterns in. They emerge from the weights, which is why a trained network is powerful and also hard to explain.
What are the main types of neural network?
- Feedforward networks: data flows one way. Used for scoring and classification on tabular data.
- Convolutional networks: built for grids such as images. Common in computer vision.
- Recurrent networks: process sequences step by step. Largely replaced for language by transformers.
- Transformers: use attention to relate every part of the input to every other. The basis of large language models.
Neural network vs deep learning
Deep learning means using neural networks with many hidden layers. A network with one or two hidden layers is a neural network but is not usually called deep.