Explain Why Residual Connections Let Very Deep Networks Train
Last updated: November 29, 2026
Quick Overview
Explain why gradients vanish or explode in a deep plain network, and show mathematically how residual connections and normalization make a 100-layer Transformer trainable.
0
0
0 solved
Explain why gradients vanish or explode in a deep plain network, and show mathematically how residual connections and normalization make a 100-layer Transformer trainable.
A deep learning fundamentals question common in Google ML-adjacent SWE screens, often framed around the ResNet models behind early Google Photos search and the residual stream in today's Transformers. The interviewer checks the chain-rule argument, not a memorized slogan.
What the Interviewer Expects
- Writes the backpropagated gradient as a product of layer Jacobians
- Explains vanishing and exploding as that product shrinking or growing geometrically
- Shows the residual Jacobian is identity plus a correction, giving a direct gradient path
- Mentions saturating activations as an extra cause
- Connects to normalization and initialization as complementary fixes
- Describes how you would detect the problem in training
Key Topics to Cover
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
- Why do some deep Transformer recipes scale residual branches down at initialization?
- How do LSTM gates address the same problem in recurrent networks?
- What does gradient clipping fix and what does it not fix?
- How would you visualize gradient health per layer during training?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Explore ML Interview PrepSample Answer
Clarify
Setting: a stack of layers trained by backpropagation. Question: why do plain deep stacks fail to train, and why do residual connections fix it?...
Approach
By the chain rule, with . If the typical singular value...