Pruning Redundant Mappings in Transformer Models via Spectral-Normalized Identity Prior

Zi Lin, Jeremiah Z. Liu, Zi Yang, Nan Hua, Dan Roth

Abstract

Large-scale Transformer models like BERT have revolutionized Natural Language Processing but remain computationally expensive for deployment on resource-constrained devices. This paper introduces SNIP (Spectral-Normalized Identity Prior), a novel structured pruning method that identifies and removes redundant components by inducing identity mappings. By incorporating spectral normalization, SNIP stabilizes the pruning process across layers with varying weight scales. Experimental results on the GLUE benchmark demonstrate that SNIP achieves superior accuracy-to-size trade-offs compared to existing pruning and distillation techniques, offering a more efficient path for model compression.

Introduction

The proliferation of Transformer-based architectures has set new benchmarks in NLP, yet their massive parameter counts pose significant challenges for real-time inference and mobile deployment. Traditional compression techniques often fall into two categories: unstructured pruning and knowledge distillation. Unstructured pruning, while effective at reducing parameter counts, often fails to deliver actual hardware speedups because it leaves the model's physical architecture intact. Knowledge distillation, conversely, requires the manual design of smaller "student" models for every specific task—a labor-intensive process.

The Challenge of Transformer Compression

The authors address the need for a structured pruning approach that can automatically "slim down" a model's physical architecture during training. The goal is to identify entire redundant modules—such as attention heads or feed-forward layers—that can be removed without significant loss in performance. However, a major hurdle in pruning pre-trained models like BERT is the high variance in weight scales across different layers, which makes applying a uniform pruning threshold problematic.

Methodology: SNIP

SNIP introduces two primary innovations to achieve effective structured pruning:

1. Identity-inducing Prior

Most modern Transformers utilize residual connections, where the output of a module is defined as $H(x) = F(x) + x$. Rather than forcing individual weights to zero, SNIP encourages the non-linear transformation $F(x)$ to become zero. When $F(x) \approx 0$, the module effectively becomes an identity mapping ($H(x) \approx x$), allowing the data to pass through unchanged. Such modules are deemed redundant and can be physically removed from the computational graph.

2. Spectral Normalization (SN)

To address the issue of inconsistent weight scales, the authors employ Spectral Normalization. By regularizing the maximum singular value of the weight matrices, SN "tames" the layers, ensuring they operate on a comparable scale. This normalization is crucial for establishing a stable, global pruning threshold that can be applied consistently across the entire model.

Figure 5: Comparison of attention and FFN output distributions with and without Spectral Normalization. SN creates a "level playing field" by aligning the scales of different layers.

Experimental Setup

The effectiveness of SNIP was evaluated using the General Language Understanding Evaluation (GLUE) benchmark, including tasks such as SST-2 (sentiment analysis), QQP/MRPC (paraphrasing), and QNLI/MNLI (natural language inference). The base model was pre-trained on a combination of Wikipedia and the BooksCorpus (3.3 billion tokens).

Results and Discussion

SNIP demonstrates a clear advantage in the accuracy-vs-size trade-off. As shown in Figure 1, SNIP consistently outperforms standard iterative pruning and popular distillation methods like DistilBERT and BERT-PKD. At a 50% compression ratio, SNIP achieved an average performance improvement of 0.5% to 1.0% over these baselines.

Figure 1: Accuracy vs. Remaining weights % on the MNLI-mm task. SNIP provides a superior and continuous trade-off curve compared to distillation and iterative pruning.

Key insights from the experiments include:

  • The Role of SN: Without Spectral Normalization, the norms of different layers in BERT are highly divergent, making global pruning ineffective. SN provides the "level playing field" necessary for structured pruning to succeed.
  • Task-Specific Redundancy: Different NLP tasks utilize different parts of the model. SNIP allows the architecture to self-organize based on the specific requirements of the task.
  • Layer Sensitivity: Feed-forward network (FFN) layers at the extreme ends of the model (very early or very late) were found to be more redundant than those in the middle. Additionally, attention heads proved to be more "prunable" than FFN layers in general.

Conclusion

SNIP offers a robust framework for structured pruning in Transformers, combining identity-inducing priors with spectral normalization to achieve high compression ratios with minimal accuracy loss. By automating the identification of redundant components, it bypasses the need for manual student architecture design required by distillation. Future work may explore applying these principles to hidden dimension pruning and combining SNIP with quantization techniques to further push the limits of model efficiency.

Summary updated

BibTeX
@inproceedings{lin2020pruning,
  author = {Zi Lin and Jeremiah Z. Liu and Zi Yang and Nan Hua and Dan Roth},
  title = {{Pruning Redundant Mappings in Transformer Models via Spectral-Normalized Identity Prior}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  doi = {10.18653/v1/2020.findings-emnlp.64},
}
Figure