← Pinterest Interview Insights
I knew the answer directionally but fumbled explaining the 'why' clearly.
Start by clarifying that gradient vanishing typically occurs near the input layers in deep feed-forward networks. Explain the chain rule and how repeated multiplication of small derivatives (e.g., sigmoid) causes gradients to shrink exponentially as they propagate backward. Contrast this with output layers where gradients are larger due to fewer multiplications.
Pro tip: Mention that while vanishing is common near inputs, exploding gradients can occur near outputs, and techniques like ReLU, batch normalization, and residual connections mitigate vanishing. This shows awareness of practical trade-offs.
Briefly define gradient vanishing as the phenomenon where gradients become exponentially small as they backpropagate through many layers, hindering learning in early layers.
Describe how backpropagation applies the chain rule, multiplying derivatives layer by layer. With activation functions like sigmoid/tanh whose derivatives are <1, repeated multiplication causes gradients to shrink.
Conclude that vanishing is most likely near the input layers because gradients must traverse all layers, undergoing many multiplications, leading to exponential decay.
Explain that near output layers, gradients are computed with fewer multiplications, so they are less affected by vanishing and may even explode if weights are large.
Mention that vanishing gradients slow learning in early layers. Mitigations include ReLU, batch normalization, residual connections, and careful initialization.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.