Backpropagation interview question

Deep LearningBackpropagationActivation Functionshard

In a deep MLP with sigmoid activations, the error signal reaching the first layer's weights has passed through ten sigmoid derivatives. Ignoring the weight matrices (assume unit scale), what is the best-case factor by which those derivatives scale the gradient?

  1. AIt is scaled by about 2.5 (10 × 0.25), because backpropagation sums the ten local derivatives along the path, so the per-layer factors accumulate rather than compound.
  2. BIt is scaled by at most about 9.5 × 10⁻⁷ (0.25¹⁰), because each sigmoid derivative is at most 0.25 and the chain rule multiplies all ten local factors together.
  3. CIt is scaled by at most about 9.8 × 10⁻⁴ (0.5¹⁰), because the sigmoid outputs 0.5 at zero and that value is the local derivative each of the ten layers multiplies in.
  4. DIt is not scaled down at all in the best case, because the sigmoid has slope 1 around zero, so units with pre-activations near zero pass the gradient through unchanged.
Show the answer and explanation

Correct answer: B, It is scaled by at most about 9.5 × 10⁻⁷ (0.25¹⁰), because each sigmoid derivative is at most 0.25 and the chain rule multiplies all ten local factors together.

Explanation Backpropagation

Backpropagation applies the chain rule layer by layer: δₗ = σ′(zₗ) ⊙ (Wₗ₊₁ᵀ δₗ₊₁). Unrolled over ten sigmoid layers, the error signal reaching the first layer's weights is a product of ten σ′ factors and the weight matrices between them.

The sigmoid derivative σ′(z) = σ(z)(1 − σ(z)) is at most 0.25 (at z = 0). With ten such factors the best case is 0.25¹⁰ ≈ 9.5 × 10⁻⁷: the first layer gets about a millionth of the signal, and that is before any saturation, which makes σ′ much smaller than 0.25. This is the classic vanishing gradient problem that made deep sigmoid networks so hard to train before ~2010.

Why the distractors are wrong:

  • Along one path the chain rule multiplies local derivatives. Sums only appear where several paths merge, e.g. at a skip connection, which is exactly why residual connections help.
  • 0.5 is σ(0), the output of the sigmoid at zero, not its slope.
  • Slope 1 at zero is true for tanh (tanh′(0) = 1), not for the sigmoid.
ActivationMax derivative10 layers, best case
Sigmoid0.25≈ 10⁻⁶
Tanh1 (only at z = 0)≤ 1
ReLU1 for z > 01

Fixes: ReLU-family activations, Xavier/He initialization, normalization layers, residual connections, and gated cells (LSTM/GRU) for recurrent nets.

Interview tip: describe vanishing gradients as "a product of many factors below one" and exploding gradients as the same product with factors above one, then list the fixes.

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More Deep Learning questions

  1. A teammate multiplies a recommender's training loss by 100 so the dashboard shows larger numbers. For one weight the gradient has been steady at g = 0.004 per…
  2. In neural network training, what is an epoch?
  3. What is the ReLU activation, and why is it a popular default for hidden layers?
  4. In neural network training, what is backpropagation?
  5. What does dropout do while a neural network is being trained?