Skip to main content
AI Training vs Inference on GPUs: Processing Pipelines, Memory Hierarchies, and Data Flow

DEEP DIVE SERIES · #18

AI Training vs Inference: Inside the GPU Processing Pipeline

32 min read
Series Companion Guide

Pair with Deep Dive #16 & The AI Storage Atlas

This article focuses on the real-time execution mechanics of LLM inference, GPU HBM saturation, and KV-cache offloading. For foundational SAN-to-NVMe cluster fabrics and sovereign data topologies, explore our companion resources.

In modern enterprise computing, high-performance GPUs have become the defining computational currency. Whether an organization is training frontier foundation models or serving autonomous AI agent swarms, billions of dollars are invested in identical silicon: NVIDIA H100, H200, and Blackwell B200 HGX systems.

Yet beneath this shared hardware footprint lies a profound engineering contrast:

Training an AI model and running inference with that same model represent two entirely different computational paradigms.

When an engineering team builds a distributed GPU training cluster, they optimize for massive, sustained matrix throughput. The objective is to calculate weight gradients across trillions of tokens and synchronize mathematical updates across thousands of nodes without bottlenecking on network jitter or checkpoint storage stalls.

When that same team deploys the trained model into production to power interactive agents, coding copilots, or real-time document analysis, the entire performance profile flips. Training parameters become fixed, read-only weight matrices. Backpropagation disappears entirely. In their place emerges a severe memory-bandwidth and memory-capacity wall governed by autoregressive next-token decoding loops, dynamic Key-Value (KV) cache materialization, and unpredictable concurrent user sessions.

If you architect an inference infrastructure using the assumptions of a training cluster, your $30,000 accelerators will spend up to 80% of their operational cycles idling, waiting on memory bus transactions and networking handoffs.

In this deep dive, we deconstruct the exact physics of the GPU processing pipeline across both disciplines. We examine the mathematical mechanics of forward and backward propagation, distributed gradient synchronization, prompt prefill versus autoregressive decode, the memory hierarchy spanning GPU High Bandwidth Memory (HBM), host server DDR5, and distributed NVMe fabrics, and the economics governing modern AI infrastructure.


The Master Architecture: Training vs. Inference on GPUs

To establish our architectural baseline, we begin with the end-to-end processing topology illustrated in our primary engineering infographic below.

Primary Architectural Infographic · Deep Dive #18
Full HD · 1024×576
AI Training vs Inference on GPUs: How the processing pipeline, memory use, and data flow differ
Click to Enlarge
Figure 1.0: End-to-end processing pipeline comparison on GPU infrastructure. The cyan left-hand pipeline traces AI model training from raw dataset ingestion and forward passes through backward automatic differentiation, all-reduce gradient synchronization across distributed interconnects, optimizer state modification, and persistent checkpoint writes. The purple right-hand pipeline traces LLM inference from prompt tokenization and prefill into dynamic KV-cache materialization, autoregressive next-token decoding loops, and hierarchical memory offloading across GPU HBM, host DRAM, and NVMe fabrics.

Technical Validation of the Architectural Infographic

Before analyzing each subsystem in detail, we must validate the infographic from an infrastructure architect’s perspective, noting both what it captures accurately and where production reality introduces additional nuance:

  1. The Core Asymmetry: The infographic correctly captures the fundamental operational divide: training is an iterative parameter-modification loop driven by forward and backward passes, loss functions, and optimizer states; inference is a read-only parameter execution pipeline that transforms static weights into dynamic streaming outputs via prompt prefill and autoregressive decode loops.
  2. Memory Hierarchy Representation: The illustration depicts a tiered memory stack on both sides: GPU HBM at the apex, host DDR DRAM in the middle, and NVMe/object storage at the base. In production, this hierarchy is conceptual rather than a universal hardware pipeline. During inference, many standard serving runtimes maintain active KV caches exclusively in GPU HBM, rejecting requests or dropping context if memory is exhausted. As discussed in our deep dive on Inside the AI Memory Wall, multi-tier offloading to host DDR5 or distributed NVMe fabrics requires specialized software architectures such as PagedAttention, prefix caching, or GPUDirect Storage (GDS) integrations.
  3. Model Weights During Inference: The infographic accurately notes that weights remain static during inference. In large-scale deployments, however, weights are rarely hosted entirely on a single GPU. Models spanning 70 billion to 405 billion parameters are partitioned across multiple GPUs via Tensor Parallelism (TP) or Pipeline Parallelism (PP), requiring continuous intra-node NVLink or inter-node InfiniBand communications even during forward-only execution.
  4. Checkpointing vs. Active Writes: The diagram correctly highlights that training generates massive, periodic burst writes of model weights and optimizer states to high-performance parallel filesystems, whereas inference produces virtually zero active storage writes, with the exception of telemetry and optional cache persistence.

1. Introduction: Two Very Different GPU Workloads

To understand why GPU clusters require different architectural optimizations for training versus inference, we must address the fundamental engineering question:

Why does training a large language model require coordinated clusters of thousands of GPUs operating synchronously for months, while serving that exact same model to users introduces an entirely different set of memory, latency, and networking bottlenecks?

The answer lies in the mathematical objective of each phase:

Architectural DimensionAI Model TrainingLLM Inference Serving
Primary ObjectiveLearn model weights by minimizing loss across curated datasetsApply learned weights to generate contextual predictions from user prompts
Computational NatureSymmetric forward pass + asymmetric 2× backward automatic differentiationAsymmetric forward pass: compute-dense prefill + memory-bandwidth-bound decode
Weight ModificationDynamic: Parameters change continuously at every optimizer stepStatic: Pretrained weights are strictly read-only
Optimization TargetThroughput & Scaling Efficiency: Model FLOPs Utilization (MFU), tokens/secLatency & Concurrency: Time to First Token (TTFT), tokens/sec/user, p99 SLA
Memory PressureWeights, weight gradients, optimizer states (Adam), and forward activationsModel weights, temporary activations, and dynamic Key-Value (KV) cache
Storage InteractionSustained high-throughput reads + massive periodic checkpoint write stormsOne-time weight loading at startup + optional microsecond KV cache offloading
Network DependencyUltra-high-bandwidth, low-jitter inter-GPU all-reduce fabrics (NVLink/InfiniBand)Request routing, tensor parallel intra-node links, or disaggregated prefill-decode

Training is fundamentally throughput-oriented. If a training run takes 90 days instead of 95 days because the cluster maintains high computational efficiency, the enterprise saves millions of dollars in power, facility, and compute leasing costs. The workload is monolithic and predictable: batches of data are fed continuously into a tightly coupled supercomputer.

Inference, by contrast, is strictly latency-sensitive and concurrency-driven. An interactive user or an autonomous multi-agent state machine will not tolerate an 18-second delay waiting for a model response. Furthermore, incoming user requests are non-deterministic, varying in prompt length, generation length, arrival rate, and reasoning complexity.

While training seeks to maximize aggregate FLOPs across a fixed pipeline, inference seeks to maximize serving concurrency while preserving microsecond-scale token generation speeds.


2. Understanding the Transformer Model

Before dissecting the GPU hardware pipelines, we must examine the computational mechanics of the modern transformer architecture, which underpins virtually all contemporary generative models (e.g., Llama 3, GPT-4, Claude, Gemini, Mistral, and DeepSeek).

Architecture Deep Dive · Section 2

Transformer Processing: Parallel Matrix Compute vs. Sequential Token Generation

Attention Physics
Internal Transformer Layer Data Path

Each transformer block processes token vectors through linear projections, scaled dot-product attention, and multi-layer perceptron (MLP) feed-forward networks:

1. Token Vectors + Positional Encoding dim: [B, S, D]
↓ LayerNorm & Attention Projections
2. Multi-Head / Grouped-Query Attention GEMM
Q = X · W_q Queries
K = X · W_k Keys
V = X · W_v Values
↓ Softmax((Q · K^T) / √d) · V + Residual
3. Feed-Forward Network (SwiGLU / MLP) Two linear projections expanding hidden dimension ~3.5×
High FLOPs
↓ LayerNorm & Next Block (Repeated N Layers)
4. Final Unembedding Logits Projection Vocab Probabilities
Core Takeaway: In both training and prefill, all tokens S are multiplied simultaneously as large dense 2D matrices.
Parallel Matrix Multiply vs Autoregressive Loop

Why inference transforms from a compute-saturated matrix multiplication into a memory-bandwidth-bound serial loop:

A. Prefill Phase (Prompt Ingestion) Parallel GEMM

All N input tokens are known upfront. Matrix multiplications are large and square.

Compute Utilization: 60% – 85% MFU (Tensor Cores saturated)
B. Decode Phase (Autoregressive Loop) GEMV Vector-Matrix

Tokens are generated strictly one at a time (t+1 depends on t). The GPU multiplies a 1-token vector against all model weights and past KV tensors.

Compute Utilization: 5% – 20% MFU (Memory Bandwidth starved)
The Decoding Dilemma: To emit just one 2-byte token, the GPU memory bus must read all 140 GB of model weights and all accumulated KV cache tensors.

A transformer processes natural language through a sequence of mathematical matrix transformations:

  1. Tokenization: Raw text is decomposed into discrete integer tokens using Byte-Pair Encoding (BPE) or similar algorithms. Each token represents a character sequence, whole word, or subword fragment.
  2. Embedding: Integer tokens are mapped to high-dimensional continuous vector space through an embedding matrix W_e ∈ R^(V × d_model), where V is vocabulary size and d_model is the model’s hidden dimension (e.g., 8,192 dimensions in Llama-3-70B). Positional encodings (such as Rotary Position Embeddings, or RoPE) are added to inject token sequence coordinates.
  3. Transformer Layers: The token representations pass sequentially through a stack of identical transformer layers (e.g., 32 layers in an 8B model; 80 layers in a 70B model; 126 layers in a 405B model). Each layer contains two primary sub-components:
    • Self-Attention Mechanism: Allows every token to dynamically weigh and attend to every other token in the sequence. Input vectors are linearly projected into Query (Q), Key (K), and Value (V) tensors using learned weight matrices.
    • Feed-Forward Network (FFN / MLP): Projects the attended vectors through two or three linear transformations with non-linear activation functions (such as SwiGLU or GELU), typically expanding the hidden dimension by a factor of 3.5× to 4× before projecting back to d_model.
  4. Layer Normalization & Residual Connections: Each sub-layer is wrapped in a residual skip connection (x + SubLayer(x)) and RMSNorm or LayerNorm to preserve stable gradient flow during deep backpropagation.
  5. Final Projection (Unembedding): The final output representations are projected back across the full vocabulary dimension V to produce unnormalized log probabilities (logits).
Mathematical Core · Scaled Dot-Product Attention
Vaswani et al. (2017)
Attention(Q, K, V) = Softmax( (Q · KT) / √dk ) · V
Queries (Q) X · Wq

What the current token is looking for across all other sequence positions.

Keys (K) X · Wk

What each candidate token contains; matched against Q via dot-product.

Values (V) X · Wv

The contextual content extracted and aggregated according to attention weights.

Scaling factor: 1 / √d_k prevents dot-product magnitudes from pushing softmax into vanishing gradients Layer Dimension: d_k = 128

Parallel Prefill vs. Sequential Autoregressive Decoding

A critical architectural distinction governs transformer execution:

During AI training and during the initial inference prefill phase, all input tokens are known simultaneously. The GPU can process all sequence positions in parallel using large, dense matrix-matrix multiplications (General Matrix Multiply, or GEMM). Because the matrices are large and square, GPU Tensor Cores operate at peak arithmetic efficiency, easily achieving 60% to 80% Model FLOPs Utilization (MFU).

During the inference decoding phase, however, language models generate output tokens autoregressively, one token at a time. Token t+1 cannot be calculated until token t has been sampled and fed back into the model.

For every single emitted token, the GPU must execute a matrix-vector multiplication (GEMV). Instead of multiplying massive 2D matrices, the GPU multiplies a 1-token vector (1 × d_model) against all model weight matrices (d_model × d_model) across all layers.

Because very few mathematical operations are performed for each byte of memory transferred, arithmetic intensity collapses. The GPU Tensor Cores sit starved for data, bottlenecked entirely by the physical speed at which memory can be transferred across the HBM bus.


3. Inside the GPU Training Pipeline

Let us trace the step-by-step lifecycle of an AI model training run, following the left-hand pipeline of our architectural infographic.

Architecture Blueprint · Training Lifecycle

The End-to-End GPU Training Processing Pipeline

Iterative Parameter Updates
01. OBJECT STORAGE S3 / Ceph

Petabytes of tokenized binary shards (WebDataset, Parquet).

Continuous streaming read (>50 GiB/s)
02. DATA PREPARATION Host CPU

Asynchronous multi-worker tokenization, shuffling, and sequence packing.

DDR5 Host Buffers
03. DMA TO GPU HBM PCIe Gen5

Direct Memory Access from pinned host RAM directly into GPU High Bandwidth Memory.

64 GB/s line-rate per direction
▼ STAGED IN ACCELERATOR HIGH BANDWIDTH MEMORY (HBM3e) ▼
Intra-GPU Computational Loop (Forward + Backward Pass) Repeats over trillions of tokens
STEP 1: FORWARD PASS Compute Activations (A)

Dense GEMM matrix multiplications across Q, K, V and FFN projections.

STEP 2: LOSS FUNCTION Cross-Entropy Loss (L)

Compares predicted vocabulary logits with ground truth targets.

STEP 3: BACKPROPAGATION Autograd Gradients (∂L/∂W)

Automatic differentiation reverses computational graph (~2× compute of forward).

STEP 4: ALL-REDUCE Gradient Sync (NCCL)

Synchronizes and averages gradients across all GPUs via InfiniBand & NVLink.

STEP 5: OPTIMIZER UPDATE AdamW Parameter Step

Momentum & variance vectors update model weights (16 bytes/param).

θt+1
STEP 6: UPDATED WEIGHTS Weights Modified in HBM

Refreshed weights immediately ready for next incoming token batch.

Next Step
💾
STEP 7: PERIODIC CHECKPOINT FLUSH (EVERY N HOURS) Terabyte State Dump to Parallel Flash (WEKA / Lustre)

Synchronous dump of model weights, optimizer states, and training RNG states via GPUDirect Storage (>800 GiB/s).

Non-blocking Fast Flush
GPU Model Training Processing Pipeline: Storage Ingestion, PCIe Gen5 DMA, Tensor Cores, and InfiniBand All-Reduce

Step 1: Data Ingestion and Preprocessing

Training begins with petabytes of raw text, code, audio, or multimodal data residing in S3-compatible object stores, distributed filesystems, or local storage.

  1. Extraction and Shuffling: High-performance data loader threads stream compressed binary shards (such as WebDataset, TFRecord, or Parquet format) into server host DRAM. Shuffling is applied across shards and within local buffers to prevent optimization bias.
  2. Tokenization and Packing: Text is tokenized into integer IDs and packed into uniform context lengths (e.g., 4,096 or 8,192 tokens) using sequence packing algorithms that eliminate wasteful padding tokens.
  3. Mini-Batch Construction: Batches are staged in host page-locked (pinned) DDR5 memory. Pinned memory bypasses OS kernel page translation tables, enabling Direct Memory Access (DMA) engines to transfer batches over PCIe Gen5 buses directly into GPU HBM at speeds up to 64 GB/s per direction without CPU intervention.

Step 2: Forward Propagation

Once a mini-batch resides in GPU HBM, the model executes a forward pass:

The GPU’s streaming multiprocessors (SMs) and specialized Tensor Cores execute millions of fused Multiply-Accumulate (FMA) instructions, calculating attention score matrices and feed-forward projections across every layer.

Crucially, every intermediate tensor produced during this forward pass (layer activations) must be retained in GPU memory. Unlike inference, where intermediate states can be discarded as soon as the next layer finishes computing, training requires these activations to compute mathematical derivatives during the backward pass.

Step 3: Loss Calculation

At the final transformer layer, the model emits unnormalized logits over the vocabulary dimension: ŷ ∈ R^(Batch × Sequence × Vocab). The training harness compares these predictions against the ground-truth target tokens using Cross-Entropy Loss:

Supervisory Objective · Cross-Entropy Loss

Loss = - (1 / N) · Σ [ log( p̂target ) ]

Where p̂ is the softmax probability computed by the GPU Tensor Cores.

The loss scalar represents the mathematical distance between what the model predicted and what the target text actually contained. The objective of the entire training cluster is to iteratively reduce this scalar.

Step 4: Backpropagation (Automatic Differentiation)

Once the loss scalar is computed, the training framework (such as PyTorch) invokes automatic differentiation to reverse through the computational graph:

  1. The Chain Rule: Using the mathematical chain rule of calculus, the GPU traverses backward through each transformer layer, computing two sets of gradients:
    • The gradient of the loss with respect to the layer inputs (∂L/∂A), which is propagated backward to preceding layers.
    • The gradient of the loss with respect to the layer weights (∂L/∂W), which will be used to modify the model’s parameters.
  2. Arithmetic Demand: Computing derivatives through matrix multiplications involves multiplying activation matrices by gradient matrices. Mathematically, the backward pass requires approximately twice as many floating-point operations as the forward pass (2× FLOPs). Consequently, a full training step requires roughly 3× the FLOPs of a forward inference pass per token (1× forward + 2× backward = 3×).
  3. Activation Memory Explosion: Storing all intermediate activations creates staggering memory consumption. To prevent out-of-memory (OOM) errors, engineers employ activation checkpointing (also known as gradient checkpointing). Instead of saving every activation, the runtime discards most intermediate tensors during the forward pass and recalculates them on the fly during the backward pass. This trades approximately 20% to 30% additional compute for a 70% reduction in activation memory.

Step 5: Distributed Gradient Synchronization

In production LLM training, models are far too large and datasets far too vast for a single GPU. Training is distributed across hundreds or thousands of GPUs using a combination of parallelism strategies:

  • Data Parallelism (DP): Multiple GPUs hold identical copies of the model parameters. Each GPU processes a different mini-batch of training data.
  • Tensor Parallelism (TP): Individual linear layers within a transformer block are split across multiple GPUs (e.g., Megatron-LM splits weight matrices across 8 GPUs within an SXM chassis).
  • Pipeline Parallelism (PP): Different layers of the model are assigned to different GPUs sequentially along a physical pipeline.
  • Fully Sharded Data Parallel (FSDP / ZeRO-3): Parameters, gradients, and optimizer states are sharded across all available GPUs, gathered just-in-time for forward and backward passes, and immediately released.
Distributed Architecture · Section 3

Multi-GPU Gradient Synchronization: NVLink Mesh & InfiniBand RDMA

NCCL All-Reduce Topology
GPU Server Node 1 (8-Way HGX)
Intra-Node
ACCELERATOR 0
Local Gradients G0
140 GB Tensor Buffer
ACCELERATOR 1
Local Gradients G1
140 GB Tensor Buffer
⚡ NVIDIA NVSwitch / NVLink 900 GB/s bi-dir
GPU Server Node 2 (8-Way HGX)
Intra-Node
ACCELERATOR 2
Local Gradients G2
140 GB Tensor Buffer
ACCELERATOR 3
Local Gradients G3
140 GB Tensor Buffer
⚡ NVIDIA NVSwitch / NVLink 900 GB/s bi-dir
🌐 SCALE-OUT INTERCONNECT: InfiniBand Quantum-2 (400 Gbps) / RoCE v2 RDMA
Synchronized Gradient Average: Ḡ = (1/K) · Σ Gk
⚠️ The Synchronous Barrier Trap: Because All-Reduce is a blocking collective operation, a single delayed optical packet or thermal throttle on any GPU halts every other accelerator in the supercomputer.

At the conclusion of the backward pass, each GPU holds a local tensor of computed weight gradients. Before parameters can be updated, all GPUs in the data-parallel group must calculate the mathematical average of their gradients using a collective communication operation called All-Reduce (G_avg = (1 / K) · Σ G_k).

This synchronization is executed via NVIDIA NCCL (NVIDIA Collective Communications Library) using ring-based or tree-based all-reduce algorithms.

Because every GPU must wait for all other GPUs to finish communicating before updating its weights, any latency variance, network congestion, or packet drop on the inter-GPU fabric stalls the entire supercomputer. This is why training clusters invest millions in lossless InfiniBand or RoCE v2 networks with dedicated optical fabrics.

Step 6: Optimizer Updates

Once the synchronized gradient tensor is available, the optimizer updates the model parameters. While stochastic gradient descent (SGD) simply scales gradients by a learning rate, modern transformers are trained using adaptive optimizers such as Adam or AdamW:

Optimizer Mechanics · AdamW Weight Update Step
16 Bytes / Parameter
1. First Moment Vector (Momentum) FP32 · 4 bytes/param
mt = β1 · mt-1 + (1 - β1) · gt

Tracks the exponentially decaying moving average of past gradients to maintain direction through saddle points.

2. Second Moment Vector (Variance) FP32 · 4 bytes/param
vt = β2 · vt-1 + (1 - β2) · (gt)2

Tracks squared gradient variance to scale learning rates inversely for frequently updated parameters.

3. Parameter Update with Bias Correction & Decoupled Weight Decay
θt+1 = θt - [ η / ( √(v̂t) + ε ) ] · m̂t - η · λ · θt
Where m̂_t and v̂_t are bias-corrected moments, η is learning rate, and λ is weight decay coefficient.
Memory Rule of Thumb: FP32 Master Weight (4B) + Momentum (4B) + Variance (4B) + Gradient (4B) = 16 Bytes / Param 70B Model = 1,120 GB in Optimizer Alone

Crucially, the Adam optimizer requires maintaining momentum, variance, and a high-precision FP32 master copy of the weights for every single parameter in the model. This creates enormous memory overhead, which we quantify in Section 5.

Step 7: Model Checkpointing

Because frontier training runs execute continuously over weeks or months, hardware failures (GPU memory ECC errors, failed transceivers, host kernel panics) are a statistical certainty.

To prevent catastrophic loss of progress, the cluster periodically writes a complete checkpoint to persistent storage:

  • Model weights (parameters in FP16/BF16)
  • Optimizer state vectors (m, v, master weights in FP32)
  • Training telemetry, step count, and random number generator (RNG) states

For a 70B model, a single checkpoint file exceeds 1.1 Terabytes. For a 405B model, it exceeds 6 Terabytes.

When a cluster of 1,024 GPUs triggers a checkpoint, thousands of processes simultaneously flush terabytes of state across the storage fabric. If the storage subsystem is built on slow legacy NAS or unoptimized object stores, checkpointing can take 15 to 30 minutes, during which all GPUs sit frozen. High-performance distributed parallel filesystems (such as WEKA or Lustre) with GPUDirect Storage allow checkpoints to complete in seconds, restoring GPU compute immediately.


4. Inside the GPU Inference Pipeline

Now, let us examine the right-hand pipeline of our infographic: serving a trained model to generate predictions from new inputs.

Architecture Blueprint · Inference Lifecycle

The End-to-End LLM Inference Execution Pipeline

Prefill + Autoregressive Loop
01. USER INGRESS HTTP / API

User query, system instructions, tools, and multi-turn history.

Context: 1K – 128K+ tokens
02. SCHEDULER & BATCHING vLLM / Engine

BPE tokenization and iteration-level continuous batch scheduling.

PagedAttention memory manager
03. PRELOADED WEIGHTS Read-Only

Immutable parameters locked in GPU HBM (FP16: 140 GB; FP8: 70 GB for 70B).

Zero active write transactions
▼ THE TWO-PHASE INFERENCE ASYMMETRY ▼
Phase 1: Prompt Ingestion (Prefill) Compute-Bound
Parallel Forward Pass

Processes all N input prompt tokens simultaneously using dense 2D GEMM matrix multiplications.

KV-Cache Materialization

Projects and stores all Key and Value attention tensors in GPU HBM (320 KB per token on Llama-3-70B).

Primary SLA Target: Time to First Token (TTFT < 300ms)
Phase 2: Autoregressive Decode Loop Memory-Bound
1-Token GEMV Vector Multiplication

Loads entire model weights and past KV tensors across the memory bus to emit one single token (t+1).

Iterative Cache Append & Stream

Appends new token to KV cache and transmits text chunk down HTTP SSE stream until EOS token.

Primary SLA Target: Generation Speed (> 40 Tokens/Sec/User)
🧠
DYNAMIC MEMORY TIERING & PREFIX REUSE GPU HBM3e ➔ Host DDR5 ➔ Distributed Parallel NVMe (WEKA)

Offloads idle conversation blocks to flash; restores context in microseconds via GPUDirect RDMA.

Bypasses Prefill
LLM Inference Execution Pipeline: Prefill Matrix Engines, Dynamic KV Cache, and Autoregressive Decoding Loop

Step 1: User Prompt and Context Assembly

Inference begins with an external user prompt or autonomous agent turn:

  1. Context Construction: The inference harness aggregates system instructions, few-shot examples, retrieved external documents (RAG), tool call results, and prior conversation transcript history into a single contiguous context window.
  2. Tokenization: The text string is converted into integer token IDs using the model’s tokenizer on CPU host cores.
  3. Batch Queuing: In modern serving engines (such as vLLM or TensorRT-LLM), requests enter an advanced scheduling queue implementing continuous batching (iteration-level scheduling). Instead of waiting for all requests in a batch to complete, the runtime inserts newly arrived prompts into the active batch between generation steps.

Step 2: Model Loading and Memory Staging

Before serving requests, pretrained model weights are loaded from persistent NVMe storage into GPU HBM:

  • Unlike training, where weights undergo constant mathematical alteration, inference model weights are immutable and read-only.
  • If the model’s footprint exceeds a single accelerator’s memory (e.g., a 70B model requires ~140 GB in FP16), the runtime shards the weights across 2, 4, or 8 GPUs using Tensor Parallelism over intra-chassis NVLink interconnects.
  • To maximize serving density, models are frequently quantized to FP8, INT8, or INT4 (AWQ/GPTQ), shrinking the static weight footprint by 50% to 75% with negligible loss in reasoning precision.

Step 3: The Prefill Phase (Time to First Token)

When a prompt enters the GPU, it undergoes the prefill phase:

The model ingests all prompt tokens simultaneously in a single forward pass:

  • Because the entire prompt sequence is known, the GPU computes dense matrix-matrix multiplications across all sequence positions.
  • Arithmetic intensity is high; Tensor Cores operate near peak utilization.
  • The latency of this phase determines Time to First Token (TTFT). If a user submits a 64,000-token codebase context, the prefill phase must execute billions of matrix operations before a single word of response can be emitted.

Step 4: Key-Value (KV) Cache Materialization

During the prefill forward pass, the model projects each input token into its corresponding Key (K) and Value (V) vectors across all attention heads and transformer layers.

In training, these vectors would be discarded or saved as activations. In inference, however, they represent the model’s active working memory of the conversation.

To avoid repeatedly recomputing these mathematical projections for every subsequent token generated, the inference engine stores the K and V tensors in GPU memory. This data structure is the Key-Value (KV) Cache.

Attention Mechanics · Autoregressive Decode

Single-Token Generation: Query Projection & KV Cache Attending

Autoregressive Step t+1
STEP INPUT Token t+1
1-TOKEN INPUT VECTOR Token ID: " architecture" dim: [1, d_model]
↓ Linear Projection (Wq)
QUERY VECTOR (q) q ∈ R1 × d_k What token t+1 attends to
ACCUMULATED KV CACHE GPU HBM Blocks
CACHED KEYS (K) Tokens 1 to t dim: [t, d_k]
CACHED VALUES (V) Tokens 1 to t dim: [t, d_v]
SCALED DOT-PRODUCT ATTENTION
Softmax( (q · KT) / √dk ) · V
GEMV: 1 vector multiplied against entire history
Memory Status: +320 KB added per token (70B)
OUTPUT STEP Token t+2
Vocab Logits Top-P Sampling
NEXT TOKEN SAMPLED " pipeline" Streamed via SSE
➔ Append new (k, v) to cache & loop
The Memory Bandwidth Bottleneck: To emit 1 token, the memory bus must read all 140 GB of model weights and all accumulated KV cache tensors. Arithmetic Intensity: < 2 FLOP/Byte

As the conversation lengthens and user concurrency increases, the KV cache grows dynamically. Unlike static model weights, the KV cache expands linearly with context length and concurrent streams, creating the primary memory bottleneck of production serving.

Step 5: The Autoregressive Decode Loop

Once prefill finishes and the initial KV cache is materialized, the inference engine enters the autoregressive decode loop:

  1. Single-Token Forward Pass: The model takes the most recently emitted token vector and projects it into a single Query vector q ∈ R^(1 × d_k).
  2. Attention over Cached History: The Query vector is multiplied against all previously cached Key vectors (K) stored in memory, producing attention weights: A = Softmax((q · K^T) / √d_k). These weights are multiplied against all cached Value vectors (V) to compute the attended output.
  3. Sampling: The output passes through the final feed-forward layers to produce logits over the vocabulary. The runtime applies temperature scaling, top-p (nucleus) filtering, or top-k sampling to select the next discrete token ID.
  4. Cache Append & Stream: The new token’s own Key and Value vectors are appended to the KV cache, and the token is converted to a text string and streamed to the client over HTTP Server-Sent Events (SSE).
  5. Loop Termination: This cycle repeats iteratively, one token at a time, until the model emits an End-of-Sequence (<|eos|>) token or reaches the maximum configured token limit.

During this entire loop, the GPU is severely memory-bandwidth bound. Every single token requires reading all model weights and all past KV tensors across the memory bus just to compute one single next-token prediction.

Step 6: Memory Hierarchy and Cache Offloading

Because GPU High Bandwidth Memory is extremely expensive and finite (e.g., 80 GB on an H100; 141 GB on an H200), production serving platforms cannot maintain unlimited KV caches in accelerator memory.

When HBM capacity is reached, the serving architecture faces three options:

  1. Request Queueing / Throttling: Reject or delay new incoming user turns until active streams complete.
  2. Context Eviction & Recomputation: Discard cached conversation histories. When that user turns next, the engine must recompute the entire prompt prefill from scratch, causing TTFT to spike from 100 milliseconds to tens of seconds.
  3. Hierarchical Memory Offloading: Selectively offload inactive KV cache blocks across a coordinated memory hierarchy:
    • Tier 1 (GPU HBM): Microsecond-scale active cache supporting active token generation.
    • Tier 2 (Host DDR5 DRAM): High-capacity server memory accessible over PCIe Gen5.
    • Tier 3 (Distributed Parallel Flash): NVMe-over-Fabrics shared storage (such as WEKA NeuralMesh) restoring cached context blocks via GPUDirect RDMA.

As explored in our companion guide on The Storage Architecture Revolution, treating storage as an active memory extension is redefining the economics of long-context multi-agent systems.


5. GPU Memory: Training Versus Inference

To design robust infrastructure, systems engineers must calculate exact memory allocation. The formulas governing memory consumption differ radically between training and inference.

Memory Physics · Section 5

GPU High Bandwidth Memory: Training Allocation vs. Inference Allocation

Benchmark: Llama-3-70B
A. Training Memory Allocation (70B BF16)
~1,120+ GB Total

Training requires storing weights, gradients, optimizer state vectors, and forward activations simultaneously:

1. Model Parameters (BF16) 70 Billion params × 2 bytes
140 GB
2. Weight Gradients (BF16) Partial derivatives ∂L/∂W for all parameters
140 GB
3. Adam Optimizer States (FP32) FP32 Master Weights (280GB) + Momentum (280GB) + Variance (280GB)
840 GB
4. Forward Activations (Checkpointing On) Intermediate tensors staged for backward pass (Seq: 8K)
~50 - 150 GB
Hardware Reality: Cannot fit on a single 80 GB GPU. Requires sharding across a minimum of 16 × NVIDIA H100 80GB GPUs using FSDP / ZeRO-3 or Tensor Parallelism.
B. Inference Memory Allocation (70B Serving)
Static 70-140 GB + Dynamic KV

Inference eliminates gradients and optimizer states, replacing them with dynamic Key-Value attention cache:

1. Model Parameters (Static) FP16: 140 GB • FP8: 70 GB • INT4: 35 GB
70 – 140 GB
2. Gradients & Optimizer States Not required during forward-only inference
0 GB
3. Transient Forward Activations Small temporary buffers per active stream
~2 – 4 GB
4. Dynamic KV Cache (Session Scaled) 32 users × 128K context × 320 KB/token
1,342 GB
Hardware Reality: Static weights easily fit on 1 node (e.g. 4–8 GPUs), but long-context multi-agent KV cache rapidly exhausts all remaining HBM, demanding memory offloading or continuous eviction.
📐 The Universal KV-Cache Capacity Formula
KV_Bytes = 2 × n_layers × n_kv_heads × d_head × seq_len × bytes_per_element × batch_size
Llama-3-70B Layers: 80 Layers
KV Heads (GQA): 8 Heads (8x sharing)
Head Dimension: 128 dims
Bytes Per Token: 320 KB / Token

Mathematical Anatomy of Training Memory

During distributed training of a model with N parameters in 16-bit mixed precision (BF16/FP16), total memory consumption per training step is the sum of four distinct components:

Training_Memory = M_weights + M_gradients + M_optimizer + M_activations + M_workspace
  • Model Parameters (M_weights): Stored in 16-bit precision (2 × N bytes) = 140 GB (70B model).
  • Weight Gradients (M_gradients): Each parameter requires an identical 16-bit gradient tensor = 140 GB (70B model).
  • Optimizer States (M_optimizer): Standard AdamW maintains three 32-bit state tensors per parameter (FP32 master weights 4N + momentum 4N + variance 4N = 12 × N bytes) = 840 GB (70B model).
  • Activation Memory (M_activations): Intermediate forward tensors staged for backprop. With activation checkpointing, consumes approximately 50 GB to 150 GB per node.
Total 70B Training Memory = 140 GB (weights) + 140 GB (gradients) + 840 GB (Adam) + 100 GB (activations) ≈ 1,220 GB

Engineering Reality: You cannot train a 70B model on a single 80 GB GPU. Even with FSDP or ZeRO-3 sharding parameters, gradients, and optimizer states evenly across GPUs, an 8-way NVIDIA H100 node (640 GB aggregate HBM) is insufficient. Production training requires distributing across at least 16 to 32 accelerators just to satisfy physical memory allocation.


Mathematical Anatomy of Inference Memory

During inference, gradients and optimizer states are completely eliminated. Memory is governed by static weights plus the dynamic Key-Value cache:

Inference_Memory = M_weights + M_runtime + M_KV_Cache
  • Static Model Parameters (M_weights): In FP16 = 140 GB; in FP8 = 70 GB; in INT4/AWQ = 35 GB (70B model).
  • Runtime Workspace (M_runtime): Transient scratchpad buffers during single-token forward passes = 2 GB to 4 GB per GPU.
  • Dynamic Key-Value Cache (M_KV_Cache): For every processed token, the model retains two vectors (K and V) across all layers:
KV_Bytes = 2 × n_layers × n_kv_heads × d_head × S_ctx × b_elem × B_concurrency

Where:

  • 2: Accounts for the two separate Key and Value tensors.
  • n_layers: Total number of transformer layers (80 in Llama-3-70B).
  • n_kv_heads: Number of Key-Value attention heads (8 heads using Grouped-Query Attention).
  • d_head: Dimension of each attention head (d_head = d_model / n_q_heads = 8192 / 64 = 128).
  • S_ctx: Active context length in tokens.
  • b_elem: Precision bytes per element (2 for FP16; 1 for FP8; 0.5 for INT4).
  • B_concurrency: Number of concurrent active user streams.

Worked Calculation: Llama-3-70B KV Cache Scaling

For a single token in FP16 (b_elem = 2):

Bytes Per Token = 2 × 80 × 8 × 128 × 2 = 327,680 bytes ≈ 320 KB / token

Now examine how this scales under enterprise workloads:

Concurrency (B)Context Length (S_ctx)Cumulative KV TokensKV Cache Footprint (FP16)KV Cache Footprint (FP8)
1 User8,192 tokens8.19K2.62 GB1.31 GB
1 User128,000 tokens128K41.94 GB20.97 GB
16 Users32,000 tokens512K167.77 GB83.88 GB
32 Users128,000 tokens4.09M1,342.17 GB (1.34 TB)671.08 GB
64 Users128,000 tokens8.19M2,684.35 GB (2.68 TB)1,342.17 GB

The Architectural Insight: While static weights occupy a fixed 70 GB (FP8), serving 32 concurrent developers working with long repository contexts requires 671 GB to 1.34 TB of pure KV cache.

In training, memory is dominated by optimizer states and activations. In inference, memory is dominated by the dynamic KV cache.


6. Why Networking Requirements Differ

Both training and inference rely on high-speed networking, but they stress completely different layers of the communications stack.

Communications Stack · Section 6

Interconnect Topologies: Training All-Reduce vs. Inference Disaggregation

Network Fabric Physics
A. Training Interconnect Fabric
Scale-Out Mesh

Synchronizes millions of weight gradients simultaneously across data-parallel ranks at every mini-batch:

Intra-Node: NVIDIA NVSwitch / NVLink 900 GB/s bidirectional bandwidth per GPU linking 8 accelerators within an SXM chassis.
Inter-Node: InfiniBand Quantum-2 / RoCE v2 3.2 Tbps aggregate network I/O per server via 8 × 400 Gbps ConnectX-7 adapters in a non-blocking rail-optimized spine-leaf fabric.
Collective Algorithm: NCCL Ring & Tree All-Reduce averaging gradient tensors across thousands of GPUs.
Fabric Criticality: Zero packet drop tolerance. A single optical transceiver glitch or PFC pause storm halts all GPUs in the cluster.
B. Inference Interconnect Fabric
Disaggregated & Serving

Optimizes for microsecond request dispatching, intra-node tensor parallelism, and disaggregated KV cache transfer:

Intra-Node: Micro-Latency TP Links Exchanges tiny single-token activation messages across tensor-parallel GPUs over NVLink (< 2 µs message latency).
Prefill-Decode Disaggregation (PD Separation) High-speed point-to-point RDMA transmits newly materialized KV cache blocks from compute-heavy prefill nodes directly to memory-heavy decode nodes.
Client Ingress: HTTP/2 & Server-Sent Events (SSE) streaming tokens to thousands of concurrent agent loops.
Fabric Criticality: Nanosecond dispatch latency and high-throughput point-to-point RDMA stream handoffs.

The Training Interconnect Fabric

During distributed training, GPUs must synchronize millions of gradient values simultaneously across data-parallel ranks at every single batch iteration:

  1. Ultra-Low Latency & High Bandwidth: Interconnect throughput must match GPU computation speeds. Inside an 8-GPU node, NVIDIA NVLink provides up to 900 GB/s bidirectional bandwidth per GPU over an NVSwitch fabric. Across nodes, clusters deploy dedicated InfiniBand (Quantum-2 400 Gbps or Quantum-X800) or RoCE v2 (RDMA over Converged Ethernet) fabrics delivering up to 3.2 Tbps of network I/O per server.
  2. Synchronous Barrier Sensitivity: All-reduce operations are collective synchronization barriers. If one GPU among 1,024 slows down due to an optical transceiver glitch or packet drop, all 1,023 other GPUs must wait at the barrier. Training fabrics require strict lossless configurations, priority-based flow control (PFC), and explicit congestion notification (ECN).
  3. Traffic Pattern: Coordinated, periodic, bursty, all-to-all and ring-collective communications.

The Inference Interconnect Fabric

Inference networking targets different optimization objectives:

  1. Tensor Parallel Intra-Node Communication: If a model is sharded across multiple GPUs in a single chassis, the GPUs exchange tiny activations after every attention and MLP block. Because decoding generates one token at a time, these all-reduce messages are minuscule (a few kilobytes). Here, nanosecond-scale message latency matters far more than raw network bandwidth. NVLink easily satisfies this requirement.
  2. Disaggregated Prefill and Decode (PD Separation): In state-of-the-art serving architectures (such as Mooncake or vLLM disaggregated serving), the prefill phase and decode phase are decoupled across separate GPU clusters:
    • Prefill nodes are configured with high-compute GPUs (e.g., H100 SXM) to process prompts with high MFU.
    • Decode nodes are configured with high-memory-bandwidth systems (e.g., H200 or GH200) to execute the autoregressive loop.
    • When prefill finishes, the newly materialized KV cache is transmitted across an ultra-high-speed RDMA network fabric directly into the decode node’s memory.
  3. Traffic Pattern: Asynchronous, streaming, client-facing ingress/egress, and point-to-point RDMA cache transfers.

7. The Storage Architecture Behind AI

Storage infrastructure is frequently misunderstood in AI engineering. Infrastructure architects often assume that once a dataset is loaded or a model is deployed, storage is irrelevant.

In production AI systems engineering, storage architecture directly determines GPU return-on-investment.

Storage Architecture TierTraining RoleInference RoleKey Protocols & Technologies
Durable Object StorageHolds petabytes of raw uncompressed datasets, web scrapes, and final model artifactsArchival repository for base weights, adapter checkpoints, and historical transcriptsS3 API, Ceph Object Gateway, MinIO
High-Performance Parallel FilesystemsFeeds tokenized batches at >50 GiB/s; absorbs multi-terabyte checkpoint write stormsRapid cold-boot model loading; shared model weight distribution across thousands of serving nodesPOSIX, WEKA NeuralMesh, Lustre, IBM Spectrum Scale
Local NVMe SSDsTemporary staging for local epoch caches and scratch filesHost-level PagedAttention KV-cache swap space; local Hugging Face weight cachePCIe Gen5 NVMe, Direct I/O, io_uring
Distributed NVMe Fabrics (NVMe-oF)Shared high-speed scratch space; multi-node checkpoint stagingAugmented Memory Grid: Shared multi-node KV-cache offload and cross-node prefix reuseNVMe-oF RDMA, GPUDirect Storage (GDS), WEKA NeuralMesh

High-Throughput Checkpointing vs. Cold-Start Model Boot

In training, storage performance is measured by its ability to prevent I/O starvation during data ingestion and absorb write bursts during checkpointing:

If a 1.25-trillion parameter model checkpoint requires 6 Terabytes of state, writing that file across a standard 10 GbE NFS share takes over an hour. With distributed parallel storage utilizing NVIDIA GPUDirect Storage (GDS), data moves directly from GPU HBM across local PCIe switches to NVMe drives, bypassing CPU socket and OS page-cache bottlenecks. Storage throughput exceeds 800 GiB/s, reducing checkpoint write stalls to seconds.

In inference, storage performance dictates cold-start recovery and dynamic auto-scaling:

When serving traffic spikes, the orchestrator (e.g., Kubernetes with KEDA) spawns new inference pods across the cluster. If each pod must download 140 GB of model weights over standard network storage, pod startup takes 10 to 15 minutes. High-throughput distributed NVMe fabrics allow hundreds of GPU pods to load weights concurrently at line-rate, achieving sub-30-second cold starts.

WEKA NeuralMesh and KV-Cache Memory Offloading

In long-context multi-agent systems, storage enters the inference critical path through prefix caching and KV-cache offloading:

When multiple enterprise agents share identical system instructions, API tool schemas, or large repository AST indexes (as detailed in our AST Skeletonization Guide), recomputing the attention state for every new turn wastes quadrillions of FLOPs.

Software-defined parallel storage architectures, such as WEKA NeuralMesh and its Augmented Memory Grid, provide microsecond-scale distributed flash fabrics. By pairing GPUDirect RDMA with distributed NVMe storage, inactive conversation KV caches can be offloaded directly from GPU HBM into shared NVMe fabrics.

When that user or autonomous agent resumes their session, the cached KV blocks are restored directly into GPU memory via DMA in milliseconds, completely bypassing the compute-heavy prefill phase.


8. Performance Engineering and GPU Economics

Designing AI infrastructure requires understanding the economic trade-offs between hardware cost and computational efficiency.

Key Performance Indicators: Training vs. Inference

The operational metrics that govern training cluster health are fundamentally distinct from inference service level agreements (SLAs):

Performance Telemetry · Section 8

Operational Benchmarks: Training Throughput vs. Inference Latency

SLAs & Target Metrics
A. Training KPI Targets (Hardware Efficiency)
Throughput
Model FLOPs Utilization (MFU) Ratio of achieved FLOPs vs physical peak
45% – 55% MFU
Cluster Token Throughput Aggregate tokens processed per second
Linear Scale
Checkpoint Stall Overhead Percentage of cluster time frozen writing state
< 1% of Run
Multi-Node Scaling Ratio Throughput scaling from 64 to 1024 GPUs
> 90% Efficiency
B. Inference KPI Targets (Latency & Quality)
Latency
Time to First Token (TTFT) Prompt prefill latency before initial emission
< 300 ms SLA
Generation Speed (TPS / Stream) Tokens emitted per second per interactive user
> 40 Tok/s/User
Inter-Token Latency (ITL / TPOT) Jitter between consecutive streamed tokens
< 25 ms / Tok
Concurrent Stream Capacity Simultaneous sessions sustained under HBM limits
32 – 128 Streams/Node

Training Metrics:

  • Model FLOPs Utilization (MFU): The ratio of observed arithmetic throughput to the theoretical peak throughput of the hardware. Modern LLM training targets 45% to 55% MFU. If MFU drops below 35%, the cluster is stalling on network synchronization, data loading, or pipeline bubbles.
  • Tokens Per Second (Cluster Throughput): Total aggregate tokens processed across all GPUs per unit time (S_tokens = Batch Size × Sequence Length / Step Time).
  • Time to Train: Total cluster operating hours required to process a training budget (e.g., 15 trillion tokens).

Inference Metrics:

  • Time to First Token (TTFT): Duration between request submission and initial token emission. Dominated by prompt prefill speed and queue wait times. Target: < 300 ms for interactive sessions.
  • Inter-Token Latency (ITL) / Time Per Output Token (TPOT): The time required to decode each subsequent token. Human reading speed is approximately 5 to 8 tokens per second; interactive coding copilots target > 40 tokens/sec/stream.
  • Serving Concurrency: Number of simultaneous active streams an 8-GPU node can maintain before HBM exhaustion triggers request queueing.

The Economics of Underutilized Silicon

At enterprise scale, high-end accelerators (NVIDIA H100 / H200) cost between $3.00 and $5.00 per GPU-hour in sovereign cloud or hyperscaler environments. An 8-way node costs approximately $25,000 to $35,000 per month to operate.

If an infrastructure team provisions expensive GPUs but couples them with inadequate networking or slow storage:

  • In training, an all-reduce network delay or slow checkpoint system that degrades MFU from 50% to 35% extends a 60-day training run to 85 days, wasting hundreds of thousands of dollars in idle operational overhead.
  • In inference, a serving engine that lacks KV-cache memory offloading or continuous batching will leave Tensor Cores operating at 5% to 10% efficiency, driving the cost per million generated tokens to unsustainable levels.

9. Interactive Engineering Component: GPU Pipeline Inspector

Use our interactive engineering simulator below to toggle between Training Mode and Inference Mode. Click on any execution stage to inspect its real-time compute engines, memory bandwidth, network fabrics, and storage I/O demands.

Interactive Architecture Lab

GPU Processing Pipeline Inspector

SELECT EXECUTION STAGE TO INSPECT TELEMETRY: Stage 1 of 7

TRAINING DATA PATH & MEMORY TRANSIT Stage 1: Batch Loading
⚙️ COMPUTE ENGINE
BF16 GEMM

Tensor Core Operations

Dense matrix multiplications across attention layers and FFN projections.

Arithmetic Intensity: Very High (FLOP/byte)
💾 MEMORY HIERARCHY
HBM3e Pressure

Activation & Gradient Tensors

Stores full intermediate tensors required for backpropagation differential chains.

Memory Bus Bandwidth: 3.35 TB/s (HBM3e)
🌐 NETWORK FABRIC
Intra-Node

PCIe / Host Staging

DMA transfers over PCIe Gen5 x16 from CPU pinned RAM to GPU accelerator memory.

Interconnect Target: 128 GB/s bi-dir
🗄️ STORAGE I/O
Object Store / NVMe

Continuous Read Stream

High-throughput sequential reads of tokenized binary dataset shards without GPU starvation.

Target Throughput: > 50 GiB/s aggregate
💡
Architectural Rule of Thumb Training Stage 1

If storage cannot feed token batches at least as fast as the GPU computes the forward pass, GPU Model Flops Utilization (MFU) plummets below 30%. Never let a $30,000 GPU wait on standard POSIX kernel file locks.


10. Architecture Decision Guide

To synthesize these architectural principles into actionable engineering practice, infrastructure architects should reference the following decision matrix when designing, sizing, and budgeting GPU clusters:

Architecture Decision Guide · Section 10

GPU Infrastructure Optimization Decision Framework

Strategic Sizing
INFRASTRUCTURE DECISION GATE What is your primary GPU cluster workload?
PATHWAY A
Frontier Pre-Training & Fine-Tuning
Throughput-First
1. Inter-GPU Scale-Out Network

Prioritize InfiniBand 400G/800G or RoCE v2 with NCCL. Zero-drop lossless fabric is mandatory to prevent all-reduce stalls.

2. High-Capacity Memory Allocation

Ensure sufficient HBM to hold weights, gradients, Adam states (16B/param), and activations (FSDP / ZeRO-3).

3. Distributed Parallel Flash Storage

Deploy parallel NVMe filesystems (WEKA, Lustre) supporting GPUDirect Storage to flush multi-terabyte checkpoints in < 30 seconds.

Optimization Metric: Maximize Model FLOPs Utilization (MFU > 50%).
Recommended Hardware: NVIDIA H100 / H200 SXM5 with 8× ConnectX-7 NICs
PATHWAY B
Production Inference & Agent Swarms
Latency-First
1. HBM Capacity & Memory Bandwidth

Prioritize maximum memory bandwidth (3.35+ TB/s) and large HBM (141 GB H200) to maximize concurrent KV-cache capacity.

2. Modern Serving Engine & Quantization

Deploy vLLM or TensorRT-LLM with PagedAttention, FP8 quantization, and continuous iteration-level batching.

3. Tiered KV-Cache Offload & Disaggregation

Implement multi-tier offload (host DDR5 + distributed NVMe flash) and disaggregated prefill-decode architectures.

Optimization Metric: Minimize TTFT (< 300 ms) and maximize Tokens/Sec/User (> 40 TPS).
Recommended Hardware: NVIDIA H200 / B200 / GH200 with NVLink & NVMe-oF

When to Prioritize Specific Infrastructure Subsystems:

1. Prioritize Ultra-High Inter-GPU Network Bandwidth (InfiniBand / RoCE v2)

  • When: Building multi-node distributed training clusters using Data Parallelism, FSDP, or Pipeline Parallelism.
  • Why: All-reduce gradient synchronization across thousands of GPUs is an absolute synchronization barrier; any network jitter or dropped packet stalls the entire cluster.

2. Prioritize Maximum GPU HBM Capacity and Memory Bus Bandwidth (H200 / B200)

  • When: Deploying high-concurrency LLM inference serving, multi-agent frameworks, and long-context (32k to 128k+) applications.
  • Why: Autoregressive decoding is physically bound by memory bus bandwidth, while serving concurrency is governed strictly by the number of KV-cache blocks that can fit in accelerator memory.

3. Prioritize Ultra-Fast Distributed Parallel Filesystems (GPUDirect Storage / NVMe-oF)

  • When: Managing multi-terabyte training checkpoint storms, large-scale dataset ingestion, or implementing cross-node KV-cache offloading for enterprise agent swarms.
  • Why: Eliminates CPU socket and OS kernel bottlenecks, dumping checkpoints in seconds and restoring cached conversation contexts at microsecond latency.

4. Prioritize Disaggregated Serving Architectures (PD Separation)

  • When: Serving multimodal or mixed-workload traffic with large prompt variances (e.g., 50,000-token prompt prefill followed by 200-token output generation).
  • Why: Prevents compute-dense prefill operations from preempting and starving latency-critical autoregressive decoding streams.

11. Conclusion: The Dual Pillars of AI Infrastructure

The journey from raw data to real-time generative intelligence spans two complementary but fundamentally distinct computational universes:

  • AI Training is the process of creating intelligence: It transforms vast, unstructured corpuses of human knowledge into billions of learned mathematical parameters. It demands brute-force arithmetic density, symmetric forward and backward automatic differentiation, tightly synchronized multi-GPU all-reduce fabrics, and burst-tolerant parallel storage systems capable of weathering terabyte-scale checkpoint storms.
  • LLM Inference is the process of executing that intelligence: It transforms static, frozen weight matrices into responsive, context-aware reasoning streams. It demands memory-bandwidth efficiency, surgical handling of dynamic Key-Value attention states, continuous batching schedulers, and hierarchical memory tiers that bridge the gap between expensive GPU HBM, host server DRAM, and distributed flash storage.

Both pipelines run on GPUs. Both utilize matrix multiplications. But the systems engineering required to optimize them could not be more different.

As foundation models evolve toward multi-turn autonomous agents, multi-million-token context windows, and real-time reasoning loops, the infrastructure teams that succeed will be those who design not for generic FLOPs, but for the exact computational, memory, networking, and storage physics of the workload at hand.


Technical References and Further Reading

  1. Vaswani, A., et al. (2017). Attention Is All You Need. Advances in Neural Information Processing Systems (NeurIPS 2017). arXiv:1706.03762.
  2. Shoeybi, M., et al. (2019). Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism. NVIDIA Applied Deep Learning Research. arXiv:1909.08053.
  3. Rajbhandari, S., et al. (2020). ZeRO: Memory Optimizations Toward Training Trillion Parameter Models. Microsoft Research. arXiv:1910.02054.
  4. Kwon, W., et al. (2023). Efficient Memory Management for Large Language Model Serving with PagedAttention. Proceedings of the ACM SIGOPS 29th Symposium on Operating Systems Principles (SOSP ‘23). arXiv:2309.06180.
  5. NVIDIA Corporation (2024). NVIDIA Collective Communications Library (NCCL) Architecture & Developer Guide. NVIDIA Developer Documentation.
  6. NVIDIA Corporation (2024). GPUDirect Storage (GDS): Architecture and Benchmarking Overview. NVIDIA Docs.
  7. Dao, T. (2023). FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning. arXiv:2307.08691.
  8. Zhong, Y., et al. (2024). DistServe: Disaggregating Prefill and Decoding for Goodput-Optimized Large Language Model Serving. arXiv:2401.09670.
  9. Viscomi, L. (2026). Inside the AI Memory Wall: GPU HBM, KV Cache, NVMe Fabrics and WEKA NeuralMesh. AgentJunky Engineering Deep Dive #17. agentjunky.com/posts/17-inside-the-ai-memory-wall-kv-cache-weka/.
  10. Viscomi, L. (2026). From SAN to Sovereign AI: The Storage Architecture Revolution. AgentJunky Engineering Deep Dive #16. agentjunky.com/posts/16-from-san-to-sovereign-ai-storage-revolution/.
  11. Viscomi, L. (2026). The AI Storage Atlas: Disaggregated NVMe Fabrics & Sovereign Cloud Reference Architectures. agentjunky.com/storage-atlas/.
Newsletter Edition #4 Latest: The AI Storage Frontier

Subscribe to The AgentJunky AI Brief

Get practical engineering thinking on AI storage fabrics, autonomous agents, Model Context Protocol, and sovereign infrastructure delivered straight to your LinkedIn feed.

Subscribe on LinkedIn ↗

Discuss an AI Opportunity

Need an architectural review, help transitioning an agent prototype to production, or designing governed tool gateways? Let's connect.