Compare Batch Norm and Layer Norm and Why Transformers Use Layer Norm
Last updated: November 29, 2026
Quick Overview
Explain what batch normalization and layer normalization compute, how they behave differently at training and inference time, and why transformers for language use layer norm (often in a pre-norm arrangement).
Microsoft
November 29, 20260
0
0 solved
Explain what batch normalization and layer normalization compute, how they behave differently at training and inference time, and why transformers for language use layer norm (often in a pre-norm arrangement).
A deep learning fundamentals question common for MLE candidates on Microsoft's AI platform and Copilot teams. The interviewer checks the normalization axes, the inference-time difference, and practical reasons tied to variable-length sequences and small per-device batches.
What the Interviewer Expects
- State which axes each method normalizes over
- Explain batch norm's running statistics at inference and the train/test mismatch
- Explain why layer norm is independent of batch size and sequence padding
- Discuss pre-norm vs post-norm stability
- Mention RMSNorm as a cheaper variant
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 goes wrong with batch norm at batch size 1 or in distributed training?
- Why does pre-norm make deep transformers easier to train?
- What does RMSNorm drop and why does it still work?
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
Input to a normalization layer in a transformer: a tensor of shape (batch , sequence , features ). For a CNN: (B, C, H, W)....
Approach
Both compute followed by a learned scale and shift . They differ in which values and are computed over....
Submit Your Answer
Microsoft Machine Learning Engineer Interview Guide
Interview process, tips, and preparation timeline