What is the difference between training and inference in machine learning, and why do their costs differ?

Quick Overview

Asks how training and inference differ in machine learning and why their compute, memory and total costs are so different. Tests understanding of backward passes and optimizer state, serving at scale under latency limits, and mode-dependent layers like dropout and batch norm.

What is the difference between training and inference in machine learning, and why do their costs differ?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

What is the difference between training and inference in machine learning, and why do their costs differ? ```hint Count the work per example Compare what the hardware has to compute and keep in memory for one example during a training step and during a prediction. Then compare how often each one runs over the model's lifetime. ``` ### What a Strong Answer Covers - What each phase does with the model's parameters - Why one training step costs more compute and memory than one prediction - Why total inference cost can exceed training cost once a model serves traffic at scale - The different goals each phase optimizes for (throughput versus latency and cost) and the techniques used for each - Behavioral differences between the two modes, such as dropout and batch norm ### Follow-up Questions - Large batches give high throughput in training. Why can't an online serving system simply use the same batch sizes? - How do quantization and distillation reduce inference cost, and what do they risk in accuracy? - When would you serve predictions in batch (offline) rather than online, and what does each cost you? - What goes wrong if a model with dropout and batch norm is served without switching it to eval mode?

Overview: Asks how training and inference differ in machine learning and why their compute, memory and total costs are so different. Tests understanding of backward passes and optimizer state, serving at scale under latency limits, and mode-dependent layers like dropout and batch norm.

PracHub logo
General
Nov 24, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

What is the difference between training and inference in machine learning, and why do their costs differ?

What a Strong Answer Covers Guidance

  • What each phase does with the model's parameters
  • Why one training step costs more compute and memory than one prediction
  • Why total inference cost can exceed training cost once a model serves traffic at scale
  • The different goals each phase optimizes for (throughput versus latency and cost) and the techniques used for each
  • Behavioral differences between the two modes, such as dropout and batch norm

Follow-up Questions Guidance

  • Large batches give high throughput in training. Why can't an online serving system simply use the same batch sizes?
  • How do quantization and distillation reduce inference cost, and what do they risk in accuracy?
  • When would you serve predictions in batch (offline) rather than online, and what does each cost you?
  • What goes wrong if a model with dropout and batch norm is served without switching it to eval mode?