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.

Google
Machine Learning
Software Engineer
Google
November 29, 2026
Software Engineer
Technical Screen
Machine Learning
Easy

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
Vanishing gradients
Residual connections
Backpropagation
Deep networks
Gradient flow
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. 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 Prep
Sample Answer
Clarify

Setting: a stack of LL layers hl+1=fl(hl)h_{l+1} = f_l(h_l) trained by backpropagation. Question: why do plain deep stacks fail to train, and why do residual connections fix it?...

Approach

By the chain rule, ∂L∂h0=∂L∂hL∏l=0L−1Jl\frac{\partial \mathcal{L}}{\partial h_0} = \frac{\partial \mathcal{L}}{\partial h_L} \prod_{l=0}^{L-1} J_l with Jl=∂fl/∂hlJ_l = \partial f_l / \partial h_l. If the typical singular value...


Submit Your Answer
Markdown supported