Fix Batch Normalization Behavior That Differs Between Training and Inference
Last updated: November 29, 2026
Quick Overview
A Google Photos model trained with batch normalization is accurate in training but much worse at inference with batch size 1, and fine-tuning with small batches is unstable. Explain how batch norm behaves in each mode, why it regularizes, and how you would fix these issues.
0
0
0 solved
A Google Photos model trained with batch normalization is accurate in training but much worse at inference with batch size 1, and fine-tuning with small batches is unstable. Explain how batch norm behaves in each mode, why it regularizes, and how you would fix these issues.
Photos models get fine-tuned and served in many settings, from TPU pods to on-device, and batch norm statistics are a common source of train-serve mismatch. The interviewer checks that you understand the mechanics, the regularizing noise, and alternatives.
What the Interviewer Expects
- Explain training mode (batch statistics) versus inference mode (running averages)
- Identify likely bugs: running stats not updated, inference in training mode, distribution shift between train and serve
- Explain why batch statistics add noise that regularizes
- Explain why small batches make statistics noisy and fine-tuning unstable
- Propose fixes: recompute stats, freeze BN, GroupNorm or LayerNorm, sync BN across devices
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 transformers use LayerNorm instead of BatchNorm?
- How does batch norm interact with dropout placed before it?
- What happens to BN statistics when you fine-tune on a very different domain?
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
Ask whether inference uses the model in eval mode, the training batch size per device, whether the serving data looks like training data, and what changed during fine-tuning (batch size, data domain)....
Approach
Lay out both modes, then match each symptom to a cause and a fix....