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
Machine Learning
Machine Learning Engineer
Uber
November 29, 2026
Machine Learning Engineer
Technical Screen
Machine Learning
Easy

0

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
batch normalization
train vs eval mode
running statistics
layer normalization
training-serving skew
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. 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 Prep
Sample 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 xx in a mini-batch BB:

x^=x−μBσB2+ϵ,y=γx^+β\hat x = \dfrac{x - \mu_B}{\sqrt{\sigma_B^2 + \epsilon}}, \qquad y = \gamma \hat x + \beta

During training, μB\mu_B and σB2\sigma_B^2 come from...


Submit Your Answer
Markdown supported