Pruning: Structured vs. Unstructured FLOPs Savings for LLMs
Pruning reduces LLM inference FLOPs by removing redundant weights. Unstructured pruning removes individual weights, achieving high sparsity but often requiring specialized hardware for speedups. Structured pruning removes entire components like neurons, channels, or attention heads, resulting in smaller, dense models that run efficiently on standard hardware and offer more predictable speedups correlating with FLOPs reduction.
The top 3
- Structured vs. Unstructured: Hardware Speed vs. Sparsity: Structured pruning removes entire components like neurons or attention heads, resulting in smaller, dense models that are inherently hardware-friendly and offer direct speedups on standard GPUs. In contrast, unstructured pruning removes individual weights, achieving higher sparsity and often better accuracy retention for a given compression ratio, but necessitates specialized sparse computation kernels or custom hardware for practical inference acceleration. [2, 8, 14]
- Key Pruning Metrics: Magnitude, Gradient, and Hessian: Unstructured pruning for LLMs often relies on magnitude-based criteria, removing weights with the smallest absolute values. Structured pruning frequently uses gradient-based importance (e.g., LLM-Pruner) or Taylor expansion approximations to identify less critical components. More advanced techniques like activation-aware pruning (Wanda) and Hessian-aware pruning (SparseGPT, HAP-E) offer superior accuracy-sparsity trade-offs by considering the impact of parameter removal on the model's loss. [2, 6, 7, 17, 21, 23, 26, 27]
- Pruning's Toughest Trade-off: Accuracy vs. Compression: Aggressive pruning, often achieving >70% sparsity, can lead to noticeable accuracy degradation, necessitating post-pruning fine-tuning or knowledge distillation to recover model performance.
Sources
Open the full topic