KatInterview

Model Optimization and Distributed Training Parallelism Strategies

Machine LearningModel answer
HardModel answerMachine Learningdeep-learningdistributed-traininginference-optimization

Last updated

Explain key techniques for reducing training and inference cost, then compare how tensor parallelism and pipeline parallelism split work across GPUs.

Model Optimization and Distributed Training Parallelism Strategies

Modern deep learning models — particularly large language models — routinely hit hardware limits during both training and serving. Engineers working on these systems need to understand not just what each optimization does, but why it helps, which bottleneck it addresses, and what it costs.

Part 1: Optimization techniques

Walk through the major categories of optimization used in training and inference:

  • Quantization — what bit-width choices exist, when they help and when they don't, and what can go wrong
  • Pruning and sparsity — the difference between unstructured and structured approaches, and what hardware support looks like
  • Knowledge distillation — how a student learns from a teacher, and the practical cost of the approach
  • Kernel and operator fusion — why combining ops matters, and what FlashAttention is actually doing
  • Memory optimizations for training — activation checkpointing, ZeRO/FSDP sharding, gradient accumulation
  • Inference-specific techniques — KV caching, continuous batching, speculative decoding

For each, explain the goal, the mechanism, and the trade-offs.

Part 2: Tensor parallelism vs. pipeline parallelism

Compare the two main model parallelism strategies:

  • How each one partitions the model
  • What communication it requires and when that communication happens
  • Whether it reduces latency, increases throughput, or both
  • What hardware topology suits each
  • Where performance degrades and why

A strong answer ties each technique back to a specific bottleneck (memory capacity, memory bandwidth, compute, communication) rather than treating them as interchangeable options.

Hints

Hint 1

Start by classifying each optimization by the bottleneck it targets — memory capacity, memory bandwidth, or compute — before explaining the mechanism. LLM decode and LLM prefill are bottlenecked differently, which affects which optimizations actually help each phase.

Hint 2

For tensor parallelism, trace one transformer MLP block through the forward pass: where does each GPU hold a slice of the weight matrix, where does local compute happen, and exactly when does the all-reduce fire? Then ask whether that all-reduce can be hidden behind compute, and what happens to efficiency as you increase the number of GPUs.

Hint 3

Pipeline parallelism replaces per-layer collectives with point-to-point sends between stage boundaries — think about why that matters for cross-node bandwidth, and then explain what the pipeline bubble is and why micro-batches are the mitigation.