Matrix Multiplication: LLM's Top FLOPs Consumer

Matrix multiplication (GEMM) is the single most computationally intensive operation in LLM inference, often accounting for over 80-90% of total Floating Point Operations (FLOPs) due to the extensive linear transformations in attention and feed-forward layers.

The top 3

  1. Matrix Multiplication's Core Role in LLMs: Matrix multiplication is the computational backbone of large language models, driving the self-attention mechanism, feed-forward networks, and embedding layers. It enables processing relationships between tokens simultaneously and transforming data into meaningful representations.
  2. Top 3 Optimization Techniques for LLM MatMul: Key optimization techniques for matrix multiplication in LLMs include quantization (reducing precision to INT8 or lower), sparsity (skipping zero computations), and kernel fusion (combining operations like RMSNorm and quantization to reduce data movement).
  3. Beyond FLOPs: Next Bottlenecks in LLM Inference: After optimizing matrix multiplication FLOPs, LLM inference often becomes bottlenecked by memory bandwidth, data movement (especially for KV cache), and PCIe transfers, rather than raw compute. This is particularly true during the decode phase of token generation.

Sources

Open the full topic