Core Operations Driving LLM Computational Intensity

Matrix multiplications in the Feed-Forward Network (FFN) and Query-Key-Value (QKV) computations within the attention mechanism are the most FLOP-intensive operations, consuming approximately 66% and 25% of FLOPs per layer, respectively.

The top 3

  1. 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.
  2. Transformer Block: FFN Often Out-FLOPs Attention: Within a Transformer block, Feed-Forward Networks (FFN) typically consume more FLOPs and parameters (around 66%) than the Multi-Head Self-Attention mechanism (around 33%), especially in larger models with expanded hidden dimensions.
  3. Halving LLM FLOPs: The Power of Lower Precision: Reducing numerical precision from FP32 to FP16/BF16 or INT8 can significantly cut memory footprint by 2x-4x and increase effective FLOPs throughput on optimized hardware, making LLM inference faster and more accessible for deployment on resource-constrained devices.

Sources

Open the full topic