KatInterview

Bias-Variance, Normalization Axes, and Gradient Decay in Deep Nets

Machine LearningModel answer
MediumModel answerMachine Learningbias-variancebatch-normalizationlayer-normalization

Last updated

Explain the bias-variance tradeoff, compare batch and layer normalization, and describe why gradients vanish in deep networks and how architecture can prevent it.

Three Deep Learning Foundations

Imagine you are walking a teammate through the ideas that most affect how neural networks are built and tuned. Give a clear, compact explanation of each topic below, including the underlying reasoning and when it matters in practice.

Part A: Error Decomposition

Describe the bias-variance tradeoff for a supervised predictor.

  • What happens to bias and to variance as a model gets more flexible?
  • Looking at training and validation error (including how they change with dataset size), how would you tell whether a model suffers mainly from high bias or high variance, and what would you do in each case?

Part B: Batch Norm vs. Layer Norm

Both layers rescale activations to stabilize optimization, yet they compute their statistics over different dimensions.

  • Compare which axes the mean and variance are taken over in each method, for both image tensors and sequence tensors.
  • In which situations would you choose layer normalization over batch normalization, and why?

Part C: Vanishing Gradients

  • Define the vanishing gradient problem.
  • Explain, using the chain rule and the shape of the activation function's derivative, why it arises in backpropagation.
  • Propose two architectural remedies and explain why each helps.

Expect to be pushed on follow-ups, such as how weight initialization interacts with gradient flow, why batch norm tracks running statistics, and whether more complexity can ever reduce both bias and variance.

Hints

Hint 1

For Part A, write the expected squared error at a point as three terms: squared bias, variance across training sets, and irreducible noise. Then ask which terms move when capacity grows.

Hint 2

For Part B, list the tensor shape first (batch, channels, height, width, or batch, tokens, features) and name which axes are averaged for each method. Then ask which method needs other examples in the batch.

Hint 3

For Part C, write the gradient to an early layer as a product of per-layer Jacobians and check how big each factor is for sigmoid. Then ask which change keeps a factor near the identity.