Navigation
πŸ“ FoundationsΒ· 14 min read

Workload Characterization

Not all model usage looks the same β€” prefill vs decode, chat vs agent, reasoning, multimodal, and training workloads each have different resource profiles.

workloadsprefilldecodeagentreasoningmultimodaltraining

The single most important skill in AI infrastructure is asking: β€œwhat kind of workload is this?” β€” because the answer determines whether you’re bottlenecked by compute, memory capacity, memory bandwidth, or network. Different workloads stress completely different parts of the hardware stack.


1. The Four Bottlenecks

Every AI workload hits one of these walls first:

BottleneckWhat it meansLimited byExample
Compute-boundGPU math units are the limitTFLOPSLarge-batch prefill, training forward pass
Memory-BW-boundData can’t be fed fast enoughHBM GB/sSingle-token decode, LayerNorm, activation functions
Memory-capacity-boundNot enough memoryHBM GBLarge model weights, long-context KV cache
Network-boundCommunication between GPUs is the limitNVLink/IB GB/sTensor parallelism AllReduce, expert parallelism All-to-All

Most infrastructure mistakes come from optimizing the wrong bottleneck.


2. Inference Workloads

Prefill vs Decode

The two phases of every LLM request have opposite resource profiles:

PropertyPrefillDecode
What happensProcess entire prompt in parallelGenerate one token at a time
GEMM M dimensionM=BΓ—SM = B \times S (all prompt tokens)M=BM = B (one new token per request)
BottleneckCompute-boundMemory-BW-bound
GPU utilizationHigh (80%+ at sufficient batch)Low (<30% for single request)
Arithmetic intensityHigh (large GEMMs)~1 (thin GEMMs)
Key metricTTFT (Time to First Token)TPOT (Time Per Output Token)

Infrastructure consequence: Prefill and decode benefit from different hardware configurations. This is why prefill-decode disaggregation uses separate GPU pools.

Short Context vs Long Context

PropertyShort (< 4K tokens)Long (32K–128K+)
Attention computeSmall (S2S^2 is manageable)Dominates (S2S^2 explodes)
KV cacheFits easilyCan consume most of GPU memory
BottleneckFFN compute or memory-BWAttention compute + KV cache capacity
Typical useChat, Q&ADocument analysis, code repos

At 128K context with LLaMA-2-7B, KV cache alone is ~64 GB β€” nearly all of an H100’s memory.

Chat vs Agent

PropertyChatAgent
Turn structureHuman β†’ Model β†’ Human β†’ …Model β†’ Tool β†’ Model β†’ Tool β†’ …
Latency toleranceInteractive (< 2s TTFT)Can be async (minutes OK)
Context managementConversation history+ tool outputs, file contents, execution results
StateStateless (per request)Stateful (sandbox, files, processes persist)
Compute patternSingle model call per turnMultiple calls, branching, retries
InfrastructureStandard servingSandbox orchestration, state management

Agent workloads are fundamentally different β€” they require stateful compute environments (sandboxes), tool execution, and multi-step orchestration. This is covered in the Apps & Agents module.

Reasoning Models (Extended Thinking)

Models like o1, DeepSeek-R1, and QwQ generate long β€œthinking” traces before answering:

PropertyStandard generationReasoning
Output length100–1000 tokens1,000–50,000+ tokens
Decode timeSecondsMinutes
KV cacheModerateVery large (thinking + answer)
Compute patternMostly one decode sequenceMay involve tree search, verification
Cost per request$0.001–0.01$0.01–1.00+

Infrastructure consequence: Reasoning models need much longer decode, much more KV cache, and potentially speculative verification (multi-token prediction). The cost-per-request is 10–100Γ— higher than standard chat.

Multimodal Workloads

ModalityInput processingImpact on computeImpact on memory
Vision (images)Vision encoder β†’ patch embeddings β†’ projector β†’ LLMPrefill gets a burst of image tokens (256–2048 per image)KV cache inflated by image tokens
Audio (speech)Whisper-style encoder β†’ audio embeddings β†’ LLMMust process faster than audio plays (real-time factor < 1)Streaming chunks, low latency
Image generationLLM β†’ diffusion model (iterative denoising)Separate GPU pool for diffusionVAE + denoising latents
VideoMany frames β†’ vision encoder β†’ very long contextExtremely long prefillMassive KV cache

Multimodal serving requires heterogeneous infrastructure β€” different model components on different hardware, with orchestration between them.


3. Training Workloads

Pre-training

The most resource-intensive phase:

PropertyValue
DataTerabytes of tokenized text
Compute10K+ GPUs for weeks/months
PatternForward β†’ backward β†’ gradient sync β†’ optimizer step, repeat
BottleneckCompute-bound (large batch GEMMs) + network-bound (gradient sync)
Key metricMFU (Model FLOPS Utilization) β€” typically 30–55%
Cost10M–10M–100M+ for frontier models

Supervised Fine-Tuning (SFT)

PropertyValue
DataThousands to millions of (instruction, response) pairs
Compute8–64 GPUs for hours/days
PatternSame as pre-training but smaller scale
BottleneckOften memory-capacity-bound (fitting model + optimizer)
Key optimizationLoRA/QLoRA to reduce trainable parameters

Reinforcement Learning (RLHF/GRPO)

PropertyValue
PatternGenerate rollouts (inference) β†’ score (inference) β†’ update (training)
BottleneckInterleaving inference and training β€” different resource profiles
ComplexityMust manage separate GPU pools for generation vs training
Key challengeDynamic resource allocation between rollout and training phases

RL training is uniquely hard for infrastructure β€” it combines inference workloads (rollout generation, reward model scoring) with training workloads (policy gradient updates) in the same training loop, requiring the system to dynamically shift resources.

Embedding & Retrieval Workloads

Often overlooked but extremely common in production:

PropertyValue
TaskEncode text/images into dense vectors for search/RAG
PatternPrefill-only (no generation), high batch size
BottleneckCompute-bound at high batch sizes (bulk encoding)
Key optimizationLarge batches, variable-length packing, FP16/INT8
Typical throughput10K–100K documents/second on one H100

Embedding is the β€œsilent majority” of AI inference β€” every RAG system embeds queries and documents, often at millions of documents per day.

Batch vs Real-Time Inference

PropertyReal-timeBatch
Latency target< 2s TTFT, < 50ms TPOTDon’t care (hours OK)
Optimization focusLatency β†’ smaller batches, speculative decodingThroughput β†’ max batch size, max utilization
SLOP99 latencyTokens/second/dollar
Typical useChat, API, interactiveDocument processing, evaluation, data labeling

Infrastructure consequence: batch inference can use spot instances (2-3Γ— cheaper) because latency doesn’t matter and restarts are acceptable.

Arithmetic Intensity: A Worked Example

To prove prefill is compute-bound and decode is memory-BW-bound, calculate arithmetic intensity for a 7B model on H100:

Prefill (S=2048, B=1): The dominant operation is FFN GEMM: (2048,4096)Γ—(4096,11008)(2048, 4096) \times (4096, 11008).

  • FLOPs: 2Γ—2048Γ—4096Γ—11008β‰ˆ1.8Γ—10112 \times 2048 \times 4096 \times 11008 \approx 1.8 \times 10^{11}
  • Bytes read: (2048Γ—4096+4096Γ—11008)Γ—2β‰ˆ1.1Γ—108(2048 \times 4096 + 4096 \times 11008) \times 2 \approx 1.1 \times 10^8
  • AI \approx 1636 β€” well above H100’s ops:byte of 295 β†’ compute-bound βœ“

Decode (S=1, B=1): Same weight matrix, but M=1: (1,4096)Γ—(4096,11008)(1, 4096) \times (4096, 11008).

  • FLOPs: 2Γ—1Γ—4096Γ—11008β‰ˆ9.0Γ—1072 \times 1 \times 4096 \times 11008 \approx 9.0 \times 10^7
  • Bytes read: (1Γ—4096+4096Γ—11008)Γ—2β‰ˆ9.0Γ—107(1 \times 4096 + 4096 \times 11008) \times 2 \approx 9.0 \times 10^7
  • AI \approx 1 β€” far below 295 β†’ memory-BW-bound βœ“

The weight matrix is the same size in both cases β€” but prefill reuses it across 2048 tokens while decode uses it for just 1.


4. Workload β†’ Infrastructure Mapping

Workload Bottleneck Map

WorkloadPrimary bottleneckKey infra decision
Prefill (short)ComputePack requests, maximize batch utilization
Prefill (long)Compute + memoryChunked prefill, sequence parallelism
DecodeMemory bandwidthBatch many requests to amortize weight reads
AgentLatency + stateSandbox infra, async execution
ReasoningKV cache + decode timeLarge memory GPUs, long-request scheduling
Vision-languageHeterogeneous computeSeparate encoder/LLM pools
Pre-trainingCompute + network3D/4D parallelism, fault tolerance
SFTMemory capacityLoRA, ZeRO, gradient checkpointing
RLHFMixed (inference + training)Dynamic resource allocation
Embedding/retrievalComputeLarge batches, packing, quantization
Batch inferenceThroughputSpot instances, max batch size

The correct infrastructure choice always starts with: what is the workload?


Self-Check

  • Name the four hardware bottlenecks and give an example workload for each
  • Explain why prefill is compute-bound but decode is memory-BW-bound
  • Explain how KV cache size changes with context length and why long context is hard
  • Explain how agent workloads differ from chat workloads in infrastructure requirements
  • Explain why reasoning models are 10–100Γ— more expensive per request
  • Explain why RLHF is uniquely challenging for infrastructure (mixed inference + training)

References