1.2 Training vs inference

NCA-AIIO · Essential AI Knowledge (38% of the exam) · Official objective: “Compare and contrast training and inference architecture requirements and considerations.”

What training and inference each do, and why they need different resources.

Key points

  1. Training is how a model learns. Data passes through the network, the error is propagated back through its layers, and the model adjusts its weights and tries again. A weight is one of the numbers inside the model that training tunes. Inference is when a trained model makes predictions on new data. NVIDIA notes inference cannot happen without training.

    What NVIDIA says (3)

    “Instead, the error is propagated back through the network’s layers, and the model must adjust its weights and try again.”

    — What's the Difference Between Deep Learning Training and Inference?

    “Inference is the process where a trained AI model generates new outputs by reasoning and making predictions on new data — classifying inputs and applying learned knowledge in real time.”

    — What's the Difference Between Deep Learning Training and Inference?

    “Inference can’t happen without training.”

    — What's the Difference Between Deep Learning Training and Inference?

  2. Precision is how many bits a number uses. FP16 (half precision) uses 16 bits; FP32 (single precision) uses 32. Mixed precision does most operations in half precision while keeping critical information in single precision. NVIDIA lists three benefits: less memory, less memory bandwidth, and much faster math, especially on GPUs with Tensor Cores.

    What NVIDIA says (3)

    “First, they require less memory, enabling the training and deployment of larger neural networks.”

    — NVIDIA Mixed Precision Training Guide

    “Second, they require less memory bandwidth which speeds up data transfer operations.”

    — NVIDIA Mixed Precision Training Guide

    “Third, math operations run much faster in reduced precision, especially on GPUs with Tensor Core support for that precision.”

    — NVIDIA Mixed Precision Training Guide

  3. NVIDIA explains that training repeats a loop: the error is propagated back through the layers, the model adjusts its weights and tries again. Over many iterations it converges on the correct weights. NVIDIA calls training 'a monster when it comes to consuming compute.'

    What NVIDIA says (2)

    “Over many iterations, it converges on the correct weights, enabling it to reliably suggest accurate, useful code completions or translations.”

    — What's the Difference Between Deep Learning Training and Inference?

    “The challenge is, it’s also a monster when it comes to consuming compute.”

    — What's the Difference Between Deep Learning Training and Inference?

  4. Latency is the time from a request to its response. Throughput is how much work is completed per unit of time. NVIDIA says inference applies learned knowledge in real time. Low-latency, high-performance inference makes real-time interaction possible. NVIDIA adds that inference optimization lets enterprises tune throughput and latency to meet their service-level agreements (SLAs).

    What NVIDIA says (2)

    “This is only possible with low-latency, high-performance inference.”

    — What is AI Inference?

    “That’s why inference optimization techniques are so critical: they allow enterprises to optimize throughput and latency so they can meet their service level agreements across a variety of use cases.”

    — What's the Difference Between Deep Learning Training and Inference?

  5. A large language model (LLM) generates text one token at a time. To avoid recomputing earlier tokens, it stores their attention keys and values in a KV (key-value) cache. NVIDIA says the two main contributors to GPU memory for LLM inference are the model weights and the KV cache. With batching, each request's KV cache is allocated separately, which can use a lot of memory.

    What NVIDIA says (2)

    “In effect, the two main contributors to the GPU LLM memory requirement are model weights and the KV cache.”

    — Mastering LLM Techniques: Inference Optimization

    “With batching, the KV cache of each of the requests in the batch must still be allocated separately, and can have a large memory footprint.”

    — Mastering LLM Techniques: Inference Optimization

  6. LLM inference has two main GPU phases. NVIDIA explains that in prefill, all input tokens are processed at once through every layer, which is computationally heavy. In decode, the model generates outputs one token at a time, and each new token depends on all the previous ones.

    What NVIDIA says (4)

    “Prefill Phase: All input tokens are processed at once, flowing through every layer of the neural network.”

    — What's the Difference Between Deep Learning Training and Inference?

    “This is computationally heavy since the entire set of input tokens is processed all together.”

    — What's the Difference Between Deep Learning Training and Inference?

    “Decode Phase (Token by Token): The model begins generating outputs one token at a time.”

    — What's the Difference Between Deep Learning Training and Inference?

    “Each new token depends on the history of all the previous ones.”

    — What's the Difference Between Deep Learning Training and Inference?

  7. Prefill is compute-heavy while decode is sensitive to latency, so mixing them on the same GPUs can make them interfere. NVIDIA describes disaggregated serving: a separate set of GPUs handles prefill, and another handles decode, to speed up prefill.

    What NVIDIA says (1)

    “To accelerate the prefill phase, enterprises can use a technique called disaggregated serving, in which a separate set of GPUs are used for the prefill phase than the next decode phase.”

    — What's the Difference Between Deep Learning Training and Inference?

  8. Training from scratch is expensive. NVIDIA describes fine-tuning as the bridge between a foundation model trained on broad data and a model specialized for a domain, such as legal documents. Developers reuse the core model and train only a few layers or adapters on domain examples, which allows faster iteration.

    What NVIDIA says (2)

    “Fine-Tuning Makes Models More Adaptable Fine-tuning is the bridge between a foundation model trained on broad data and a model specialized for a specific domain — like legal documents, medical images or enterprise analytics.”

    — What's the Difference Between Deep Learning Training and Inference?

    “Instead of starting from scratch, developers reuse the core model and train just a few layers or adapters on domain-specific examples.”

    — What's the Difference Between Deep Learning Training and Inference?

  9. FP16 has a smaller range than FP32, so very small gradient values can become zero. NVIDIA's guide says mixed precision training needs two steps: port the model to use FP16 where appropriate, and add loss scaling to preserve small gradients. Without loss scaling, training can diverge, while with it the model matches single precision.

    What NVIDIA says (3)

    “Using mixed precision training requires two steps: Porting the model to use the FP16 data type where appropriate.”

    — NVIDIA Mixed Precision Training Guide

    “Adding loss scaling to preserve small gradient values.”

    — NVIDIA Mixed Precision Training Guide

    “Mixed precision without loss scaling (grey) diverges after a while, whereas mixed precision with loss scaling (green) matches the single precision model (black).”

    — NVIDIA Mixed Precision Training Guide

  10. Smaller number formats store each value in fewer bytes. NVIDIA's guide says FP16 uses 16 bits compared with 32 for FP32. That reduces the network's memory use, allowing larger networks or larger mini-batches, and FP16 transfers take less time than FP32 or FP64.

    What NVIDIA says (3)

    “Half-precision floating point format (FP16) uses 16 bits, compared to 32 bits for single precision (FP32).”

    — NVIDIA Mixed Precision Training Guide

    “Lowering the required memory enables training of larger models or training with larger mini-batches.”

    — NVIDIA Mixed Precision Training Guide

    “Half precision (also known as FP16) data compared to higher precision FP32 vs FP64 reduces memory usage of the neural network, allowing training and deployment of larger networks, and FP16 data transfers take less time than FP32 or FP64 transfers.”

    — NVIDIA Mixed Precision Training Guide

  11. Inference is optimized differently from training. NVIDIA's AI inference glossary says the inference phase is optimized for speed and efficiency, often using speculative decoding, quantization, pruning and layer fusion, while maintaining accuracy.

    What NVIDIA says (1)

    “This phase is optimized for speed and efficiency, often using techniques like speculative decoding, quantization, pruning, and layer fusion to enhance performance while maintaining accuracy.”

    — What is AI Inference?

Key terms

Try it

Sample question

Which statement best contrasts training and inference?

Show the answer

Answer: Training adjusts a model's weights by passing data through it and propagating errors back. Inference uses the trained model to make predictions on new data, often in real time.

Training is how a model learns. Data passes through the network, the error is propagated back through its layers, and the model adjusts its weights and tries again. A weight is one of the numbers inside the model that training tunes. Inference is when a trained model makes predictions on new data. NVIDIA notes inference cannot happen without training.

What NVIDIA says (3)

“Instead, the error is propagated back through the network’s layers, and the model must adjust its weights and try again.”

— What's the Difference Between Deep Learning Training and Inference?

“Inference is the process where a trained AI model generates new outputs by reasoning and making predictions on new data — classifying inputs and applying learned knowledge in real time.”

— What's the Difference Between Deep Learning Training and Inference?

“Inference can’t happen without training.”

— What's the Difference Between Deep Learning Training and Inference?

Practice 1.2 (11 questions) Full Essential AI Knowledge guide

← 1.1 The NVIDIA software stack · 1.3 AI, machine learning and deep learning →