Your LLM Isn’t Slow Because of the Model. It’s Slow Because of Physics.

· Source: LLM on Medium · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Cloud Computing & IT Infrastructure · Depth: Intermediate, long

Summary

LLM inference performance is primarily limited by physics, specifically the finite resources of GPU compute and memory bandwidth, rather than model size alone. GPUs are designed for massive parallelism, performing many simple calculations simultaneously. The article explains that inference has two distinct phases: prefill, which is compute-bound as it processes prompt tokens in parallel, and decode, which is memory-bound due to repeatedly loading model weights and the growing Key-Value (KV) cache for single token generation. Arithmetic intensity determines whether a workload is compute or memory-bound. Optimizations like batching, quantization (e.g., FP16, INT8, FP8), FlashAttention, PagedAttention, and continuous batching (e.g., vLLM) are not isolated tricks but solutions to efficiently manage data movement and memory bandwidth, particularly for the memory-intensive decode phase and KV cache management.

Key takeaway

For AI engineers optimizing LLM serving performance, understanding the hardware bottleneck is crucial. If your LLM feels slow, ask whether the GPU is compute-bound or memory-bound, especially during the memory-intensive decode phase. Focus your efforts on techniques that improve memory bandwidth utilization, such as efficient batching, quantization, PagedAttention for KV cache management, or FlashAttention. This perspective will guide you toward effective engineering trade-offs, rather than simply blaming model size or GPU power.

Key insights

LLM inference speed is often limited by data movement (memory-bound) rather than raw computation (compute-bound).

Principles

In practice

Topics

Best for: AI Engineer, Machine Learning Engineer, MLOps Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by LLM on Medium.