TL;DR
This paper investigates how common compression techniques (pruning and quantization) affect the "parametric knowledge" stored within large language models (LLMs). They find that compressing all modules simultaneously has the most detrimental impact, and that structured pruning of the final layer significantly harms performance, especially for encoder-only models.
What Problem Does This Paper Address?
Large Language Models (LLMs) are incredibly powerful but also massive, making them difficult and expensive to deploy. Compression techniques like pruning (removing connections) and quantization (reducing the precision of weights) aim to make LLMs smaller and faster. However, most research on compression focuses on general performance metrics like perplexity or accuracy on broad benchmarks. This leaves a gap in understanding how these techniques impact the specific knowledge that LLMs learn during pre-training – their "parametric knowledge." This knowledge is crucial for tasks requiring reasoning and factual recall. Without this fine-grained understanding, practitioners struggle to make informed decisions about which compression strategies to use without sacrificing essential model capabilities.
Methods
The authors conduct a large-scale empirical study using standard compression techniques:
- Pruning: They explore both unstructured pruning (removing individual connections) and structured pruning (removing entire neurons or channels). Saliency for pruning is determined by the L1-norm of weights.
- Quantization: They focus on Post-Training Dynamic Quantization (PTDQ), quantizing to 8 bits (int8). This method dynamically calculates clipping ranges for activations during inference, balancing performance and computational overhead.
- Compression Strategies: They systematically apply these techniques to different parts of the Transformer architecture:
- Attention-only Global Compression: Compressing all linear layers within attention modules.
- Feed-forward-only Global Compression: Compressing all linear layers within feed-forward networks.
- Overall Global Compression: Compressing both attention and feed-forward layers (excluding the final dense layer for pruning).
- Final Dense Layer Pruning: Specifically targeting the final layer for pruning.
- Combined Techniques: They also investigate the impact of applying pruning followed by quantization.
Datasets
The paper uses established benchmarks to evaluate the impact of compression:
- LAMA (Language Model Analysis): Used for encoder-only models to assess factual and commonsense knowledge. It comprises four datasets: TRex, Google-RE, ConceptNet, and SQUAD, each focusing on different types of relational knowledge.
- Language Model Evaluation Harness: Used for encoder-decoder and decoder-only models. This includes:
- BoolQ: A question-answering dataset.
- PIQA (Physical Interaction QA): A commonsense reasoning dataset.
- Winogrande: A dataset for resolving pronoun ambiguity and commonsense reasoning.
Key Insights and Ideas
- Holistic Compression is Risky: Compressing all modules simultaneously (OverallGP and OverallGQ) consistently leads to the most significant drop in parametric knowledge across all model families. This suggests that models are not uniformly robust to compression across all their components.
- Feed-Forward vs. Attention Robustness Varies: For encoder-only models, pruning feed-forward networks has a more detrimental effect than pruning attention modules at medium sparsity levels. This is counterintuitive given the larger size of feed-forward networks, suggesting they might be over-parameterized and thus more sensitive to knowledge loss when pruned. However, for decoder-only and encoder-decoder models, attention module pruning is more impactful.
- Final Layer Sensitivity: Pruning the final dense layer, especially with structured pruning, severely impacts performance for encoder-only models. This highlights the final layer's critical role in encoding structured knowledge.
- Quantization is Gentler than Pruning: Generally, quantization (especially AttGQ) has a less detrimental effect on performance compared to pruning, even at similar compression levels. This is likely because quantization preserves all connections, whereas pruning eliminates them.
Key Results
- Pruning Levels: At pruning levels exceeding 50% (Phigh), the parametric knowledge of all models declines rapidly, often to near-zero accuracy.
- Quantization Impact: Quantizing attention modules (AttGQ) shows a lesser performance drop compared to quantizing feed-forward networks (FFGQ) across all models.
- Combined Pruning & Quantization: At 20% sparsity, compressing attention modules (AttGPQ) results in a smaller performance drop than compressing feed-forward networks (FFGPQ) for most models. However, this trend reverses for encoder-decoder models at 40% sparsity.
- Final Layer Pruning: For encoder-only models, L1-unstructured pruning leads to a smaller performance decrease than L1-structured pruning. For decoder-only and encoder-decoder models, even at 20% sparsity, final layer pruning shows minimal impact, suggesting these models might encode knowledge differently in their final layers.
Limitations and Future Work
- Scope: The authors acknowledge that their study focuses on a subset of standard compression techniques and model families. More specialized or advanced techniques might exhibit different behaviors.
- Inference Time: The paper does not directly address the tradeoff between compression and wall-clock inference time, noting that this is a complex factor best studied separately.
- Future Work: The authors suggest exploring additional specialized compression techniques and further investigating the impact on inference time. They also hope their work provides a foundation for developing more intuitive rules-of-thumb for practitioners selecting compression strategies.
Summary updated