Why Batch Normalization Behaves Differently at Inference Time
Last updated: November 29, 2026
Quick Overview
Your demand model uses batch normalization and gives different predictions in a single-request serving path than in offline batch scoring. Explain how batch norm works in training versus inference and what likely went wrong.
Uber
November 29, 20260
0
0 solved
Your demand model uses batch normalization and gives different predictions in a single-request serving path than in offline batch scoring. Explain how batch norm works in training versus inference and what likely went wrong.
Uber serves many deep models one request at a time through its online prediction service, so train and serve mismatches in normalization are a practical bug. The interviewer checks that you know what statistics are used in each mode.
What the Interviewer Expects
- State the batch norm transform with learnable scale and shift
- Explain running mean and variance used at inference
- Identify the bug: model left in training mode or stale running statistics
- Mention alternatives like layer norm for small or variable batches
- Describe a test to catch it
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 does layer norm not have this problem?
- What happens to batch norm with batch size 1 in training?
- How would you set momentum for the running statistics?
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
Confirm symptoms: offline scoring with batches of 1,024 looks right, the online path with one request at a time gives different values, and the difference shrinks when online requests are grouped....
Approach
Batch norm for a feature in a mini-batch :
During training, and come from...