1.3 Training vs. Inference Computational Profiles

Key Takeaways

  • Training is a throughput-bound workload prioritizing aggregate FLOP/s, large batch sizes, backward pass gradient computation, and multi-GPU collective synchronization.
  • Inference is a latency-sensitive, SLA-governed workload executing only the forward pass, evaluated on Time to First Token (TTFT), Inter-Token Latency (ITL), and concurrency.
  • Large Language Model inference is split into two distinct operational phases: the compute-bound prompt prefill phase and the memory-bandwidth-bound autoregressive decoding phase.
  • The Roofline Model establishes hardware performance ceilings by plotting Operational Intensity (FLOPs/byte) against peak memory bandwidth and peak compute throughput.
  • Mixed precision execution (FP16, BF16, FP8) accelerates compute throughput on Tensor Cores and drastically reduces HBM memory footprint while preserving training stability.
Last updated: August 2026

1.3 Training vs. Inference Computational Profiles

Architectural Overview: In enterprise AI infrastructure, training and inference represent fundamentally different computational, memory, and networking paradigms. Training is an offline, throughput-oriented workload designed to learn parameters across large distributed clusters over days or weeks. Inference is an online, latency-sensitive workload designed to evaluate queries within strict Service Level Agreements (SLAs).


1. Deep Comparison: Training vs. Inference

Designing optimal GPU infrastructure requires matching hardware capabilities to the specific computational requirements of training or inference workloads.

Architectural DimensionModel Training ProfileModel Inference Profile
Primary ObjectiveMaximize aggregate computational throughput (tokens/sec, samples/sec, TFLOPS utilization)Minimize end-to-end response latency (P90/P99 latency, TTFT, ITL) while maximizing concurrency
Computational PassesFull Forward Pass + Loss Evaluation + Full Backward Pass (Backprop) + Optimizer UpdateForward Pass Only (Evaluation / Activation Mapping)
FLOP Ratio per Sample~3× Forward Pass FLOPs (1× Forward + 2× Backward pass gradient computation)1× Forward Pass FLOPs
Latency ToleranceHigh tolerance (batch jobs run asynchronously for hours, days, or months)Low tolerance (interactive SLAs often require <100ms response or <20ms per token)
Batch SizingLarge batch sizes (e.g., 32–4,096 per GPU) to saturate Tensor Cores and amortize memory accessSmall or dynamic batch sizes (e.g., 1–32) to meet strict interactive latency targets
Memory ResidencyWeights + Gradients + Optimizer States (e.g., AdamW) + Stored Activations for BackpropWeights + KV Cache (for LLMs) + Small dynamic activation working buffer
Distributed ScalingData Parallelism (DDP/FSDP), Tensor Parallelism (TP), Pipeline Parallelism (PP), Megatron-LMTensor Parallelism (TP for large models), Pipeline Parallelism (PP), Model Replication
Numerical PrecisionMixed Precision: FP32 master weights, BF16/FP16 forward/backward, FP8 Transformer EngineQuantized / Reduced Precision: FP16, BF16, FP8, INT8, INT4 (via TensorRT / vLLM)
Interconnect DemandMassive, continuous All-Reduce / Reduce-Scatter gradient synchronization across GPUsModest communication; TP All-Reduce within single node (NVLink) or light multi-node TP

2. Memory Footprint Breakdown: Training vs. Inference

The total memory footprint allocated inside GPU High Bandwidth Memory (HBM) differs dramatically between training and inference.

+-----------------------------------------------------------------------------+
|                     GPU HBM MEMORY ALLOCATION PROFILES                      |
|                                                                             |
|  [ TRAINING MEMORY ALLOCATION ]         [ INFERENCE MEMORY ALLOCATION ]     |
|  +-----------------------------------+  +--------------------------------+  |
|  | Optimizer States (AdamW: 12-16B/p)|  | Model Weights (FP16/FP8: 1-2B/p)|  |
|  +-----------------------------------+  +--------------------------------+  |
|  | Gradients (FP16/BF16: 2-4B/param) |  | Dynamic KV Cache               |  |
|  +-----------------------------------+  | (Grows with Context & Concur.) |  |
|  | Model Parameters (2-4B/param)     |  +--------------------------------+  |
|  +-----------------------------------+  | Ephemeral Activation Buffers   |  |
|  | Stored Forward Pass Activations   |  +--------------------------------+  |
|  | (Required for Backpropagation)    |                                      |
|  +-----------------------------------+                                      |
|  | Working Scratchpad Memory         |                                      |
|  +-----------------------------------+                                      |
+-----------------------------------------------------------------------------+

Training Memory Components

For an $N$-parameter model trained with mixed precision and the AdamW optimizer:

  1. Model Parameters: Stored in BF16/FP16 (2 bytes per parameter) or FP32 (4 bytes per parameter).
  2. Gradients: Stored in BF16/FP16 (2 bytes per parameter) during backward accumulation.
  3. Optimizer States: In standard AdamW, the system maintains FP32 master weights (4 bytes), first momentum estimates (4 bytes), and second momentum variance estimates (4 bytes), requiring 12 to 16 bytes per parameter.
  4. Forward Activations: Intermediate layer outputs generated during the forward pass must be retained in memory until the corresponding layer's backward pass calculates parameter gradients. In long-context models, activations frequently exceed model weight memory unless mitigated by Activation Checkpointing (Recomputation).
  5. Temporary Workspace: Buffers for cuDNN convolution plans, GEMM workspaces, and NCCL communication rings.

Total Training Memory16N (Static Weights/States)+MemoryActivations+MemoryWorkspace\text{Total Training Memory} \approx 16N \text{ (Static Weights/States)} + \text{Memory}_{\text{Activations}} + \text{Memory}_{\text{Workspace}}

Inference Memory Components

Inference eliminates gradients, optimizer states, and stored backward activations entirely:

  1. Model Weights: Static baseline footprint. For example, an unquantized 70B parameter model in FP16 requires $70 \times 10^9 \times 2 \text{ bytes} \approx 140 \text{ GB}$ of HBM. In FP8, this drops to $\approx 70 \text{ GB}$.
  2. Key-Value (KV) Cache (LLMs): Autoregressive models cache previous token Key and Value projection vectors to avoid redundant attention recalculations. The KV cache size per token across batch size $b$, context length $s$, number of layers $l$, number of KV heads $h_{kv}$, and head dimension $d$ is: MemoryKV=2×b×s×l×hkv×d×bytes per element\text{Memory}_{\text{KV}} = 2 \times b \times s \times l \times h_{kv} \times d \times \text{bytes per element} In multi-user serving environments, the KV cache dynamically expands and can easily consume 50–70% of available GPU memory.
  3. Activation Working Memory: Minimal ephemeral memory allocated only for the current token or batch forward evaluation, immediately overwritten by subsequent layers.

3. Deconstructing LLM Inference: Prefill vs. Decoding Phase

Large Language Model serving consists of two computationally distinct phases that stress different hardware subsystems within the GPU.

   [ USER PROMPT: N Tokens ]
              │
              ▼
   ┌────────────────────────────────────────────────────────────────────────┐
   │                   PHASE 1: PREFILL (PROMPT PROCESSING)                 │
   │   - Ingests all input tokens concurrently in parallel                  │
   │   - Dense Matrix-Matrix Multiplication (GEMM)                          │
   │   - Arithmetic Intensity: HIGH (Hundreds of FLOPs/byte)                │
   │   - Primary Hardware Bound: COMPUTE-BOUND (Tensor Cores)               │
   │   - Key Performance Metric: Time to First Token (TTFT)                 │
   │   - Output: Initial token + Populated Initial KV Cache                 │
   └───────────────────────────────────┬────────────────────────────────────┘
                                       │
                                       ▼
   ┌────────────────────────────────────────────────────────────────────────┐
   │                  PHASE 2: DECODING (AUTOREGRESSIVE GENERATION)         │
   │   - Generates tokens sequentially, one token at a time                 │
   │   - Matrix-Vector Multiplication (GEMV)                                │
   │   - Arithmetic Intensity: LOW (Single-digit FLOPs/byte)                │
   │   - Primary Hardware Bound: MEMORY-BANDWIDTH-BOUND (HBM Streaming)     │
   │   - Key Performance Metric: Inter-Token Latency (ITL) / TPOT           │
   │   - Mechanism: Reads entire model weight matrix from HBM for EACH token│
   └────────────────────────────────────────────────────────────────────────┘

Detailed Phase Comparison

Operational CharacteristicPhase 1: Prefill (Context Phase)Phase 2: Decoding (Generation Phase)
Input SizeEntire user prompt ($N$ tokens simultaneously)Single generated token ($1$ token per step)
Mathematical OperationMatrix-Matrix Multiplication (GEMM)Matrix-Vector Multiplication (GEMV)
Hardware BottleneckCompute-Bound (Tensor Core FLOPS limit)Memory-Bandwidth-Bound (HBM read speed)
Arithmetic IntensityHigh (>100 FLOPs/byte)Very Low (<10 FLOPs/byte at batch size = 1)
Critical SLA MetricTime to First Token (TTFT)Time Per Output Token (TPOT) / Inter-Token Latency
Optimization TacticsChunked prefill, FlashAttention, Tensor ParallelismDynamic batching (vLLM/Triton), PagedAttention, Speculative Decoding, FP8/INT4 weight quantization

4. The Roofline Model & Operational Intensity

The Roofline Model is a foundational performance model used by systems architects to diagnose whether an AI kernel or application is bounded by GPU compute capacity (Tensor Core FLOPs) or memory subsystem bandwidth (HBM bytes/sec).

   Attainable Performance (TFLOPS)
         ▲
         │                           /──────────────────────── Peak Compute Ceiling
         │                          /                          (e.g., H100 FP16: 989 TFLOPS)
         │                         /  COMPUTE-BOUND REGION
         │                        /   (Performance limited by Tensor Cores)
         │                       /│
         │                      / │
         │                     /  │
         │  MEMORY-BOUND      /   │
         │  REGION           /    │
         │  (Performance    /     │
         │   limited by    /      │
         │   HBM Bandwidth/       │
         │               /        │
         │              /         │
         │             /          │
         │            /           │
         └───────────┴────────────┴───────────────────────────► Operational Intensity
                                  ▲                             (FLOPs / Byte)
                                  │
                           RIDGE POINT (Knee)
                 = Peak Compute / Peak Memory Bandwidth

Key Mathematical Formulations

  1. Operational Intensity (Arithmetic Intensity): The ratio of total floating-point operations executed to the total bytes of data transferred to/from device memory (HBM): Operational Intensity=Total Floating Point Operations (FLOPs)Total DRAM / HBM Bytes Transferred\text{Operational Intensity} = \frac{\text{Total Floating Point Operations (FLOPs)}}{\text{Total DRAM / HBM Bytes Transferred}}
  2. Attainable Performance Ceiling: Attainable Performance=min(Peak Compute Capacity,Operational Intensity×Memory Bandwidth)\text{Attainable Performance} = \min\left(\text{Peak Compute Capacity}, \text{Operational Intensity} \times \text{Memory Bandwidth}\right)
  3. The Ridge Point (Knee of the Curve): The operational intensity threshold where a GPU transitions from memory-bandwidth-bound to compute-bound: Ridge Point=Peak Compute FLOP/sPeak Memory Bandwidth (Bytes/s)\text{Ridge Point} = \frac{\text{Peak Compute FLOP/s}}{\text{Peak Memory Bandwidth (Bytes/s)}}

Practical GPU Example: NVIDIA H100 SXM5

  • Peak FP16 Tensor Core Compute: $989 \times 10^{12} \text{ FLOP/s}$ (without structured sparsity).
  • Peak HBM3 Memory Bandwidth: $3.35 \times 10^{12} \text{ Bytes/s}$ ($3.35 \text{ TB/s}$).
  • Ridge Point Calculation: Ridge Point=989×10123.35×1012295.2 FLOPs/Byte\text{Ridge Point} = \frac{989 \times 10^{12}}{3.35 \times 10^{12}} \approx 295.2 \text{ FLOPs/Byte}

Operational Takeaway:

  • If an operation (such as single-token LLM decoding or DLRM embedding table lookup) achieves an operational intensity of only $15 \text{ FLOPs/Byte}$ (well below $295.2$), it resides squarely in the memory-bound region. Upgrading compute cores will yield zero performance gain; only increasing memory bandwidth or batch size will improve throughput.
  • If an operation (such as large-batch training GEMM or prompt prefill) achieves an operational intensity of $500 \text{ FLOPs/Byte}$ (well above $295.2$), it resides in the compute-bound region, fully saturating Tensor Cores.

5. Precision Formats & Numerical Representation

Modern accelerated computing leverages reduced-precision arithmetic formats to maximize Tensor Core execution speed and reduce memory consumption while preserving numerical gradient stability.

FormatTotal BitsBit Layout (Sign : Exponent : Mantissa)Dynamic RangePrimary Advantages & Applications
FP3232$1 : 8 : 23$Large (~10^±38)Master optimizer weights, loss scaling, stable reduction operations
FP1616$1 : 5 : 10$Limited (~10^±5)High precision mantissa; requires loss scaling to prevent underflow during backpropagation
BF1616$1 : 8 : 7$Same as FP32 (~10^±38)Preserves FP32 dynamic range; standard format for deep learning training without loss scaling
FP8 (E4M3)8$1 : 4 : 3$Higher precision within FP8Forward pass GEMMs, weights, and activations in NVIDIA Transformer Engine
FP8 (E5M2)8$1 : 5 : 2$Higher dynamic range within FP8Backward pass gradient accumulation where wide exponent range is critical
INT8 / INT48 / 4Integer / Quantized scaleFixed discreteHigh-throughput low-latency inference quantization (via TensorRT)
Loading diagram...
GPU Roofline Model Architecture
Operational Intensity Comparison (FLOPs / Byte)
Test Your Knowledge

During autoregressive Large Language Model (LLM) inference serving with a single user stream (batch size = 1), why is the token decoding phase primarily memory-bandwidth bound rather than compute-bound?

A
B
C
D
Test Your Knowledge

According to the Roofline Model, what fundamental metric determines whether an accelerated workload is memory-bandwidth bound or compute-bound on a given GPU architecture?

A
B
C
D
Test Your Knowledge

Which of the following memory components is strictly required in GPU HBM during deep learning model training, but is entirely absent during standard inference execution?

A
B
C
D