Explain When Batch Norm Fails and Layer Norm Works Instead
Last updated: November 29, 2026
Quick Overview
Explain how batch normalization and layer normalization compute their statistics, and why transformers such as Llama use layer norm or RMSNorm instead of batch norm.
Meta
November 29, 20260
0
0 solved
Explain how batch normalization and layer normalization compute their statistics, and why transformers such as Llama use layer norm or RMSNorm instead of batch norm.
A common fundamentals question in Meta ML screens, particularly for candidates moving from vision to language models. The interviewer wants precise axes of normalization and concrete reasons batch norm struggles with variable-length sequences and small batches.
What the Interviewer Expects
- State which axes each method normalizes over
- Explain train versus inference behaviour of batch norm running statistics
- Give reasons batch norm fails for small batches, padding, and autoregressive decoding
- Describe RMSNorm and pre-norm placement
- Mention where batch norm still works well, such as CNN vision models
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
- What happens to batch norm with batch size 1 at training time?
- Why do pre-norm transformers train more stably than post-norm?
- What does RMSNorm drop compared with layer norm, and why is that acceptable?
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
Consider an activation tensor of shape (batch , sequence , features ) for text, or (batch, channels, height, width) for images. Both methods compute $\hat{x} = (x - \mu)/\sqrt{\sigma^2 + \eps...
Approach
Compare the statistics, then the consequences for training and serving....