Activation Function
A nonlinear function inside a neuron. It receives the weighted sum of inputs and decides how strongly the signal will proceed further through the network.
Why It Is Needed
If neurons simply added inputs with weights, the entire network would become one linear formula — no matter how many layers you add. An activation function introduces nonlinearity, and the network starts to learn complex patterns.
Popular Functions
| Function | Formula | Where Used |
|---|---|---|
| ReLU | max(0, x) |
Mainly in deep networks |
| Sigmoid | 1/(1+e⁻ˣ) |
Probabilities, outputs 0..1 |
| Tanh | (eˣ−e⁻ˣ)/(eˣ+e⁻ˣ) |
From −1 to 1 |
| Softmax | normalization to probabilities | Last layer of classifiers |
Role in Transformer
In Transformer, activation functions are placed inside fully connected blocks (usually GELU or SwiGLU in modern models) — they give layers the ability to model complex dependencies between tokens.