Training vs inference: two very different workloads
Same model, two jobs. One learns for days on a big cluster; the other answers a user in milliseconds. Their hardware needs are almost opposite.
- Compare and contrast training and inference architecture requirements and considerations.
This is one of the most tested ideas in Domain 1, because almost every infrastructure decision later depends on it. Toggle the widget to see the difference, then read on.
01What training actually does
Training is the learning phase. A batch of examples goes forward through the network to produce predictions, a loss function measures how wrong they are, and then a backward pass (backpropagation) works out how every weight should change. An optimiser applies those changes. Repeat millions of times.
Three consequences follow, and the exam loves all three:
- It is compute-hungry. The backward pass costs roughly twice the forward pass, so one training step is about three times the work of one prediction, and you do millions of steps.
- It is memory-hungry. GPU memory holds not just the weights but also the gradients, the optimiser state (Adam keeps two extra values per weight) and the activations saved for the backward pass. A rule of thumb for mixed-precision training with Adam is roughly 16 to 20 bytes per parameter before activations, so a 7-billion-parameter model needs well over 100 GB just for training state. That is why large models are trained across many GPUs.
- It is a batch, throughput job. Nobody is waiting for an individual step. The goal is to finish the whole run as fast and cheaply as possible, so you maximise throughput: big batches, many GPUs, fast interconnect between them (NVLink inside a node, InfiniBand between nodes) to synchronise gradients.
02What inference does
Inference is using the trained, frozen model to make predictions. Only the forward pass runs. No gradients, no optimiser state, no weight updates. That changes the priorities completely:
- Latency matters. A real user or application is waiting. For a chatbot that means time to first token and tokens per second; for fraud detection it can mean a few milliseconds per transaction.
- Memory is smaller but different. You need the weights, often in a lower precision such as FP8, INT8 or FP4, plus working memory. For LLMs the big extra is the KV cache, which stores attention state for every active conversation and grows with context length and the number of users.
- It runs forever and scales out. Training ends; inference runs 24/7 and must grow with traffic. So you add replicas behind a load balancer (scale out) and autoscale with demand. Over a model's life, inference usually consumes far more total compute than training did.
03Side by side
| Training | Inference | |
|---|---|---|
| Goal | Learn the weights | Use the weights to predict |
| Passes | Forward + backward | Forward only |
| Optimise for | Throughput, time to train | Latency, throughput per dollar, cost per token |
| Precision | Mixed precision (BF16/FP16, FP8 on newer GPUs) | Lower precision common (FP8, INT8, FP4) |
| Memory holds | Weights, gradients, optimiser state, activations | Weights, activations, KV cache |
| Batch size | Large | Small to medium, dynamically batched |
| Scale pattern | Scale up and out: many GPUs working on one job | Scale out: many replicas, each serving requests |
| Network | Very high bandwidth, low latency between GPUs (NVLink, InfiniBand) | Front-end network to users; multi-GPU only for very large models |
| Duration | Hours to months, then stops | Continuous, 24/7 |
| Typical hardware | DGX/HGX nodes in a cluster (e.g. DGX SuperPOD) | From single GPUs and edge devices to multi-GPU servers |
| Software | PyTorch, NeMo, NCCL, Slurm | TensorRT, Triton, NIM, Kubernetes |
04Architecture considerations the exam expects
Sizing training
Start from model size and dataset size. Model size sets the minimum GPU memory (and therefore the number of GPUs needed just to hold the training state). Dataset size and the number of training passes set the compute time. Then ask how fast GPUs can exchange gradients: if the interconnect is slow, adding GPUs stops helping. That is why training clusters use NVLink/NVSwitch inside a node and a non-blocking InfiniBand fabric between nodes, plus fast parallel storage that can feed data and absorb checkpoints (periodic saves of the training state so a failure does not lose days of work).
Sizing inference
Start from the service-level objective: maximum latency and expected requests per second. Pick a precision and optimisation (TensorRT) that meets accuracy needs, measure throughput per GPU at that latency, then divide demand by it to get replicas. Leave headroom for peaks. If many small models share a cluster, partition GPUs (MIG, fractional GPUs) instead of giving each a whole GPU.
05Fine-tuning sits in between
Fine-tuning (and parameter-efficient methods such as LoRA) adapts a pretrained model to a specific task with much less data and compute than full training. It is still training, with a backward pass and gradients, but often fits on a single node. Questions sometimes use fine-tuning to test whether you remember that any weight update means training-class requirements.
✦Key terms: flip the cards
- Training = forward + backward, memory for gradients and optimiser state, throughput-oriented, tightly coupled GPUs.
- Inference = forward only, latency-oriented, lower precision, scale out with replicas.
- Interconnect and storage matter most for training; latency and cost per request matter most for inference.
- Inference is not "cheap and unimportant": over a model's life it usually uses more total compute than training.
- Fine-tuning still needs training-style resources (backward pass, gradients).
- Lower precision is common in inference; training typically uses mixed precision, not INT8.
?Quick quiz
1. Which workload stores gradients and optimiser state in GPU memory?
Why: Only training computes gradients and keeps optimiser state.
2. A chatbot must answer within 200 ms for thousands of users. Which metric dominates design?
Why: Interactive inference is latency-bound.
3. Why do training clusters need very high-bandwidth GPU-to-GPU links?
Why: Distributed training exchanges gradients (AllReduce) at every step.
4. Inference capacity is usually increased by:
Why: Inference scales out with more replicas.
5. Which precision choice is most typical for optimised production inference?
Why: Lower precisions such as FP8 and INT8 cut latency and memory for inference.
Score: 0 / 5
Medium blocked automated reading of this article (HTTP 403), so this lesson is built from the standard training-versus-inference material in NVIDIA and IBM documentation rather than from that post. Read the original yourself; the concepts are the same.