Task-specific Compression for Multi-task Language Models using Attribution-based Pruning

Nakyeong Yang, Yunah Jang, Hwanhee Lee, Seohyeong Jeong, Kyomin Jung · DOI

TL;DR

This paper introduces a novel, training-free method to compress large multi-task language models by identifying and pruning task-specific, unimportant neurons. This approach efficiently extracts only the necessary parameters for a given task, preserving pre-trained knowledge and enabling faster inference without requiring additional training.

What Problem Does This Paper Address?

Modern large language models (LLMs) like T5 and GPT-3 achieve remarkable performance across a wide range of natural language understanding (NLU) tasks by using a single, massive model. However, when these models are deployed for a specific task, a significant portion of their parameters remain unused, leading to computational inefficiency and memory overhead. Existing compression techniques, such as pruning, knowledge distillation, and quantization, often require additional training, which is computationally expensive, can degrade pre-trained knowledge, and necessitates storing separate compressed models for each task. This paper aims to address this by developing a method for task-specific compression that is training-free and preserves the model's original capabilities.

Methods

The core of this paper is an attribution-based pruning method. The authors leverage an attribution technique to determine which neurons within each layer of a pre-trained multi-task language model are most essential for performing a specific task. This is achieved by calculating the gradient of the task's output with respect to the neuron's activation.

  1. Task-Specific Knowledge Extraction: For a given task, the model performs a single forward and backward pass using a small set of data samples. The attribution scores are computed for each neuron.
  2. Neuron Importance Ranking: Neurons within each layer are ranked based on their attribution scores.
  3. Structured Pruning: A predefined pruning rate is applied to each prunable layer, removing neurons with the lowest attribution scores. This is a structured pruning approach, meaning entire neurons (or their associated weights) are removed, which is more hardware-friendly than unstructured pruning.
  4. Training-Free: Crucially, this process does not update the model's parameters. It only identifies and removes redundant ones for a specific task. This preserves the original pre-trained knowledge.
  5. Extensions: The method is extended to handle low-resource (few-shot data) and unsupervised (no labels) settings by adapting the attribution calculation.

Datasets

The experiments were conducted on six widely-used NLU datasets:

  • SST-2 (sentiment analysis)
  • MRPC (semantic textual similarity)
  • BoolQ (question answering)
  • QNLI (natural language inference)
  • CB (natural language inference)
  • RTE (natural language inference)

The paper uses the pre-trained T5-base model, which was fine-tuned on these datasets for multi-task learning.

Key Insights and Ideas

  • Task-Specific Knowledge is Localized: The attribution method reveals that not all neurons are equally important for every task. This allows for targeted pruning, leading to significant compression without substantial performance loss.
  • Decoder is More Crucial for Task-Specific Knowledge: Experiments suggest that the decoder part of Transformer models holds more task-specific information than the encoder. This implies that for many NLU tasks, the generation or reasoning components are more critical than the initial encoding.
  • Low-Resource and Unsupervised Pruning is Feasible: The ability to achieve comparable performance with very few labeled samples (e.g., 10¹ for SST-2) or even without labels is a major advantage, significantly reducing data acquisition costs.
  • Preservation of Pre-trained Knowledge: The training-free nature of the method is key to avoiding catastrophic forgetting and maintaining the model's general capabilities.
  • Layer-Specific Importance: Different layers and types of layers (e.g., self-attention vs. feed-forward networks) contribute differently to task performance, offering avenues for more nuanced pruning strategies.

Key Results

  • The proposed attribution-based pruning (T5-AP) significantly outperforms baseline training-free pruning methods (T5-FPP, T5-SVD, T5-RAP, T5-RP) across the tested datasets.
  • In the low-resource setting, using as few as 10¹ samples for SST-2 yielded performance comparable to using the entire training dataset, demonstrating high efficiency.
  • The method shows robust performance maintenance even when applied to unseen domains, particularly when the unseen domain is related to the training data.
  • Module-integrated pruning (compressing both encoder and decoder simultaneously) did not further degrade performance, suggesting a holistic compression approach is viable.
  • Analysis of layer types and depths indicated that low-level layers and specific components like decoder cross-attention networks are particularly critical for preserving performance.

Limitations and Future Work

  • Limited Baseline Comparison: The authors acknowledge that due to the novelty of training-free, task-specific compression, a comprehensive comparison with all existing baseline algorithms was not fully feasible.
  • Dataset Scope: The experiments were conducted on six GLUE benchmark datasets. Further evaluation on a wider range of challenging NLU tasks would be beneficial to demonstrate broader generalization.
  • Layer-Specific Pruning Rates: The current method applies a uniform pruning rate across prunable layers. Exploring layer-specific pruning rates could lead to even more optimized compression.
  • Hardware Acceleration: While structured pruning is more hardware-friendly, the paper doesn't delve into specific hardware implementations or speedups beyond theoretical efficiency gains.

Future work could involve exploring these limitations, such as developing more sophisticated layer-specific pruning strategies and investigating hardware-aware compression.

Summary updated

BibTeX
@inproceedings{yang2023task,
  author = {Nakyeong Yang and Yunah Jang and Hwanhee Lee and Seohyeong Jeong and Kyomin Jung},
  title = {{Task-specific Compression for Multi-task Language Models using Attribution-based Pruning}},
  booktitle = {EACL (Findings)},
  year = {2023},
  doi = {10.18653/v1/2023.findings-eacl.43},
}
Figure