Machine Learning Basics

In a neural network with many stacked layers, which of the following is the reason that using the sigmoid function as the activation function makes the layers near the input hard to train?

  1. AThe derivative of the sigmoid function is at most 0.25, so the gradient shrinks each time it passes through a layer in backpropagation and becomes almost 0 in the layers near the input
  2. BThe output of the sigmoid function is not confined to the range 0 to 1, so values grow at each layer and the computation overflows
  3. CThe sigmoid function has points where it cannot be differentiated, so some layers cannot obtain gradients in backpropagation
Show answer and explanation

Answer: A. The derivative of the sigmoid function is at most 0.25, so the gradient shrinks each time it passes through a layer in backpropagation and becomes almost 0 in the layers near the input

In backpropagation, the derivatives of the activation functions of successive layers are multiplied into the gradient one after another. The derivative of the sigmoid function, σ(z)(1 − σ(z)), is at most 0.25, so after 10 layers, for example, the gradient becomes as small as 0.25¹⁰ ≈ 9.5 × 10⁻⁷. This is called the vanishing gradient problem. Countermeasures include using ReLU, whose derivative is 1 over the positive range, adding residual (skip) connections that carry signals past layers, choosing the initial weights carefully, and using batch normalization.

  • A. Correct. The repeated multiplication by derivatives smaller than 1 makes the gradient vanish.
  • B. The output of the sigmoid function is confined to the range 0 to 1, so values do not overflow.
  • C. The sigmoid function can be differentiated everywhere.
Practice this topic Back to topic

Related calculators

Books on Machine Learning Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Machine Learning Basics questions

  1. A model is trained on 10,000 training samples with a mini-batch size (batch size) of 50. How many weight updates are there in one epoch?
  2. How many trainable parameters does a fully connected layer with 64 inputs and 32 outputs (one bias per output) have?
  3. A 28×28 single-channel image is convolved with a 5×5 filter (stride 1, no padding), followed by 2×2 max pooling (stride 2). What are the height and width of the output?
  4. Which of the following correctly describes recurrent neural networks (RNNs) and LSTMs?
  5. Which of the following describes the self-attention used in the Transformer?