Notes

Pre-Activation

Before a neural network can decide how strongly a unit should “fire,” it first combines the information arriving from the previous layer. That raw combined signal is the pre-activation: the value a neuron has computed before an activation function reshapes it.

The calculation before the decision

For one neuron, the pre-activation is usually written as z:

z = w₁x₁ + w₂x₂ + ... + wₙxₙ + b
a = φ(z)

Here, x values are inputs, w values are learned weights, and b is a learned bias. The next line applies an activation function φ, such as ReLU, GELU, or sigmoid, producing the neuron’s output a. For a whole layer, this becomes the compact matrix operation Z = XW + b. Each number in Z is a pre-activation.

Why its scale matters

Pre-activations determine which part of an activation function the network uses. If they become extremely large or small, training can lose useful gradient information:

  • With sigmoid or tanh, large-magnitude pre-activations push outputs into flat, saturated regions, where gradients approach zero.
  • With ReLU, a persistently negative pre-activation produces zero output and zero local gradient: a “dead” unit.
  • With exploding pre-activations, activations and loss values can become unstable or diverge.
Managing pre-activations in real networks

Weight initialization, learning rate, normalization, and architecture all help keep pre-activations in a workable range. A PyTorch nn.Linear layer computes the weighted sum and bias; nn.ReLU then transforms it. In transformer blocks, LayerNorm controls the scale of signals entering later computations. In deep residual networks, skip connections provide alternate routes for both signals and gradients, reducing the damage when a sequence of transformations produces poorly scaled pre-activations. Pre-activation is therefore not merely an intermediate number: it is the junction where learned linear evidence becomes nonlinear behavior, and where stable training can be preserved or lost.

Pre-activation is a neuron’s raw input before its activation function: the weighted sum of inputs plus bias, typically written z = Wx + b. The activation function transforms this value into the neuron’s output. Pre-activations determine which units activate and directly affect gradient flow, saturation, and numerical stability during training.

Imagine a judge adding up several clues before making a decision. A neural network does something similar: each tiny unit receives signals, gives some signals more importance than others, and adds them together. That raw total is called the pre-activation.

It is the unit’s “first impression” before it decides how strongly to respond. The next step applies an activation—a simple rule that can dampen, pass on, or emphasize the total. Keeping these stages separate lets the network combine evidence first, then decide what that evidence should mean, such as whether a photo contains the edge of a cat’s ear.