Top 3 LLM Layers Most Prone to Activation-Induced Quantization Failures

Feed-forward network (FFN) layers, residual connections, and attention output layers are particularly susceptible to activation-induced quantization errors due to prevalent high-magnitude activation spikes and wide dynamic ranges.

The top 3

  1. Normalization Layers: Sensitive to Statistic Perturbation: Normalization layers (e.g., LayerNorm, RMSNorm) are highly susceptible to quantization errors because low-precision activations can significantly distort the calculated mean, variance, or RMS statistics, leading to network instability. RMSNorm, by not centering activations, can exacerbate issues as its outputs may drift from a zero mean, impacting optimal quantization.
  2. Softmax in Attention: Exponential Sensitivity to Noise: The softmax function, crucial for converting attention scores into probabilities, is challenging to quantize due to its exponential nature; small input changes from quantization noise can drastically alter output probabilities. Research often recommends keeping softmax computations in higher precision (e.g., FP16 or FP32) to prevent significant distortion of attention weights.
  3. FFN Layers with GLU: Activation Spikes Cause Errors: Feed-Forward Network (FFN) layers, especially those incorporating Gated Linear Unit (GLU) variants common in models like LLaMA, frequently exhibit 'activation spikes' – extreme activation values. These spikes, often concentrated in early and late layers and specific tokens, lead to severe local quantization errors and considerable performance degradation in quantized LLMs.

Sources

Open the full topic