Explain Core ML Concepts
Company: Snapchat
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: medium
Interview Round: Onsite
Answer these machine-learning fundamentals questions:
1. Explain the difference between batch normalization and layer normalization, including how each computes statistics, where each is typically used, and practical tradeoffs.
2. What is model calibration? How would you evaluate whether predicted probabilities are calibrated, and how can calibration be improved?
3. How would you handle an imbalanced dataset during training, evaluation, and threshold selection?
### Constraints & Assumptions
- Explain both intuition and practical use cases.
- Distinguish ranking quality from probability calibration.
- For imbalance, discuss training strategy, evaluation metrics, threshold selection, and calibration.
- Avoid using accuracy alone for imbalanced data.
### Clarifying Questions to Ask
- Is the model for classification, ranking, recommendation, fraud, or another task?
- Are predicted probabilities used directly for decisions?
- How imbalanced is the dataset, and which error type is more costly?
- Are batch sizes large, small, or variable?
### What a Strong Answer Covers
- BatchNorm computes batch-level statistics, while LayerNorm computes per-example feature statistics.
- Calibration means predicted probabilities match observed frequencies.
- Reliability diagrams, ECE, Brier score, and log loss.
- Platt scaling, isotonic regression, temperature scaling, and calibration on representative data.
- Class weighting, resampling, focal loss, hard-negative mining, PR-AUC, F-beta, and cost-based thresholds.
### Follow-up Questions
- Why is LayerNorm common in Transformers?
- Can a model have high AUC but poor calibration?
- How does class weighting affect probability estimates?
- How would you pick an operating threshold under review-capacity constraints?
Quick Answer: Explain core ML concepts including BatchNorm versus LayerNorm, probability calibration, reliability diagrams, ECE, Brier score, imbalanced data training, PR-AUC, class weighting, and threshold selection.