Skip to content
Back to all articles
By TJ SoftUpdated:

What exactly is a neuron in artificial intelligence?

Czym właściwie jest neuron w sztucznej inteligencji?

A neuron in artificial intelligence is a basic computational unit inspired by the structure of a biological neuron, but operating entirely mathematically. Its task is to process a piece of information—receiving data, assigning weights to it, summing it, and deciding whether the signal will be passed on. Although the term “neuron” sounds biological, in practice it refers to a simple mathematical function that forms a building block of a larger structure called a neural network.

Table of contents

.

How Does a Single Neuron Work?

Mathematically, a neuron can be described by the equation:

.

A neuron in a network therefore acts like a filter: it takes in data, multiplies it by weights, adds a bias, and passes the result through an activation function. Depending on its shape (e.g. ReLU, sigmoid, tanh), the result may be “smoothed,” bounded, or clipped to zero. This simple transformation allows the network to learn nonlinear relationships—that is, relationships that cannot be expressed in a single straightforward formula.

Neurons Do Not Work Individually

In theory, one can think of a single neuron as a small function. In practice, however, individual neurons are not operated on. Modern models operate on vast collections of neurons organized into layers—and all these neurons are processed in parallel.

Calculations are performed on entire matrices or tensors, representing thousands or even millions of neurons operating simultaneously. As a result, the model can analyze large amounts of data in a very short time. Instead of calculating each neuron one by one, modern systems (e.g., GPT-4) perform a single matrix operation corresponding to thousands of parallel transformations:

.

This approach allows for fully leveraging the capabilities of graphics processing units (GPUs) and parallel learning, which is key to the performance of modern artificial intelligence.

How Many Neurons Does a Layer Have in a Language Model?

The number of neurons in a layer depends on the size of the model and its architecture. In large language models, such as GPT-3 or GPT-4, a single layer can have hundreds of thousands of neurons. For example:

  • GPT-3 (175 billion parameters) has approximately 12,288 neurons in each of its 96 layers.
  • GPT-2 Small has 768 neurons per layer.

The number of neurons in the layer is usually equal to the embedding dimension, that is, the length of the vector representing a token. This value determines how wide the layer is and how much information the model can process simultaneously.

Did “individual neurons” exist in the past?

In a sense, yes. However, it is worth remembering that even in the oldest neural networks, a neuron was always a mathematical function, not a separate object such as a transistor. Thus, neurons operated on ordinary computers; there was no need to build special-purpose electronics specifically for neural networks.

The difference between “old” and “new” models lies in the way computations are performed, not in the concept of a neuron.

The Old Approach – Counting Neurons One by One

In older implementations (e.g. in the 1980s and 1990s), networks were small. Each neuron was computed separately in a loop:

for neuron in layer: y = activation(dot(x, neuron.weights) + neuron.bias)

It worked correctly, but slowly—because the processor (CPU) performed the calculations sequentially.

Modern Approach – Bulk Operations

Modern networks perform the same operations simultaneously on entire data matrices:

Y = activation(W @ X + b)

Not only faster, but also more numerically stable. As a result, today’s models can have billions of neurons and still operate in real time.

How Do Neurons “Understand” Data?

The fact that all neurons in a layer process the same data does not mean that they do so in the same way.
Each neuron has different weights, so each of them responds to different input features.

Different Neurons, Different “Filters”

In a given layer, all neurons look at the same input vector, but each applies a different set of weights. This can be compared to a group of people looking at the same photograph:

  • one person notices colors,
  • another shapes,
  • a third emotions.

They all look at the same thing, but perceive something different. That is precisely why the neural layer creates many different interpretations of the same signal.

Connections Between Layers, or How Neurons “Talk”

.

Every neuron in the next layer is connected to all the neurons in the previous layer. However, this does not mean chaos; each connection has its own weight, which determines how strong the influence of one neuron on another is.

During training, the network adjusts these weights to minimize the error as much as possible.
As a result, neurons in successive layers learn to recognize increasingly complex relationships:

  • the first layers recognize simple patterns (e.g. relationships between words),
  • the middle layers begin to understand the meaning of phrases and the context,
  • the final layers build a general understanding of the text and predict subsequent tokens.

.

The Attention Mechanism, or How Words Look at Other Words

Modern architectures, such as Transformer, introduced an additional element: attention. Thanks to it, the network does not treat all connections equally. A neuron can “focus” only on those fragments of data that are relevant to the given context.

Example: If the model processes the sentence “The dog that chases the cat is fast,” the attention mechanism ensures that “that” is associated with “dog,” rather than with “cat.” It is precisely thanks to this that modern language models can preserve the grammatical and logical meaning of sentences.

From Chaos to Meaning: How the Final Result Is Created

After passing through many layers, the input signal (e.g., a sentence) is transformed into a series of vectors. Each layer adds something of its own, extracting meaning, context, tone, and relationships between words. At the end, the network creates a semantic representation of the entire text, from which it can predict the next token or generate a response.

The entire process can be summarized as follows:

  • The first layers analyze syntax and local relationships.
  • The middle layers build an understanding of context and meaning.
  • The final layers synthesize the whole, creating a response or prediction.

As a result, something that looks like “understanding” from the outside emerges from simple mathematical operations.

Why does this work?

This works because:

  • all neurons process data in parallel,
  • each neuron has its own weights, so it responds to different features,
  • the network learns hierarchically: from simple relationships to complex structures,
  • the attention mechanism allows the model to focus on what matters.

From a mathematical point of view, a neural network is nothing more than a composition of multiple functions.
From a practical point of view, it is a structure capable of extracting meaning from vast amounts of data and then transforming it into something useful: a prediction, translation, image, or sound.

Summary

In AI, a neuron is simply a mathematical function that processes data. Thousands of such functions operating in parallel form layers, and layers connected to one another form a network capable of learning. Thanks to matrix computations, modern processors, and the attention mechanism, today’s models can analyze language, images, and sounds with a level of precision that seemed impossible just a few years ago.

All of this, from a “neuron” to a “conscious sentence,” is still just mathematics. But mathematics that has begun to speak with a human voice.