Serving Large Language Models (LLMs) at low Time-To-First-Token (TTFT) and low Inter-Token Latency (ITL) is fundamentally a hardware systems problem governed by the GPU Roofline model and High-Bandwidth Memory (HBM) capacity. Autoregressive generation splits into two physically distinct regimes: Prefill, which processes all prompt tokens in parallel and saturates Tensor Core FLOPs, and Decode, which generates one token per step and is bottlenecked by streaming gigabytes of weights and Key-Value (KV) cache states from HBM into SRAM.
This chapter deconstructs the core mechanics of LLM inference engines before scaling to multi-tenant serving in AI-C05-001: Roofline arithmetic intensity analysis, exact KV cache memory sizing for 70B+ parameter models, Grouped-Query Attention (GQA) compression, SRAM-tiled FlashAttention, and Speculative Decoding.