Transfer Learning for Structured Pruning under Limited Task Data

Lucio M. Dery, David Grangier, Awni HannunarXiv 2023

Abstract

Large, pre-trained models are problematic to use in resource-constrained applications. Fortunately, task-aware structured pruning methods offer a solution. These approaches reduce model size by dropping structural units like layers and attention heads in a manner that takes into account the end-task. However, these pruning algorithms require more task-specific data than is typically available. We propose a framework which combines structured pruning with transfer learning to reduce the need for task-specific data. Our empirical results answer questions such as: How should the two tasks be coupled? What parameters should be transferred? And, when during training should transfer learning be introduced? Leveraging these insights, we demonstrate that our framework results in pruned models with improved generalization over strong baselines.

Introduction

We are currently in the era of "Gigantic Models," but most of these models are too large to run on edge devices like smartphones without specialized hardware. Structured pruning—the process of removing entire components like attention heads or layers—is the gold standard for making these models hardware-friendly. Unlike unstructured pruning, which zeros out individual weights, structured pruning leads to immediate speedups on standard hardware.

However, researchers often face a "low-resource double-bind." To prune a model without destroying its accuracy, substantial task-specific data is typically required to "re-learn" the behavior of the compressed model. For niche tasks with limited data, structured pruning often fails. This paper investigates whether data from an auxiliary task can be leveraged to prune a model for a data-starved target task.

Methodology

The proposed framework builds upon the CoFi (Coarse- and Fine-grained Pruning) algorithm, which uses structural variables ($z$) as binary gates to decide which components to retain. The core innovation is the $\delta$-Formulation, which balances shared knowledge with task-specific needs:

  • Base Structure ($z_{base}$): A shared foundation of components generally useful across tasks.
  • Task-Specific Offsets ($\delta$): Small adjustments allowing each task to keep or drop components unique to its specific requirements.

Through empirical study, the authors found that pruning while training on both auxiliary and target tasks simultaneously is superior to sequential fine-tuning. Furthermore, transferring both model weights and structural masks (the "on/off" switches) is essential for optimal performance.

Experimental Results

The framework was evaluated across three domains: Computer Science (SCIIE, ACL-ARC), Biomedical (CHEMPROT, RCT), and General Language (STSB, MRPC), focusing on low-resource versions of these tasks.

Comparison of pruning methods across four tasks at 95% sparsity. The proposed method ('Ours') demonstrates strong performance, particularly in the SCIIE task where it significantly outperforms the 'No Transfer' baseline.

As shown in the results above, the proposed method enables a more "graceful degradation" at high sparsity levels. At 95% sparsity (removing 19 out of every 20 parameters), the transfer-learned model maintained much higher accuracy than standard baselines. On the SCIIE task, the method provided a ~5% boost in accuracy over standard pruning, successfully producing performant models even at 50x compression ratios.

Structural Insights and Discussion

An interesting finding is that transfer learning results in a more "diffuse" model architecture. While standard pruning tends to concentrate parameters in the early layers of a network, pruning with transfer learning spreads useful components more evenly across the entire depth of the model.

Proportion of activated attention heads per layer. Pruning with transfer learning (bottom two rows) results in a more 'diffuse' structure compared to standard single-task pruning (top row).

Additionally, the $\delta$-Formulation helps mitigate "negative transfer," where an auxiliary task might otherwise degrade performance. The framework acts as a buffer, dampening the impact of unrelated data compared to simpler multitask methods. This results in models that achieve ~10x speedups in inference time and 1.2x memory savings compared to naive pruning at the same accuracy threshold.

Conclusion

This work demonstrates that transfer learning is a powerful tool for enabling structured pruning in data-scarce environments. By sharing structural foundations while allowing task-specific offsets, the framework achieves extreme compression without the catastrophic accuracy loss typical of standard methods. Future work will explore scaling these insights to Large Language Models (LLMs) and developing systematic methods for auxiliary task selection.

Summary updated

BibTeX
@misc{dery2023transfer,
  author = {Lucio M. Dery and David Grangier and Awni Hannun},
  title = {{Transfer Learning for Structured Pruning under Limited Task Data}},
  year = {2023},
  eprint = {2311.06382},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.06382},
}
Figure