The Cost of Compression: Investigating the Impact of Compression on Parametric Knowledge in Language Models

Satya Sai Srinath Namburi, Makesh Sreedhar, Srinath Srinivasan, Frederic Sala

Introduction

As Large Language Models (LLMs) continue to scale in size, the computational and memory requirements for their deployment have become a significant barrier. Techniques such as pruning (removing weights) and quantization (reducing numerical precision) are frequently employed to enable inference on consumer-grade hardware. However, while these methods are effective at reducing model size, their impact on the specific factual knowledge—or parametric knowledge—stored within the model's weights is often overlooked. This paper investigates how different compression strategies affect the ability of models to recall facts, revealing that the "cost" of compression varies significantly across model architectures.

Methodology

The researchers evaluated three primary model families: Encoder-only (e.g., BERT), Encoder-Decoder (e.g., T5), and Decoder-only (e.g., Vicuna). The study focused on three compression techniques:

  1. Pruning: Utilizing L1-unstructured pruning (removing individual weights) and structured pruning (removing entire neurons or channels).
  2. Quantization: Specifically Post-Training Dynamic Quantization (PTDQ) to 8-bit integers (int8).
  3. Hybrid Approaches: Combining pruning and quantization.

Crucially, the study targeted specific sub-modules within the Transformer block—the Attention modules, the Feed-Forward Networks (FFN), and the Final Dense Layer—to identify which components are most critical for knowledge retention.

Transformer architecture and targeted sub-modules for compression.

To measure factual recall, the authors utilized the LAMA (LAnguage Model Analysis) benchmark, which uses cloze-style prompts (e.g., "The capital of France is [MASK]") to test the model's internal knowledge. They also assessed general reasoning capabilities using the LM-Evaluation-Harness suite, including tasks like BoolQ and PIQA.

Key Insights

The Architecture Divide

A major finding of the study is the stark difference in sensitivity between architectures. In Encoder-only models like BERT, the Feed-Forward Networks (FFN) appear to be the primary repositories of parametric knowledge. Pruning the FFN leads to a much more rapid decline in factual accuracy compared to pruning the Attention modules.

Impact of pruning specific sub-modules on factual recall in Encoder-only models (BERT).

Conversely, in Decoder-only and Encoder-Decoder models (such as Vicuna and T5), the Attention modules are significantly more sensitive. In these architectures, removing attention connections causes a sharper drop in factual recall than removing FFN weights. This suggests that the mechanism for storing and retrieving facts is fundamentally different across these architectural paradigms.

Knowledge Bottlenecks and Synergy

The researchers also identified the Final Dense Layer as a critical knowledge bottleneck. Pruning even a small percentage (20%) of this layer caused performance to drop to near-random levels across all models. Furthermore, the study found that "Global Pruning"—pruning all modules simultaneously—is more destructive than the sum of pruning individual components, indicating a multiplicative rather than additive cost to compression.

Results and Practical Implications

  • The 50% Threshold: Factual knowledge generally remains stable until approximately 30-40% sparsity. Beyond the 50% pruning mark, accuracy declines precipitously.
  • Quantization Resilience: Quantizing models to 8-bit (int8) is remarkably safe, typically resulting in less than a 5% drop in accuracy. Interestingly, while Attention modules are sensitive to pruning, they are highly resilient to quantization, suggesting they can be approximated but not removed.
  • Unstructured vs. Structured Pruning: For the final layer, unstructured pruning (targeting individual weights) was far more effective at preserving knowledge than structured pruning, implying that knowledge is distributed throughout the weights rather than localized in specific neurons.

Conclusion

This research highlights that compression is not a "one-size-fits-all" process. For practitioners, the choice of which layers to compress should be guided by the model's architecture: Decoder models require careful handling of Attention layers, while Encoder models are more sensitive to FFN compression. As we continue to deploy LLMs on the edge, understanding these architectural sensitivities will be crucial for maintaining the "intelligence" of compressed models.

Summary updated

BibTeX
@inproceedings{namburi2023cost,
  author = {Satya Sai Srinath Namburi and Makesh Sreedhar and Srinath Srinivasan and Frederic Sala},
  title = {{The Cost of Compression: Investigating the Impact of Compression on Parametric Knowledge in Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.349},
}
Figure