AI Logic

Glossary

Vanishing Gradient Problem

Updated:

Graph of gradient magnitude. The horizontal axis is the number of layers back from the output layer (left is the output layer, right is the input side), and the vertical axis is the gradient magnitude (log scale). A gradient of 1 at the output layer is multiplied by 0.25 at each layer and becomes smaller toward the right, reaching about 10⁻⁶ after 10 layers. The lightly shaded band at the bottom is the region where the gradient is nearly 0 and the weights of layers near the input are barely updated. An arrow at the top shows the direction of backpropagation (left to right).

Explanation

The vanishing gradient problem is a problem that occurs during neural network training, in which the gradients (derivatives) used to update the weights shrink exponentially as the network gets deeper, so that training stops making progress. This problem is especially pronounced in deep networks and when using activation functions such as the sigmoid function or the hyperbolic tangent function. Vanishing gradients stem from the properties of the activation function and the initial values of the weights. For example, the gradient of the sigmoid function approaches 0 as the input grows, so the gradient shrinks with each additional layer, and training stalls as a result. Consequently, the effect can be particularly strong when processing long sequences, such as in recurrent neural networks (RNNs).

Where It Is Used

Several countermeasures exist to avoid vanishing gradients. First, choosing ReLU (Rectified Linear Unit) or its variants (Leaky ReLU, Parametric ReLU, etc.) as the activation function mitigates vanishing gradients. Second, for weight initialization, methods such as He initialization and Xavier initialization reduce the risk of vanishing gradients. Third, Batch Normalization normalizes the output of each layer and improves the stability of the gradients. Finally, residual networks (ResNet) and DenseNet add more paths through which data flows, alleviating the effect of vanishing gradients. These measures make it possible to train deep learning models more effectively and improve their performance.

FAQ

Q. Why do vanishing gradients occur?
A.

Mainly because the activation function's gradient is small or the initial weights are not appropriate, so the gradient shrinks each time it passes through a layer.

Q. What effects does it have?
A.

Because the gradient becomes small, the weights of the earlier layers in the network are barely updated, and training may not progress or improve accuracy.

Q. How can it be addressed?
A.

Vanishing gradients can be prevented by using activation functions such as ReLU, applying He or Xavier initialization, or introducing batch normalization or architectures like ResNet.