Major Performance Bottlenecks in On-Device LLM Inference
Memory bandwidth during the autoregressive decode phase is a primary bottleneck, as the GPU must repeatedly fetch model weights and the growing Key-Value cache; additionally, KV cache management and the computational intensity of the prefill phase pose significant challenges for resource-limited hardware.
The top 3
- Why Memory Bandwidth Dominates LLM Inference Latency: For on-device LLM inference, particularly during autoregressive token generation, performance is often limited by the speed at which model weights and Key-Value (KV) cache data can be transferred from slower main memory (like DRAM or HBM) to faster on-chip compute units, a phenomenon known as the "memory wall."
- KV Cache Growth: The Hidden Memory Hog: The Key-Value (KV) cache is crucial for the attention mechanism in LLMs, storing intermediate computations. However, its size grows linearly with the input sequence length, rapidly consuming GPU memory. This limits the number of concurrent requests and maximum context window, leading to a "capacity-bound" inference regime, especially with long prompts.
- Computational Intensity: The FLOPs Bottleneck: On-device LLM inference also faces a significant bottleneck from the sheer volume of floating-point operations (FLOPs), particularly large matrix multiplications within transformer layers, which can overwhelm the sustained processing capabilities of mobile NPUs or GPUs.
Sources
Open the full topic