What is a neuron in AI? Watch
In AI, a neuron (also called an artificial neuron, a node or a unit) is the smallest building block of a neural network. It is a tiny piece of maths: some numbers go in, one number comes out.
The name was borrowed from the nerve cells in our brain, but an AI neuron is not a living cell. It is a small calculation that a computer repeats millions of times a second. Connect millions of them in layers and you get the engine inside today's AI.
The five parts of an AI neuron Watch
The idea is not new: in 1958, Frank Rosenblatt built the perceptron, a machine with artificial neurons that learned from examples. Today's neurons work almost the same way, in five parts:
- Inputs (x): numbers that come in, like the brightness of a pixel or a fact written as 1 for yes and 0 for no.
- Weights (w): one number per input that says how much it matters. A big weight means important; a negative weight means "this pushes against".
- Weighted sum: multiply each input by its weight and add them all up.
- Bias (b): one extra number added at the end. It sets how easily the neuron fires, like a threshold.
- Activation: a small function that turns the sum into the output, for example a number between 0 and 1.
In one line: output = activation(w1 × x1 + w2 × x2 + w3 × x3 + b). That is all one neuron does: multiply, add, decide.
Worked example: should I take an umbrella? Watch
Let us build one neuron that decides whether to take an umbrella. It gets three inputs, each with a weight:
| Input | Today | Weight | Why this weight |
|---|---|---|---|
| x1: dark clouds? (1 yes, 0 no) | 1 | 2 | clouds are a strong sign of rain |
| x2: rain chance in the weather app | 0.7 | 3 | the forecast matters most |
| x3: sunny right now? (1 yes, 0 no) | 0 | -1.5 | sunshine pushes against rain |
| Bias | none | -2.5 | do not carry an umbrella without a good reason |
- Multiply: 1 × 2 = 2, then 0.7 × 3 = 2.1, then 0 × -1.5 = 0.
- Add, with the bias: 2 + 2.1 + 0 - 2.5 = 1.6.
- Activation: the sigmoid function turns 1.6 into 0.83.
- Answer: 0.83 means 83 percent sure. Take the umbrella!
On a sunny day, with no clouds, a 10 percent forecast and sunshine, the sum is 0 + 0.3 - 1.5 - 2.5 = -3.7, and the output is only 0.02: leave the umbrella at home. The same neuron gives a different answer because the inputs changed.
Activation: the neuron's on-off switch Watch
Without an activation, a neuron could only draw straight lines, and even a thousand layers would act like one. The activation adds the bend that lets networks learn complex patterns. Three common ones:
- Step: output 1 if the sum is above zero, else 0: a plain on-off switch. Used in the first perceptron.
- Sigmoid: squeezes any number into a smooth value between 0 and 1, read as "how sure". We used it for the umbrella.
- ReLU: negative sums become 0, positive sums pass through unchanged. It is simple and fast, so most modern deep networks use it or a close cousin.
How a neuron learns from its mistakes Watch
A new neuron starts with random weights, so its first answers are guesses. Learning means adjusting the weights, one example at a time:
- Guess: on a day with dark clouds it says 0.4, only 40 percent sure of rain.
- Check: it did rain, so the right answer was 1. The error is 1 - 0.4 = 0.6.
- Adjust: new weight = old weight + learning rate × error × input. With a clouds weight of 0.5 and a learning rate of 0.1: 0.5 + 0.1 × 0.6 × 1 = 0.56.
- Repeat: do this for thousands of examples. Slowly the weights settle on values that give good answers.
Notice: if an input was 0, its weight does not change, because it played no part in the mistake. And the learning rate keeps every step small, so one odd day does not undo everything. In big networks the same idea, spread back through all the layers, is called backpropagation.
What a neuron does inside a real AI Watch
In an image AI, the inputs of a first-layer neuron are pixel brightness values, from 0 for black to 1 for white. Here is one neuron that looks at four pixels in a row, with weights -1, -1, +1 and +1, a bias of 0 and the ReLU activation:
- Dark to bright (0.1, 0.1, 0.9, 0.9): -0.1 - 0.1 + 0.9 + 0.9 = 1.6. Positive, so it fires with 1.6.
- Plain grey (0.5, 0.5, 0.5, 0.5): -0.5 - 0.5 + 0.5 + 0.5 = 0. Nothing to see, so the output is 0.
- Bright to dark (0.9, 0.9, 0.1, 0.1): the sum is -1.6, and ReLU turns it into 0. Silent.
Nobody types these weights in. During training, many first-layer neurons in image models turn into edge and colour detectors like this one by themselves. Neurons in deeper layers take those outputs as their inputs and respond to curves, then to eyes and wheels, then to whole faces.
In a chatbot like ChatGPT, the inputs are not pixels but the long lists of numbers that stand for each token. GPT-3, for example, has 96 layers, and each layer has about 49,000 neurons, each one looking at 12,288 numbers at once.
From one neuron to a whole network Watch
One neuron can only split things with a straight line. In 1969, Marvin Minsky and Seymour Papert showed it cannot even learn "one or the other, but not both" (XOR). The fix is to connect many neurons in layers, where each layer's outputs are the next layer's inputs.
- Input layer: takes in the data, like the pixels of a photo.
- Hidden layers: find patterns, simple ones first, like edges, then bigger ones, like eyes and faces.
- Output layer: gives the answer, like "cat" or "dog".
Every connection has its own weight. A small network has thousands of weights; GPT-3 had 175 billion. Many layers is what "deep" means in deep learning.
AI neuron words in one table Watch
| Word | What it means | Example |
|---|---|---|
| Neuron | One small calculation: numbers in, one number out | the umbrella neuron |
| Weight | How much one input matters, learned in training | 3 for the rain forecast |
| Bias | Sets how easily the neuron fires | -2.5 for the umbrella |
| Activation | Turns the sum into the output | sigmoid, ReLU |
| Layer | A group of neurons working side by side | about 49,000 in each GPT-3 layer |
| Parameters | All the weights and biases of a model together | 175 billion in GPT-3 |
Try it yourself Watch
Here is the umbrella neuron in Python. Run it free in Google Colab (colab.research.google.com) or on your own computer:
import math
def neuron(inputs, weights, bias):
total = sum(x * w for x, w in zip(inputs, weights)) + bias
return 1 / (1 + math.exp(-total)) # sigmoid activation
weights, bias = [2, 3, -1.5], -2.5
print('Cloudy day:', round(neuron([1, 0.7, 0], weights, bias), 2))
print('Sunny day: ', round(neuron([0, 0.1, 1], weights, bias), 2))
# Output:
# Cloudy day: 0.83
# Sunny day: 0.02
Lesson learned Watch
An AI neuron takes numbers in, multiplies each by a weight, adds a bias, and an activation decides the output. It learns by nudging its weights after every mistake, and millions of them in layers make a neural network.
Frequently asked questions
What is a neuron in AI?
An artificial neuron is a small maths function: it multiplies its inputs by weights, adds them with a bias, and passes the total through an activation function to give an output.
What are weights and bias?
Weights say how much each input matters; the bias sets how easily the neuron fires. Both are numbers the AI learns during training.
Is an AI neuron like a brain neuron?
Only in its name and the basic idea of many inputs and one output. An AI neuron is a simple maths function that works only with numbers; it does not think or feel.
How does a neuron learn?
It compares its answer with the right answer and changes each weight a little to reduce the error, over many examples. In big networks this is done with backpropagation.
How many neurons does ChatGPT have?
OpenAI has not published the size of its newest models. The older GPT-3 has 96 layers with about 49,000 neurons each in their feed-forward part, about 4.7 million in all, and 175 billion parameters.